mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Compare commits
459 Commits
2.9.6
...
3cabc07d58
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3cabc07d58 | ||
|
|
b0546b1e60 | ||
|
|
a988e67490 | ||
|
|
2594c5bbf0 | ||
|
|
db70fa341c | ||
|
|
763e3852ac | ||
|
|
8ec86973c6 | ||
|
|
eb2c6ac6f2 | ||
|
|
cbcc893ce5 | ||
|
|
382b049c5f | ||
|
|
a53763221c | ||
|
|
b7bac28113 | ||
|
|
a9edb16554 | ||
|
|
0aeb1fc6af | ||
|
|
eeeeda4e5e | ||
|
|
f5881eda53 | ||
|
|
c1997d9f70 | ||
|
|
bb1caa6642 | ||
|
|
dd5ca93f26 | ||
|
|
1889df4952 | ||
|
|
7ca219748d | ||
|
|
2fc16ba694 | ||
|
|
a4feafab8e | ||
|
|
997baf21a0 | ||
|
|
b126cc00d0 | ||
|
|
09b7922b84 | ||
|
|
7a5b9a75f3 | ||
|
|
4bab2ee1de | ||
|
|
d7defe6f7f | ||
|
|
db869bcb6d | ||
|
|
ea4a1f9ff9 | ||
|
|
20406e40ca | ||
|
|
3b50fee5a0 | ||
|
|
804004198b | ||
|
|
5b8b8a5566 | ||
|
|
0468bacc0b | ||
|
|
7eba1349ae | ||
|
|
b6074a4795 | ||
|
|
36c9f551d9 | ||
|
|
89c3f7310b | ||
|
|
a6b622ed31 | ||
|
|
f1af3a50b8 | ||
|
|
0c90e90c18 | ||
|
|
f97ef25104 | ||
|
|
069c0aa03f | ||
|
|
b145588ed5 | ||
|
|
3ad60a95ce | ||
|
|
ac4b620f16 | ||
|
|
ccada18a6a | ||
|
|
1547d66327 | ||
|
|
8042e8bfaf | ||
|
|
dd7b87e9cd | ||
|
|
460d2768ff | ||
|
|
3c74272749 | ||
|
|
82c409d77a | ||
|
|
195aac4504 | ||
|
|
08d8f3e25f | ||
|
|
6f72697e26 | ||
|
|
0f6439cf9f | ||
|
|
2c10943cb1 | ||
|
|
544db963ea | ||
|
|
207698a2dd | ||
|
|
d1ae2c0f5e | ||
|
|
0392417189 | ||
|
|
be4beea9d0 | ||
|
|
5da899138b | ||
|
|
1ec1e00bde | ||
|
|
5d93b33d42 | ||
|
|
b2077bfc74 | ||
|
|
6fdf9a649f | ||
|
|
d013bbc751 | ||
|
|
e0092fdba0 | ||
|
|
fbeada439f | ||
|
|
6c8858d2f5 | ||
|
|
e2b77878df | ||
|
|
53d7972858 | ||
|
|
04a55e4104 | ||
|
|
d11acecdac | ||
|
|
49c11073e6 | ||
|
|
1a156e7e12 | ||
|
|
1856754614 | ||
|
|
6ac452ff15 | ||
|
|
d707a4775c | ||
|
|
ffccc31e38 | ||
|
|
0405af2bde | ||
|
|
e50e572c78 | ||
|
|
3083599158 | ||
|
|
b7b6c1ea19 | ||
|
|
5b107ce2da | ||
|
|
5c1e342a79 | ||
|
|
ddf33da787 | ||
|
|
b0a192a767 | ||
|
|
986c340211 | ||
|
|
2109537f86 | ||
|
|
690db7f12f | ||
|
|
4f3fd06cc9 | ||
|
|
4074023ed3 | ||
|
|
6c00b0c7eb | ||
|
|
76dc0d690a | ||
|
|
d783f7be99 | ||
|
|
b66e91b11f | ||
|
|
dc83af4d02 | ||
|
|
0a38700edb | ||
|
|
659615114a | ||
|
|
4955fe4d92 | ||
|
|
792aa73832 | ||
|
|
a915452e6e | ||
|
|
be8405b72b | ||
|
|
5ca3e3b2b8 | ||
|
|
618a8744a2 | ||
|
|
23aeef7a20 | ||
|
|
9ac4f136aa | ||
|
|
c9a09c2fc9 | ||
|
|
6028c91f81 | ||
|
|
3c57928f46 | ||
|
|
32f0bb33c3 | ||
|
|
31d0410284 | ||
|
|
87c436ba34 | ||
|
|
6e9727e265 | ||
|
|
94ee76fe62 | ||
|
|
ea23162ca9 | ||
|
|
683388faee | ||
|
|
56ec3920c5 | ||
|
|
f335ffc4ec | ||
|
|
4976cd86f2 | ||
|
|
c00eff8b23 | ||
|
|
3c710613a8 | ||
|
|
45ebf9a3c7 | ||
|
|
c808e4a4e2 | ||
|
|
e2612b97d7 | ||
|
|
70e9d91bb5 | ||
|
|
0b8810f8b3 | ||
|
|
41b867a4ca | ||
|
|
1c0a8d9380 | ||
|
|
2b0b9d44eb | ||
|
|
2fc7a3b542 | ||
|
|
12b596a47f | ||
|
|
8ef781a9ac | ||
|
|
43eeaede65 | ||
|
|
749c5f87de | ||
|
|
a520daeb56 | ||
|
|
f9ba96f228 | ||
|
|
a49bd23a2a | ||
|
|
cea2f18228 | ||
|
|
fd2d8a5119 | ||
|
|
fa4e0447dd | ||
|
|
31aa604fc4 | ||
|
|
f44db27565 | ||
|
|
9b1abab73a | ||
|
|
cad8f15b61 | ||
|
|
1d08bcf2e0 | ||
|
|
9487a5ae91 | ||
|
|
96337cc5df | ||
|
|
bc9eee22b7 | ||
|
|
f74d25b31c | ||
|
|
1156971d94 | ||
|
|
c79b5c37c4 | ||
|
|
a2b650a9e3 | ||
|
|
905b442e9b | ||
|
|
18fe3112bd | ||
|
|
cc057744ba | ||
|
|
db1779e1db | ||
|
|
d25a723fc7 | ||
|
|
f0fe1b431d | ||
|
|
8e286edd25 | ||
|
|
74520b1359 | ||
|
|
d06e44d37b | ||
|
|
35348d9b81 | ||
|
|
4b16e94eaf | ||
|
|
d983676330 | ||
|
|
03c30f3cce | ||
|
|
99b93266ad | ||
|
|
e307b57e67 | ||
|
|
5ef9bb2acd | ||
|
|
4aacdc1567 | ||
|
|
57552f4300 | ||
|
|
09d53f7d8c | ||
|
|
d9948d1a19 | ||
|
|
5f7a4f2bbb | ||
|
|
1b6945e0b0 | ||
|
|
4fd55b1bd6 | ||
|
|
20b8deb6de | ||
|
|
6af836c118 | ||
|
|
f87b8a2c2a | ||
|
|
daffd7412a | ||
|
|
bfb60b318e | ||
|
|
a55959dfbb | ||
|
|
4d24eb82be | ||
|
|
e26caa2f74 | ||
|
|
b75fff60c8 | ||
|
|
4ac57fce7a | ||
|
|
25a9a0120a | ||
|
|
66a1fa8af5 | ||
|
|
1b4033cfce | ||
|
|
48bc41873a | ||
|
|
068a1ab99c | ||
|
|
6551383070 | ||
|
|
b03978cc3d | ||
|
|
82f4c5790a | ||
|
|
5957124e9e | ||
|
|
92a05ca74a | ||
|
|
d02b5db6dd | ||
|
|
bd074728fe | ||
|
|
61b7b3ead6 | ||
|
|
7f7999e3e5 | ||
|
|
b522b38d31 | ||
|
|
b2dc7bc232 | ||
|
|
def622a02c | ||
|
|
30bedb39f1 | ||
|
|
fbcc4ee32b | ||
|
|
63c68d729b | ||
|
|
04f8f6d512 | ||
|
|
b74d46f762 | ||
|
|
02decc3901 | ||
|
|
dcdea16624 | ||
|
|
2635cf6345 | ||
|
|
e86069d39c | ||
|
|
fdcf153b0b | ||
|
|
8523b7e20a | ||
|
|
29b992bf81 | ||
|
|
4c52509d6d | ||
|
|
9bc067f2e8 | ||
|
|
5fbe0d9a70 | ||
|
|
474f767e56 | ||
|
|
f9030be843 | ||
|
|
538e35d8f0 | ||
|
|
203f0c8abc | ||
|
|
d0736b0b56 | ||
|
|
15b1ed028e | ||
|
|
008617a35c | ||
|
|
6144a61a2e | ||
|
|
5d192abd25 | ||
|
|
62337f445a | ||
|
|
b38c1c5827 | ||
|
|
c08cee2317 | ||
|
|
0f7759d070 | ||
|
|
4a0842bea6 | ||
|
|
3b3666c5f7 | ||
|
|
45912911ee | ||
|
|
9916afaa49 | ||
|
|
55c5a23616 | ||
|
|
6bee1cc88e | ||
|
|
43ab4d5f38 | ||
|
|
0427c0d3a7 | ||
|
|
014750ea7f | ||
|
|
e4bbfce314 | ||
|
|
359429b17e | ||
|
|
6001f6abda | ||
|
|
fd9b5d8d16 | ||
|
|
b6f184388a | ||
|
|
d8471698ab | ||
|
|
6204cecbbd | ||
|
|
ddeca49916 | ||
|
|
d8dcf37886 | ||
|
|
5ae41a208b | ||
|
|
0462d900e6 | ||
|
|
0f962461e1 | ||
|
|
aadc03c38d | ||
|
|
683fa13bb2 | ||
|
|
e4408a964d | ||
|
|
f97f33ab59 | ||
|
|
f59102ee09 | ||
|
|
e42e4e1ddf | ||
|
|
a30079c45b | ||
|
|
50ffd9aba6 | ||
|
|
936fec1f49 | ||
|
|
9625d87dd5 | ||
|
|
802139205c | ||
|
|
fb918cb2a4 | ||
|
|
abb4de46d7 | ||
|
|
dce9631399 | ||
|
|
6c773786d2 | ||
|
|
8939963187 | ||
|
|
f9747d1c4c | ||
|
|
60a3d3409e | ||
|
|
b72124c0d9 | ||
|
|
d51e761b26 | ||
|
|
1445ef61a0 | ||
|
|
dfe2ed2a98 | ||
|
|
be87103b53 | ||
|
|
2fb460c4bb | ||
|
|
216ea230a8 | ||
|
|
90096163ee | ||
|
|
cd178d6a8c | ||
|
|
2aa0b5ddfb | ||
|
|
37f819458a | ||
|
|
168f4301d2 | ||
|
|
d5a406c60f | ||
|
|
cb16210577 | ||
|
|
8c0e0de45f | ||
|
|
3524cba4ef | ||
|
|
5f8d1cf5b0 | ||
|
|
846aa823d4 | ||
|
|
68298fc585 | ||
|
|
e9d75f6d94 | ||
|
|
8fa5277417 | ||
|
|
231f1f236d | ||
|
|
ece0a46f97 | ||
|
|
2c9b0b8376 | ||
|
|
a798f2d61c | ||
|
|
ae08c87822 | ||
|
|
ae880e9d1c | ||
|
|
101d2e1de5 | ||
|
|
f6b7708567 | ||
|
|
051286acd1 | ||
|
|
7f572a1a9b | ||
|
|
d62025dfe0 | ||
|
|
07009630c6 | ||
|
|
865042a843 | ||
|
|
f00d0dc871 | ||
|
|
d6adcdf8bd | ||
|
|
2c192fba30 | ||
|
|
97f11c93bb | ||
|
|
f531fdaa70 | ||
|
|
81f8e84ca4 | ||
|
|
d74de11b8b | ||
|
|
30f2097d7a | ||
|
|
f903844059 | ||
|
|
68b2b452cc | ||
|
|
668d120d60 | ||
|
|
7543f31c85 | ||
|
|
56d84e7b25 | ||
|
|
ed2d3d856b | ||
|
|
1e5c3a3c21 | ||
|
|
37d5b6a0fc | ||
|
|
c58a954d18 | ||
|
|
0d481afa16 | ||
|
|
016875d724 | ||
|
|
5df0d60135 | ||
|
|
e77d61c4cb | ||
|
|
504142c585 | ||
|
|
80df849d18 | ||
|
|
e74c79b5d6 | ||
|
|
f738ddfca8 | ||
|
|
af45b0d709 | ||
|
|
e746617139 | ||
|
|
3105f7407d | ||
|
|
2f568bca17 | ||
|
|
aeb1664134 | ||
|
|
b7702ab933 | ||
|
|
cc14f82e85 | ||
|
|
5aea17e20e | ||
|
|
ad9eaea010 | ||
|
|
284a770daa | ||
|
|
ccd190a8b1 | ||
|
|
19f6a8d8f6 | ||
|
|
24264bd885 | ||
|
|
872bb3d775 | ||
|
|
d36cd8e284 | ||
|
|
eab643268f | ||
|
|
9356794112 | ||
|
|
35c24810f9 | ||
|
|
a54944b021 | ||
|
|
bc9938d08a | ||
|
|
b77f179acc | ||
|
|
90d20076c9 | ||
|
|
a1fc18fd48 | ||
|
|
69176c118f | ||
|
|
7ae98ef5f9 | ||
|
|
bbc539fac6 | ||
|
|
c1958b62ff | ||
|
|
a3864d5f32 | ||
|
|
9dc9b21b16 | ||
|
|
4cb784cc18 | ||
|
|
16655cf070 | ||
|
|
38e10331c9 | ||
|
|
40053670ea | ||
|
|
a63a15db1c | ||
|
|
76294f11e4 | ||
|
|
cc247a0f03 | ||
|
|
37cbf212f7 | ||
|
|
500fe37ac4 | ||
|
|
50a38cf2a4 | ||
|
|
c2aa57c603 | ||
|
|
ccf3093fe8 | ||
|
|
d2d0659776 | ||
|
|
8087c87027 | ||
|
|
c4738b24eb | ||
|
|
c73d8a6339 | ||
|
|
04f2f7d34f | ||
|
|
5d6951ae11 | ||
|
|
214cd3748c | ||
|
|
6fb931a055 | ||
|
|
b5d1cee96b | ||
|
|
e6aa341863 | ||
|
|
3595afe0cc | ||
|
|
0b21cb687e | ||
|
|
8a21fe80de | ||
|
|
51eb3a2e82 | ||
|
|
ec8bfb32b4 | ||
|
|
e6dda35f3d | ||
|
|
9d2896d088 | ||
|
|
036cc9d211 | ||
|
|
e6484c1598 | ||
|
|
65c7b0d12f | ||
|
|
9f8e7f4f3c | ||
|
|
b215d0e7d4 | ||
|
|
13b272b6e5 | ||
|
|
f9031dba42 | ||
|
|
29a4f7c160 | ||
|
|
55a9c7e020 | ||
|
|
84dd1fa21c | ||
|
|
42979093b8 | ||
|
|
edf7f4677c | ||
|
|
8958d7b71f | ||
|
|
6083191f32 | ||
|
|
8e0446c594 | ||
|
|
7e20a0a0dc | ||
|
|
58139b34a8 | ||
|
|
9ceb26c7b1 | ||
|
|
9ca30fc00c | ||
|
|
1ba1738aa0 | ||
|
|
c8cdbeac5c | ||
|
|
4b12b04840 | ||
|
|
c571d32d0e | ||
|
|
b350243e50 | ||
|
|
042b82d3a6 | ||
|
|
62ef56684b | ||
|
|
1033b975f8 | ||
|
|
11a05f1333 | ||
|
|
8cdf8677c1 | ||
|
|
e1706c94af | ||
|
|
f9f0a8e866 | ||
|
|
5f9d4405b1 | ||
|
|
2d1fcb9be8 | ||
|
|
5fcd394ddd | ||
|
|
a6de09a0ca | ||
|
|
b60435fb2c | ||
|
|
754430ba75 | ||
|
|
4668132b37 | ||
|
|
ceb77e2837 | ||
|
|
137f0251fb | ||
|
|
08745c910c | ||
|
|
16dc3860f7 | ||
|
|
333ed629bb | ||
|
|
c87e91d845 | ||
|
|
778ae1b8e5 | ||
|
|
a6568a955f | ||
|
|
6df4fffafd | ||
|
|
7bac0f32fc | ||
|
|
783e29f189 | ||
|
|
af39a3ae9c | ||
|
|
c985d40ca0 | ||
|
|
90b588420f | ||
|
|
3a0d2a5c51 | ||
|
|
07a76ced88 | ||
|
|
a3805118a0 | ||
|
|
f1c03e1b86 | ||
|
|
2e6957984f | ||
|
|
433a66d530 | ||
|
|
7d3ad15f39 | ||
|
|
d0728afee7 | ||
|
|
01330bf00c | ||
|
|
01de638b8e | ||
|
|
3e8c7ad1df | ||
|
|
22c6a03161 | ||
|
|
dd8b2caa24 | ||
|
|
1e4cfd473c | ||
|
|
044fb66ca0 |
2
.github/workflows/build-includes.yml
vendored
2
.github/workflows/build-includes.yml
vendored
@@ -5,6 +5,8 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
- develop
|
- develop
|
||||||
|
- Apple/Develop
|
||||||
|
|
||||||
paths:
|
paths:
|
||||||
- 'Moose Setup/**/*.lua'
|
- 'Moose Setup/**/*.lua'
|
||||||
- 'Moose Development/**/*.lua'
|
- 'Moose Development/**/*.lua'
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|||||||
@@ -17,6 +17,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
|
||||||
|
|||||||
@@ -19,6 +19,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.
|
||||||
@@ -3895,10 +3897,14 @@ do -- AI_A2G_DISPATCHER
|
|||||||
|
|
||||||
if Squadron then
|
if Squadron then
|
||||||
local FirstUnit = AttackSetUnit:GetRandomSurely()
|
local FirstUnit = AttackSetUnit:GetRandomSurely()
|
||||||
|
if FirstUnit then
|
||||||
local Coordinate = FirstUnit:GetCoordinate() -- Core.Point#COORDINATE
|
local Coordinate = FirstUnit:GetCoordinate() -- Core.Point#COORDINATE
|
||||||
if self.SetSendPlayerMessages then
|
if self.SetSendPlayerMessages then
|
||||||
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", on route to ground target at " .. Coordinate:ToStringA2G( DefenderGroup ), DefenderGroup )
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", on route to ground target at " .. Coordinate:ToStringA2G( DefenderGroup ), DefenderGroup )
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
self:GetParent(self).onafterEngageRoute( self, DefenderGroup, From, Event, To, AttackSetUnit )
|
self:GetParent(self).onafterEngageRoute( self, DefenderGroup, From, Event, To, AttackSetUnit )
|
||||||
end
|
end
|
||||||
@@ -4785,3 +4791,4 @@ end
|
|||||||
end
|
end
|
||||||
self:T({Squadron = Squadron.Name,SquadronResourceCount = Squadron.ResourceCount})
|
self:T({Squadron = Squadron.Name,SquadronResourceCount = Squadron.ResourceCount})
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -20,6 +20,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.
|
||||||
|
|||||||
@@ -9,11 +9,13 @@
|
|||||||
-- @module AI.AI_Air
|
-- @module AI.AI_Air
|
||||||
-- @image MOOSE.JPG
|
-- @image MOOSE.JPG
|
||||||
|
|
||||||
|
---
|
||||||
-- @type AI_AIR
|
-- @type AI_AIR
|
||||||
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
||||||
|
|
||||||
--- 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
|
||||||
--
|
--
|
||||||
@@ -656,8 +658,8 @@ function AI_AIR:onafterRTB( AIGroup, From, Event, To )
|
|||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local FromRTBRoutePoint = FromCoord:WaypointAir(
|
local FromRTBRoutePoint = FromCoord:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType,
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
COORDINATE.WaypointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
COORDINATE.WaypointAction.TurningPoint,
|
||||||
RTBSpeed,
|
RTBSpeed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
@@ -665,8 +667,8 @@ function AI_AIR:onafterRTB( AIGroup, From, Event, To )
|
|||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local ToRTBRoutePoint = ToAirbaseCoord:WaypointAir(
|
local ToRTBRoutePoint = ToAirbaseCoord:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType,
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
COORDINATE.WaypointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
COORDINATE.WaypointAction.TurningPoint,
|
||||||
RTBSpeed,
|
RTBSpeed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
@@ -760,10 +762,10 @@ function AI_AIR:onafterRefuel( AIGroup, From, Event, To )
|
|||||||
local ToRefuelSpeed = math.random( self.PatrolMinSpeed, self.PatrolMaxSpeed )
|
local ToRefuelSpeed = math.random( self.PatrolMinSpeed, self.PatrolMaxSpeed )
|
||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local FromRefuelRoutePoint = FromRefuelCoord:WaypointAir(self.PatrolAltType, POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, ToRefuelSpeed, true)
|
local FromRefuelRoutePoint = FromRefuelCoord:WaypointAir(self.PatrolAltType, COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, ToRefuelSpeed, true)
|
||||||
|
|
||||||
--- Create a route point of type air. NOT used!
|
--- Create a route point of type air. NOT used!
|
||||||
local ToRefuelRoutePoint = Tanker:GetCoordinate():WaypointAir(self.PatrolAltType, POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, ToRefuelSpeed, true)
|
local ToRefuelRoutePoint = Tanker:GetCoordinate():WaypointAir(self.PatrolAltType, COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, ToRefuelSpeed, true)
|
||||||
|
|
||||||
self:F( { ToRefuelSpeed = ToRefuelSpeed } )
|
self:F( { ToRefuelSpeed = ToRefuelSpeed } )
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
||||||
@@ -453,7 +455,7 @@ function AI_AIR_ENGAGE:onafterEngageRoute( DefenderGroup, From, Event, To, Attac
|
|||||||
|
|
||||||
--- Calculate the target route point.
|
--- Calculate the target route point.
|
||||||
|
|
||||||
local FromWP = DefenderCoord:WaypointAir(self.PatrolAltType or "RADIO", POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, EngageSpeed, true)
|
local FromWP = DefenderCoord:WaypointAir(self.PatrolAltType or "RADIO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, EngageSpeed, true)
|
||||||
|
|
||||||
EngageRoute[#EngageRoute+1] = FromWP
|
EngageRoute[#EngageRoute+1] = FromWP
|
||||||
|
|
||||||
@@ -462,7 +464,7 @@ function AI_AIR_ENGAGE:onafterEngageRoute( DefenderGroup, From, Event, To, Attac
|
|||||||
local FromEngageAngle = DefenderCoord:GetAngleDegrees( DefenderCoord:GetDirectionVec3( TargetCoord ) )
|
local FromEngageAngle = DefenderCoord:GetAngleDegrees( DefenderCoord:GetDirectionVec3( TargetCoord ) )
|
||||||
local ToCoord=DefenderCoord:Translate( EngageDistance, FromEngageAngle, true )
|
local ToCoord=DefenderCoord:Translate( EngageDistance, FromEngageAngle, true )
|
||||||
|
|
||||||
local ToWP = ToCoord:WaypointAir(self.PatrolAltType or "RADIO", POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, EngageSpeed, true)
|
local ToWP = ToCoord:WaypointAir(self.PatrolAltType or "RADIO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, EngageSpeed, true)
|
||||||
|
|
||||||
EngageRoute[#EngageRoute+1] = ToWP
|
EngageRoute[#EngageRoute+1] = ToWP
|
||||||
|
|
||||||
@@ -536,7 +538,7 @@ function AI_AIR_ENGAGE:onafterEngage( DefenderGroup, From, Event, To, AttackSetU
|
|||||||
local EngageRoute = {}
|
local EngageRoute = {}
|
||||||
local AttackTasks = {}
|
local AttackTasks = {}
|
||||||
|
|
||||||
local FromWP = DefenderCoord:WaypointAir(self.EngageAltType or "RADIO", POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, EngageSpeed, true)
|
local FromWP = DefenderCoord:WaypointAir(self.EngageAltType or "RADIO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, EngageSpeed, true)
|
||||||
EngageRoute[#EngageRoute+1] = FromWP
|
EngageRoute[#EngageRoute+1] = FromWP
|
||||||
|
|
||||||
self:SetTargetDistance( TargetCoord ) -- For RTB status check
|
self:SetTargetDistance( TargetCoord ) -- For RTB status check
|
||||||
@@ -544,7 +546,7 @@ function AI_AIR_ENGAGE:onafterEngage( DefenderGroup, From, Event, To, AttackSetU
|
|||||||
local FromEngageAngle = DefenderCoord:GetAngleDegrees( DefenderCoord:GetDirectionVec3( TargetCoord ) )
|
local FromEngageAngle = DefenderCoord:GetAngleDegrees( DefenderCoord:GetDirectionVec3( TargetCoord ) )
|
||||||
local ToCoord=DefenderCoord:Translate( EngageDistance, FromEngageAngle, true )
|
local ToCoord=DefenderCoord:Translate( EngageDistance, FromEngageAngle, true )
|
||||||
|
|
||||||
local ToWP = ToCoord:WaypointAir(self.EngageAltType or "RADIO", POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, EngageSpeed, true)
|
local ToWP = ToCoord:WaypointAir(self.EngageAltType or "RADIO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, EngageSpeed, true)
|
||||||
EngageRoute[#EngageRoute+1] = ToWP
|
EngageRoute[#EngageRoute+1] = ToWP
|
||||||
|
|
||||||
-- TODO: A factor of * 3 this way too low. This causes the AI NOT to engage until very close or even merged sometimes. Some A2A missiles have a much longer range! Needs more frequent updates of the task!
|
-- TODO: A factor of * 3 this way too low. This causes the AI NOT to engage until very close or even merged sometimes. Some A2A missiles have a much longer range! Needs more frequent updates of the task!
|
||||||
|
|||||||
@@ -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.
|
||||||
@@ -309,7 +311,7 @@ function AI_AIR_PATROL:onafterPatrolRoute( AIPatrol, From, Event, To )
|
|||||||
local ToTargetSpeed = math.random( self.PatrolMinSpeed, self.PatrolMaxSpeed )
|
local ToTargetSpeed = math.random( self.PatrolMinSpeed, self.PatrolMaxSpeed )
|
||||||
local speedkmh=ToTargetSpeed
|
local speedkmh=ToTargetSpeed
|
||||||
|
|
||||||
local FromWP = CurrentCoord:WaypointAir(self.PatrolAltType or "RADIO", POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, ToTargetSpeed, true)
|
local FromWP = CurrentCoord:WaypointAir(self.PatrolAltType or "RADIO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, ToTargetSpeed, true)
|
||||||
PatrolRoute[#PatrolRoute+1] = FromWP
|
PatrolRoute[#PatrolRoute+1] = FromWP
|
||||||
|
|
||||||
if self.racetrack then
|
if self.racetrack then
|
||||||
@@ -359,7 +361,7 @@ function AI_AIR_PATROL:onafterPatrolRoute( AIPatrol, From, Event, To )
|
|||||||
else
|
else
|
||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local ToWP = ToTargetCoord:WaypointAir(self.PatrolAltType, POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, ToTargetSpeed, true)
|
local ToWP = ToTargetCoord:WaypointAir(self.PatrolAltType, COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, ToTargetSpeed, true)
|
||||||
PatrolRoute[#PatrolRoute+1] = ToWP
|
PatrolRoute[#PatrolRoute+1] = ToWP
|
||||||
|
|
||||||
local Tasks = {}
|
local Tasks = {}
|
||||||
|
|||||||
@@ -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.
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
@@ -175,7 +177,6 @@ function AI_BAI_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
|
|||||||
-- @param #string From The From State string.
|
-- @param #string From The From State string.
|
||||||
-- @param #string Event The Event string.
|
-- @param #string Event The Event string.
|
||||||
-- @param #string To The To State string.
|
-- @param #string To The To State string.
|
||||||
|
|
||||||
-- @return #boolean Return false to cancel Transition.
|
-- @return #boolean Return false to cancel Transition.
|
||||||
|
|
||||||
--- OnAfter Transition Handler for Event Engage.
|
--- OnAfter Transition Handler for Event Engage.
|
||||||
@@ -522,12 +523,12 @@ function AI_BAI_ZONE:onafterEngage( Controllable, From, Event, To,
|
|||||||
|
|
||||||
--DONE: Create GetAltitude function for GROUP, and delete GetUnit(1).
|
--DONE: Create GetAltitude function for GROUP, and delete GetUnit(1).
|
||||||
local CurrentAltitude = self.Controllable:GetAltitude()
|
local CurrentAltitude = self.Controllable:GetAltitude()
|
||||||
local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
|
local CurrentPointVec3 = COORDINATE:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
|
||||||
local ToEngageZoneSpeed = self.PatrolMaxSpeed
|
local ToEngageZoneSpeed = self.PatrolMaxSpeed
|
||||||
local CurrentRoutePoint = CurrentPointVec3:WaypointAir(
|
local CurrentRoutePoint = CurrentPointVec3:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType,
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
COORDINATE.WaypointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
COORDINATE.WaypointAction.TurningPoint,
|
||||||
self.EngageSpeed,
|
self.EngageSpeed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
@@ -578,13 +579,13 @@ function AI_BAI_ZONE:onafterEngage( Controllable, From, Event, To,
|
|||||||
self:T2( ToTargetVec2 )
|
self:T2( ToTargetVec2 )
|
||||||
|
|
||||||
--- Obtain a 3D @{Point} from the 2D point + altitude.
|
--- Obtain a 3D @{Point} from the 2D point + altitude.
|
||||||
local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, self.EngageAltitude, ToTargetVec2.y )
|
local ToTargetPointVec3 = COORDINATE:New( ToTargetVec2.x, self.EngageAltitude, ToTargetVec2.y )
|
||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local ToTargetRoutePoint = ToTargetPointVec3:WaypointAir(
|
local ToTargetRoutePoint = ToTargetPointVec3:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType,
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
COORDINATE.WaypointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
COORDINATE.WaypointAction.TurningPoint,
|
||||||
self.EngageSpeed,
|
self.EngageSpeed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -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.
|
||||||
--
|
--
|
||||||
@@ -220,16 +221,9 @@ function AI_BALANCER:onenterReturning( SetGroup, From, Event, To, AIGroup )
|
|||||||
AIGroup:MessageToRed( "Returning to home base ...", 30 )
|
AIGroup:MessageToRed( "Returning to home base ...", 30 )
|
||||||
else
|
else
|
||||||
-- Okay, we need to send this Group back to the nearest base of the Coalition of the AI.
|
-- Okay, we need to send this Group back to the nearest base of the Coalition of the AI.
|
||||||
--TODO: i need to rework the POINT_VEC2 thing.
|
local PointVec2 = COORDINATE:New(AIGroup:GetVec2().x, 0, AIGroup:GetVec2().y)
|
||||||
local PointVec2 = POINT_VEC2:New( AIGroup:GetVec2().x, AIGroup:GetVec2().y )
|
|
||||||
local ClosestAirbase = self.ReturnAirbaseSet:FindNearestAirbaseFromPointVec2( PointVec2 )
|
local ClosestAirbase = self.ReturnAirbaseSet:FindNearestAirbaseFromPointVec2( PointVec2 )
|
||||||
self:T( ClosestAirbase.AirbaseName )
|
self:T( ClosestAirbase.AirbaseName )
|
||||||
--[[
|
|
||||||
AIGroup:MessageToRed( "Returning to " .. ClosestAirbase:GetName().. " ...", 30 )
|
|
||||||
local RTBRoute = AIGroup:RouteReturnToAirbase( ClosestAirbase )
|
|
||||||
AIGroupTemplate.route = RTBRoute
|
|
||||||
AIGroup:Respawn( AIGroupTemplate )
|
|
||||||
]]
|
|
||||||
AIGroup:RouteRTB(ClosestAirbase)
|
AIGroup:RouteRTB(ClosestAirbase)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
||||||
@@ -423,12 +425,12 @@ function AI_CAP_ZONE:onafterEngage( Controllable, From, Event, To )
|
|||||||
|
|
||||||
--DONE: Create GetAltitude function for GROUP, and delete GetUnit(1).
|
--DONE: Create GetAltitude function for GROUP, and delete GetUnit(1).
|
||||||
local CurrentAltitude = self.Controllable:GetAltitude()
|
local CurrentAltitude = self.Controllable:GetAltitude()
|
||||||
local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
|
local CurrentPointVec3 = COORDINATE:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
|
||||||
local ToEngageZoneSpeed = self.PatrolMaxSpeed
|
local ToEngageZoneSpeed = self.PatrolMaxSpeed
|
||||||
local CurrentRoutePoint = CurrentPointVec3:WaypointAir(
|
local CurrentRoutePoint = CurrentPointVec3:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType,
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
COORDINATE.WaypointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
COORDINATE.WaypointAction.TurningPoint,
|
||||||
ToEngageZoneSpeed,
|
ToEngageZoneSpeed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
@@ -445,13 +447,13 @@ function AI_CAP_ZONE:onafterEngage( Controllable, From, Event, To )
|
|||||||
self:T2( { self.PatrolMinSpeed, self.PatrolMaxSpeed, ToTargetSpeed } )
|
self:T2( { self.PatrolMinSpeed, self.PatrolMaxSpeed, ToTargetSpeed } )
|
||||||
|
|
||||||
--- Obtain a 3D @{Point} from the 2D point + altitude.
|
--- Obtain a 3D @{Point} from the 2D point + altitude.
|
||||||
local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, ToTargetAltitude, ToTargetVec2.y )
|
local ToTargetPointVec3 = COORDINATE:New( ToTargetVec2.x, ToTargetAltitude, ToTargetVec2.y )
|
||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local ToPatrolRoutePoint = ToTargetPointVec3:WaypointAir(
|
local ToPatrolRoutePoint = ToTargetPointVec3:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType,
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
COORDINATE.WaypointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
COORDINATE.WaypointAction.TurningPoint,
|
||||||
ToTargetSpeed,
|
ToTargetSpeed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -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.
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
@@ -466,12 +469,12 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To,
|
|||||||
|
|
||||||
--DONE: Create GetAltitude function for GROUP, and delete GetUnit(1).
|
--DONE: Create GetAltitude function for GROUP, and delete GetUnit(1).
|
||||||
local CurrentAltitude = self.Controllable:GetAltitude()
|
local CurrentAltitude = self.Controllable:GetAltitude()
|
||||||
local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
|
local CurrentPointVec3 = COORDINATE:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
|
||||||
local ToEngageZoneSpeed = self.PatrolMaxSpeed
|
local ToEngageZoneSpeed = self.PatrolMaxSpeed
|
||||||
local CurrentRoutePoint = CurrentPointVec3:WaypointAir(
|
local CurrentRoutePoint = CurrentPointVec3:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType,
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
COORDINATE.WaypointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
COORDINATE.WaypointAction.TurningPoint,
|
||||||
self.EngageSpeed,
|
self.EngageSpeed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
@@ -508,13 +511,13 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To,
|
|||||||
self:T2( ToTargetVec2 )
|
self:T2( ToTargetVec2 )
|
||||||
|
|
||||||
--- Obtain a 3D @{Point} from the 2D point + altitude.
|
--- Obtain a 3D @{Point} from the 2D point + altitude.
|
||||||
local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, self.EngageAltitude, ToTargetVec2.y )
|
local ToTargetPointVec3 = COORDINATE:New( ToTargetVec2.x, self.EngageAltitude, ToTargetVec2.y )
|
||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local ToTargetRoutePoint = ToTargetPointVec3:WaypointAir(
|
local ToTargetRoutePoint = ToTargetPointVec3:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType,
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
COORDINATE.WaypointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
COORDINATE.WaypointAction.TurningPoint,
|
||||||
self.EngageSpeed,
|
self.EngageSpeed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -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.
|
||||||
@@ -440,7 +442,7 @@ function AI_CARGO_AIRPLANE:Route( Airplane, Airbase, Speed, Height, Uncontrolled
|
|||||||
|
|
||||||
-- To point.
|
-- To point.
|
||||||
local AirbasePointVec2 = Airbase:GetPointVec2()
|
local AirbasePointVec2 = Airbase:GetPointVec2()
|
||||||
local ToWaypoint = AirbasePointVec2:WaypointAir(POINT_VEC3.RoutePointAltType.BARO, "Land", "Landing", Speed or Airplane:GetSpeedMax()*0.8, true, Airbase)
|
local ToWaypoint = AirbasePointVec2:WaypointAir(COORDINATE.WaypointAltType.BARO, "Land", "Landing", Speed or Airplane:GetSpeedMax()*0.8, true, Airbase)
|
||||||
|
|
||||||
--ToWaypoint["airdromeId"] = Airbase:GetID()
|
--ToWaypoint["airdromeId"] = Airbase:GetID()
|
||||||
--ToWaypoint["speed_locked"] = true
|
--ToWaypoint["speed_locked"] = true
|
||||||
|
|||||||
@@ -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.
|
||||||
@@ -367,8 +369,8 @@ function AI_CARGO_HELICOPTER:onafterQueue( Helicopter, From, Event, To, Coordina
|
|||||||
-- local CoordinateFrom = Helicopter:GetCoordinate()
|
-- local CoordinateFrom = Helicopter:GetCoordinate()
|
||||||
-- local WaypointFrom = CoordinateFrom:WaypointAir(
|
-- local WaypointFrom = CoordinateFrom:WaypointAir(
|
||||||
-- "RADIO",
|
-- "RADIO",
|
||||||
-- POINT_VEC3.RoutePointType.TurningPoint,
|
-- COORDINATE.WaypointType.TurningPoint,
|
||||||
-- POINT_VEC3.RoutePointAction.TurningPoint,
|
-- COORDINATE.WaypointAction.TurningPoint,
|
||||||
-- Speed,
|
-- Speed,
|
||||||
-- true
|
-- true
|
||||||
-- )
|
-- )
|
||||||
@@ -380,8 +382,8 @@ function AI_CARGO_HELICOPTER:onafterQueue( Helicopter, From, Event, To, Coordina
|
|||||||
|
|
||||||
local WaypointTo = CoordinateTo:WaypointAir(
|
local WaypointTo = CoordinateTo:WaypointAir(
|
||||||
"RADIO",
|
"RADIO",
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
COORDINATE.WaypointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
COORDINATE.WaypointAction.TurningPoint,
|
||||||
50,
|
50,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
@@ -427,7 +429,7 @@ function AI_CARGO_HELICOPTER:onafterOrbit( Helicopter, From, Event, To, Coordina
|
|||||||
local landheight = CoordinateTo:GetLandHeight() -- get target height
|
local landheight = CoordinateTo:GetLandHeight() -- get target height
|
||||||
CoordinateTo.y = landheight + 50 -- flight height should be 50m above ground
|
CoordinateTo.y = landheight + 50 -- flight height should be 50m above ground
|
||||||
|
|
||||||
local WaypointTo = CoordinateTo:WaypointAir("RADIO", POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, 50, true)
|
local WaypointTo = CoordinateTo:WaypointAir("RADIO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, 50, true)
|
||||||
Route[#Route+1] = WaypointTo
|
Route[#Route+1] = WaypointTo
|
||||||
|
|
||||||
local Tasks = {}
|
local Tasks = {}
|
||||||
@@ -496,14 +498,14 @@ function AI_CARGO_HELICOPTER:onafterPickup( Helicopter, From, Event, To, Coordin
|
|||||||
local CoordinateFrom = Helicopter:GetCoordinate()
|
local CoordinateFrom = Helicopter:GetCoordinate()
|
||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local WaypointFrom = CoordinateFrom:WaypointAir("RADIO", POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, _speed, true)
|
local WaypointFrom = CoordinateFrom:WaypointAir("RADIO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, _speed, true)
|
||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local CoordinateTo = Coordinate
|
local CoordinateTo = Coordinate
|
||||||
local landheight = CoordinateTo:GetLandHeight() -- get target height
|
local landheight = CoordinateTo:GetLandHeight() -- get target height
|
||||||
CoordinateTo.y = landheight + 50 -- flight height should be 50m above ground
|
CoordinateTo.y = landheight + 50 -- flight height should be 50m above ground
|
||||||
|
|
||||||
local WaypointTo = CoordinateTo:WaypointAir("RADIO", POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint,_speed, true)
|
local WaypointTo = CoordinateTo:WaypointAir("RADIO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint,_speed, true)
|
||||||
|
|
||||||
Route[#Route+1] = WaypointFrom
|
Route[#Route+1] = WaypointFrom
|
||||||
Route[#Route+1] = WaypointTo
|
Route[#Route+1] = WaypointTo
|
||||||
@@ -563,7 +565,7 @@ function AI_CARGO_HELICOPTER:onafterDeploy( Helicopter, From, Event, To, Coordin
|
|||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local CoordinateFrom = Helicopter:GetCoordinate()
|
local CoordinateFrom = Helicopter:GetCoordinate()
|
||||||
local WaypointFrom = CoordinateFrom:WaypointAir("RADIO", POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, _speed, true)
|
local WaypointFrom = CoordinateFrom:WaypointAir("RADIO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, _speed, true)
|
||||||
Route[#Route+1] = WaypointFrom
|
Route[#Route+1] = WaypointFrom
|
||||||
Route[#Route+1] = WaypointFrom
|
Route[#Route+1] = WaypointFrom
|
||||||
|
|
||||||
@@ -573,7 +575,7 @@ function AI_CARGO_HELICOPTER:onafterDeploy( Helicopter, From, Event, To, Coordin
|
|||||||
local landheight = CoordinateTo:GetLandHeight() -- get target height
|
local landheight = CoordinateTo:GetLandHeight() -- get target height
|
||||||
CoordinateTo.y = landheight + 50 -- flight height should be 50m above ground
|
CoordinateTo.y = landheight + 50 -- flight height should be 50m above ground
|
||||||
|
|
||||||
local WaypointTo = CoordinateTo:WaypointAir("RADIO", POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, _speed, true)
|
local WaypointTo = CoordinateTo:WaypointAir("RADIO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, _speed, true)
|
||||||
|
|
||||||
Route[#Route+1] = WaypointTo
|
Route[#Route+1] = WaypointTo
|
||||||
Route[#Route+1] = WaypointTo
|
Route[#Route+1] = WaypointTo
|
||||||
@@ -631,7 +633,7 @@ function AI_CARGO_HELICOPTER:onafterHome( Helicopter, From, Event, To, Coordinat
|
|||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local CoordinateFrom = Helicopter:GetCoordinate()
|
local CoordinateFrom = Helicopter:GetCoordinate()
|
||||||
|
|
||||||
local WaypointFrom = CoordinateFrom:WaypointAir("RADIO", POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, Speed, true)
|
local WaypointFrom = CoordinateFrom:WaypointAir("RADIO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, Speed, true)
|
||||||
Route[#Route+1] = WaypointFrom
|
Route[#Route+1] = WaypointFrom
|
||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
@@ -639,7 +641,7 @@ function AI_CARGO_HELICOPTER:onafterHome( Helicopter, From, Event, To, Coordinat
|
|||||||
local landheight = CoordinateTo:GetLandHeight() -- get target height
|
local landheight = CoordinateTo:GetLandHeight() -- get target height
|
||||||
CoordinateTo.y = landheight + Height -- flight height should be 50m above ground
|
CoordinateTo.y = landheight + Height -- flight height should be 50m above ground
|
||||||
|
|
||||||
local WaypointTo = CoordinateTo:WaypointAir("RADIO", POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, Speed, true)
|
local WaypointTo = CoordinateTo:WaypointAir("RADIO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, Speed, true)
|
||||||
|
|
||||||
Route[#Route+1] = WaypointTo
|
Route[#Route+1] = WaypointTo
|
||||||
|
|
||||||
|
|||||||
@@ -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:
|
||||||
@@ -158,7 +160,6 @@ AI_FORMATION.__Enum.Mode = {
|
|||||||
-- @field #number GroundRadar
|
-- @field #number GroundRadar
|
||||||
-- @field #number Ground
|
-- @field #number Ground
|
||||||
AI_FORMATION.__Enum.ReportType = {
|
AI_FORMATION.__Enum.ReportType = {
|
||||||
Airborne = "*",
|
|
||||||
Airborne = "A",
|
Airborne = "A",
|
||||||
GroundRadar = "R",
|
GroundRadar = "R",
|
||||||
Ground = "G",
|
Ground = "G",
|
||||||
@@ -725,7 +726,7 @@ function AI_FORMATION:onafterFormationLine( FollowGroupSet, From , Event , To, X
|
|||||||
|
|
||||||
for FollowID, FollowGroup in pairs( FollowSet ) do
|
for FollowID, FollowGroup in pairs( FollowSet ) do
|
||||||
|
|
||||||
local PointVec3 = POINT_VEC3:New()
|
local PointVec3 = COORDINATE:New()
|
||||||
PointVec3:SetX( XStart + i * XSpace )
|
PointVec3:SetX( XStart + i * XSpace )
|
||||||
PointVec3:SetY( YStart + i * YSpace )
|
PointVec3:SetY( YStart + i * YSpace )
|
||||||
PointVec3:SetZ( ZStart + i * ZSpace )
|
PointVec3:SetZ( ZStart + i * ZSpace )
|
||||||
@@ -877,7 +878,7 @@ function AI_FORMATION:onafterFormationCenterWing( FollowGroupSet, From , Event ,
|
|||||||
|
|
||||||
for FollowID, FollowGroup in pairs( FollowSet ) do
|
for FollowID, FollowGroup in pairs( FollowSet ) do
|
||||||
|
|
||||||
local PointVec3 = POINT_VEC3:New()
|
local PointVec3 = COORDINATE:New()
|
||||||
|
|
||||||
local Side = ( i % 2 == 0 ) and 1 or -1
|
local Side = ( i % 2 == 0 ) and 1 or -1
|
||||||
local Row = i / 2 + 1
|
local Row = i / 2 + 1
|
||||||
@@ -936,7 +937,7 @@ function AI_FORMATION:onafterFormationBox( FollowGroupSet, From , Event , To, XS
|
|||||||
|
|
||||||
for FollowID, FollowGroup in pairs( FollowSet ) do
|
for FollowID, FollowGroup in pairs( FollowSet ) do
|
||||||
|
|
||||||
local PointVec3 = POINT_VEC3:New()
|
local PointVec3 = COORDINATE:New()
|
||||||
|
|
||||||
local ZIndex = i % ZLevels
|
local ZIndex = i % ZLevels
|
||||||
local XIndex = math.floor( i / ZLevels )
|
local XIndex = math.floor( i / ZLevels )
|
||||||
@@ -1222,7 +1223,6 @@ function AI_FORMATION:FollowMe(FollowGroup, ClientUnit, CT1, CV1, CT2, CV2)
|
|||||||
local CVI = {
|
local CVI = {
|
||||||
x = CV2.x + CS * 10 * math.sin(Ca),
|
x = CV2.x + CS * 10 * math.sin(Ca),
|
||||||
y = GH2.y + Inclination, -- + FollowFormation.y,
|
y = GH2.y + Inclination, -- + FollowFormation.y,
|
||||||
y = GH2.y,
|
|
||||||
z = CV2.z + CS * 10 * math.cos(Ca),
|
z = CV2.z + CS * 10 * math.cos(Ca),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
||||||
@@ -751,12 +753,12 @@ function AI_PATROL_ZONE:onafterRoute( Controllable, From, Event, To )
|
|||||||
if not CurrentVec2 then return end
|
if not CurrentVec2 then return end
|
||||||
--Done: Create GetAltitude function for GROUP, and delete GetUnit(1).
|
--Done: Create GetAltitude function for GROUP, and delete GetUnit(1).
|
||||||
local CurrentAltitude = self.Controllable:GetAltitude()
|
local CurrentAltitude = self.Controllable:GetAltitude()
|
||||||
local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
|
local CurrentPointVec3 = COORDINATE:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
|
||||||
local ToPatrolZoneSpeed = self.PatrolMaxSpeed
|
local ToPatrolZoneSpeed = self.PatrolMaxSpeed
|
||||||
local CurrentRoutePoint = CurrentPointVec3:WaypointAir(
|
local CurrentRoutePoint = CurrentPointVec3:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType,
|
||||||
POINT_VEC3.RoutePointType.TakeOffParking,
|
COORDINATE.WaypointType.TakeOffParking,
|
||||||
POINT_VEC3.RoutePointAction.FromParkingArea,
|
COORDINATE.WaypointAction.FromParkingArea,
|
||||||
ToPatrolZoneSpeed,
|
ToPatrolZoneSpeed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
@@ -767,12 +769,12 @@ function AI_PATROL_ZONE:onafterRoute( Controllable, From, Event, To )
|
|||||||
if not CurrentVec2 then return end
|
if not CurrentVec2 then return end
|
||||||
--DONE: Create GetAltitude function for GROUP, and delete GetUnit(1).
|
--DONE: Create GetAltitude function for GROUP, and delete GetUnit(1).
|
||||||
local CurrentAltitude = self.Controllable:GetAltitude()
|
local CurrentAltitude = self.Controllable:GetAltitude()
|
||||||
local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
|
local CurrentPointVec3 = COORDINATE:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
|
||||||
local ToPatrolZoneSpeed = self.PatrolMaxSpeed
|
local ToPatrolZoneSpeed = self.PatrolMaxSpeed
|
||||||
local CurrentRoutePoint = CurrentPointVec3:WaypointAir(
|
local CurrentRoutePoint = CurrentPointVec3:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType,
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
COORDINATE.WaypointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
COORDINATE.WaypointAction.TurningPoint,
|
||||||
ToPatrolZoneSpeed,
|
ToPatrolZoneSpeed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
@@ -792,13 +794,13 @@ function AI_PATROL_ZONE:onafterRoute( Controllable, From, Event, To )
|
|||||||
self:T2( { self.PatrolMinSpeed, self.PatrolMaxSpeed, ToTargetSpeed } )
|
self:T2( { self.PatrolMinSpeed, self.PatrolMaxSpeed, ToTargetSpeed } )
|
||||||
|
|
||||||
--- Obtain a 3D @{Point} from the 2D point + altitude.
|
--- Obtain a 3D @{Point} from the 2D point + altitude.
|
||||||
local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, ToTargetAltitude, ToTargetVec2.y )
|
local ToTargetPointVec3 = COORDINATE:New( ToTargetVec2.x, ToTargetAltitude, ToTargetVec2.y )
|
||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local ToTargetRoutePoint = ToTargetPointVec3:WaypointAir(
|
local ToTargetRoutePoint = ToTargetPointVec3:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType,
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
COORDINATE.WaypointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
COORDINATE.WaypointAction.TurningPoint,
|
||||||
ToTargetSpeed,
|
ToTargetSpeed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
@@ -846,7 +848,6 @@ function AI_PATROL_ZONE:onafterStatus()
|
|||||||
OldAIControllable:SetTask( TimedOrbitTask, 10 )
|
OldAIControllable:SetTask( TimedOrbitTask, 10 )
|
||||||
|
|
||||||
RTB = true
|
RTB = true
|
||||||
else
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TODO: Check GROUP damage function.
|
-- TODO: Check GROUP damage function.
|
||||||
@@ -856,6 +857,16 @@ function AI_PATROL_ZONE:onafterStatus()
|
|||||||
RTB = true
|
RTB = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if self:IsInstanceOf("AI_CAS") or self:IsInstanceOf("AI_BAI") then
|
||||||
|
local atotal,shells,rockets,bombs,missiles = self.Controllable:GetAmmunition()
|
||||||
|
local arelevant = rockets+bombs
|
||||||
|
if arelevant == 0 or missiles == 0 then
|
||||||
|
RTB = true
|
||||||
|
self:T({total=atotal,shells=shells,rockets=rockets,bombs=bombs,missiles=missiles})
|
||||||
|
self:T( self.Controllable:GetName() .. " is out of ammo, RTB!" )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if RTB == true then
|
if RTB == true then
|
||||||
self:RTB()
|
self:RTB()
|
||||||
else
|
else
|
||||||
@@ -881,12 +892,12 @@ function AI_PATROL_ZONE:onafterRTB()
|
|||||||
--DONE: Create GetAltitude function for GROUP, and delete GetUnit(1).
|
--DONE: Create GetAltitude function for GROUP, and delete GetUnit(1).
|
||||||
--local CurrentAltitude = self.Controllable:GetUnit(1):GetAltitude()
|
--local CurrentAltitude = self.Controllable:GetUnit(1):GetAltitude()
|
||||||
local CurrentAltitude = self.Controllable:GetAltitude()
|
local CurrentAltitude = self.Controllable:GetAltitude()
|
||||||
local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
|
local CurrentPointVec3 = COORDINATE:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
|
||||||
local ToPatrolZoneSpeed = self.PatrolMaxSpeed
|
local ToPatrolZoneSpeed = self.PatrolMaxSpeed
|
||||||
local CurrentRoutePoint = CurrentPointVec3:WaypointAir(
|
local CurrentRoutePoint = CurrentPointVec3:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType,
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
COORDINATE.WaypointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
COORDINATE.WaypointAction.TurningPoint,
|
||||||
ToPatrolZoneSpeed,
|
ToPatrolZoneSpeed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -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.
|
||||||
@@ -275,14 +277,14 @@
|
|||||||
-- The cargo must be in the **Loaded** state.
|
-- The cargo must be in the **Loaded** state.
|
||||||
-- @function [parent=#CARGO] UnBoard
|
-- @function [parent=#CARGO] UnBoard
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Core.Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
|
-- @param Core.Point#COORDINATE ToPointVec2 (optional) @{Core.Point#COORDINATE) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
|
||||||
|
|
||||||
--- UnBoards the cargo to a Carrier. The event will create a movement (= running or driving) of the cargo from the Carrier.
|
--- UnBoards the cargo to a Carrier. The event will create a movement (= running or driving) of the cargo from the Carrier.
|
||||||
-- The cargo must be in the **Loaded** state.
|
-- The cargo must be in the **Loaded** state.
|
||||||
-- @function [parent=#CARGO] __UnBoard
|
-- @function [parent=#CARGO] __UnBoard
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param #number DelaySeconds The amount of seconds to delay the action.
|
-- @param #number DelaySeconds The amount of seconds to delay the action.
|
||||||
-- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Core.Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
|
-- @param Core.Point#COORDINATE ToPointVec2 (optional) @{Core.Point#COORDINATE) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
|
||||||
|
|
||||||
|
|
||||||
-- Load
|
-- Load
|
||||||
@@ -307,14 +309,14 @@
|
|||||||
-- The cargo must be in the **Loaded** state.
|
-- The cargo must be in the **Loaded** state.
|
||||||
-- @function [parent=#CARGO] UnLoad
|
-- @function [parent=#CARGO] UnLoad
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Core.Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
|
-- @param Core.Point#COORDINATE ToPointVec2 (optional) @{Core.Point#COORDINATE) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
|
||||||
|
|
||||||
--- UnLoads the cargo to a Carrier. The event will unload the cargo from the Carrier. There will be no movement simulated of the cargo loading.
|
--- UnLoads the cargo to a Carrier. The event will unload the cargo from the Carrier. There will be no movement simulated of the cargo loading.
|
||||||
-- The cargo must be in the **Loaded** state.
|
-- The cargo must be in the **Loaded** state.
|
||||||
-- @function [parent=#CARGO] __UnLoad
|
-- @function [parent=#CARGO] __UnLoad
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param #number DelaySeconds The amount of seconds to delay the action.
|
-- @param #number DelaySeconds The amount of seconds to delay the action.
|
||||||
-- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Core.Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
|
-- @param Core.Point#COORDINATE ToPointVec2 (optional) @{Core.Point#COORDINATE) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
|
||||||
|
|
||||||
-- State Transition Functions
|
-- State Transition Functions
|
||||||
|
|
||||||
@@ -467,7 +469,7 @@ do -- CARGO
|
|||||||
self.Type = Type
|
self.Type = Type
|
||||||
self.Name = Name
|
self.Name = Name
|
||||||
self.Weight = Weight or 0
|
self.Weight = Weight or 0
|
||||||
self.CargoObject = nil
|
self.CargoObject = nil -- Wrapper.Group#GROUP
|
||||||
self.CargoCarrier = nil -- Wrapper.Client#CLIENT
|
self.CargoCarrier = nil -- Wrapper.Client#CLIENT
|
||||||
self.Representable = false
|
self.Representable = false
|
||||||
self.Slingloadable = false
|
self.Slingloadable = false
|
||||||
@@ -897,7 +899,7 @@ do -- CARGO
|
|||||||
|
|
||||||
--- Get the current PointVec2 of the cargo.
|
--- Get the current PointVec2 of the cargo.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return Core.Point#POINT_VEC2
|
-- @return Core.Point#COORDINATE
|
||||||
function CARGO:GetPointVec2()
|
function CARGO:GetPointVec2()
|
||||||
return self.CargoObject:GetPointVec2()
|
return self.CargoObject:GetPointVec2()
|
||||||
end
|
end
|
||||||
@@ -1094,7 +1096,7 @@ do -- CARGO_REPRESENTABLE
|
|||||||
|
|
||||||
--- Route a cargo unit to a PointVec2.
|
--- Route a cargo unit to a PointVec2.
|
||||||
-- @param #CARGO_REPRESENTABLE self
|
-- @param #CARGO_REPRESENTABLE self
|
||||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
-- @param Core.Point#COORDINATE ToPointVec2
|
||||||
-- @param #number Speed
|
-- @param #number Speed
|
||||||
-- @return #CARGO_REPRESENTABLE
|
-- @return #CARGO_REPRESENTABLE
|
||||||
function CARGO_REPRESENTABLE:RouteTo( ToPointVec2, Speed )
|
function CARGO_REPRESENTABLE:RouteTo( ToPointVec2, Speed )
|
||||||
|
|||||||
@@ -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.
|
||||||
--
|
--
|
||||||
@@ -114,7 +117,7 @@ do -- CARGO_CRATE
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#POINT_VEC2
|
-- @param Core.Point#COORDINATE
|
||||||
function CARGO_CRATE:onenterUnLoaded( From, Event, To, ToPointVec2 )
|
function CARGO_CRATE:onenterUnLoaded( From, Event, To, ToPointVec2 )
|
||||||
--self:T( { ToPointVec2, From, Event, To } )
|
--self:T( { ToPointVec2, From, Event, To } )
|
||||||
|
|
||||||
|
|||||||
@@ -22,9 +22,12 @@ do -- CARGO_GROUP
|
|||||||
--- @type CARGO_GROUP
|
--- @type CARGO_GROUP
|
||||||
-- @field Core.Set#SET_CARGO CargoSet The collection of derived CARGO objects.
|
-- @field Core.Set#SET_CARGO CargoSet The collection of derived CARGO objects.
|
||||||
-- @field #string GroupName The name of the CargoGroup.
|
-- @field #string GroupName The name of the CargoGroup.
|
||||||
|
-- @field Wrapper.Group#GROUÜ CargoCarrier The carrier 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:
|
||||||
@@ -410,7 +413,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
-- @param Core.Point#COORDINATE ToPointVec2
|
||||||
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
||||||
function CARGO_GROUP:onafterUnBoard( From, Event, To, ToPointVec2, NearRadius, ... )
|
function CARGO_GROUP:onafterUnBoard( From, Event, To, ToPointVec2, NearRadius, ... )
|
||||||
self:T( {From, Event, To, ToPointVec2, NearRadius } )
|
self:T( {From, Event, To, ToPointVec2, NearRadius } )
|
||||||
@@ -453,7 +456,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
-- @param Core.Point#COORDINATE ToPointVec2
|
||||||
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
||||||
function CARGO_GROUP:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... )
|
function CARGO_GROUP:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... )
|
||||||
--self:T( { From, Event, To, ToPointVec2, NearRadius } )
|
--self:T( { From, Event, To, ToPointVec2, NearRadius } )
|
||||||
@@ -491,7 +494,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
-- @param Core.Point#COORDINATE ToPointVec2
|
||||||
function CARGO_GROUP:onafterUnLoad( From, Event, To, ToPointVec2, ... )
|
function CARGO_GROUP:onafterUnLoad( From, Event, To, ToPointVec2, ... )
|
||||||
--self:T( { From, Event, To, ToPointVec2 } )
|
--self:T( { From, Event, To, ToPointVec2 } )
|
||||||
|
|
||||||
@@ -771,3 +774,4 @@ do -- CARGO_GROUP
|
|||||||
|
|
||||||
|
|
||||||
end -- CARGO_GROUP
|
end -- CARGO_GROUP
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
--
|
--
|
||||||
@@ -72,7 +74,7 @@ do -- CARGO_UNIT
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
-- @param Core.Point#COORDINATE ToPointVec2
|
||||||
-- @param #number NearRadius (optional) Defaut 25 m.
|
-- @param #number NearRadius (optional) Defaut 25 m.
|
||||||
function CARGO_UNIT:onenterUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
function CARGO_UNIT:onenterUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
||||||
self:T( { From, Event, To, ToPointVec2, NearRadius } )
|
self:T( { From, Event, To, ToPointVec2, NearRadius } )
|
||||||
@@ -145,7 +147,7 @@ do -- CARGO_UNIT
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
-- @param Core.Point#COORDINATE ToPointVec2
|
||||||
-- @param #number NearRadius (optional) Defaut 100 m.
|
-- @param #number NearRadius (optional) Defaut 100 m.
|
||||||
function CARGO_UNIT:onleaveUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
function CARGO_UNIT:onleaveUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
||||||
self:T( { From, Event, To, ToPointVec2, NearRadius } )
|
self:T( { From, Event, To, ToPointVec2, NearRadius } )
|
||||||
@@ -171,7 +173,7 @@ do -- CARGO_UNIT
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
-- @param Core.Point#COORDINATE ToPointVec2
|
||||||
-- @param #number NearRadius (optional) Defaut 100 m.
|
-- @param #number NearRadius (optional) Defaut 100 m.
|
||||||
function CARGO_UNIT:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
function CARGO_UNIT:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
||||||
self:T( { From, Event, To, ToPointVec2, NearRadius } )
|
self:T( { From, Event, To, ToPointVec2, NearRadius } )
|
||||||
@@ -197,7 +199,7 @@ do -- CARGO_UNIT
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#POINT_VEC2
|
-- @param Core.Point#COORDINATE
|
||||||
function CARGO_UNIT:onenterUnLoaded( From, Event, To, ToPointVec2 )
|
function CARGO_UNIT:onenterUnLoaded( From, Event, To, ToPointVec2 )
|
||||||
self:T( { ToPointVec2, From, Event, To } )
|
self:T( { ToPointVec2, From, Event, To } )
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
-- @module Core.Base
|
-- @module Core.Base
|
||||||
-- @image Core_Base.JPG
|
-- @image Core_Base.JPG
|
||||||
|
|
||||||
local _TraceOnOff = true
|
local _TraceOnOff = false -- default to no tracing
|
||||||
local _TraceLevel = 1
|
local _TraceLevel = 1
|
||||||
local _TraceAll = false
|
local _TraceAll = false
|
||||||
local _TraceClass = {}
|
local _TraceClass = {}
|
||||||
@@ -34,11 +34,12 @@ local _TraceClassMethod = {}
|
|||||||
|
|
||||||
local _ClassID = 0
|
local _ClassID = 0
|
||||||
|
|
||||||
---
|
--- Base class of everything
|
||||||
-- @type BASE
|
-- @type BASE
|
||||||
-- @field ClassName The name of the class.
|
-- @field #string ClassName The name of the class.
|
||||||
-- @field ClassID The ID number of the class.
|
-- @field #number ClassID The ID number of the class.
|
||||||
-- @field ClassNameAndID The name of the class concatenated with the ID number of the class.
|
-- @field #string ClassNameAndID The name of the class concatenated with the ID number of the class.
|
||||||
|
-- @field Core.Scheduler#SCHEDULER Scheduler The scheduler object.
|
||||||
|
|
||||||
--- BASE class
|
--- BASE class
|
||||||
--
|
--
|
||||||
@@ -200,6 +201,7 @@ BASE = {
|
|||||||
States = {},
|
States = {},
|
||||||
Debug = debug,
|
Debug = debug,
|
||||||
Scheduler = nil,
|
Scheduler = nil,
|
||||||
|
Properties = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- @field #BASE.__
|
-- @field #BASE.__
|
||||||
@@ -210,14 +212,6 @@ BASE._ = {
|
|||||||
Schedules = {}, --- Contains the Schedulers Active
|
Schedules = {}, --- Contains the Schedulers Active
|
||||||
}
|
}
|
||||||
|
|
||||||
--- The Formation Class
|
|
||||||
-- @type FORMATION
|
|
||||||
-- @field Cone A cone formation.
|
|
||||||
FORMATION = {
|
|
||||||
Cone = "Cone",
|
|
||||||
Vee = "Vee",
|
|
||||||
}
|
|
||||||
|
|
||||||
--- BASE constructor.
|
--- BASE constructor.
|
||||||
--
|
--
|
||||||
-- This is an example how to use the BASE:New() constructor in a new class definition when inheriting from BASE.
|
-- This is an example how to use the BASE:New() constructor in a new class definition when inheriting from BASE.
|
||||||
@@ -742,6 +736,30 @@ do -- Event Handling
|
|||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
|
--- Occurs when a player creates a dynamic cargo object from the F8 ground crew menu.
|
||||||
|
-- *** NOTE *** this is a workarounf for DCS not creating these events as of Aug 2024.
|
||||||
|
-- @function [parent=#BASE] OnEventNewDynamicCargo
|
||||||
|
-- @param #BASE self
|
||||||
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
|
--- Occurs when a player loads a dynamic cargo object with the F8 ground crew menu into a helo.
|
||||||
|
-- *** NOTE *** this is a workarounf for DCS not creating these events as of Aug 2024.
|
||||||
|
-- @function [parent=#BASE] OnEventDynamicCargoLoaded
|
||||||
|
-- @param #BASE self
|
||||||
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
|
--- Occurs when a player unloads a dynamic cargo object with the F8 ground crew menu from a helo.
|
||||||
|
-- *** NOTE *** this is a workarounf for DCS not creating these events as of Aug 2024.
|
||||||
|
-- @function [parent=#BASE] OnEventDynamicCargoUnloaded
|
||||||
|
-- @param #BASE self
|
||||||
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
|
--- Occurs when a dynamic cargo crate is removed.
|
||||||
|
-- *** NOTE *** this is a workarounf for DCS not creating these events as of Aug 2024.
|
||||||
|
-- @function [parent=#BASE] OnEventDynamicCargoRemoved
|
||||||
|
-- @param #BASE self
|
||||||
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Creation of a Birth Event.
|
--- Creation of a Birth Event.
|
||||||
@@ -863,6 +881,62 @@ end
|
|||||||
world.onEvent(Event)
|
world.onEvent(Event)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Creation of a S_EVENT_NEW_DYNAMIC_CARGO event.
|
||||||
|
-- @param #BASE self
|
||||||
|
-- @param Wrapper.DynamicCargo#DYNAMICCARGO DynamicCargo the dynamic cargo object
|
||||||
|
function BASE:CreateEventNewDynamicCargo(DynamicCargo)
|
||||||
|
self:F({DynamicCargo})
|
||||||
|
local Event = {
|
||||||
|
id = EVENTS.NewDynamicCargo,
|
||||||
|
time = timer.getTime(),
|
||||||
|
dynamiccargo = DynamicCargo,
|
||||||
|
initiator = DynamicCargo:GetDCSObject(),
|
||||||
|
}
|
||||||
|
world.onEvent( Event )
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Creation of a S_EVENT_DYNAMIC_CARGO_LOADED event.
|
||||||
|
-- @param #BASE self
|
||||||
|
-- @param Wrapper.DynamicCargo#DYNAMICCARGO DynamicCargo the dynamic cargo object
|
||||||
|
function BASE:CreateEventDynamicCargoLoaded(DynamicCargo)
|
||||||
|
self:F({DynamicCargo})
|
||||||
|
local Event = {
|
||||||
|
id = EVENTS.DynamicCargoLoaded,
|
||||||
|
time = timer.getTime(),
|
||||||
|
dynamiccargo = DynamicCargo,
|
||||||
|
initiator = DynamicCargo:GetDCSObject(),
|
||||||
|
}
|
||||||
|
world.onEvent( Event )
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Creation of a S_EVENT_DYNAMIC_CARGO_UNLOADED event.
|
||||||
|
-- @param #BASE self
|
||||||
|
-- @param Wrapper.DynamicCargo#DYNAMICCARGO DynamicCargo the dynamic cargo object
|
||||||
|
function BASE:CreateEventDynamicCargoUnloaded(DynamicCargo)
|
||||||
|
self:F({DynamicCargo})
|
||||||
|
local Event = {
|
||||||
|
id = EVENTS.DynamicCargoUnloaded,
|
||||||
|
time = timer.getTime(),
|
||||||
|
dynamiccargo = DynamicCargo,
|
||||||
|
initiator = DynamicCargo:GetDCSObject(),
|
||||||
|
}
|
||||||
|
world.onEvent( Event )
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Creation of a S_EVENT_DYNAMIC_CARGO_REMOVED event.
|
||||||
|
-- @param #BASE self
|
||||||
|
-- @param Wrapper.DynamicCargo#DYNAMICCARGO DynamicCargo the dynamic cargo object
|
||||||
|
function BASE:CreateEventDynamicCargoRemoved(DynamicCargo)
|
||||||
|
self:F({DynamicCargo})
|
||||||
|
local Event = {
|
||||||
|
id = EVENTS.DynamicCargoRemoved,
|
||||||
|
time = timer.getTime(),
|
||||||
|
dynamiccargo = DynamicCargo,
|
||||||
|
initiator = DynamicCargo:GetDCSObject(),
|
||||||
|
}
|
||||||
|
world.onEvent( Event )
|
||||||
|
end
|
||||||
|
|
||||||
--- The main event handling function... This function captures all events generated for the class.
|
--- The main event handling function... This function captures all events generated for the class.
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param DCS#Event event
|
-- @param DCS#Event event
|
||||||
@@ -900,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, ... )
|
||||||
|
|
||||||
@@ -1036,6 +1110,31 @@ function BASE:ClearState( Object, StateName )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set one property of an object.
|
||||||
|
-- @param #BASE self
|
||||||
|
-- @param Key The key that is used as a reference of the value. Note that the key can be a #string, but it can also be any other type!
|
||||||
|
-- @param Value The value that is stored. Note that the value can be a #string, but it can also be any other type!
|
||||||
|
function BASE:SetProperty(Key,Value)
|
||||||
|
self.Properties = self.Properties or {}
|
||||||
|
self.Properties[Key] = Value
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Get one property of an object by the key.
|
||||||
|
-- @param #BASE self
|
||||||
|
-- @param Key The key that is used as a reference of the value. Note that the key can be a #string, but it can also be any other type!
|
||||||
|
-- @return Value The value that is stored. Note that the value can be a #string, but it can also be any other type! Nil if not found.
|
||||||
|
function BASE:GetProperty(Key)
|
||||||
|
self.Properties = self.Properties or {}
|
||||||
|
return self.Properties[Key]
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Get all of the properties of an object in a table.
|
||||||
|
-- @param #BASE self
|
||||||
|
-- @return #table of values, indexed by keys.
|
||||||
|
function BASE:GetProperties()
|
||||||
|
return self.Properties
|
||||||
|
end
|
||||||
|
|
||||||
-- Trace section
|
-- Trace section
|
||||||
|
|
||||||
-- Log a trace (only shown when trace is on)
|
-- Log a trace (only shown when trace is on)
|
||||||
@@ -1157,6 +1256,15 @@ function BASE:_Serialize(Arguments)
|
|||||||
return text
|
return text
|
||||||
end
|
end
|
||||||
|
|
||||||
|
----- (Internal) Serialize arguments
|
||||||
|
---- @param #BASE self
|
||||||
|
---- @param #table Arguments
|
||||||
|
---- @return #string Text
|
||||||
|
--function BASE:_Serialize(Arguments)
|
||||||
|
-- local text=UTILS.BasicSerialize(Arguments)
|
||||||
|
-- return text
|
||||||
|
--end
|
||||||
|
|
||||||
--- Trace a function call. This function is private.
|
--- Trace a function call. This function is private.
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param Arguments A #table or any field.
|
-- @param Arguments A #table or any field.
|
||||||
@@ -1191,7 +1299,7 @@ end
|
|||||||
-- @param Arguments A #table or any field.
|
-- @param Arguments A #table or any field.
|
||||||
function BASE:F( Arguments )
|
function BASE:F( Arguments )
|
||||||
|
|
||||||
if BASE.Debug and _TraceOnOff then
|
if BASE.Debug and _TraceOnOff == true then
|
||||||
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
|
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
|
||||||
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
|
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
|
||||||
|
|
||||||
@@ -1206,7 +1314,7 @@ end
|
|||||||
-- @param Arguments A #table or any field.
|
-- @param Arguments A #table or any field.
|
||||||
function BASE:F2( Arguments )
|
function BASE:F2( Arguments )
|
||||||
|
|
||||||
if BASE.Debug and _TraceOnOff then
|
if BASE.Debug and _TraceOnOff == true and _TraceLevel >= 2 then
|
||||||
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
|
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
|
||||||
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
|
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
|
||||||
|
|
||||||
@@ -1221,7 +1329,7 @@ end
|
|||||||
-- @param Arguments A #table or any field.
|
-- @param Arguments A #table or any field.
|
||||||
function BASE:F3( Arguments )
|
function BASE:F3( Arguments )
|
||||||
|
|
||||||
if BASE.Debug and _TraceOnOff then
|
if BASE.Debug and _TraceOnOff == true and _TraceLevel >= 3 then
|
||||||
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
|
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
|
||||||
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
|
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
|
||||||
|
|
||||||
@@ -1265,7 +1373,7 @@ end
|
|||||||
-- @param Arguments A #table or any field.
|
-- @param Arguments A #table or any field.
|
||||||
function BASE:T( Arguments )
|
function BASE:T( Arguments )
|
||||||
|
|
||||||
if BASE.Debug and _TraceOnOff then
|
if BASE.Debug and _TraceOnOff == true then
|
||||||
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
|
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
|
||||||
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
|
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
|
||||||
|
|
||||||
@@ -1280,7 +1388,7 @@ end
|
|||||||
-- @param Arguments A #table or any field.
|
-- @param Arguments A #table or any field.
|
||||||
function BASE:T2( Arguments )
|
function BASE:T2( Arguments )
|
||||||
|
|
||||||
if BASE.Debug and _TraceOnOff then
|
if BASE.Debug and _TraceOnOff == true and _TraceLevel >= 2 then
|
||||||
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
|
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
|
||||||
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
|
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
|
||||||
|
|
||||||
@@ -1295,7 +1403,7 @@ end
|
|||||||
-- @param Arguments A #table or any field.
|
-- @param Arguments A #table or any field.
|
||||||
function BASE:T3( Arguments )
|
function BASE:T3( Arguments )
|
||||||
|
|
||||||
if BASE.Debug and _TraceOnOff then
|
if BASE.Debug and _TraceOnOff == true and _TraceLevel >= 3 then
|
||||||
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
|
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
|
||||||
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
|
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
|
||||||
|
|
||||||
@@ -1327,7 +1435,7 @@ function BASE:E( Arguments )
|
|||||||
|
|
||||||
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "E", self.ClassName, self.ClassID, Function, UTILS.BasicSerialize( Arguments ) ) )
|
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "E", self.ClassName, self.ClassID, Function, UTILS.BasicSerialize( Arguments ) ) )
|
||||||
else
|
else
|
||||||
env.info( string.format( "%1s:%30s%05d(%s)", "E", self.ClassName, self.ClassID, BASE:_Serialize(Arguments) ) )
|
env.info( string.format( "%1s:%30s%05d(%s)", "E", self.ClassName, self.ClassID, UTILS.BasicSerialize(Arguments) ) )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -1354,8 +1462,7 @@ function BASE:I( Arguments )
|
|||||||
|
|
||||||
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "I", self.ClassName, self.ClassID, Function, UTILS.BasicSerialize( Arguments ) ) )
|
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "I", self.ClassName, self.ClassID, Function, UTILS.BasicSerialize( Arguments ) ) )
|
||||||
else
|
else
|
||||||
env.info( string.format( "%1s:%30s%05d(%s)", "I", self.ClassName, self.ClassID, BASE:_Serialize(Arguments)) )
|
env.info( string.format( "%1s:%30s%05d(%s)", "I", self.ClassName, self.ClassID, UTILS.BasicSerialize(Arguments)) )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
-- * Manage database of hits to units and statics.
|
-- * Manage database of hits to units and statics.
|
||||||
-- * Manage database of destroys of units and statics.
|
-- * Manage database of destroys of units and statics.
|
||||||
-- * Manage database of @{Core.Zone#ZONE_BASE} objects.
|
-- * Manage database of @{Core.Zone#ZONE_BASE} objects.
|
||||||
|
-- * Manage database of @{Wrapper.DynamicCargo#DYNAMICCARGO} objects alive in the mission.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -39,6 +40,7 @@
|
|||||||
-- @field #table STORAGES DCS warehouse storages.
|
-- @field #table STORAGES DCS warehouse storages.
|
||||||
-- @field #table STNS Used Link16 octal numbers for F16/15/18/AWACS planes.
|
-- @field #table STNS Used Link16 octal numbers for F16/15/18/AWACS planes.
|
||||||
-- @field #table SADL Used Link16 octal numbers for A10/C-II planes.
|
-- @field #table SADL Used Link16 octal numbers for A10/C-II planes.
|
||||||
|
-- @field #table DYNAMICCARGO Dynamic Cargo objects.
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
--- Contains collections of wrapper objects defined within MOOSE that reflect objects within the simulator.
|
--- Contains collections of wrapper objects defined within MOOSE that reflect objects within the simulator.
|
||||||
@@ -54,6 +56,7 @@
|
|||||||
-- * PLAYERS
|
-- * PLAYERS
|
||||||
-- * CARGOS
|
-- * CARGOS
|
||||||
-- * STORAGES (DCS warehouses)
|
-- * STORAGES (DCS warehouses)
|
||||||
|
-- * DYNAMICCARGO
|
||||||
--
|
--
|
||||||
-- On top, for internal MOOSE administration purposes, the DATABASE administers the Unit and Group TEMPLATES as defined within the Mission Editor.
|
-- On top, for internal MOOSE administration purposes, the DATABASE administers the Unit and Group TEMPLATES as defined within the Mission Editor.
|
||||||
--
|
--
|
||||||
@@ -97,6 +100,7 @@ DATABASE = {
|
|||||||
STORAGES = {},
|
STORAGES = {},
|
||||||
STNS={},
|
STNS={},
|
||||||
SADL={},
|
SADL={},
|
||||||
|
DYNAMICCARGO={},
|
||||||
}
|
}
|
||||||
|
|
||||||
local _DATABASECoalition =
|
local _DATABASECoalition =
|
||||||
@@ -135,7 +139,7 @@ function DATABASE:New()
|
|||||||
self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
|
self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
|
||||||
self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash )
|
self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash )
|
||||||
self:HandleEvent( EVENTS.RemoveUnit, self._EventOnDeadOrCrash )
|
self:HandleEvent( EVENTS.RemoveUnit, self._EventOnDeadOrCrash )
|
||||||
--self:HandleEvent( EVENTS.UnitLost, self._EventOnDeadOrCrash ) -- DCS 2.7.1 for Aerial units no dead event ATM
|
self:HandleEvent( EVENTS.UnitLost, self._EventOnDeadOrCrash ) -- DCS 2.7.1 for Aerial units no dead event ATM
|
||||||
self:HandleEvent( EVENTS.Hit, self.AccountHits )
|
self:HandleEvent( EVENTS.Hit, self.AccountHits )
|
||||||
self:HandleEvent( EVENTS.NewCargo )
|
self:HandleEvent( EVENTS.NewCargo )
|
||||||
self:HandleEvent( EVENTS.DeleteCargo )
|
self:HandleEvent( EVENTS.DeleteCargo )
|
||||||
@@ -143,6 +147,8 @@ function DATABASE:New()
|
|||||||
self:HandleEvent( EVENTS.DeleteZone )
|
self:HandleEvent( EVENTS.DeleteZone )
|
||||||
--self:HandleEvent( EVENTS.PlayerEnterUnit, self._EventOnPlayerEnterUnit ) -- This is not working anymore!, handling this through the birth event.
|
--self:HandleEvent( EVENTS.PlayerEnterUnit, self._EventOnPlayerEnterUnit ) -- This is not working anymore!, handling this through the birth event.
|
||||||
self:HandleEvent( EVENTS.PlayerLeaveUnit, self._EventOnPlayerLeaveUnit )
|
self:HandleEvent( EVENTS.PlayerLeaveUnit, self._EventOnPlayerLeaveUnit )
|
||||||
|
-- DCS 2.9.7 Moose own dynamic cargo events
|
||||||
|
self:HandleEvent( EVENTS.DynamicCargoRemoved, self._EventOnDynamicCargoRemoved)
|
||||||
|
|
||||||
self:_RegisterTemplates()
|
self:_RegisterTemplates()
|
||||||
self:_RegisterGroupsAndUnits()
|
self:_RegisterGroupsAndUnits()
|
||||||
@@ -170,24 +176,30 @@ end
|
|||||||
--- Adds a Unit based on the Unit Name in the DATABASE.
|
--- Adds a Unit based on the Unit Name in the DATABASE.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #string DCSUnitName Unit name.
|
-- @param #string DCSUnitName Unit name.
|
||||||
|
-- @param #boolean force
|
||||||
-- @return Wrapper.Unit#UNIT The added unit.
|
-- @return Wrapper.Unit#UNIT The added unit.
|
||||||
function DATABASE:AddUnit( DCSUnitName )
|
function DATABASE:AddUnit( DCSUnitName, force )
|
||||||
|
|
||||||
if not self.UNITS[DCSUnitName] then
|
local DCSunitName = DCSUnitName
|
||||||
|
|
||||||
|
if type(DCSunitName) == "number" then DCSunitName = string.format("%d",DCSUnitName) end
|
||||||
|
|
||||||
|
if not self.UNITS[DCSunitName] or force == true then
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:T( { "Add UNIT:", DCSUnitName } )
|
self:T( { "Add UNIT:", DCSunitName } )
|
||||||
|
|
||||||
-- Register unit
|
-- Register unit
|
||||||
self.UNITS[DCSUnitName]=UNIT:Register(DCSUnitName)
|
self.UNITS[DCSunitName]=UNIT:Register(DCSunitName)
|
||||||
end
|
end
|
||||||
|
|
||||||
return self.UNITS[DCSUnitName]
|
return self.UNITS[DCSunitName]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Deletes a Unit from the DATABASE based on the Unit Name.
|
--- Deletes a Unit from the DATABASE based on the Unit Name.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
function DATABASE:DeleteUnit( DCSUnitName )
|
function DATABASE:DeleteUnit( DCSUnitName )
|
||||||
|
self:T("DeleteUnit "..tostring(DCSUnitName))
|
||||||
self.UNITS[DCSUnitName] = nil
|
self.UNITS[DCSUnitName] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -199,10 +211,9 @@ function DATABASE:AddStatic( DCSStaticName )
|
|||||||
|
|
||||||
if not self.STATICS[DCSStaticName] then
|
if not self.STATICS[DCSStaticName] then
|
||||||
self.STATICS[DCSStaticName] = STATIC:Register( DCSStaticName )
|
self.STATICS[DCSStaticName] = STATIC:Register( DCSStaticName )
|
||||||
return self.STATICS[DCSStaticName]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil
|
return self.STATICS[DCSStaticName]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -212,16 +223,42 @@ function DATABASE:DeleteStatic( DCSStaticName )
|
|||||||
self.STATICS[DCSStaticName] = nil
|
self.STATICS[DCSStaticName] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Finds a STATIC based on the StaticName.
|
--- Finds a STATIC based on the Static Name.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #string StaticName
|
-- @param #string StaticName Name of the static object.
|
||||||
-- @return Wrapper.Static#STATIC The found STATIC.
|
-- @return Wrapper.Static#STATIC The found STATIC.
|
||||||
function DATABASE:FindStatic( StaticName )
|
function DATABASE:FindStatic( StaticName )
|
||||||
|
|
||||||
local StaticFound = self.STATICS[StaticName]
|
local StaticFound = self.STATICS[StaticName]
|
||||||
return StaticFound
|
return StaticFound
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Add a DynamicCargo to the database.
|
||||||
|
-- @param #DATABASE self
|
||||||
|
-- @param #string Name Name of the dynamic cargo.
|
||||||
|
-- @return Wrapper.DynamicCargo#DYNAMICCARGO The dynamic cargo object.
|
||||||
|
function DATABASE:AddDynamicCargo( Name )
|
||||||
|
if not self.DYNAMICCARGO[Name] then
|
||||||
|
self.DYNAMICCARGO[Name] = DYNAMICCARGO:Register(Name)
|
||||||
|
end
|
||||||
|
return self.DYNAMICCARGO[Name]
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Finds a DYNAMICCARGO based on the Dynamic Cargo Name.
|
||||||
|
-- @param #DATABASE self
|
||||||
|
-- @param #string DynamicCargoName
|
||||||
|
-- @return Wrapper.DynamicCargo#DYNAMICCARGO The found DYNAMICCARGO.
|
||||||
|
function DATABASE:FindDynamicCargo( DynamicCargoName )
|
||||||
|
local StaticFound = self.DYNAMICCARGO[DynamicCargoName]
|
||||||
|
return StaticFound
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Deletes a DYNAMICCARGO from the DATABASE based on the Dynamic Cargo Name.
|
||||||
|
-- @param #DATABASE self
|
||||||
|
function DATABASE:DeleteDynamicCargo( DynamicCargoName )
|
||||||
|
self.DYNAMICCARGO[DynamicCargoName] = nil
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Adds a Airbase based on the Airbase Name in the DATABASE.
|
--- Adds a Airbase based on the Airbase Name in the DATABASE.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #string AirbaseName The name of the airbase.
|
-- @param #string AirbaseName The name of the airbase.
|
||||||
@@ -813,14 +850,19 @@ end
|
|||||||
--- Adds a CLIENT based on the ClientName in the DATABASE.
|
--- Adds a CLIENT based on the ClientName in the DATABASE.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #string ClientName Name of the Client unit.
|
-- @param #string ClientName Name of the Client unit.
|
||||||
|
-- @param #boolean Force (optional) Force registration of client.
|
||||||
-- @return Wrapper.Client#CLIENT The client object.
|
-- @return Wrapper.Client#CLIENT The client object.
|
||||||
function DATABASE:AddClient( ClientName )
|
function DATABASE:AddClient( ClientName, Force )
|
||||||
|
|
||||||
if not self.CLIENTS[ClientName] then
|
local DCSUnitName = ClientName
|
||||||
self.CLIENTS[ClientName] = CLIENT:Register( ClientName )
|
|
||||||
|
if type(DCSUnitName) == "number" then DCSUnitName = string.format("%d",ClientName) end
|
||||||
|
|
||||||
|
if not self.CLIENTS[DCSUnitName] or Force == true then
|
||||||
|
self.CLIENTS[DCSUnitName] = CLIENT:Register( DCSUnitName )
|
||||||
end
|
end
|
||||||
|
|
||||||
return self.CLIENTS[ClientName]
|
return self.CLIENTS[DCSUnitName]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -830,16 +872,28 @@ 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
|
||||||
|
-- see if the group exists in the API, maybe a dynamic slot
|
||||||
|
self:_RegisterDynamicGroup(GroupName)
|
||||||
|
return self.GROUPS[GroupName]
|
||||||
|
end
|
||||||
|
|
||||||
return GroupFound
|
return GroupFound
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Adds a GROUP based on the GroupName in the DATABASE.
|
--- Adds a GROUP based on the GroupName in the DATABASE.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
function DATABASE:AddGroup( GroupName )
|
-- @param #string GroupName
|
||||||
|
-- @param #boolean force
|
||||||
|
-- @return Wrapper.Group#GROUP The Group
|
||||||
|
function DATABASE:AddGroup( GroupName, force )
|
||||||
|
|
||||||
if not self.GROUPS[GroupName] then
|
if not self.GROUPS[GroupName] or force == true then
|
||||||
self:T( { "Add GROUP:", GroupName } )
|
self:T( { "Add GROUP:", GroupName } )
|
||||||
self.GROUPS[GroupName] = GROUP:Register( GroupName )
|
self.GROUPS[GroupName] = GROUP:Register( GroupName )
|
||||||
end
|
end
|
||||||
@@ -851,8 +905,10 @@ end
|
|||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
function DATABASE:AddPlayer( UnitName, PlayerName )
|
function DATABASE:AddPlayer( UnitName, PlayerName )
|
||||||
|
|
||||||
|
if type(UnitName) == "number" then UnitName = string.format("%d",UnitName) end
|
||||||
|
|
||||||
if PlayerName then
|
if PlayerName then
|
||||||
self:T( { "Add player for unit:", UnitName, PlayerName } )
|
self:I( { "Add player for unit:", UnitName, PlayerName } )
|
||||||
self.PLAYERS[PlayerName] = UnitName
|
self.PLAYERS[PlayerName] = UnitName
|
||||||
self.PLAYERUNITS[PlayerName] = self:FindUnit( UnitName )
|
self.PLAYERUNITS[PlayerName] = self:FindUnit( UnitName )
|
||||||
self.PLAYERSJOINED[PlayerName] = PlayerName
|
self.PLAYERSJOINED[PlayerName] = PlayerName
|
||||||
@@ -860,6 +916,21 @@ function DATABASE:AddPlayer( UnitName, PlayerName )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Get a PlayerName by UnitName from PLAYERS in DATABASE.
|
||||||
|
-- @param #DATABASE self
|
||||||
|
-- @return #string PlayerName
|
||||||
|
-- @return Wrapper.Unit#UNIT PlayerUnit
|
||||||
|
function DATABASE:_FindPlayerNameByUnitName(UnitName)
|
||||||
|
if UnitName then
|
||||||
|
for playername,unitname in pairs(self.PLAYERS) do
|
||||||
|
if unitname == UnitName and self.PLAYERUNITS[playername] and self.PLAYERUNITS[playername]:IsAlive() then
|
||||||
|
return playername, self.PLAYERUNITS[playername]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
--- Deletes a player from the DATABASE based on the Player Name.
|
--- Deletes a player from the DATABASE based on the Player Name.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
function DATABASE:DeletePlayer( UnitName, PlayerName )
|
function DATABASE:DeletePlayer( UnitName, PlayerName )
|
||||||
@@ -1147,10 +1218,13 @@ end
|
|||||||
-- @param #string GroupName Group name.
|
-- @param #string GroupName Group name.
|
||||||
-- @return #table Group template table.
|
-- @return #table Group template table.
|
||||||
function DATABASE:GetGroupTemplate( GroupName )
|
function DATABASE:GetGroupTemplate( GroupName )
|
||||||
local GroupTemplate = self.Templates.Groups[GroupName].Template
|
local GroupTemplate=nil
|
||||||
GroupTemplate.SpawnCoalitionID = self.Templates.Groups[GroupName].CoalitionID
|
if self.Templates.Groups[GroupName] then
|
||||||
GroupTemplate.SpawnCategoryID = self.Templates.Groups[GroupName].CategoryID
|
GroupTemplate = self.Templates.Groups[GroupName].Template
|
||||||
GroupTemplate.SpawnCountryID = self.Templates.Groups[GroupName].CountryID
|
GroupTemplate.SpawnCoalitionID = self.Templates.Groups[GroupName].CoalitionID
|
||||||
|
GroupTemplate.SpawnCategoryID = self.Templates.Groups[GroupName].CategoryID
|
||||||
|
GroupTemplate.SpawnCountryID = self.Templates.Groups[GroupName].CountryID
|
||||||
|
end
|
||||||
return GroupTemplate
|
return GroupTemplate
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1195,6 +1269,43 @@ function DATABASE:_RegisterStaticTemplate( StaticTemplate, CoalitionID, Category
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Get a generic static cargo group template from scratch for dynamic cargo spawns register. Does not register the template!
|
||||||
|
-- @param #DATABASE self
|
||||||
|
-- @param #string Name Name of the static.
|
||||||
|
-- @param #string Typename Typename of the static. Defaults to "container_cargo".
|
||||||
|
-- @param #number Mass Mass of the static. Defaults to 0.
|
||||||
|
-- @param #number Coalition Coalition of the static. Defaults to coalition.side.BLUE.
|
||||||
|
-- @param #number Country Country of the static. Defaults to country.id.GERMANY.
|
||||||
|
-- @return #table Static template table.
|
||||||
|
function DATABASE:_GetGenericStaticCargoGroupTemplate(Name,Typename,Mass,Coalition,Country)
|
||||||
|
local StaticTemplate = {}
|
||||||
|
StaticTemplate.name = Name or "None"
|
||||||
|
StaticTemplate.units = { [1] = {
|
||||||
|
name = Name,
|
||||||
|
resourcePayload = {
|
||||||
|
["weapons"] = {},
|
||||||
|
["aircrafts"] = {},
|
||||||
|
["gasoline"] = 0,
|
||||||
|
["diesel"] = 0,
|
||||||
|
["methanol_mixture"] = 0,
|
||||||
|
["jet_fuel"] = 0,
|
||||||
|
},
|
||||||
|
["mass"] = Mass or 0,
|
||||||
|
["category"] = "Cargos",
|
||||||
|
["canCargo"] = true,
|
||||||
|
["type"] = Typename or "container_cargo",
|
||||||
|
["rate"] = 100,
|
||||||
|
["y"] = 0,
|
||||||
|
["x"] = 0,
|
||||||
|
["heading"] = 0,
|
||||||
|
}}
|
||||||
|
StaticTemplate.CategoryID = "static"
|
||||||
|
StaticTemplate.CoalitionID = Coalition or coalition.side.BLUE
|
||||||
|
StaticTemplate.CountryID = Country or country.id.GERMANY
|
||||||
|
--UTILS.PrintTableToLog(StaticTemplate)
|
||||||
|
return StaticTemplate
|
||||||
|
end
|
||||||
|
|
||||||
--- Get static group template.
|
--- Get static group template.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #string StaticName Name of the static.
|
-- @param #string StaticName Name of the static.
|
||||||
@@ -1268,7 +1379,11 @@ end
|
|||||||
-- @param #string ClientName Name of the Client.
|
-- @param #string ClientName Name of the Client.
|
||||||
-- @return #number Coalition ID.
|
-- @return #number Coalition ID.
|
||||||
function DATABASE:GetCoalitionFromClientTemplate( ClientName )
|
function DATABASE:GetCoalitionFromClientTemplate( ClientName )
|
||||||
return self.Templates.ClientsByName[ClientName].CoalitionID
|
if self.Templates.ClientsByName[ClientName] then
|
||||||
|
return self.Templates.ClientsByName[ClientName].CoalitionID
|
||||||
|
end
|
||||||
|
self:E("WARNING: Template does not exist for client "..tostring(ClientName))
|
||||||
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get category ID from client name.
|
--- Get category ID from client name.
|
||||||
@@ -1276,7 +1391,11 @@ end
|
|||||||
-- @param #string ClientName Name of the Client.
|
-- @param #string ClientName Name of the Client.
|
||||||
-- @return #number Category ID.
|
-- @return #number Category ID.
|
||||||
function DATABASE:GetCategoryFromClientTemplate( ClientName )
|
function DATABASE:GetCategoryFromClientTemplate( ClientName )
|
||||||
return self.Templates.ClientsByName[ClientName].CategoryID
|
if self.Templates.ClientsByName[ClientName] then
|
||||||
|
return self.Templates.ClientsByName[ClientName].CategoryID
|
||||||
|
end
|
||||||
|
self:E("WARNING: Template does not exist for client "..tostring(ClientName))
|
||||||
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get country ID from client name.
|
--- Get country ID from client name.
|
||||||
@@ -1284,7 +1403,11 @@ end
|
|||||||
-- @param #string ClientName Name of the Client.
|
-- @param #string ClientName Name of the Client.
|
||||||
-- @return #number Country ID.
|
-- @return #number Country ID.
|
||||||
function DATABASE:GetCountryFromClientTemplate( ClientName )
|
function DATABASE:GetCountryFromClientTemplate( ClientName )
|
||||||
return self.Templates.ClientsByName[ClientName].CountryID
|
if self.Templates.ClientsByName[ClientName] then
|
||||||
|
return self.Templates.ClientsByName[ClientName].CountryID
|
||||||
|
end
|
||||||
|
self:E("WARNING: Template does not exist for client "..tostring(ClientName))
|
||||||
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Airbase
|
--- Airbase
|
||||||
@@ -1330,6 +1453,36 @@ function DATABASE:_RegisterPlayers()
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Private method that registers a single dynamic slot Group and Units within in the mission.
|
||||||
|
-- @param #DATABASE self
|
||||||
|
-- @return #DATABASE self
|
||||||
|
function DATABASE:_RegisterDynamicGroup(Groupname)
|
||||||
|
local DCSGroup = Group.getByName(Groupname)
|
||||||
|
if DCSGroup and DCSGroup:isExist() then
|
||||||
|
|
||||||
|
-- Group name.
|
||||||
|
local DCSGroupName = DCSGroup:getName()
|
||||||
|
|
||||||
|
-- Add group.
|
||||||
|
self:I(string.format("Register Group: %s", tostring(DCSGroupName)))
|
||||||
|
self:AddGroup( DCSGroupName, true )
|
||||||
|
|
||||||
|
-- Loop over units in group.
|
||||||
|
for DCSUnitId, DCSUnit in pairs( DCSGroup:getUnits() ) do
|
||||||
|
|
||||||
|
-- Get unit name.
|
||||||
|
local DCSUnitName = DCSUnit:getName()
|
||||||
|
|
||||||
|
-- Add unit.
|
||||||
|
self:I(string.format("Register Unit: %s", tostring(DCSUnitName)))
|
||||||
|
self:AddUnit( tostring(DCSUnitName), true )
|
||||||
|
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self:E({"Group does not exist: ", DCSGroup})
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Private method that registers all Groups and Units within in the mission.
|
--- Private method that registers all Groups and Units within in the mission.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
@@ -1429,11 +1582,28 @@ end
|
|||||||
-- @return #DATABASE self
|
-- @return #DATABASE self
|
||||||
function DATABASE:_RegisterAirbase(airbase)
|
function DATABASE:_RegisterAirbase(airbase)
|
||||||
|
|
||||||
|
local IsSyria = UTILS.GetDCSMap() == "Syria" and true or false
|
||||||
|
local countHSyria = 0
|
||||||
|
|
||||||
if airbase then
|
if airbase then
|
||||||
|
|
||||||
-- Get the airbase name.
|
-- Get the airbase name.
|
||||||
local DCSAirbaseName = airbase:getName()
|
local DCSAirbaseName = airbase:getName()
|
||||||
|
|
||||||
|
-- DCS 2.9.8.1107 added 143 helipads all named H with the same object ID ..
|
||||||
|
if IsSyria and DCSAirbaseName == "H" and countHSyria > 0 then
|
||||||
|
--[[
|
||||||
|
local p = airbase:getPosition().p
|
||||||
|
local mgrs = COORDINATE:New(p.x,p.z,p.y):ToStringMGRS()
|
||||||
|
self:I("Airbase on Syria map named H @ "..mgrs)
|
||||||
|
countHSyria = countHSyria + 1
|
||||||
|
if countHSyria > 1 then return self end
|
||||||
|
--]]
|
||||||
|
return self
|
||||||
|
elseif IsSyria and DCSAirbaseName == "H" and countHSyria == 0 then
|
||||||
|
countHSyria = countHSyria + 1
|
||||||
|
end
|
||||||
|
|
||||||
-- This gave the incorrect value to be inserted into the airdromeID for DCS 2.5.6. Is fixed now.
|
-- This gave the incorrect value to be inserted into the airdromeID for DCS 2.5.6. Is fixed now.
|
||||||
local airbaseID=airbase:getID()
|
local airbaseID=airbase:getID()
|
||||||
|
|
||||||
@@ -1473,7 +1643,7 @@ end
|
|||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param Core.Event#EVENTDATA Event
|
-- @param Core.Event#EVENTDATA Event
|
||||||
function DATABASE:_EventOnBirth( Event )
|
function DATABASE:_EventOnBirth( Event )
|
||||||
self:F( { Event } )
|
self:T( { Event } )
|
||||||
|
|
||||||
if Event.IniDCSUnit then
|
if Event.IniDCSUnit then
|
||||||
|
|
||||||
@@ -1482,6 +1652,16 @@ function DATABASE:_EventOnBirth( Event )
|
|||||||
-- Add static object to DB.
|
-- Add static object to DB.
|
||||||
self:AddStatic( Event.IniDCSUnitName )
|
self:AddStatic( Event.IniDCSUnitName )
|
||||||
|
|
||||||
|
elseif Event.IniObjectCategory == Object.Category.CARGO and string.match(Event.IniUnitName,".+|%d%d:%d%d|PKG%d+") then
|
||||||
|
|
||||||
|
-- Add dynamic cargo object to DB
|
||||||
|
|
||||||
|
local cargo = self:AddDynamicCargo(Event.IniDCSUnitName)
|
||||||
|
|
||||||
|
self:I(string.format("Adding dynamic cargo %s", tostring(Event.IniDCSUnitName)))
|
||||||
|
|
||||||
|
self:CreateEventNewDynamicCargo( cargo )
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
if Event.IniObjectCategory == Object.Category.UNIT then
|
if Event.IniObjectCategory == Object.Category.UNIT then
|
||||||
@@ -1503,8 +1683,8 @@ function DATABASE:_EventOnBirth( Event )
|
|||||||
|
|
||||||
if Event.IniObjectCategory == Object.Category.UNIT then
|
if Event.IniObjectCategory == Object.Category.UNIT then
|
||||||
|
|
||||||
Event.IniUnit = self:FindUnit( Event.IniDCSUnitName )
|
|
||||||
Event.IniGroup = self:FindGroup( Event.IniDCSGroupName )
|
Event.IniGroup = self:FindGroup( Event.IniDCSGroupName )
|
||||||
|
Event.IniUnit = self:FindUnit( Event.IniDCSUnitName )
|
||||||
|
|
||||||
-- Client
|
-- Client
|
||||||
local client=self.CLIENTS[Event.IniDCSUnitName] --Wrapper.Client#CLIENT
|
local client=self.CLIENTS[Event.IniDCSUnitName] --Wrapper.Client#CLIENT
|
||||||
@@ -1522,8 +1702,8 @@ function DATABASE:_EventOnBirth( Event )
|
|||||||
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' of group '%s'", tostring(PlayerName), tostring(Event.IniDCSUnitName), tostring(Event.IniDCSGroupName)))
|
||||||
|
|
||||||
-- Add client in case it does not exist already.
|
-- Add client in case it does not exist already.
|
||||||
if not client then
|
if client == nil or (client and client:CountPlayers() == 0) then
|
||||||
client=self:AddClient(Event.IniDCSUnitName)
|
client=self:AddClient(Event.IniDCSUnitName, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Add player.
|
-- Add player.
|
||||||
@@ -1534,12 +1714,17 @@ function DATABASE:_EventOnBirth( Event )
|
|||||||
self:AddPlayer( Event.IniUnitName, PlayerName )
|
self:AddPlayer( Event.IniUnitName, PlayerName )
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Player settings.
|
local function SetPlayerSettings(self,PlayerName,IniUnit)
|
||||||
local Settings = SETTINGS:Set( PlayerName )
|
-- Player settings.
|
||||||
Settings:SetPlayerMenu(Event.IniUnit)
|
local Settings = SETTINGS:Set( PlayerName )
|
||||||
|
--Settings:SetPlayerMenu(Event.IniUnit)
|
||||||
|
Settings:SetPlayerMenu(IniUnit)
|
||||||
|
-- Create an event.
|
||||||
|
self:CreateEventPlayerEnterAircraft(IniUnit)
|
||||||
|
--self:CreateEventPlayerEnterAircraft(Event.IniUnit)
|
||||||
|
end
|
||||||
|
|
||||||
-- Create an event.
|
self:ScheduleOnce(1,SetPlayerSettings,self,PlayerName,Event.IniUnit)
|
||||||
self:CreateEventPlayerEnterAircraft(Event.IniUnit)
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1554,7 +1739,6 @@ end
|
|||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param Core.Event#EVENTDATA Event
|
-- @param Core.Event#EVENTDATA Event
|
||||||
function DATABASE:_EventOnDeadOrCrash( Event )
|
function DATABASE:_EventOnDeadOrCrash( Event )
|
||||||
|
|
||||||
if Event.IniDCSUnit then
|
if Event.IniDCSUnit then
|
||||||
|
|
||||||
local name=Event.IniDCSUnitName
|
local name=Event.IniDCSUnitName
|
||||||
@@ -1595,7 +1779,8 @@ function DATABASE:_EventOnDeadOrCrash( Event )
|
|||||||
|
|
||||||
-- Delete unit.
|
-- Delete unit.
|
||||||
if self.UNITS[Event.IniDCSUnitName] then
|
if self.UNITS[Event.IniDCSUnitName] then
|
||||||
self:DeleteUnit(Event.IniDCSUnitName)
|
self:ScheduleOnce(1,self.DeleteUnit,self,Event.IniDCSUnitName)
|
||||||
|
--self:DeleteUnit(Event.IniDCSUnitName)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Remove client players.
|
-- Remove client players.
|
||||||
@@ -1662,6 +1847,15 @@ function DATABASE:_EventOnPlayerEnterUnit( Event )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Handles the OnDynamicCargoRemoved event to clean the active dynamic cargo table.
|
||||||
|
-- @param #DATABASE self
|
||||||
|
-- @param Core.Event#EVENTDATA Event
|
||||||
|
function DATABASE:_EventOnDynamicCargoRemoved( Event )
|
||||||
|
self:T( { Event } )
|
||||||
|
if Event.IniDynamicCargoName then
|
||||||
|
self:DeleteDynamicCargo(Event.IniDynamicCargoName)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--- Handles the OnPlayerLeaveUnit event to clean the active players table.
|
--- Handles the OnPlayerLeaveUnit event to clean the active players table.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
@@ -1703,6 +1897,7 @@ function DATABASE:_EventOnPlayerLeaveUnit( Event )
|
|||||||
local client=self.CLIENTS[Event.IniDCSUnitName] --Wrapper.Client#CLIENT
|
local client=self.CLIENTS[Event.IniDCSUnitName] --Wrapper.Client#CLIENT
|
||||||
if client then
|
if client then
|
||||||
client:RemovePlayer(PlayerName)
|
client:RemovePlayer(PlayerName)
|
||||||
|
--self.PLAYERSETTINGS[PlayerName] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -194,6 +194,11 @@ world.event.S_EVENT_NEW_ZONE_GOAL = world.event.S_EVENT_MAX + 1004
|
|||||||
world.event.S_EVENT_DELETE_ZONE_GOAL = world.event.S_EVENT_MAX + 1005
|
world.event.S_EVENT_DELETE_ZONE_GOAL = world.event.S_EVENT_MAX + 1005
|
||||||
world.event.S_EVENT_REMOVE_UNIT = world.event.S_EVENT_MAX + 1006
|
world.event.S_EVENT_REMOVE_UNIT = world.event.S_EVENT_MAX + 1006
|
||||||
world.event.S_EVENT_PLAYER_ENTER_AIRCRAFT = world.event.S_EVENT_MAX + 1007
|
world.event.S_EVENT_PLAYER_ENTER_AIRCRAFT = world.event.S_EVENT_MAX + 1007
|
||||||
|
-- dynamic cargo
|
||||||
|
world.event.S_EVENT_NEW_DYNAMIC_CARGO = world.event.S_EVENT_MAX + 1008
|
||||||
|
world.event.S_EVENT_DYNAMIC_CARGO_LOADED = world.event.S_EVENT_MAX + 1009
|
||||||
|
world.event.S_EVENT_DYNAMIC_CARGO_UNLOADED = world.event.S_EVENT_MAX + 1010
|
||||||
|
world.event.S_EVENT_DYNAMIC_CARGO_REMOVED = world.event.S_EVENT_MAX + 1011
|
||||||
|
|
||||||
|
|
||||||
--- The different types of events supported by MOOSE.
|
--- The different types of events supported by MOOSE.
|
||||||
@@ -261,17 +266,29 @@ EVENTS = {
|
|||||||
SimulationStart = world.event.S_EVENT_SIMULATION_START or -1,
|
SimulationStart = world.event.S_EVENT_SIMULATION_START or -1,
|
||||||
WeaponRearm = world.event.S_EVENT_WEAPON_REARM or -1,
|
WeaponRearm = world.event.S_EVENT_WEAPON_REARM or -1,
|
||||||
WeaponDrop = world.event.S_EVENT_WEAPON_DROP or -1,
|
WeaponDrop = world.event.S_EVENT_WEAPON_DROP or -1,
|
||||||
-- Added with DCS 2.9.0
|
-- Added with DCS 2.9.x
|
||||||
UnitTaskTimeout = world.event.S_EVENT_UNIT_TASK_TIMEOUT or -1,
|
--UnitTaskTimeout = world.event.S_EVENT_UNIT_TASK_TIMEOUT or -1,
|
||||||
|
UnitTaskComplete = world.event.S_EVENT_UNIT_TASK_COMPLETE or -1,
|
||||||
UnitTaskStage = world.event.S_EVENT_UNIT_TASK_STAGE or -1,
|
UnitTaskStage = world.event.S_EVENT_UNIT_TASK_STAGE or -1,
|
||||||
MacSubtaskScore = world.event.S_EVENT_MAC_SUBTASK_SCORE or -1,
|
--MacSubtaskScore = world.event.S_EVENT_MAC_SUBTASK_SCORE or -1,
|
||||||
MacExtraScore = world.event.S_EVENT_MAC_EXTRA_SCORE or -1,
|
MacExtraScore = world.event.S_EVENT_MAC_EXTRA_SCORE or -1,
|
||||||
MissionRestart = world.event.S_EVENT_MISSION_RESTART or -1,
|
MissionRestart = world.event.S_EVENT_MISSION_RESTART or -1,
|
||||||
MissionWinner = world.event.S_EVENT_MISSION_WINNER or -1,
|
MissionWinner = world.event.S_EVENT_MISSION_WINNER or -1,
|
||||||
PostponedTakeoff = world.event.S_EVENT_POSTPONED_TAKEOFF or -1,
|
RunwayTakeoff = world.event.S_EVENT_RUNWAY_TAKEOFF or -1,
|
||||||
PostponedLand = world.event.S_EVENT_POSTPONED_LAND or -1,
|
RunwayTouch = world.event.S_EVENT_RUNWAY_TOUCH or -1,
|
||||||
|
MacLMSRestart = world.event.S_EVENT_MAC_LMS_RESTART or -1,
|
||||||
|
SimulationFreeze = world.event.S_EVENT_SIMULATION_FREEZE or -1,
|
||||||
|
SimulationUnfreeze = world.event.S_EVENT_SIMULATION_UNFREEZE or -1,
|
||||||
|
HumanAircraftRepairStart = world.event.S_EVENT_HUMAN_AIRCRAFT_REPAIR_START or -1,
|
||||||
|
HumanAircraftRepairFinish = world.event.S_EVENT_HUMAN_AIRCRAFT_REPAIR_FINISH or -1,
|
||||||
|
-- dynamic cargo
|
||||||
|
NewDynamicCargo = world.event.S_EVENT_NEW_DYNAMIC_CARGO or -1,
|
||||||
|
DynamicCargoLoaded = world.event.S_EVENT_DYNAMIC_CARGO_LOADED or -1,
|
||||||
|
DynamicCargoUnloaded = world.event.S_EVENT_DYNAMIC_CARGO_UNLOADED or -1,
|
||||||
|
DynamicCargoRemoved = world.event.S_EVENT_DYNAMIC_CARGO_REMOVED or -1,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
--- The Event structure
|
--- The Event structure
|
||||||
-- Note that at the beginning of each field description, there is an indication which field will be populated depending on the object type involved in the Event:
|
-- Note that at the beginning of each field description, there is an indication which field will be populated depending on the object type involved in the Event:
|
||||||
--
|
--
|
||||||
@@ -327,6 +344,9 @@ EVENTS = {
|
|||||||
--
|
--
|
||||||
-- @field Core.Zone#ZONE Zone The zone object.
|
-- @field Core.Zone#ZONE Zone The zone object.
|
||||||
-- @field #string ZoneName The name of the zone.
|
-- @field #string ZoneName The name of the zone.
|
||||||
|
--
|
||||||
|
-- @field Wrapper.DynamicCargo#DYNAMICCARGO IniDynamicCargo The dynamic cargo object.
|
||||||
|
-- @field #string IniDynamicCargoName The dynamic cargo unit name.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -646,24 +666,24 @@ local _EVENTMETA = {
|
|||||||
Text = "S_EVENT_WEAPON_DROP"
|
Text = "S_EVENT_WEAPON_DROP"
|
||||||
},
|
},
|
||||||
-- DCS 2.9
|
-- DCS 2.9
|
||||||
[EVENTS.UnitTaskTimeout] = {
|
--[EVENTS.UnitTaskTimeout] = {
|
||||||
Order = 1,
|
-- Order = 1,
|
||||||
Side = "I",
|
-- Side = "I",
|
||||||
Event = "OnEventUnitTaskTimeout",
|
-- Event = "OnEventUnitTaskTimeout",
|
||||||
Text = "S_EVENT_UNIT_TASK_TIMEOUT "
|
-- Text = "S_EVENT_UNIT_TASK_TIMEOUT "
|
||||||
},
|
--},
|
||||||
[EVENTS.UnitTaskStage] = {
|
[EVENTS.UnitTaskStage] = {
|
||||||
Order = 1,
|
Order = 1,
|
||||||
Side = "I",
|
Side = "I",
|
||||||
Event = "OnEventUnitTaskStage",
|
Event = "OnEventUnitTaskStage",
|
||||||
Text = "S_EVENT_UNIT_TASK_STAGE "
|
Text = "S_EVENT_UNIT_TASK_STAGE "
|
||||||
},
|
},
|
||||||
[EVENTS.MacSubtaskScore] = {
|
--[EVENTS.MacSubtaskScore] = {
|
||||||
Order = 1,
|
-- Order = 1,
|
||||||
Side = "I",
|
--Side = "I",
|
||||||
Event = "OnEventMacSubtaskScore",
|
--Event = "OnEventMacSubtaskScore",
|
||||||
Text = "S_EVENT_MAC_SUBTASK_SCORE"
|
--Text = "S_EVENT_MAC_SUBTASK_SCORE"
|
||||||
},
|
--},
|
||||||
[EVENTS.MacExtraScore] = {
|
[EVENTS.MacExtraScore] = {
|
||||||
Order = 1,
|
Order = 1,
|
||||||
Side = "I",
|
Side = "I",
|
||||||
@@ -682,20 +702,76 @@ local _EVENTMETA = {
|
|||||||
Event = "OnEventMissionWinner",
|
Event = "OnEventMissionWinner",
|
||||||
Text = "S_EVENT_MISSION_WINNER"
|
Text = "S_EVENT_MISSION_WINNER"
|
||||||
},
|
},
|
||||||
[EVENTS.PostponedTakeoff] = {
|
[EVENTS.RunwayTakeoff] = {
|
||||||
Order = 1,
|
Order = 1,
|
||||||
Side = "I",
|
Side = "I",
|
||||||
Event = "OnEventPostponedTakeoff",
|
Event = "OnEventRunwayTakeoff",
|
||||||
Text = "S_EVENT_POSTPONED_TAKEOFF"
|
Text = "S_EVENT_RUNWAY_TAKEOFF"
|
||||||
},
|
},
|
||||||
[EVENTS.PostponedLand] = {
|
[EVENTS.RunwayTouch] = {
|
||||||
Order = 1,
|
Order = 1,
|
||||||
Side = "I",
|
Side = "I",
|
||||||
Event = "OnEventPostponedLand",
|
Event = "OnEventRunwayTouch",
|
||||||
Text = "S_EVENT_POSTPONED_LAND"
|
Text = "S_EVENT_RUNWAY_TOUCH"
|
||||||
|
},
|
||||||
|
[EVENTS.MacLMSRestart] = {
|
||||||
|
Order = 1,
|
||||||
|
Side = "I",
|
||||||
|
Event = "OnEventMacLMSRestart",
|
||||||
|
Text = "S_EVENT_MAC_LMS_RESTART"
|
||||||
|
},
|
||||||
|
[EVENTS.SimulationFreeze] = {
|
||||||
|
Order = 1,
|
||||||
|
Side = "I",
|
||||||
|
Event = "OnEventSimulationFreeze",
|
||||||
|
Text = "S_EVENT_SIMULATION_FREEZE"
|
||||||
|
},
|
||||||
|
[EVENTS.SimulationUnfreeze] = {
|
||||||
|
Order = 1,
|
||||||
|
Side = "I",
|
||||||
|
Event = "OnEventSimulationUnfreeze",
|
||||||
|
Text = "S_EVENT_SIMULATION_UNFREEZE"
|
||||||
|
},
|
||||||
|
[EVENTS.HumanAircraftRepairStart] = {
|
||||||
|
Order = 1,
|
||||||
|
Side = "I",
|
||||||
|
Event = "OnEventHumanAircraftRepairStart",
|
||||||
|
Text = "S_EVENT_HUMAN_AIRCRAFT_REPAIR_START"
|
||||||
|
},
|
||||||
|
[EVENTS.HumanAircraftRepairFinish] = {
|
||||||
|
Order = 1,
|
||||||
|
Side = "I",
|
||||||
|
Event = "OnEventHumanAircraftRepairFinish",
|
||||||
|
Text = "S_EVENT_HUMAN_AIRCRAFT_REPAIR_FINISH"
|
||||||
|
},
|
||||||
|
-- dynamic cargo
|
||||||
|
[EVENTS.NewDynamicCargo] = {
|
||||||
|
Order = 1,
|
||||||
|
Side = "I",
|
||||||
|
Event = "OnEventNewDynamicCargo",
|
||||||
|
Text = "S_EVENT_NEW_DYNAMIC_CARGO"
|
||||||
|
},
|
||||||
|
[EVENTS.DynamicCargoLoaded] = {
|
||||||
|
Order = 1,
|
||||||
|
Side = "I",
|
||||||
|
Event = "OnEventDynamicCargoLoaded",
|
||||||
|
Text = "S_EVENT_DYNAMIC_CARGO_LOADED"
|
||||||
|
},
|
||||||
|
[EVENTS.DynamicCargoUnloaded] = {
|
||||||
|
Order = 1,
|
||||||
|
Side = "I",
|
||||||
|
Event = "OnEventDynamicCargoUnloaded",
|
||||||
|
Text = "S_EVENT_DYNAMIC_CARGO_UNLOADED"
|
||||||
|
},
|
||||||
|
[EVENTS.DynamicCargoRemoved] = {
|
||||||
|
Order = 1,
|
||||||
|
Side = "I",
|
||||||
|
Event = "OnEventDynamicCargoRemoved",
|
||||||
|
Text = "S_EVENT_DYNAMIC_CARGO_REMOVED"
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
--- The Events structure
|
--- The Events structure
|
||||||
-- @type EVENT.Events
|
-- @type EVENT.Events
|
||||||
-- @field #number IniUnit
|
-- @field #number IniUnit
|
||||||
@@ -1109,6 +1185,62 @@ do -- Event Creation
|
|||||||
world.onEvent( Event )
|
world.onEvent( Event )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Creation of a S_EVENT_NEW_DYNAMIC_CARGO event.
|
||||||
|
-- @param #EVENT self
|
||||||
|
-- @param Wrapper.DynamicCargo#DYNAMICCARGO DynamicCargo the dynamic cargo object
|
||||||
|
function EVENT:CreateEventNewDynamicCargo(DynamicCargo)
|
||||||
|
self:F({DynamicCargo})
|
||||||
|
local Event = {
|
||||||
|
id = EVENTS.NewDynamicCargo,
|
||||||
|
time = timer.getTime(),
|
||||||
|
dynamiccargo = DynamicCargo,
|
||||||
|
initiator = DynamicCargo:GetDCSObject(),
|
||||||
|
}
|
||||||
|
world.onEvent( Event )
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Creation of a S_EVENT_DYNAMIC_CARGO_LOADED event.
|
||||||
|
-- @param #EVENT self
|
||||||
|
-- @param Wrapper.DynamicCargo#DYNAMICCARGO DynamicCargo the dynamic cargo object
|
||||||
|
function EVENT:CreateEventDynamicCargoLoaded(DynamicCargo)
|
||||||
|
self:F({DynamicCargo})
|
||||||
|
local Event = {
|
||||||
|
id = EVENTS.DynamicCargoLoaded,
|
||||||
|
time = timer.getTime(),
|
||||||
|
dynamiccargo = DynamicCargo,
|
||||||
|
initiator = DynamicCargo:GetDCSObject(),
|
||||||
|
}
|
||||||
|
world.onEvent( Event )
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Creation of a S_EVENT_DYNAMIC_CARGO_UNLOADED event.
|
||||||
|
-- @param #EVENT self
|
||||||
|
-- @param Wrapper.DynamicCargo#DYNAMICCARGO DynamicCargo the dynamic cargo object
|
||||||
|
function EVENT:CreateEventDynamicCargoUnloaded(DynamicCargo)
|
||||||
|
self:F({DynamicCargo})
|
||||||
|
local Event = {
|
||||||
|
id = EVENTS.DynamicCargoUnloaded,
|
||||||
|
time = timer.getTime(),
|
||||||
|
dynamiccargo = DynamicCargo,
|
||||||
|
initiator = DynamicCargo:GetDCSObject(),
|
||||||
|
}
|
||||||
|
world.onEvent( Event )
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Creation of a S_EVENT_DYNAMIC_CARGO_REMOVED event.
|
||||||
|
-- @param #EVENT self
|
||||||
|
-- @param Wrapper.DynamicCargo#DYNAMICCARGO DynamicCargo the dynamic cargo object
|
||||||
|
function EVENT:CreateEventDynamicCargoRemoved(DynamicCargo)
|
||||||
|
self:F({DynamicCargo})
|
||||||
|
local Event = {
|
||||||
|
id = EVENTS.DynamicCargoRemoved,
|
||||||
|
time = timer.getTime(),
|
||||||
|
dynamiccargo = DynamicCargo,
|
||||||
|
initiator = DynamicCargo:GetDCSObject(),
|
||||||
|
}
|
||||||
|
world.onEvent( Event )
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Main event function.
|
--- Main event function.
|
||||||
@@ -1197,6 +1329,7 @@ function EVENT:onEvent( Event )
|
|||||||
end
|
end
|
||||||
|
|
||||||
Event.IniDCSGroupName = Event.IniUnit and Event.IniUnit.GroupName or ""
|
Event.IniDCSGroupName = Event.IniUnit and Event.IniUnit.GroupName or ""
|
||||||
|
Event.IniGroupName=Event.IniDCSGroupName --At least set the group name because group might not exist any more
|
||||||
if Event.IniDCSGroup and Event.IniDCSGroup:isExist() then
|
if Event.IniDCSGroup and Event.IniDCSGroup:isExist() then
|
||||||
Event.IniDCSGroupName = Event.IniDCSGroup:getName()
|
Event.IniDCSGroupName = Event.IniDCSGroup:getName()
|
||||||
Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
|
Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
|
||||||
@@ -1223,7 +1356,13 @@ function EVENT:onEvent( Event )
|
|||||||
Event.IniDCSUnit = Event.initiator
|
Event.IniDCSUnit = Event.initiator
|
||||||
Event.IniDCSUnitName = Event.IniDCSUnit:getName()
|
Event.IniDCSUnitName = Event.IniDCSUnit:getName()
|
||||||
Event.IniUnitName = Event.IniDCSUnitName
|
Event.IniUnitName = Event.IniDCSUnitName
|
||||||
Event.IniUnit = CARGO:FindByName( Event.IniDCSUnitName )
|
if string.match(Event.IniUnitName,".+|%d%d:%d%d|PKG%d+") then
|
||||||
|
Event.IniDynamicCargo = DYNAMICCARGO:FindByName(Event.IniUnitName)
|
||||||
|
Event.IniDynamicCargoName = Event.IniUnitName
|
||||||
|
Event.IniPlayerName = string.match(Event.IniUnitName,"^(.+)|%d%d:%d%d|PKG%d+")
|
||||||
|
else
|
||||||
|
Event.IniUnit = CARGO:FindByName( Event.IniDCSUnitName )
|
||||||
|
end
|
||||||
Event.IniCoalition = Event.IniDCSUnit:getCoalition()
|
Event.IniCoalition = Event.IniDCSUnit:getCoalition()
|
||||||
Event.IniCategory = Event.IniDCSUnit:getDesc().category
|
Event.IniCategory = Event.IniDCSUnit:getDesc().category
|
||||||
Event.IniTypeName = Event.IniDCSUnit:getTypeName()
|
Event.IniTypeName = Event.IniDCSUnit:getTypeName()
|
||||||
@@ -1233,11 +1372,12 @@ function EVENT:onEvent( Event )
|
|||||||
-- Scenery
|
-- Scenery
|
||||||
---
|
---
|
||||||
Event.IniDCSUnit = Event.initiator
|
Event.IniDCSUnit = Event.initiator
|
||||||
Event.IniDCSUnitName = Event.IniDCSUnit:getName()
|
Event.IniDCSUnitName = ( Event.IniDCSUnit and Event.IniDCSUnit.getName ) and Event.IniDCSUnit:getName() or "Scenery no name "..math.random(1,20000)
|
||||||
Event.IniUnitName = Event.IniDCSUnitName
|
Event.IniUnitName = Event.IniDCSUnitName
|
||||||
Event.IniUnit = SCENERY:Register( Event.IniDCSUnitName, Event.initiator )
|
Event.IniUnit = SCENERY:Register( Event.IniDCSUnitName, Event.initiator )
|
||||||
Event.IniCategory = Event.IniDCSUnit:getDesc().category
|
Event.IniCategory = (Event.IniDCSUnit and Event.IniDCSUnit.getDesc ) and Event.IniDCSUnit:getDesc().category
|
||||||
Event.IniTypeName = Event.initiator:isExist() and Event.IniDCSUnit:getTypeName() or "SCENERY"
|
Event.IniTypeName = (Event.initiator and Event.initiator.isExist
|
||||||
|
and Event.initiator:isExist() and Event.IniDCSUnit and Event.IniDCSUnit.getTypeName) and Event.IniDCSUnit:getTypeName() or "SCENERY"
|
||||||
|
|
||||||
elseif Event.IniObjectCategory == Object.Category.BASE then
|
elseif Event.IniObjectCategory == Object.Category.BASE then
|
||||||
---
|
---
|
||||||
@@ -1301,7 +1441,7 @@ function EVENT:onEvent( Event )
|
|||||||
-- STATIC
|
-- STATIC
|
||||||
---
|
---
|
||||||
Event.TgtDCSUnit = Event.target
|
Event.TgtDCSUnit = Event.target
|
||||||
if Event.target:isExist() and Event.id ~= 33 then -- leave out ejected seat object
|
if Event.target.isExist and Event.target:isExist() and Event.id ~= 33 then -- leave out ejected seat object, check that isExist exists (Kiowa Hellfire issue, Special K)
|
||||||
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
|
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
|
||||||
-- Workaround for borked target info on cruise missiles
|
-- Workaround for borked target info on cruise missiles
|
||||||
if Event.TgtDCSUnitName and Event.TgtDCSUnitName ~= "" then
|
if Event.TgtDCSUnitName and Event.TgtDCSUnitName ~= "" then
|
||||||
@@ -1335,24 +1475,26 @@ function EVENT:onEvent( Event )
|
|||||||
-- SCENERY
|
-- SCENERY
|
||||||
---
|
---
|
||||||
Event.TgtDCSUnit = Event.target
|
Event.TgtDCSUnit = Event.target
|
||||||
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
|
Event.TgtDCSUnitName = Event.TgtDCSUnit.getName and Event.TgtDCSUnit.getName() or nil
|
||||||
Event.TgtUnitName = Event.TgtDCSUnitName
|
if Event.TgtDCSUnitName~=nil then
|
||||||
Event.TgtUnit = SCENERY:Register( Event.TgtDCSUnitName, Event.target )
|
Event.TgtUnitName = Event.TgtDCSUnitName
|
||||||
Event.TgtCategory = Event.TgtDCSUnit:getDesc().category
|
Event.TgtUnit = SCENERY:Register( Event.TgtDCSUnitName, Event.target )
|
||||||
Event.TgtTypeName = Event.TgtDCSUnit:getTypeName()
|
Event.TgtCategory = Event.TgtDCSUnit:getDesc().category
|
||||||
|
Event.TgtTypeName = Event.TgtDCSUnit:getTypeName()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Weapon.
|
-- Weapon.
|
||||||
if Event.weapon then
|
if Event.weapon and type(Event.weapon) == "table" and Event.weapon.isExist and Event.weapon:isExist() then
|
||||||
Event.Weapon = Event.weapon
|
Event.Weapon = Event.weapon
|
||||||
Event.WeaponName = Event.Weapon:getTypeName()
|
Event.WeaponName = Event.weapon:isExist() and Event.weapon:getTypeName() or "Unknown Weapon"
|
||||||
Event.WeaponUNIT = CLIENT:Find( Event.Weapon, '', true ) -- Sometimes, the weapon is a player unit!
|
Event.WeaponUNIT = CLIENT:Find( Event.Weapon, '', true ) -- Sometimes, the weapon is a player unit!
|
||||||
Event.WeaponPlayerName = Event.WeaponUNIT and Event.Weapon.getPlayerName and Event.Weapon:getPlayerName()
|
Event.WeaponPlayerName = Event.WeaponUNIT and Event.Weapon.getPlayerName and Event.Weapon:getPlayerName()
|
||||||
--Event.WeaponPlayerName = Event.WeaponUNIT and Event.Weapon:getPlayerName()
|
--Event.WeaponPlayerName = Event.WeaponUNIT and Event.Weapon:getPlayerName()
|
||||||
Event.WeaponCoalition = Event.WeaponUNIT and Event.Weapon:getCoalition()
|
Event.WeaponCoalition = Event.WeaponUNIT and Event.Weapon.getCoalition and Event.Weapon:getCoalition()
|
||||||
Event.WeaponCategory = Event.WeaponUNIT and Event.Weapon:getDesc().category
|
Event.WeaponCategory = Event.WeaponUNIT and Event.Weapon.getDesc and Event.Weapon:getDesc().category
|
||||||
Event.WeaponTypeName = Event.WeaponUNIT and Event.Weapon:getTypeName()
|
Event.WeaponTypeName = Event.WeaponUNIT and Event.Weapon.getTypeName and Event.Weapon:getTypeName()
|
||||||
--Event.WeaponTgtDCSUnit = Event.Weapon:getTarget()
|
--Event.WeaponTgtDCSUnit = Event.Weapon:getTarget()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1388,6 +1530,15 @@ function EVENT:onEvent( Event )
|
|||||||
Event.CargoName = Event.cargo.Name
|
Event.CargoName = Event.cargo.Name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Dynamic cargo Object
|
||||||
|
if Event.dynamiccargo then
|
||||||
|
Event.IniDynamicCargo = Event.dynamiccargo
|
||||||
|
Event.IniDynamicCargoName = Event.IniDynamicCargo.StaticName
|
||||||
|
if Event.IniDynamicCargo.Owner or Event.IniUnitName then
|
||||||
|
Event.IniPlayerName = Event.IniDynamicCargo.Owner or string.match(Event.IniUnitName or "None|00:00|PKG00","^(.+)|%d%d:%d%d|PKG%d+")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Zone object.
|
-- Zone object.
|
||||||
if Event.zone then
|
if Event.zone then
|
||||||
Event.Zone = Event.zone
|
Event.Zone = Event.zone
|
||||||
|
|||||||
@@ -108,26 +108,30 @@ function MARKEROPS_BASE:New(Tagname,Keywords,Casesensitive)
|
|||||||
--- On after "MarkAdded" event. Triggered when a Marker is added to the F10 map.
|
--- On after "MarkAdded" event. Triggered when a Marker is added to the F10 map.
|
||||||
-- @function [parent=#MARKEROPS_BASE] OnAfterMarkAdded
|
-- @function [parent=#MARKEROPS_BASE] OnAfterMarkAdded
|
||||||
-- @param #MARKEROPS_BASE self
|
-- @param #MARKEROPS_BASE self
|
||||||
-- @param #string From The From state
|
-- @param #string From The From state.
|
||||||
-- @param #string Event The Event called
|
-- @param #string Event The Event called.
|
||||||
-- @param #string To The To state
|
-- @param #string To The To state.
|
||||||
-- @param #string Text The text on the marker
|
-- @param #string Text The text on the marker.
|
||||||
-- @param #table Keywords Table of matching keywords found in the Event text
|
-- @param #table Keywords Table of matching keywords found in the Event text.
|
||||||
-- @param Core.Point#COORDINATE Coord Coordinate of the marker.
|
-- @param Core.Point#COORDINATE Coord Coordinate of the marker.
|
||||||
-- @param #number MarkerID Id of this marker
|
-- @param #number MarkerID Id of this marker.
|
||||||
-- @param #number CoalitionNumber Coalition of the marker creator
|
-- @param #number CoalitionNumber Coalition of the marker creator.
|
||||||
|
-- @param #string PlayerName Name of the player creating/changing the mark. nil if it cannot be obtained.
|
||||||
|
-- @param Core.Event#EVENTDATA EventData the event data table.
|
||||||
|
|
||||||
--- On after "MarkChanged" event. Triggered when a Marker is changed on the F10 map.
|
--- On after "MarkChanged" event. Triggered when a Marker is changed on the F10 map.
|
||||||
-- @function [parent=#MARKEROPS_BASE] OnAfterMarkChanged
|
-- @function [parent=#MARKEROPS_BASE] OnAfterMarkChanged
|
||||||
-- @param #MARKEROPS_BASE self
|
-- @param #MARKEROPS_BASE self
|
||||||
-- @param #string From The From state
|
-- @param #string From The From state.
|
||||||
-- @param #string Event The Event called
|
-- @param #string Event The Event called.
|
||||||
-- @param #string To The To state
|
-- @param #string To The To state.
|
||||||
-- @param #string Text The text on the marker
|
-- @param #string Text The text on the marker.
|
||||||
-- @param #table Keywords Table of matching keywords found in the Event text
|
-- @param #table Keywords Table of matching keywords found in the Event text.
|
||||||
-- @param Core.Point#COORDINATE Coord Coordinate of the marker.
|
-- @param Core.Point#COORDINATE Coord Coordinate of the marker.
|
||||||
-- @param #number MarkerID Id of this marker
|
-- @param #number MarkerID Id of this marker.
|
||||||
-- @param #number CoalitionNumber Coalition of the marker creator
|
-- @param #number CoalitionNumber Coalition of the marker creator.
|
||||||
|
-- @param #string PlayerName Name of the player creating/changing the mark. nil if it cannot be obtained.
|
||||||
|
-- @param Core.Event#EVENTDATA EventData the event data table
|
||||||
|
|
||||||
--- On after "MarkDeleted" event. Triggered when a Marker is deleted from the F10 map.
|
--- On after "MarkDeleted" event. Triggered when a Marker is deleted from the F10 map.
|
||||||
-- @function [parent=#MARKEROPS_BASE] OnAfterMarkDeleted
|
-- @function [parent=#MARKEROPS_BASE] OnAfterMarkDeleted
|
||||||
@@ -167,7 +171,7 @@ function MARKEROPS_BASE:OnEventMark(Event)
|
|||||||
if Eventtext~=nil then
|
if Eventtext~=nil then
|
||||||
if self:_MatchTag(Eventtext) then
|
if self:_MatchTag(Eventtext) then
|
||||||
local matchtable = self:_MatchKeywords(Eventtext)
|
local matchtable = self:_MatchKeywords(Eventtext)
|
||||||
self:MarkAdded(Eventtext,matchtable,coord,Event.idx,coalition)
|
self:MarkAdded(Eventtext,matchtable,coord,Event.idx,coalition,Event.PlayerName,Event)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif Event.id==world.event.S_EVENT_MARK_CHANGE then
|
elseif Event.id==world.event.S_EVENT_MARK_CHANGE then
|
||||||
@@ -177,7 +181,7 @@ function MARKEROPS_BASE:OnEventMark(Event)
|
|||||||
if Eventtext~=nil then
|
if Eventtext~=nil then
|
||||||
if self:_MatchTag(Eventtext) then
|
if self:_MatchTag(Eventtext) then
|
||||||
local matchtable = self:_MatchKeywords(Eventtext)
|
local matchtable = self:_MatchKeywords(Eventtext)
|
||||||
self:MarkChanged(Eventtext,matchtable,coord,Event.idx,coalition)
|
self:MarkChanged(Eventtext,matchtable,coord,Event.idx,coalition,Event.PlayerName,Event)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif Event.id==world.event.S_EVENT_MARK_REMOVED then
|
elseif Event.id==world.event.S_EVENT_MARK_REMOVED then
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Features:
|
-- ## Features:
|
||||||
--
|
--
|
||||||
-- * Setup mission sub menus.
|
-- * Setup mission sub menus.
|
||||||
-- * Setup mission command menus.
|
-- * Setup mission command menus.
|
||||||
@@ -44,7 +44,11 @@
|
|||||||
-- * @{Core.Menu#MENU_GROUP_COMMAND}: Manages command menus for GROUPs.
|
-- * @{Core.Menu#MENU_GROUP_COMMAND}: Manages command menus for GROUPs.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
---
|
--
|
||||||
|
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_Demos/tree/master/Core/Menu)
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
|
--
|
||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
-- ### Contributions:
|
-- ### Contributions:
|
||||||
--
|
--
|
||||||
@@ -101,6 +105,7 @@ function MENU_INDEX:PrepareCoalition( CoalitionSide )
|
|||||||
self.Coalition[CoalitionSide] = self.Coalition[CoalitionSide] or {}
|
self.Coalition[CoalitionSide] = self.Coalition[CoalitionSide] or {}
|
||||||
self.Coalition[CoalitionSide].Menus = self.Coalition[CoalitionSide].Menus or {}
|
self.Coalition[CoalitionSide].Menus = self.Coalition[CoalitionSide].Menus or {}
|
||||||
end
|
end
|
||||||
|
|
||||||
---
|
---
|
||||||
-- @param Wrapper.Group#GROUP Group
|
-- @param Wrapper.Group#GROUP Group
|
||||||
function MENU_INDEX:PrepareGroup( Group )
|
function MENU_INDEX:PrepareGroup( Group )
|
||||||
@@ -114,9 +119,11 @@ end
|
|||||||
function MENU_INDEX:HasMissionMenu( Path )
|
function MENU_INDEX:HasMissionMenu( Path )
|
||||||
return self.MenuMission.Menus[Path]
|
return self.MenuMission.Menus[Path]
|
||||||
end
|
end
|
||||||
|
|
||||||
function MENU_INDEX:SetMissionMenu( Path, Menu )
|
function MENU_INDEX:SetMissionMenu( Path, Menu )
|
||||||
self.MenuMission.Menus[Path] = Menu
|
self.MenuMission.Menus[Path] = Menu
|
||||||
end
|
end
|
||||||
|
|
||||||
function MENU_INDEX:ClearMissionMenu( Path )
|
function MENU_INDEX:ClearMissionMenu( Path )
|
||||||
self.MenuMission.Menus[Path] = nil
|
self.MenuMission.Menus[Path] = nil
|
||||||
end
|
end
|
||||||
@@ -124,9 +131,11 @@ end
|
|||||||
function MENU_INDEX:HasCoalitionMenu( Coalition, Path )
|
function MENU_INDEX:HasCoalitionMenu( Coalition, Path )
|
||||||
return self.Coalition[Coalition].Menus[Path]
|
return self.Coalition[Coalition].Menus[Path]
|
||||||
end
|
end
|
||||||
|
|
||||||
function MENU_INDEX:SetCoalitionMenu( Coalition, Path, Menu )
|
function MENU_INDEX:SetCoalitionMenu( Coalition, Path, Menu )
|
||||||
self.Coalition[Coalition].Menus[Path] = Menu
|
self.Coalition[Coalition].Menus[Path] = Menu
|
||||||
end
|
end
|
||||||
|
|
||||||
function MENU_INDEX:ClearCoalitionMenu( Coalition, Path )
|
function MENU_INDEX:ClearCoalitionMenu( Coalition, Path )
|
||||||
self.Coalition[Coalition].Menus[Path] = nil
|
self.Coalition[Coalition].Menus[Path] = nil
|
||||||
end
|
end
|
||||||
@@ -134,19 +143,24 @@ end
|
|||||||
function MENU_INDEX:HasGroupMenu( Group, Path )
|
function MENU_INDEX:HasGroupMenu( Group, Path )
|
||||||
if Group and Group:IsAlive() then
|
if Group and Group:IsAlive() then
|
||||||
local MenuGroupName = Group:GetName()
|
local MenuGroupName = Group:GetName()
|
||||||
return self.Group[MenuGroupName].Menus[Path]
|
if self.Group[MenuGroupName] and self.Group[MenuGroupName].Menus and self.Group[MenuGroupName].Menus[Path] then
|
||||||
|
return self.Group[MenuGroupName].Menus[Path]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function MENU_INDEX:SetGroupMenu( Group, Path, Menu )
|
function MENU_INDEX:SetGroupMenu( Group, Path, Menu )
|
||||||
local MenuGroupName = Group:GetName()
|
local MenuGroupName = Group:GetName()
|
||||||
Group:F({MenuGroupName=MenuGroupName,Path=Path})
|
--Group:F({MenuGroupName=MenuGroupName,Path=Path})
|
||||||
self.Group[MenuGroupName].Menus[Path] = Menu
|
self.Group[MenuGroupName].Menus[Path] = Menu
|
||||||
end
|
end
|
||||||
|
|
||||||
function MENU_INDEX:ClearGroupMenu( Group, Path )
|
function MENU_INDEX:ClearGroupMenu( Group, Path )
|
||||||
local MenuGroupName = Group:GetName()
|
local MenuGroupName = Group:GetName()
|
||||||
self.Group[MenuGroupName].Menus[Path] = nil
|
self.Group[MenuGroupName].Menus[Path] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function MENU_INDEX:Refresh( Group )
|
function MENU_INDEX:Refresh( Group )
|
||||||
for MenuID, Menu in pairs( self.MenuMission.Menus ) do
|
for MenuID, Menu in pairs( self.MenuMission.Menus ) do
|
||||||
Menu:Refresh()
|
Menu:Refresh()
|
||||||
@@ -166,7 +180,8 @@ function MENU_INDEX:Refresh( Group )
|
|||||||
end
|
end
|
||||||
|
|
||||||
do -- MENU_BASE
|
do -- MENU_BASE
|
||||||
--- @type MENU_BASE
|
---
|
||||||
|
-- @type MENU_BASE
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
--- Defines the main MENU class where other MENU classes are derived from.
|
--- Defines the main MENU class where other MENU classes are derived from.
|
||||||
-- This is an abstract class, so don't use it.
|
-- This is an abstract class, so don't use it.
|
||||||
@@ -206,6 +221,7 @@ do -- MENU_BASE
|
|||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
function MENU_BASE:SetParentMenu( MenuText, Menu )
|
function MENU_BASE:SetParentMenu( MenuText, Menu )
|
||||||
if self.ParentMenu then
|
if self.ParentMenu then
|
||||||
self.ParentMenu.Menus = self.ParentMenu.Menus or {}
|
self.ParentMenu.Menus = self.ParentMenu.Menus or {}
|
||||||
@@ -277,8 +293,10 @@ do -- MENU_BASE
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
do -- MENU_COMMAND_BASE
|
do
|
||||||
--- @type MENU_COMMAND_BASE
|
---
|
||||||
|
-- MENU_COMMAND_BASE
|
||||||
|
-- @type MENU_COMMAND_BASE
|
||||||
-- @field #function MenuCallHandler
|
-- @field #function MenuCallHandler
|
||||||
-- @extends Core.Menu#MENU_BASE
|
-- @extends Core.Menu#MENU_BASE
|
||||||
|
|
||||||
@@ -343,8 +361,10 @@ do -- MENU_COMMAND_BASE
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
do -- MENU_MISSION
|
do
|
||||||
--- @type MENU_MISSION
|
---
|
||||||
|
-- MENU_MISSION
|
||||||
|
-- @type MENU_MISSION
|
||||||
-- @extends Core.Menu#MENU_BASE
|
-- @extends Core.Menu#MENU_BASE
|
||||||
--- Manages the main menus for a complete mission.
|
--- Manages the main menus for a complete mission.
|
||||||
--
|
--
|
||||||
@@ -509,8 +529,9 @@ do -- MENU_MISSION_COMMAND
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
do -- MENU_COALITION
|
do
|
||||||
--- @type MENU_COALITION
|
--- MENU_COALITION
|
||||||
|
-- @type MENU_COALITION
|
||||||
-- @extends Core.Menu#MENU_BASE
|
-- @extends Core.Menu#MENU_BASE
|
||||||
|
|
||||||
--- Manages the main menus for DCS.coalition.
|
--- Manages the main menus for DCS.coalition.
|
||||||
@@ -635,9 +656,10 @@ do -- MENU_COALITION
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
do -- MENU_COALITION_COMMAND
|
do
|
||||||
|
|
||||||
--- @type MENU_COALITION_COMMAND
|
--- MENU_COALITION_COMMAND
|
||||||
|
-- @type MENU_COALITION_COMMAND
|
||||||
-- @extends Core.Menu#MENU_COMMAND_BASE
|
-- @extends Core.Menu#MENU_COMMAND_BASE
|
||||||
|
|
||||||
--- Manages the command menus for coalitions, which allow players to execute functions during mission execution.
|
--- Manages the command menus for coalitions, which allow players to execute functions during mission execution.
|
||||||
@@ -725,8 +747,11 @@ do
|
|||||||
-- So every menu for a client created must be tracked so that program logic accidentally does not create.
|
-- So every menu for a client created must be tracked so that program logic accidentally does not create.
|
||||||
-- the same menus twice during initialization logic.
|
-- the same menus twice during initialization logic.
|
||||||
-- These menu classes are handling this logic with this variable.
|
-- These menu classes are handling this logic with this variable.
|
||||||
|
|
||||||
local _MENUGROUPS = {}
|
local _MENUGROUPS = {}
|
||||||
--- @type MENU_GROUP
|
|
||||||
|
---
|
||||||
|
-- @type MENU_GROUP
|
||||||
-- @extends Core.Menu#MENU_BASE
|
-- @extends Core.Menu#MENU_BASE
|
||||||
|
|
||||||
|
|
||||||
@@ -757,7 +782,7 @@ do
|
|||||||
-- MenuStatus[MenuGroupName]:Remove()
|
-- MenuStatus[MenuGroupName]:Remove()
|
||||||
-- end
|
-- end
|
||||||
--
|
--
|
||||||
-- --- @param Wrapper.Group#GROUP MenuGroup
|
-- -- @param Wrapper.Group#GROUP MenuGroup
|
||||||
-- local function AddStatusMenu( MenuGroup )
|
-- local function AddStatusMenu( MenuGroup )
|
||||||
-- local MenuGroupName = MenuGroup:GetName()
|
-- local MenuGroupName = MenuGroup:GetName()
|
||||||
-- -- This would create a menu for the red coalition under the MenuCoalitionRed menu object.
|
-- -- This would create a menu for the red coalition under the MenuCoalitionRed menu object.
|
||||||
@@ -899,8 +924,8 @@ do
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---
|
||||||
--- @type MENU_GROUP_COMMAND
|
-- @type MENU_GROUP_COMMAND
|
||||||
-- @extends Core.Menu#MENU_COMMAND_BASE
|
-- @extends Core.Menu#MENU_COMMAND_BASE
|
||||||
|
|
||||||
--- The @{Core.Menu#MENU_GROUP_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
|
--- The @{Core.Menu#MENU_GROUP_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
|
||||||
@@ -983,7 +1008,8 @@ do
|
|||||||
end
|
end
|
||||||
--- MENU_GROUP_DELAYED
|
--- MENU_GROUP_DELAYED
|
||||||
do
|
do
|
||||||
--- @type MENU_GROUP_DELAYED
|
---
|
||||||
|
-- @type MENU_GROUP_DELAYED
|
||||||
-- @extends Core.Menu#MENU_BASE
|
-- @extends Core.Menu#MENU_BASE
|
||||||
|
|
||||||
|
|
||||||
@@ -1034,6 +1060,7 @@ do
|
|||||||
-- @param #MENU_GROUP_DELAYED self
|
-- @param #MENU_GROUP_DELAYED self
|
||||||
-- @return #MENU_GROUP_DELAYED
|
-- @return #MENU_GROUP_DELAYED
|
||||||
function MENU_GROUP_DELAYED:Set()
|
function MENU_GROUP_DELAYED:Set()
|
||||||
|
if not self.GroupID then return end
|
||||||
do
|
do
|
||||||
if not self.MenuSet then
|
if not self.MenuSet then
|
||||||
missionCommands.addSubMenuForGroup( self.GroupID, self.MenuText, self.MenuParentPath )
|
missionCommands.addSubMenuForGroup( self.GroupID, self.MenuText, self.MenuParentPath )
|
||||||
@@ -1106,8 +1133,8 @@ do
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---
|
||||||
--- @type MENU_GROUP_COMMAND_DELAYED
|
-- @type MENU_GROUP_COMMAND_DELAYED
|
||||||
-- @extends Core.Menu#MENU_COMMAND_BASE
|
-- @extends Core.Menu#MENU_COMMAND_BASE
|
||||||
|
|
||||||
--- Manages the command menus for coalitions, which allow players to execute functions during mission execution.
|
--- Manages the command menus for coalitions, which allow players to execute functions during mission execution.
|
||||||
|
|||||||
@@ -75,35 +75,37 @@ MESSAGE.Type = {
|
|||||||
|
|
||||||
--- Creates a new MESSAGE object. Note that these MESSAGE objects are not yet displayed on the display panel. You must use the functions @{#MESSAGE.ToClient} or @{#MESSAGE.ToCoalition} or @{#MESSAGE.ToAll} to send these Messages to the respective recipients.
|
--- Creates a new MESSAGE object. Note that these MESSAGE objects are not yet displayed on the display panel. You must use the functions @{#MESSAGE.ToClient} or @{#MESSAGE.ToCoalition} or @{#MESSAGE.ToAll} to send these Messages to the respective recipients.
|
||||||
-- @param self
|
-- @param self
|
||||||
-- @param #string MessageText is the text of the Message.
|
-- @param #string Text is the text of the Message.
|
||||||
-- @param #number MessageDuration is a number in seconds of how long the MESSAGE should be shown on the display panel.
|
-- @param #number Duration Duration in seconds how long the message text is shown.
|
||||||
-- @param #string MessageCategory (optional) is a string expressing the "category" of the Message. The category will be shown as the first text in the message followed by a ": ".
|
-- @param #string Category (Optional) String expressing the "category" of the Message. The category will be shown as the first text in the message followed by a ": ".
|
||||||
-- @param #boolean ClearScreen (optional) Clear all previous messages if true.
|
-- @param #boolean ClearScreen (optional) Clear all previous messages if true.
|
||||||
-- @return #MESSAGE
|
-- @return #MESSAGE self
|
||||||
-- @usage
|
-- @usage
|
||||||
--
|
--
|
||||||
-- -- Create a series of new Messages.
|
-- -- Create a series of new Messages.
|
||||||
-- -- MessageAll is meant to be sent to all players, for 25 seconds, and is classified as "Score".
|
-- -- MessageAll is meant to be sent to all players, for 25 seconds, and is classified as "Score".
|
||||||
-- -- MessageRED is meant to be sent to the RED players only, for 10 seconds, and is classified as "End of Mission", with ID "Win".
|
-- -- MessageRED is meant to be sent to the RED players only, for 10 seconds, and is classified as "End of Mission", with ID "Win".
|
||||||
-- -- MessageClient1 is meant to be sent to a Client, for 25 seconds, and is classified as "Score", with ID "Score".
|
-- -- MessageClient1 is meant to be sent to a Client, for 25 seconds, and is classified as "Score", with ID "Score".
|
||||||
-- -- MessageClient1 is meant to be sent to a Client, for 25 seconds, and is classified as "Score", with ID "Score".
|
-- -- MessageClient1 is meant to be sent to a Client, for 25 seconds, and is classified as "Score", with ID "Score".
|
||||||
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", 25, "End of Mission" )
|
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", 25, "End of Mission" )
|
||||||
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", 25, "Penalty" )
|
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", 25, "Penalty" )
|
||||||
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", 25, "Score" )
|
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", 25, "Score" )
|
||||||
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", 25, "Score")
|
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", 25, "Score")
|
||||||
--
|
--
|
||||||
function MESSAGE:New( MessageText, MessageDuration, MessageCategory, ClearScreen )
|
function MESSAGE:New( Text, Duration, Category, ClearScreen )
|
||||||
|
|
||||||
local self = BASE:Inherit( self, BASE:New() )
|
local self = BASE:Inherit( self, BASE:New() )
|
||||||
self:F( { MessageText, MessageDuration, MessageCategory } )
|
|
||||||
|
self:F( { Text, Duration, Category } )
|
||||||
|
|
||||||
self.MessageType = nil
|
self.MessageType = nil
|
||||||
|
|
||||||
-- When no MessageCategory is given, we don't show it as a title...
|
-- When no MessageCategory is given, we don't show it as a title...
|
||||||
if MessageCategory and MessageCategory ~= "" then
|
if Category and Category ~= "" then
|
||||||
if MessageCategory:sub( -1 ) ~= "\n" then
|
if Category:sub( -1 ) ~= "\n" then
|
||||||
self.MessageCategory = MessageCategory .. ": "
|
self.MessageCategory = Category .. ": "
|
||||||
else
|
else
|
||||||
self.MessageCategory = MessageCategory:sub( 1, -2 ) .. ":\n"
|
self.MessageCategory = Category:sub( 1, -2 ) .. ":\n"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
self.MessageCategory = ""
|
self.MessageCategory = ""
|
||||||
@@ -114,9 +116,9 @@ function MESSAGE:New( MessageText, MessageDuration, MessageCategory, ClearScreen
|
|||||||
self.ClearScreen = ClearScreen
|
self.ClearScreen = ClearScreen
|
||||||
end
|
end
|
||||||
|
|
||||||
self.MessageDuration = MessageDuration or 5
|
self.MessageDuration = Duration or 5
|
||||||
self.MessageTime = timer.getTime()
|
self.MessageTime = timer.getTime()
|
||||||
self.MessageText = MessageText:gsub( "^\n", "", 1 ):gsub( "\n$", "", 1 )
|
self.MessageText = Text:gsub( "^\n", "", 1 ):gsub( "\n$", "", 1 )
|
||||||
|
|
||||||
self.MessageSent = false
|
self.MessageSent = false
|
||||||
self.MessageGroup = false
|
self.MessageGroup = false
|
||||||
@@ -177,40 +179,22 @@ end
|
|||||||
--
|
--
|
||||||
-- -- Send the 2 messages created with the @{New} method to the Client Group.
|
-- -- Send the 2 messages created with the @{New} method to the Client Group.
|
||||||
-- -- Note that the Message of MessageClient2 is overwriting the Message of MessageClient1.
|
-- -- Note that the Message of MessageClient2 is overwriting the Message of MessageClient1.
|
||||||
-- ClientGroup = Group.getByName( "ClientGroup" )
|
-- Client = CLIENT:FindByName("NameOfClientUnit")
|
||||||
--
|
--
|
||||||
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25, "Score" ):ToClient( ClientGroup )
|
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", 25, "Score" ):ToClient( Client )
|
||||||
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25, "Score" ):ToClient( ClientGroup )
|
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", 25, "Score" ):ToClient( Client )
|
||||||
-- or
|
-- or
|
||||||
-- MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25 ):ToClient( ClientGroup )
|
-- MESSAGE:New( "Congratulations, you've just hit a target", 25, "Score"):ToClient( Client )
|
||||||
-- MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25 ):ToClient( ClientGroup )
|
-- MESSAGE:New( "Congratulations, you've just killed a target", 25, "Score"):ToClient( Client )
|
||||||
-- or
|
-- or
|
||||||
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25 )
|
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", 25, "Score")
|
||||||
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25 )
|
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", 25, "Score")
|
||||||
-- MessageClient1:ToClient( ClientGroup )
|
-- MessageClient1:ToClient( Client )
|
||||||
-- MessageClient2:ToClient( ClientGroup )
|
-- MessageClient2:ToClient( Client )
|
||||||
--
|
--
|
||||||
function MESSAGE:ToClient( Client, Settings )
|
function MESSAGE:ToClient( Client, Settings )
|
||||||
self:F( Client )
|
self:F( Client )
|
||||||
|
self:ToUnit(Client,Settings)
|
||||||
if Client and Client:GetClientGroupID() then
|
|
||||||
|
|
||||||
if self.MessageType then
|
|
||||||
local Settings = Settings or ( Client and _DATABASE:GetPlayerSettings( Client:GetPlayerName() ) ) or _SETTINGS -- Core.Settings#SETTINGS
|
|
||||||
self.MessageDuration = Settings:GetMessageTime( self.MessageType )
|
|
||||||
self.MessageCategory = "" -- self.MessageType .. ": "
|
|
||||||
end
|
|
||||||
|
|
||||||
local Unit = Client:GetClient()
|
|
||||||
|
|
||||||
if self.MessageDuration ~= 0 then
|
|
||||||
local ClientGroupID = Client:GetClientGroupID()
|
|
||||||
self:T( self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration )
|
|
||||||
--trigger.action.outTextForGroup( ClientGroupID, self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration , self.ClearScreen)
|
|
||||||
trigger.action.outTextForUnit( Unit:GetID(), self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration , self.ClearScreen)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -222,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
|
||||||
@@ -247,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
|
||||||
@@ -257,6 +241,7 @@ function MESSAGE:ToUnit( Unit, Settings )
|
|||||||
|
|
||||||
if self.MessageDuration ~= 0 then
|
if self.MessageDuration ~= 0 then
|
||||||
self:T( self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration )
|
self:T( self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration )
|
||||||
|
local ID = Unit:GetID()
|
||||||
trigger.action.outTextForUnit( Unit:GetID(), self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration, self.ClearScreen )
|
trigger.action.outTextForUnit( Unit:GetID(), self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration, self.ClearScreen )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -305,11 +290,11 @@ end
|
|||||||
-- @usage
|
-- @usage
|
||||||
--
|
--
|
||||||
-- -- Send a message created with the @{New} method to the BLUE coalition.
|
-- -- Send a message created with the @{New} method to the BLUE coalition.
|
||||||
-- MessageBLUE = MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", "Penalty", 25):ToBlue()
|
-- MessageBLUE = MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", 25, "Penalty"):ToBlue()
|
||||||
-- or
|
-- or
|
||||||
-- MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 ):ToBlue()
|
-- MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", 25, "Penalty"):ToBlue()
|
||||||
-- or
|
-- or
|
||||||
-- MessageBLUE = MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 )
|
-- MessageBLUE = MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", 25, "Penalty")
|
||||||
-- MessageBLUE:ToBlue()
|
-- MessageBLUE:ToBlue()
|
||||||
--
|
--
|
||||||
function MESSAGE:ToBlue()
|
function MESSAGE:ToBlue()
|
||||||
@@ -326,11 +311,11 @@ end
|
|||||||
-- @usage
|
-- @usage
|
||||||
--
|
--
|
||||||
-- -- Send a message created with the @{New} method to the RED coalition.
|
-- -- Send a message created with the @{New} method to the RED coalition.
|
||||||
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 ):ToRed()
|
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", 25, "Penalty"):ToRed()
|
||||||
-- or
|
-- or
|
||||||
-- MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 ):ToRed()
|
-- MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", 25, "Penalty"):ToRed()
|
||||||
-- or
|
-- or
|
||||||
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 )
|
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", 25, "Penalty")
|
||||||
-- MessageRED:ToRed()
|
-- MessageRED:ToRed()
|
||||||
--
|
--
|
||||||
function MESSAGE:ToRed()
|
function MESSAGE:ToRed()
|
||||||
@@ -349,11 +334,11 @@ end
|
|||||||
-- @usage
|
-- @usage
|
||||||
--
|
--
|
||||||
-- -- Send a message created with the @{New} method to the RED coalition.
|
-- -- Send a message created with the @{New} method to the RED coalition.
|
||||||
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 ):ToCoalition( coalition.side.RED )
|
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", 25, "Penalty"):ToCoalition( coalition.side.RED )
|
||||||
-- or
|
-- or
|
||||||
-- MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 ):ToCoalition( coalition.side.RED )
|
-- MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", 25, "Penalty"):ToCoalition( coalition.side.RED )
|
||||||
-- or
|
-- or
|
||||||
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 )
|
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", 25, "Penalty")
|
||||||
-- MessageRED:ToCoalition( coalition.side.RED )
|
-- MessageRED:ToCoalition( coalition.side.RED )
|
||||||
--
|
--
|
||||||
function MESSAGE:ToCoalition( CoalitionSide, Settings )
|
function MESSAGE:ToCoalition( CoalitionSide, Settings )
|
||||||
@@ -395,29 +380,36 @@ end
|
|||||||
--- Sends a MESSAGE to all players.
|
--- Sends a MESSAGE to all players.
|
||||||
-- @param #MESSAGE self
|
-- @param #MESSAGE self
|
||||||
-- @param Core.Settings#Settings Settings (Optional) Settings for message display.
|
-- @param Core.Settings#Settings Settings (Optional) Settings for message display.
|
||||||
-- @return #MESSAGE
|
-- @param #number Delay (Optional) Delay in seconds before the message is send. Default instantly (`nil`).
|
||||||
|
-- @return #MESSAGE self
|
||||||
-- @usage
|
-- @usage
|
||||||
--
|
--
|
||||||
-- -- Send a message created to all players.
|
-- -- Send a message created to all players.
|
||||||
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25 ):ToAll()
|
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", 25, "End of Mission"):ToAll()
|
||||||
-- or
|
-- or
|
||||||
-- MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25 ):ToAll()
|
-- MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", 25, "End of Mission"):ToAll()
|
||||||
-- or
|
-- or
|
||||||
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25 )
|
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", 25, "End of Mission")
|
||||||
-- MessageAll:ToAll()
|
-- MessageAll:ToAll()
|
||||||
--
|
--
|
||||||
function MESSAGE:ToAll( Settings )
|
function MESSAGE:ToAll( Settings, Delay )
|
||||||
self:F()
|
self:F()
|
||||||
|
|
||||||
if self.MessageType then
|
if Delay and Delay>0 then
|
||||||
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
self:ScheduleOnce(Delay, MESSAGE.ToAll, self, Settings, 0)
|
||||||
self.MessageDuration = Settings:GetMessageTime( self.MessageType )
|
else
|
||||||
self.MessageCategory = "" -- self.MessageType .. ": "
|
|
||||||
end
|
if self.MessageType then
|
||||||
|
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
||||||
|
self.MessageDuration = Settings:GetMessageTime( self.MessageType )
|
||||||
|
self.MessageCategory = "" -- self.MessageType .. ": "
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.MessageDuration ~= 0 then
|
||||||
|
self:T( self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ) .. " / " .. self.MessageDuration )
|
||||||
|
trigger.action.outText( self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ), self.MessageDuration, self.ClearScreen )
|
||||||
|
end
|
||||||
|
|
||||||
if self.MessageDuration ~= 0 then
|
|
||||||
self:T( self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ) .. " / " .. self.MessageDuration )
|
|
||||||
trigger.action.outText( self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ), self.MessageDuration, self.ClearScreen )
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -472,6 +464,7 @@ _MESSAGESRS = {}
|
|||||||
-- @param #number Volume (optional) Volume, can be between 0.0 and 1.0 (loudest).
|
-- @param #number Volume (optional) Volume, can be between 0.0 and 1.0 (loudest).
|
||||||
-- @param #string Label (optional) Label, defaults to "MESSAGE" or the Message Category set.
|
-- @param #string Label (optional) Label, defaults to "MESSAGE" or the Message Category set.
|
||||||
-- @param Core.Point#COORDINATE Coordinate (optional) Coordinate this messages originates from.
|
-- @param Core.Point#COORDINATE Coordinate (optional) Coordinate this messages originates from.
|
||||||
|
-- @param #string Backend (optional) Backend to be used, can be MSRS.Backend.SRSEXE or MSRS.Backend.GRPC
|
||||||
-- @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
|
||||||
@@ -479,7 +472,7 @@ _MESSAGESRS = {}
|
|||||||
-- -- 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)
|
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"
|
||||||
|
|
||||||
@@ -497,6 +490,10 @@ function MESSAGE.SetMSRS(PathToSRS,Port,PathToCredentials,Frequency,Modulation,G
|
|||||||
_MESSAGESRS.MSRS:SetCoordinate(Coordinate)
|
_MESSAGESRS.MSRS:SetCoordinate(Coordinate)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if Backend then
|
||||||
|
_MESSAGESRS.MSRS:SetBackend(Backend)
|
||||||
|
end
|
||||||
|
|
||||||
_MESSAGESRS.Culture = Culture or MSRS.culture or "en-GB"
|
_MESSAGESRS.Culture = Culture or MSRS.culture or "en-GB"
|
||||||
_MESSAGESRS.MSRS:SetCulture(Culture)
|
_MESSAGESRS.MSRS:SetCulture(Culture)
|
||||||
|
|
||||||
@@ -509,10 +506,10 @@ function MESSAGE.SetMSRS(PathToSRS,Port,PathToCredentials,Frequency,Modulation,G
|
|||||||
end
|
end
|
||||||
|
|
||||||
_MESSAGESRS.label = Label or MSRS.Label or "MESSAGE"
|
_MESSAGESRS.label = Label or MSRS.Label or "MESSAGE"
|
||||||
_MESSAGESRS.MSRS:SetLabel(Label or "MESSAGE")
|
_MESSAGESRS.MSRS:SetLabel(_MESSAGESRS.label)
|
||||||
|
|
||||||
_MESSAGESRS.port = Port or MSRS.port or 5002
|
_MESSAGESRS.port = Port or MSRS.port or 5002
|
||||||
_MESSAGESRS.MSRS:SetPort(Port or 5002)
|
_MESSAGESRS.MSRS:SetPort(_MESSAGESRS.port)
|
||||||
|
|
||||||
_MESSAGESRS.volume = Volume or MSRS.volume or 1
|
_MESSAGESRS.volume = Volume or MSRS.volume or 1
|
||||||
_MESSAGESRS.MSRS:SetVolume(_MESSAGESRS.volume)
|
_MESSAGESRS.MSRS:SetVolume(_MESSAGESRS.volume)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -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 ) ) )
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -29,7 +29,9 @@
|
|||||||
-- @module Core.Settings
|
-- @module Core.Settings
|
||||||
-- @image Core_Settings.JPG
|
-- @image Core_Settings.JPG
|
||||||
|
|
||||||
--- @type SETTINGS
|
|
||||||
|
---
|
||||||
|
-- @type SETTINGS
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
--- Takes care of various settings that influence the behavior of certain functionalities and classes within the MOOSE framework.
|
--- Takes care of various settings that influence the behavior of certain functionalities and classes within the MOOSE framework.
|
||||||
@@ -218,7 +220,8 @@ SETTINGS = {
|
|||||||
|
|
||||||
SETTINGS.__Enum = {}
|
SETTINGS.__Enum = {}
|
||||||
|
|
||||||
--- @type SETTINGS.__Enum.Era
|
---
|
||||||
|
-- @type SETTINGS.__Enum.Era
|
||||||
-- @field #number WWII
|
-- @field #number WWII
|
||||||
-- @field #number Korea
|
-- @field #number Korea
|
||||||
-- @field #number Cold
|
-- @field #number Cold
|
||||||
@@ -737,8 +740,8 @@ do -- SETTINGS
|
|||||||
if _SETTINGS.ShowPlayerMenu == true then
|
if _SETTINGS.ShowPlayerMenu == true then
|
||||||
|
|
||||||
local PlayerGroup = PlayerUnit:GetGroup()
|
local PlayerGroup = PlayerUnit:GetGroup()
|
||||||
local PlayerName = PlayerUnit:GetPlayerName()
|
local PlayerName = PlayerUnit:GetPlayerName() or "None"
|
||||||
local PlayerNames = PlayerGroup:GetPlayerNames()
|
--local PlayerNames = PlayerGroup:GetPlayerNames()
|
||||||
|
|
||||||
local PlayerMenu = MENU_GROUP:New( PlayerGroup, 'Settings "' .. PlayerName .. '"' )
|
local PlayerMenu = MENU_GROUP:New( PlayerGroup, 'Settings "' .. PlayerName .. '"' )
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -105,7 +105,7 @@
|
|||||||
--
|
--
|
||||||
-- * @{#SPAWNSTATIC.Spawn}(Heading, NewName) spawns the static with the set parameters. Optionally, heading and name can be given. The name **must be unique**!
|
-- * @{#SPAWNSTATIC.Spawn}(Heading, NewName) spawns the static with the set parameters. Optionally, heading and name can be given. The name **must be unique**!
|
||||||
-- * @{#SPAWNSTATIC.SpawnFromCoordinate}(Coordinate, Heading, NewName) spawn the static at the given coordinate. Optionally, heading and name can be given. The name **must be unique**!
|
-- * @{#SPAWNSTATIC.SpawnFromCoordinate}(Coordinate, Heading, NewName) spawn the static at the given coordinate. Optionally, heading and name can be given. The name **must be unique**!
|
||||||
-- * @{#SPAWNSTATIC.SpawnFromPointVec2}(PointVec2, Heading, NewName) spawns the static at a POINT_VEC2 coordinate. Optionally, heading and name can be given. The name **must be unique**!
|
-- * @{#SPAWNSTATIC.SpawnFromPointVec2}(PointVec2, Heading, NewName) spawns the static at a COORDINATE coordinate. Optionally, heading and name can be given. The name **must be unique**!
|
||||||
-- * @{#SPAWNSTATIC.SpawnFromZone}(Zone, Heading, NewName) spawns the static at the center of a @{Core.Zone}. Optionally, heading and name can be given. The name **must be unique**!
|
-- * @{#SPAWNSTATIC.SpawnFromZone}(Zone, Heading, NewName) spawns the static at the center of a @{Core.Zone}. Optionally, heading and name can be given. The name **must be unique**!
|
||||||
--
|
--
|
||||||
-- @field #SPAWNSTATIC SPAWNSTATIC
|
-- @field #SPAWNSTATIC SPAWNSTATIC
|
||||||
@@ -189,6 +189,7 @@ function SPAWNSTATIC:NewFromType(StaticType, StaticCategory, CountryID)
|
|||||||
self.InitStaticCategory=StaticCategory
|
self.InitStaticCategory=StaticCategory
|
||||||
self.CountryID=CountryID or country.id.USA
|
self.CountryID=CountryID or country.id.USA
|
||||||
self.SpawnTemplatePrefix=self.InitStaticType
|
self.SpawnTemplatePrefix=self.InitStaticType
|
||||||
|
self.TemplateStaticUnit = {}
|
||||||
|
|
||||||
self.InitStaticCoordinate=COORDINATE:New(0, 0, 0)
|
self.InitStaticCoordinate=COORDINATE:New(0, 0, 0)
|
||||||
self.InitStaticHeading=0
|
self.InitStaticHeading=0
|
||||||
@@ -196,6 +197,61 @@ function SPAWNSTATIC:NewFromType(StaticType, StaticCategory, CountryID)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- (Internal/Cargo) Init the resource table for STATIC object that should be spawned containing storage objects.
|
||||||
|
-- NOTE that you have to init many other parameters as the resources.
|
||||||
|
-- @param #SPAWNSTATIC self
|
||||||
|
-- @param #number CombinedWeight The weight this cargo object should have (some have fixed weights!), defaults to 1kg.
|
||||||
|
-- @return #SPAWNSTATIC self
|
||||||
|
function SPAWNSTATIC:_InitResourceTable(CombinedWeight)
|
||||||
|
if not self.TemplateStaticUnit.resourcePayload then
|
||||||
|
self.TemplateStaticUnit.resourcePayload = {
|
||||||
|
["weapons"] = {},
|
||||||
|
["aircrafts"] = {},
|
||||||
|
["gasoline"] = 0,
|
||||||
|
["diesel"] = 0,
|
||||||
|
["methanol_mixture"] = 0,
|
||||||
|
["jet_fuel"] = 0,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
self:InitCargo(true)
|
||||||
|
self:InitCargoMass(CombinedWeight or 1)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- (User/Cargo) Add to resource table for STATIC object that should be spawned containing storage objects. Inits the object table if necessary and sets it to be cargo for helicopters.
|
||||||
|
-- @param #SPAWNSTATIC self
|
||||||
|
-- @param #string Type Type of cargo. Known types are: STORAGE.Type.WEAPONS, STORAGE.Type.LIQUIDS, STORAGE.Type.AIRCRAFT. Liquids are fuel.
|
||||||
|
-- @param #string Name Name of the cargo type. Liquids can be STORAGE.LiquidName.JETFUEL, STORAGE.LiquidName.GASOLINE, STORAGE.LiquidName.MW50 and STORAGE.LiquidName.DIESEL. The currently available weapon items are available in the `ENUMS.Storage.weapons`, e.g. `ENUMS.Storage.weapons.bombs.Mk_82Y`. Aircraft go by their typename.
|
||||||
|
-- @param #number Amount of tons (liquids) or number (everything else) to add.
|
||||||
|
-- @param #number CombinedWeight Combined weight to be set to this static cargo object. NOTE - some static cargo objects have fixed weights!
|
||||||
|
-- @return #SPAWNSTATIC self
|
||||||
|
function SPAWNSTATIC:AddCargoResource(Type,Name,Amount,CombinedWeight)
|
||||||
|
if not self.TemplateStaticUnit.resourcePayload then
|
||||||
|
self:_InitResourceTable(CombinedWeight)
|
||||||
|
end
|
||||||
|
if Type == STORAGE.Type.LIQUIDS and type(Name) == "string" then
|
||||||
|
self.TemplateStaticUnit.resourcePayload[Name] = Amount
|
||||||
|
else
|
||||||
|
self.TemplateStaticUnit.resourcePayload[Type] = {
|
||||||
|
[Name] = {
|
||||||
|
["amount"] = Amount,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
UTILS.PrintTableToLog(self.TemplateStaticUnit)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- (User/Cargo) Resets resource table to zero for STATIC object that should be spawned containing storage objects. Inits the object table if necessary and sets it to be cargo for helicopters.
|
||||||
|
-- Handy if you spawn from cargo statics which have resources already set.
|
||||||
|
-- @param #SPAWNSTATIC self
|
||||||
|
-- @return #SPAWNSTATIC self
|
||||||
|
function SPAWNSTATIC:ResetCargoResources()
|
||||||
|
self.TemplateStaticUnit.resourcePayload = nil
|
||||||
|
self:_InitResourceTable()
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Initialize heading of the spawned static.
|
--- Initialize heading of the spawned static.
|
||||||
-- @param #SPAWNSTATIC self
|
-- @param #SPAWNSTATIC self
|
||||||
-- @param Core.Point#COORDINATE Coordinate Position where the static is spawned.
|
-- @param Core.Point#COORDINATE Coordinate Position where the static is spawned.
|
||||||
@@ -317,6 +373,25 @@ function SPAWNSTATIC:InitLinkToUnit(Unit, OffsetX, OffsetY, OffsetAngle)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Allows to place a CallFunction hook when a new static spawns.
|
||||||
|
-- The provided method will be called when a new group is spawned, including its given parameters.
|
||||||
|
-- The first parameter of the SpawnFunction is the @{Wrapper.Static#STATIC} that was spawned.
|
||||||
|
-- @param #SPAWNSTATIC self
|
||||||
|
-- @param #function SpawnCallBackFunction The function to be called when a group spawns.
|
||||||
|
-- @param SpawnFunctionArguments A random amount of arguments to be provided to the function when the group spawns.
|
||||||
|
-- @return #SPAWNSTATIC self
|
||||||
|
function SPAWNSTATIC:OnSpawnStatic( SpawnCallBackFunction, ... )
|
||||||
|
self:F( "OnSpawnStatic" )
|
||||||
|
|
||||||
|
self.SpawnFunctionHook = SpawnCallBackFunction
|
||||||
|
self.SpawnFunctionArguments = {}
|
||||||
|
if arg then
|
||||||
|
self.SpawnFunctionArguments = arg
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Spawn a new STATIC object.
|
--- Spawn a new STATIC object.
|
||||||
-- @param #SPAWNSTATIC self
|
-- @param #SPAWNSTATIC self
|
||||||
-- @param #number Heading (Optional) The heading of the static, which is a number in degrees from 0 to 360. Default is the heading of the template.
|
-- @param #number Heading (Optional) The heading of the static, which is a number in degrees from 0 to 360. Default is the heading of the template.
|
||||||
@@ -336,9 +411,9 @@ function SPAWNSTATIC:Spawn(Heading, NewName)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Creates a new @{Wrapper.Static} from a POINT_VEC2.
|
--- Creates a new @{Wrapper.Static} from a COORDINATE.
|
||||||
-- @param #SPAWNSTATIC self
|
-- @param #SPAWNSTATIC self
|
||||||
-- @param Core.Point#POINT_VEC2 PointVec2 The 2D coordinate where to spawn the static.
|
-- @param Core.Point#COORDINATE PointVec2 The 2D coordinate where to spawn the static.
|
||||||
-- @param #number Heading The heading of the static, which is a number in degrees from 0 to 360.
|
-- @param #number Heading The heading of the static, which is a number in degrees from 0 to 360.
|
||||||
-- @param #string NewName (Optional) The name of the new static.
|
-- @param #string NewName (Optional) The name of the new static.
|
||||||
-- @return Wrapper.Static#STATIC The static spawned.
|
-- @return Wrapper.Static#STATIC The static spawned.
|
||||||
@@ -384,7 +459,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
|
||||||
@@ -460,12 +536,6 @@ function SPAWNSTATIC:_SpawnStatic(Template, CountryID)
|
|||||||
-- Name of the spawned static.
|
-- Name of the spawned static.
|
||||||
Template.name = self.InitStaticName or string.format("%s#%05d", self.SpawnTemplatePrefix, self.SpawnIndex)
|
Template.name = self.InitStaticName or string.format("%s#%05d", self.SpawnTemplatePrefix, self.SpawnIndex)
|
||||||
|
|
||||||
-- Add and register the new static.
|
|
||||||
local mystatic=_DATABASE:AddStatic(Template.name)
|
|
||||||
|
|
||||||
-- Debug output.
|
|
||||||
self:T(Template)
|
|
||||||
|
|
||||||
-- Add static to the game.
|
-- Add static to the game.
|
||||||
local Static=nil --DCS#StaticObject
|
local Static=nil --DCS#StaticObject
|
||||||
|
|
||||||
@@ -488,7 +558,7 @@ function SPAWNSTATIC:_SpawnStatic(Template, CountryID)
|
|||||||
-- 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)
|
||||||
|
|
||||||
-- Currently DCS 2.8 does not trigger birth events if FAPRS 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
|
||||||
local Event = {
|
local Event = {
|
||||||
id = EVENTS.Birth,
|
id = EVENTS.Birth,
|
||||||
@@ -502,6 +572,28 @@ function SPAWNSTATIC:_SpawnStatic(Template, CountryID)
|
|||||||
self:T("Spawning Static")
|
self:T("Spawning Static")
|
||||||
self:T2({Template=Template})
|
self:T2({Template=Template})
|
||||||
Static=coalition.addStaticObject(CountryID, Template)
|
Static=coalition.addStaticObject(CountryID, Template)
|
||||||
|
|
||||||
|
if Static then
|
||||||
|
self:T(string.format("Succesfully spawned static object \"%s\" ID=%d", Static:getName(), Static:getID()))
|
||||||
|
--[[
|
||||||
|
local static=StaticObject.getByName(Static:getName())
|
||||||
|
if static then
|
||||||
|
env.info(string.format("FF got static from StaticObject.getByName"))
|
||||||
|
else
|
||||||
|
env.error(string.format("FF error did NOT get static from StaticObject.getByName"))
|
||||||
|
end ]]
|
||||||
|
else
|
||||||
|
self:E(string.format("ERROR: DCS static object \"%s\" is nil!", tostring(Template.name)))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Add and register the new static.
|
||||||
|
local mystatic=_DATABASE:AddStatic(Template.name)
|
||||||
|
|
||||||
|
-- If there is a SpawnFunction hook defined, call it.
|
||||||
|
if self.SpawnFunctionHook then
|
||||||
|
-- delay calling this for .3 seconds so that it hopefully comes after the BIRTH event of the group.
|
||||||
|
self:ScheduleOnce(0.3, self.SpawnFunctionHook, mystatic, unpack(self.SpawnFunctionArguments))
|
||||||
end
|
end
|
||||||
|
|
||||||
return mystatic
|
return mystatic
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ do -- UserFlag
|
|||||||
|
|
||||||
--- Set the userflag to a given Number.
|
--- Set the userflag to a given Number.
|
||||||
-- @param #USERFLAG self
|
-- @param #USERFLAG self
|
||||||
-- @param #number Number The number value to be checked if it is the same as the userflag.
|
-- @param #number Number The number value to set the flag to.
|
||||||
-- @param #number Delay Delay in seconds, before the flag is set.
|
-- @param #number Delay Delay in seconds, before the flag is set.
|
||||||
-- @return #USERFLAG The userflag instance.
|
-- @return #USERFLAG The userflag instance.
|
||||||
-- @usage
|
-- @usage
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,8 @@
|
|||||||
-- @module Core.Zone_Detection
|
-- @module Core.Zone_Detection
|
||||||
-- @image MOOSE.JPG
|
-- @image MOOSE.JPG
|
||||||
|
|
||||||
--- @type ZONE_DETECTION
|
---
|
||||||
|
-- @type ZONE_DETECTION
|
||||||
-- @field DCS#Vec2 Vec2 The current location of the zone.
|
-- @field DCS#Vec2 Vec2 The current location of the zone.
|
||||||
-- @field DCS#Distance Radius The radius of the zone.
|
-- @field DCS#Distance Radius The radius of the zone.
|
||||||
-- @extends #ZONE_BASE
|
-- @extends #ZONE_BASE
|
||||||
@@ -106,7 +107,7 @@ function ZONE_DETECTION:SmokeZone( SmokeColor, Points, AddHeight, AngleOffset )
|
|||||||
local Radial = ( Angle + AngleOffset ) * RadialBase / 360
|
local Radial = ( Angle + AngleOffset ) * RadialBase / 360
|
||||||
Point.x = Vec2.x + math.cos( Radial ) * self:GetRadius()
|
Point.x = Vec2.x + math.cos( Radial ) * self:GetRadius()
|
||||||
Point.y = Vec2.y + math.sin( Radial ) * self:GetRadius()
|
Point.y = Vec2.y + math.sin( Radial ) * self:GetRadius()
|
||||||
POINT_VEC2:New( Point.x, Point.y, AddHeight ):Smoke( SmokeColor )
|
COORDINATE:New( Point.x, AddHeight, Point.y):Smoke( SmokeColor )
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -137,7 +138,7 @@ function ZONE_DETECTION:FlareZone( FlareColor, Points, Azimuth, AddHeight )
|
|||||||
local Radial = Angle * RadialBase / 360
|
local Radial = Angle * RadialBase / 360
|
||||||
Point.x = Vec2.x + math.cos( Radial ) * self:GetRadius()
|
Point.x = Vec2.x + math.cos( Radial ) * self:GetRadius()
|
||||||
Point.y = Vec2.y + math.sin( Radial ) * self:GetRadius()
|
Point.y = Vec2.y + math.sin( Radial ) * self:GetRadius()
|
||||||
POINT_VEC2:New( Point.x, Point.y, AddHeight ):Flare( FlareColor, Azimuth )
|
COORDINATE:New( Point.x, AddHeight, Point.y ):Flare( FlareColor, Azimuth )
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -201,4 +202,3 @@ function ZONE_DETECTION:IsVec3InZone( Vec3 )
|
|||||||
|
|
||||||
return InZone
|
return InZone
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ do -- world
|
|||||||
-- @field #world.event event [https://wiki.hoggitworld.com/view/DCS_enum_world](https://wiki.hoggitworld.com/view/DCS_enum_world)
|
-- @field #world.event event [https://wiki.hoggitworld.com/view/DCS_enum_world](https://wiki.hoggitworld.com/view/DCS_enum_world)
|
||||||
-- @field #world.BirthPlace BirthPlace The birthplace enumerator is used to define where an aircraft or helicopter has spawned in association with birth events.
|
-- @field #world.BirthPlace BirthPlace The birthplace enumerator is used to define where an aircraft or helicopter has spawned in association with birth events.
|
||||||
-- @field #world.VolumeType VolumeType The volumeType enumerator defines the types of 3d geometery used within the [world.searchObjects](https://wiki.hoggitworld.com/view/DCS_func_searchObjects) function.
|
-- @field #world.VolumeType VolumeType The volumeType enumerator defines the types of 3d geometery used within the [world.searchObjects](https://wiki.hoggitworld.com/view/DCS_func_searchObjects) function.
|
||||||
|
-- @field #world.weather weather Weather functions for fog etc.
|
||||||
|
|
||||||
--- The world singleton contains functions centered around two different but extremely useful functions.
|
--- The world singleton contains functions centered around two different but extremely useful functions.
|
||||||
-- * Events and event handlers are all governed within world.
|
-- * Events and event handlers are all governed within world.
|
||||||
@@ -25,38 +26,68 @@ do -- world
|
|||||||
|
|
||||||
--- [https://wiki.hoggitworld.com/view/DCS_enum_world](https://wiki.hoggitworld.com/view/DCS_enum_world)
|
--- [https://wiki.hoggitworld.com/view/DCS_enum_world](https://wiki.hoggitworld.com/view/DCS_enum_world)
|
||||||
-- @type world.event
|
-- @type world.event
|
||||||
-- @field S_EVENT_INVALID
|
-- @field S_EVENT_INVALID = 0
|
||||||
-- @field S_EVENT_SHOT [https://wiki.hoggitworld.com/view/DCS_event_shot](https://wiki.hoggitworld.com/view/DCS_event_shot)
|
-- @field S_EVENT_SHOT = 1
|
||||||
-- @field S_EVENT_HIT [https://wiki.hoggitworld.com/view/DCS_event_hit](https://wiki.hoggitworld.com/view/DCS_event_hit)
|
-- @field S_EVENT_HIT = 2
|
||||||
-- @field S_EVENT_TAKEOFF [https://wiki.hoggitworld.com/view/DCS_event_takeoff](https://wiki.hoggitworld.com/view/DCS_event_takeoff)
|
-- @field S_EVENT_TAKEOFF = 3
|
||||||
-- @field S_EVENT_LAND [https://wiki.hoggitworld.com/view/DCS_event_land](https://wiki.hoggitworld.com/view/DCS_event_land)
|
-- @field S_EVENT_LAND = 4
|
||||||
-- @field S_EVENT_CRASH [https://wiki.hoggitworld.com/view/DCS_event_crash](https://wiki.hoggitworld.com/view/DCS_event_crash)
|
-- @field S_EVENT_CRASH = 5
|
||||||
-- @field S_EVENT_EJECTION [https://wiki.hoggitworld.com/view/DCS_event_ejection](https://wiki.hoggitworld.com/view/DCS_event_ejection)
|
-- @field S_EVENT_EJECTION = 6
|
||||||
-- @field S_EVENT_REFUELING [https://wiki.hoggitworld.com/view/DCS_event_refueling](https://wiki.hoggitworld.com/view/DCS_event_refueling)
|
-- @field S_EVENT_REFUELING = 7
|
||||||
-- @field S_EVENT_DEAD [https://wiki.hoggitworld.com/view/DCS_event_dead](https://wiki.hoggitworld.com/view/DCS_event_dead)
|
-- @field S_EVENT_DEAD = 8
|
||||||
-- @field S_EVENT_PILOT_DEAD [https://wiki.hoggitworld.com/view/DCS_event_pilot_dead](https://wiki.hoggitworld.com/view/DCS_event_pilot_dead)
|
-- @field S_EVENT_PILOT_DEAD = 9
|
||||||
-- @field S_EVENT_BASE_CAPTURED [https://wiki.hoggitworld.com/view/DCS_event_base_captured](https://wiki.hoggitworld.com/view/DCS_event_base_captured)
|
-- @field S_EVENT_BASE_CAPTURED = 10
|
||||||
-- @field S_EVENT_MISSION_START [https://wiki.hoggitworld.com/view/DCS_event_mission_start](https://wiki.hoggitworld.com/view/DCS_event_mission_start)
|
-- @field S_EVENT_MISSION_START = 11
|
||||||
-- @field S_EVENT_MISSION_END [https://wiki.hoggitworld.com/view/DCS_event_mission_end](https://wiki.hoggitworld.com/view/DCS_event_mission_end)
|
-- @field S_EVENT_MISSION_END = 12
|
||||||
-- @field S_EVENT_TOOK_CONTROL
|
-- @field S_EVENT_TOOK_CONTROL = 13
|
||||||
-- @field S_EVENT_REFUELING_STOP [https://wiki.hoggitworld.com/view/DCS_event_refueling_stop](https://wiki.hoggitworld.com/view/DCS_event_refueling_stop)
|
-- @field S_EVENT_REFUELING_STOP = 14
|
||||||
-- @field S_EVENT_BIRTH [https://wiki.hoggitworld.com/view/DCS_event_birth](https://wiki.hoggitworld.com/view/DCS_event_birth)
|
-- @field S_EVENT_BIRTH = 15
|
||||||
-- @field S_EVENT_HUMAN_FAILURE [https://wiki.hoggitworld.com/view/DCS_event_human_failure](https://wiki.hoggitworld.com/view/DCS_event_human_failure)
|
-- @field S_EVENT_HUMAN_FAILURE = 16
|
||||||
-- @field S_EVENT_ENGINE_STARTUP [https://wiki.hoggitworld.com/view/DCS_event_engine_startup](https://wiki.hoggitworld.com/view/DCS_event_engine_startup)
|
-- @field S_EVENT_DETAILED_FAILURE = 17
|
||||||
-- @field S_EVENT_ENGINE_SHUTDOWN [https://wiki.hoggitworld.com/view/DCS_event_engine_shutdown](https://wiki.hoggitworld.com/view/DCS_event_engine_shutdown)
|
-- @field S_EVENT_ENGINE_STARTUP = 18
|
||||||
-- @field S_EVENT_PLAYER_ENTER_UNIT [https://wiki.hoggitworld.com/view/DCS_event_player_enter_unit](https://wiki.hoggitworld.com/view/DCS_event_player_enter_unit)
|
-- @field S_EVENT_ENGINE_SHUTDOWN = 19
|
||||||
-- @field S_EVENT_PLAYER_LEAVE_UNIT [https://wiki.hoggitworld.com/view/DCS_event_player_leave_unit](https://wiki.hoggitworld.com/view/DCS_event_player_leave_unit)
|
-- @field S_EVENT_PLAYER_ENTER_UNIT = 20
|
||||||
-- @field S_EVENT_PLAYER_COMMENT
|
-- @field S_EVENT_PLAYER_LEAVE_UNIT = 21
|
||||||
-- @field S_EVENT_SHOOTING_START [https://wiki.hoggitworld.com/view/DCS_event_shooting_start](https://wiki.hoggitworld.com/view/DCS_event_shooting_start)
|
-- @field S_EVENT_PLAYER_COMMENT = 22
|
||||||
-- @field S_EVENT_SHOOTING_END [https://wiki.hoggitworld.com/view/DCS_event_shooting_end](https://wiki.hoggitworld.com/view/DCS_event_shooting_end)
|
-- @field S_EVENT_SHOOTING_START = 23
|
||||||
-- @field S_EVENT_MARK ADDED [https://wiki.hoggitworld.com/view/DCS_event_mark_added](https://wiki.hoggitworld.com/view/DCS_event_mark_added) DCS>=2.5.1
|
-- @field S_EVENT_SHOOTING_END = 24
|
||||||
-- @field S_EVENT_MARK CHANGE [https://wiki.hoggitworld.com/view/DCS_event_mark_change](https://wiki.hoggitworld.com/view/DCS_event_mark_change) DCS>=2.5.1
|
-- @field S_EVENT_MARK_ADDED = 25
|
||||||
-- @field S_EVENT_MARK REMOVE [https://wiki.hoggitworld.com/view/DCS_event_mark_remove](https://wiki.hoggitworld.com/view/DCS_event_mark_remove) DCS>=2.5.1
|
-- @field S_EVENT_MARK_CHANGE = 26
|
||||||
-- @field S_EVENT_KILL [https://wiki.hoggitworld.com/view/DCS_event_kill](https://wiki.hoggitworld.com/view/DCS_event_kill) DCS>=2.5.6
|
-- @field S_EVENT_MARK_REMOVED = 27
|
||||||
-- @field S_EVENT_SCORE [https://wiki.hoggitworld.com/view/DCS_event_score](https://wiki.hoggitworld.com/view/DCS_event_score) DCS>=2.5.6
|
-- @field S_EVENT_KILL = 28
|
||||||
-- @field S_EVENT_UNIT_LOST [https://wiki.hoggitworld.com/view/DCS_event_unit_lost](https://wiki.hoggitworld.com/view/DCS_event_unit_lost) DCS>=2.5.6
|
-- @field S_EVENT_SCORE = 29
|
||||||
-- @field S_EVENT_LANDING_AFTER_EJECTION [https://wiki.hoggitworld.com/view/DCS_event_landing_after_ejection](https://wiki.hoggitworld.com/view/DCS_event_landing_after_ejection) DCS>=2.5.6
|
-- @field S_EVENT_UNIT_LOST = 30
|
||||||
-- @field S_EVENT_MAX
|
-- @field S_EVENT_LANDING_AFTER_EJECTION = 31
|
||||||
|
-- @field S_EVENT_PARATROOPER_LENDING = 32 -- who's lending whom what? ;)
|
||||||
|
-- @field S_EVENT_DISCARD_CHAIR_AFTER_EJECTION = 33
|
||||||
|
-- @field S_EVENT_WEAPON_ADD = 34
|
||||||
|
-- @field S_EVENT_TRIGGER_ZONE = 35
|
||||||
|
-- @field S_EVENT_LANDING_QUALITY_MARK = 36
|
||||||
|
-- @field S_EVENT_BDA = 37 -- battle damage assessment
|
||||||
|
-- @field S_EVENT_AI_ABORT_MISSION = 38
|
||||||
|
-- @field S_EVENT_DAYNIGHT = 39
|
||||||
|
-- @field S_EVENT_FLIGHT_TIME = 40
|
||||||
|
-- @field S_EVENT_PLAYER_SELF_KILL_PILOT = 41
|
||||||
|
-- @field S_EVENT_PLAYER_CAPTURE_AIRFIELD = 42
|
||||||
|
-- @field S_EVENT_EMERGENCY_LANDING = 43
|
||||||
|
-- @field S_EVENT_UNIT_CREATE_TASK = 44
|
||||||
|
-- @field S_EVENT_UNIT_DELETE_TASK = 45
|
||||||
|
-- @field S_EVENT_SIMULATION_START = 46
|
||||||
|
-- @field S_EVENT_WEAPON_REARM = 47
|
||||||
|
-- @field S_EVENT_WEAPON_DROP = 48
|
||||||
|
-- @field S_EVENT_UNIT_TASK_COMPLETE = 49
|
||||||
|
-- @field S_EVENT_UNIT_TASK_STAGE = 50
|
||||||
|
-- @field S_EVENT_MAC_EXTRA_SCORE= 51 -- not sure what this is
|
||||||
|
-- @field S_EVENT_MISSION_RESTART= 52
|
||||||
|
-- @field S_EVENT_MISSION_WINNER = 53
|
||||||
|
-- @field S_EVENT_RUNWAY_TAKEOFF= 54
|
||||||
|
-- @field S_EVENT_RUNWAY_TOUCH= 55
|
||||||
|
-- @field S_EVENT_MAC_LMS_RESTART= 56 -- not sure what this is
|
||||||
|
-- @field S_EVENT_SIMULATION_FREEZE = 57
|
||||||
|
-- @field S_EVENT_SIMULATION_UNFREEZE = 58
|
||||||
|
-- @field S_EVENT_HUMAN_AIRCRAFT_REPAIR_START = 59
|
||||||
|
-- @field S_EVENT_HUMAN_AIRCRAFT_REPAIR_FINISH = 60
|
||||||
|
-- @field S_EVENT_MAX = 61
|
||||||
|
|
||||||
--- The birthplace enumerator is used to define where an aircraft or helicopter has spawned in association with birth events.
|
--- The birthplace enumerator is used to define where an aircraft or helicopter has spawned in association with birth events.
|
||||||
-- @type world.BirthPlace
|
-- @type world.BirthPlace
|
||||||
@@ -103,6 +134,36 @@ do -- world
|
|||||||
-- @param #number coalitionId The coalition side number ID. Default is all airbases are returned.
|
-- @param #number coalitionId The coalition side number ID. Default is all airbases are returned.
|
||||||
-- @return #table Table of DCS airbase objects.
|
-- @return #table Table of DCS airbase objects.
|
||||||
|
|
||||||
|
|
||||||
|
--- Weather functions.
|
||||||
|
-- @type world.weather
|
||||||
|
|
||||||
|
--- Fog animation data structure.
|
||||||
|
-- @type world.FogAnimation
|
||||||
|
-- @field #number time
|
||||||
|
-- @field #number visibility
|
||||||
|
-- @field #number thickness
|
||||||
|
|
||||||
|
--- Returns the current fog thickness.
|
||||||
|
-- @function [parent=#world.weather] getFogThickness Returns the fog thickness.
|
||||||
|
-- @return #number Fog thickness in meters. If there is no fog, zero is returned.
|
||||||
|
|
||||||
|
--- Sets the fog thickness instantly. Any current fog animation is discarded.
|
||||||
|
-- @function [parent=#world.weather] setFogThickness
|
||||||
|
-- @param #number thickness Fog thickness in meters. Set to zero to disable fog.
|
||||||
|
|
||||||
|
--- Returns the current fog visibility distance.
|
||||||
|
-- @function [parent=#world.weather] getFogVisibilityDistance Returns the current maximum visibility distance in meters. Returns zero if fog is not present.
|
||||||
|
|
||||||
|
--- Instantly sets the maximum visibility distance of fog at sea level when looking at the horizon. Any current fog animation is discarded. Set zero to disable the fog.
|
||||||
|
-- @function [parent=#world.weather] setFogVisibilityDistance
|
||||||
|
-- @param #number visibility Max fog visibility in meters. Set to zero to disable fog.
|
||||||
|
|
||||||
|
--- Sets fog animation keys. Time is set in seconds and relative to the current simulation time, where time=0 is the current moment.
|
||||||
|
-- Time must be increasing. Previous animation is always discarded despite the data being correct.
|
||||||
|
-- @function [parent=#world.weather] setFogAnimation
|
||||||
|
-- @param #world.FogAnimation animation List of fog animations
|
||||||
|
|
||||||
end -- world
|
end -- world
|
||||||
|
|
||||||
|
|
||||||
@@ -137,7 +198,7 @@ end -- env
|
|||||||
|
|
||||||
do -- radio
|
do -- radio
|
||||||
|
|
||||||
---@type radio
|
--@type radio
|
||||||
-- @field #radio.modulation modulation
|
-- @field #radio.modulation modulation
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -377,7 +438,7 @@ do -- coalition
|
|||||||
-- @param #table groupData Group data table.
|
-- @param #table groupData Group data table.
|
||||||
-- @return DCS#Group The spawned Group object.
|
-- @return DCS#Group The spawned Group object.
|
||||||
|
|
||||||
--- Dynamically spawns a static object. See [hoggit](https://wiki.hoggitworld.com/view/DCS_func_addGroup)
|
--- Dynamically spawns a static object. See [hoggit](https://wiki.hoggitworld.com/view/DCS_func_addStaticObject)
|
||||||
-- @function [parent=#coalition] addStaticObject
|
-- @function [parent=#coalition] addStaticObject
|
||||||
-- @param #number countryId Id of the country.
|
-- @param #number countryId Id of the country.
|
||||||
-- @param #table groupData Group data table.
|
-- @param #table groupData Group data table.
|
||||||
@@ -390,6 +451,7 @@ end -- coalition
|
|||||||
|
|
||||||
do -- Types
|
do -- Types
|
||||||
|
|
||||||
|
--- Descriptors.
|
||||||
-- @type Desc
|
-- @type Desc
|
||||||
-- @field #number speedMax0 Max speed in meters/second at zero altitude.
|
-- @field #number speedMax0 Max speed in meters/second at zero altitude.
|
||||||
-- @field #number massEmpty Empty mass in kg.
|
-- @field #number massEmpty Empty mass in kg.
|
||||||
@@ -568,9 +630,13 @@ do -- Object
|
|||||||
--- @function [parent=#Object] destroy
|
--- @function [parent=#Object] destroy
|
||||||
-- @param #Object self
|
-- @param #Object self
|
||||||
|
|
||||||
--- @function [parent=#Object] getCategory
|
--- Returns an enumerator of the category for the specific object.
|
||||||
|
-- The enumerator returned is dependent on the category of the object and how the function is called.
|
||||||
|
-- As of DCS 2.9.2 when this function is called on an Object, Unit, Weapon, or Airbase a 2nd value will be returned which details the object sub-category value.
|
||||||
|
-- @function [parent=#Object] getCategory
|
||||||
-- @param #Object self
|
-- @param #Object self
|
||||||
-- @return #Object.Category
|
-- @return #Object.Category The object category (1=UNIT, 2=WEAPON, 3=STATIC, 4=BASE, 5=SCENERY, 6=Cargo)
|
||||||
|
-- @return #number The subcategory of the passed object, e.g. Unit.Category if a unit object was passed.
|
||||||
|
|
||||||
--- Returns type name of the Object.
|
--- Returns type name of the Object.
|
||||||
-- @function [parent=#Object] getTypeName
|
-- @function [parent=#Object] getTypeName
|
||||||
@@ -983,12 +1049,14 @@ do -- Spot
|
|||||||
end -- Spot
|
end -- Spot
|
||||||
|
|
||||||
do -- Controller
|
do -- Controller
|
||||||
|
|
||||||
--- Controller is an object that performs A.I.-tasks. Other words controller is an instance of A.I.. Controller stores current main task, active enroute tasks and behavior options. Controller performs commands. Please, read DCS A-10C GUI Manual EN.pdf chapter "Task Planning for Unit Groups", page 91 to understand A.I. system of DCS:A-10C.
|
--- Controller is an object that performs A.I.-tasks. Other words controller is an instance of A.I.. Controller stores current main task, active enroute tasks and behavior options. Controller performs commands. Please, read DCS A-10C GUI Manual EN.pdf chapter "Task Planning for Unit Groups", page 91 to understand A.I. system of DCS:A-10C.
|
||||||
--
|
--
|
||||||
-- This class has 2 types of functions:
|
-- This class has 2 types of functions:
|
||||||
--
|
--
|
||||||
-- * Tasks
|
-- * Tasks
|
||||||
-- * Commands: Commands are instant actions those required zero time to perform. Commands may be used both for control unit/group behavior and control game mechanics.
|
-- * Commands: Commands are instant actions those required zero time to perform. Commands may be used both for control unit/group behavior and control game mechanics.
|
||||||
|
--
|
||||||
-- @type Controller
|
-- @type Controller
|
||||||
-- @field #Controller.Detection Detection Enum contains identifiers of surface types.
|
-- @field #Controller.Detection Detection Enum contains identifiers of surface types.
|
||||||
|
|
||||||
@@ -1049,18 +1117,18 @@ do -- Controller
|
|||||||
|
|
||||||
-- Detection
|
-- Detection
|
||||||
|
|
||||||
--- Enum contains identifiers of surface types.
|
--- Enum containing detection types.
|
||||||
-- @type Controller.Detection
|
-- @type Controller.Detection
|
||||||
-- @field VISUAL
|
-- @field #number VISUAL Visual detection. Numeric value 1.
|
||||||
-- @field OPTIC
|
-- @field #number OPTIC Optical detection. Numeric value 2.
|
||||||
-- @field RADAR
|
-- @field #number RADAR Radar detection. Numeric value 4.
|
||||||
-- @field IRST
|
-- @field #number IRST Infra-red search and track detection. Numeric value 8.
|
||||||
-- @field RWR
|
-- @field #number RWR Radar Warning Receiver detection. Numeric value 16.
|
||||||
-- @field DLINK
|
-- @field #number DLINK Data link detection. Numeric value 32.
|
||||||
|
|
||||||
--- Detected target.
|
--- Detected target.
|
||||||
-- @type DetectedTarget
|
-- @type Controller.DetectedTarget
|
||||||
-- @field Wrapper.Object#Object object The target
|
-- @field DCS#Object object The target
|
||||||
-- @field #boolean visible The target is visible
|
-- @field #boolean visible The target is visible
|
||||||
-- @field #boolean type The target type is known
|
-- @field #boolean type The target type is known
|
||||||
-- @field #boolean distance Distance to the target is known
|
-- @field #boolean distance Distance to the target is known
|
||||||
@@ -1073,9 +1141,9 @@ do -- Controller
|
|||||||
-- @param #Controller.Detection detection Controller.Detection detection1, Controller.Detection detection2, ... Controller.Detection detectionN
|
-- @param #Controller.Detection detection Controller.Detection detection1, Controller.Detection detection2, ... Controller.Detection detectionN
|
||||||
-- @return #boolean detected True if the target is detected.
|
-- @return #boolean detected True if the target is detected.
|
||||||
-- @return #boolean visible Has effect only if detected is true. True if the target is visible now.
|
-- @return #boolean visible Has effect only if detected is true. True if the target is visible now.
|
||||||
-- @return #ModelTime lastTime Has effect only if visible is false. Last time when target was seen.
|
|
||||||
-- @return #boolean type Has effect only if detected is true. True if the target type is known.
|
-- @return #boolean type Has effect only if detected is true. True if the target type is known.
|
||||||
-- @return #boolean distance Has effect only if detected is true. True if the distance to the target is known.
|
-- @return #boolean distance Has effect only if detected is true. True if the distance to the target is known.
|
||||||
|
-- @return #ModelTime lastTime Has effect only if visible is false. Last time when target was seen.
|
||||||
-- @return #Vec3 lastPos Has effect only if visible is false. Last position of the target when it was seen.
|
-- @return #Vec3 lastPos Has effect only if visible is false. Last position of the target when it was seen.
|
||||||
-- @return #Vec3 lastVel Has effect only if visible is false. Last velocity of the target when it was seen.
|
-- @return #Vec3 lastVel Has effect only if visible is false. Last velocity of the target when it was seen.
|
||||||
|
|
||||||
@@ -1101,6 +1169,7 @@ end -- Controller
|
|||||||
|
|
||||||
do -- Unit
|
do -- Unit
|
||||||
|
|
||||||
|
--- Unit.
|
||||||
-- @type Unit
|
-- @type Unit
|
||||||
-- @extends #CoalitionObject
|
-- @extends #CoalitionObject
|
||||||
-- @field ID Identifier of an unit. It assigned to an unit by the Mission Editor automatically.
|
-- @field ID Identifier of an unit. It assigned to an unit by the Mission Editor automatically.
|
||||||
@@ -1665,6 +1734,7 @@ do -- AI
|
|||||||
-- @field ALARM_STATE @{#AI.Option.Ground.val.ALARM_STATE}
|
-- @field ALARM_STATE @{#AI.Option.Ground.val.ALARM_STATE}
|
||||||
-- @field ENGAGE_AIR_WEAPONS
|
-- @field ENGAGE_AIR_WEAPONS
|
||||||
-- @field AC_ENGAGEMENT_RANGE_RESTRICTION
|
-- @field AC_ENGAGEMENT_RANGE_RESTRICTION
|
||||||
|
-- @field EVASION_OF_ARM
|
||||||
|
|
||||||
---
|
---
|
||||||
-- @type AI.Option.Ground.mid -- Moose added
|
-- @type AI.Option.Ground.mid -- Moose added
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
-- ### Author: FlightControl - Framework Design & Programming
|
-- ### Author: FlightControl - Framework Design & Programming
|
||||||
-- ### Refactoring to use the Runway auto-detection: Applevangelist
|
-- ### Refactoring to use the Runway auto-detection: Applevangelist
|
||||||
-- @date August 2022
|
-- @date August 2022
|
||||||
-- Last Update Nov 2023
|
-- Last Update Feb 2025
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -416,7 +416,7 @@ end
|
|||||||
-- @field #ATC_GROUND_UNIVERSAL
|
-- @field #ATC_GROUND_UNIVERSAL
|
||||||
ATC_GROUND_UNIVERSAL = {
|
ATC_GROUND_UNIVERSAL = {
|
||||||
ClassName = "ATC_GROUND_UNIVERSAL",
|
ClassName = "ATC_GROUND_UNIVERSAL",
|
||||||
Version = "0.0.1",
|
Version = "0.0.2",
|
||||||
SetClient = nil,
|
SetClient = nil,
|
||||||
Airbases = nil,
|
Airbases = nil,
|
||||||
AirbaseList = nil,
|
AirbaseList = nil,
|
||||||
@@ -442,16 +442,24 @@ function ATC_GROUND_UNIVERSAL:New(AirbaseList)
|
|||||||
|
|
||||||
self.Airbases = {}
|
self.Airbases = {}
|
||||||
|
|
||||||
for _name,_ in pairs(_DATABASE.AIRBASES) do
|
|
||||||
self.Airbases[_name]={}
|
|
||||||
end
|
|
||||||
|
|
||||||
self.AirbaseList = AirbaseList
|
self.AirbaseList = AirbaseList
|
||||||
|
|
||||||
if not self.AirbaseList then
|
if not self.AirbaseList then
|
||||||
self.AirbaseList = {}
|
self.AirbaseList = {}
|
||||||
for _name,_ in pairs(_DATABASE.AIRBASES) do
|
for _name,_base in pairs(_DATABASE.AIRBASES) do
|
||||||
self.AirbaseList[_name]=_name
|
-- DONE exclude FARPS and Ships
|
||||||
|
if _base and _base.isAirdrome == true then
|
||||||
|
self.AirbaseList[_name]=_name
|
||||||
|
self.Airbases[_name]={}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
for _,_name in pairs(AirbaseList) do
|
||||||
|
-- DONE exclude FARPS and Ships
|
||||||
|
local airbase = _DATABASE:FindAirbase(_name)
|
||||||
|
if airbase and (airbase.isAirdrome == true) then
|
||||||
|
self.Airbases[_name]={}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -721,14 +729,18 @@ function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
|
|||||||
|
|
||||||
if NotInRunwayZone then
|
if NotInRunwayZone then
|
||||||
|
|
||||||
|
local Taxi = Client:GetState( self, "Taxi" )
|
||||||
|
|
||||||
if IsOnGround then
|
if IsOnGround then
|
||||||
local Taxi = Client:GetState( self, "Taxi" )
|
|
||||||
self:T( Taxi )
|
self:T( Taxi )
|
||||||
if Taxi == false then
|
if Taxi == false then
|
||||||
local Velocity = VELOCITY:New( AirbaseMeta.KickSpeed or self.KickSpeed )
|
local Velocity = VELOCITY:New( AirbaseMeta.KickSpeed or self.KickSpeed )
|
||||||
Client:Message( "Welcome to " .. AirbaseID .. ". The maximum taxiing speed is " ..
|
Client:Message( "Welcome to " .. AirbaseID .. ". The maximum taxiing speed is " ..
|
||||||
Velocity:ToString() , 20, "ATC" )
|
Velocity:ToString() , 20, "ATC" )
|
||||||
Client:SetState( self, "Taxi", true )
|
Client:SetState( self, "Taxi", true )
|
||||||
|
Client:SetState( self, "Speeding", false )
|
||||||
|
Client:SetState( self, "Warnings", 0 )
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TODO: GetVelocityKMH function usage
|
-- TODO: GetVelocityKMH function usage
|
||||||
@@ -737,7 +749,7 @@ function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
|
|||||||
local IsAboveRunway = Client:IsAboveRunway()
|
local IsAboveRunway = Client:IsAboveRunway()
|
||||||
self:T( {IsAboveRunway, IsOnGround, Velocity:Get() })
|
self:T( {IsAboveRunway, IsOnGround, Velocity:Get() })
|
||||||
|
|
||||||
if IsOnGround then
|
if IsOnGround and not Taxi then
|
||||||
local Speeding = false
|
local Speeding = false
|
||||||
if AirbaseMeta.MaximumKickSpeed then
|
if AirbaseMeta.MaximumKickSpeed then
|
||||||
if Velocity:Get() > AirbaseMeta.MaximumKickSpeed then
|
if Velocity:Get() > AirbaseMeta.MaximumKickSpeed then
|
||||||
@@ -749,15 +761,17 @@ function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if Speeding == true then
|
if Speeding == true then
|
||||||
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() ..
|
--MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() ..
|
||||||
" has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
-- " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
||||||
Client:Destroy()
|
--Client:Destroy()
|
||||||
Client:SetState( self, "Speeding", false )
|
Client:SetState( self, "Speeding", true )
|
||||||
Client:SetState( self, "Warnings", 0 )
|
local SpeedingWarnings = Client:GetState( self, "Warnings" )
|
||||||
|
Client:SetState( self, "Warnings", SpeedingWarnings + 1 )
|
||||||
|
Client:Message( "Warning " .. SpeedingWarnings .. "/3! Airbase traffic rule violation! Slow down now! Your speed is " ..
|
||||||
|
Velocity:ToString(), 5, "ATC" )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if IsOnGround then
|
if IsOnGround then
|
||||||
|
|
||||||
local Speeding = false
|
local Speeding = false
|
||||||
@@ -1035,23 +1049,23 @@ end
|
|||||||
-- The following airbases are monitored at the Nevada region.
|
-- The following airbases are monitored at the Nevada region.
|
||||||
-- Use the @{Wrapper.Airbase#AIRBASE.Nevada} enumeration to select the airbases to be monitored.
|
-- Use the @{Wrapper.Airbase#AIRBASE.Nevada} enumeration to select the airbases to be monitored.
|
||||||
--
|
--
|
||||||
-- * `AIRBASE.Nevada.Beatty_Airport`
|
-- * `AIRBASE.Nevada.Beatty`
|
||||||
-- * `AIRBASE.Nevada.Boulder_City_Airport`
|
-- * `AIRBASE.Nevada.Boulder_City`
|
||||||
-- * `AIRBASE.Nevada.Creech_AFB`
|
-- * `AIRBASE.Nevada.Creech`
|
||||||
-- * `AIRBASE.Nevada.Echo_Bay`
|
-- * `AIRBASE.Nevada.Echo_Bay`
|
||||||
-- * `AIRBASE.Nevada.Groom_Lake_AFB`
|
-- * `AIRBASE.Nevada.Groom_Lake`
|
||||||
-- * `AIRBASE.Nevada.Henderson_Executive_Airport`
|
-- * `AIRBASE.Nevada.Henderson_Executive`
|
||||||
-- * `AIRBASE.Nevada.Jean_Airport`
|
-- * `AIRBASE.Nevada.Jean`
|
||||||
-- * `AIRBASE.Nevada.Laughlin_Airport`
|
-- * `AIRBASE.Nevada.Laughlin`
|
||||||
-- * `AIRBASE.Nevada.Lincoln_County`
|
-- * `AIRBASE.Nevada.Lincoln_County`
|
||||||
-- * `AIRBASE.Nevada.McCarran_International_Airport`
|
-- * `AIRBASE.Nevada.McCarran_International`
|
||||||
-- * `AIRBASE.Nevada.Mesquite`
|
-- * `AIRBASE.Nevada.Mesquite`
|
||||||
-- * `AIRBASE.Nevada.Mina_Airport`
|
-- * `AIRBASE.Nevada.Mina`
|
||||||
-- * `AIRBASE.Nevada.Nellis_AFB`
|
-- * `AIRBASE.Nevada.Nellis`
|
||||||
-- * `AIRBASE.Nevada.North_Las_Vegas`
|
-- * `AIRBASE.Nevada.North_Las_Vegas`
|
||||||
-- * `AIRBASE.Nevada.Pahute_Mesa_Airstrip`
|
-- * `AIRBASE.Nevada.Pahute_Mesa`
|
||||||
-- * `AIRBASE.Nevada.Tonopah_Airport`
|
-- * `AIRBASE.Nevada.Tonopah`
|
||||||
-- * `AIRBASE.Nevada.Tonopah_Test_Range_Airfield`
|
-- * `AIRBASE.Nevada.Tonopah_Test_Range`
|
||||||
--
|
--
|
||||||
-- # Installation
|
-- # Installation
|
||||||
--
|
--
|
||||||
@@ -1088,10 +1102,10 @@ end
|
|||||||
--
|
--
|
||||||
-- -- Monitor specific airbases.
|
-- -- Monitor specific airbases.
|
||||||
-- ATC_Ground = ATC_GROUND_NEVADA:New(
|
-- ATC_Ground = ATC_GROUND_NEVADA:New(
|
||||||
-- { AIRBASE.Nevada.Laughlin_Airport,
|
-- { AIRBASE.Nevada.Laughlin,
|
||||||
-- AIRBASE.Nevada.Lincoln_County,
|
-- AIRBASE.Nevada.Lincoln_County,
|
||||||
-- AIRBASE.Nevada.North_Las_Vegas,
|
-- AIRBASE.Nevada.North_Las_Vegas,
|
||||||
-- AIRBASE.Nevada.McCarran_International_Airport
|
-- AIRBASE.Nevada.McCarran_International
|
||||||
-- }
|
-- }
|
||||||
-- )
|
-- )
|
||||||
--
|
--
|
||||||
@@ -1330,33 +1344,33 @@ end
|
|||||||
-- The following airbases are monitored at the PersianGulf region.
|
-- The following airbases are monitored at the PersianGulf region.
|
||||||
-- Use the @{Wrapper.Airbase#AIRBASE.PersianGulf} enumeration to select the airbases to be monitored.
|
-- Use the @{Wrapper.Airbase#AIRBASE.PersianGulf} enumeration to select the airbases to be monitored.
|
||||||
--
|
--
|
||||||
-- * `AIRBASE.PersianGulf.Abu_Musa_Island_Airport`
|
-- * `AIRBASE.PersianGulf.Abu_Musa_Island`
|
||||||
-- * `AIRBASE.PersianGulf.Al_Dhafra_AB`
|
-- * `AIRBASE.PersianGulf.Al_Dhafra_AFB`
|
||||||
-- * `AIRBASE.PersianGulf.Al_Maktoum_Intl`
|
-- * `AIRBASE.PersianGulf.Al_Maktoum_Intl`
|
||||||
-- * `AIRBASE.PersianGulf.Al_Minhad_AB`
|
-- * `AIRBASE.PersianGulf.Al_Minhad_AFB`
|
||||||
-- * `AIRBASE.PersianGulf.Bandar_Abbas_Intl`
|
-- * `AIRBASE.PersianGulf.Bandar_Abbas_Intl`
|
||||||
-- * `AIRBASE.PersianGulf.Bandar_Lengeh`
|
-- * `AIRBASE.PersianGulf.Bandar_Lengeh`
|
||||||
-- * `AIRBASE.PersianGulf.Dubai_Intl`
|
-- * `AIRBASE.PersianGulf.Dubai_Intl`
|
||||||
-- * `AIRBASE.PersianGulf.Fujairah_Intl`
|
-- * `AIRBASE.PersianGulf.Fujairah_Intl`
|
||||||
-- * `AIRBASE.PersianGulf.Havadarya`
|
-- * `AIRBASE.PersianGulf.Havadarya`
|
||||||
-- * `AIRBASE.PersianGulf.Kerman_Airport`
|
-- * `AIRBASE.PersianGulf.Kerman`
|
||||||
-- * `AIRBASE.PersianGulf.Khasab`
|
-- * `AIRBASE.PersianGulf.Khasab`
|
||||||
-- * `AIRBASE.PersianGulf.Lar_Airbase`
|
-- * `AIRBASE.PersianGulf.Lar`
|
||||||
-- * `AIRBASE.PersianGulf.Qeshm_Island`
|
-- * `AIRBASE.PersianGulf.Qeshm_Island`
|
||||||
-- * `AIRBASE.PersianGulf.Sharjah_Intl`
|
-- * `AIRBASE.PersianGulf.Sharjah_Intl`
|
||||||
-- * `AIRBASE.PersianGulf.Shiraz_International_Airport`
|
-- * `AIRBASE.PersianGulf.Shiraz_Intl`
|
||||||
-- * `AIRBASE.PersianGulf.Sir_Abu_Nuayr`
|
-- * `AIRBASE.PersianGulf.Sir_Abu_Nuayr`
|
||||||
-- * `AIRBASE.PersianGulf.Sirri_Island`
|
-- * `AIRBASE.PersianGulf.Sirri_Island`
|
||||||
-- * `AIRBASE.PersianGulf.Tunb_Island_AFB`
|
-- * `AIRBASE.PersianGulf.Tunb_Island_AFB`
|
||||||
-- * `AIRBASE.PersianGulf.Tunb_Kochak`
|
-- * `AIRBASE.PersianGulf.Tunb_Kochak`
|
||||||
-- * `AIRBASE.PersianGulf.Sas_Al_Nakheel_Airport`
|
-- * `AIRBASE.PersianGulf.Sas_Al_Nakheel`
|
||||||
-- * `AIRBASE.PersianGulf.Bandar_e_Jask_airfield`
|
-- * `AIRBASE.PersianGulf.Bandar_e_Jask`
|
||||||
-- * `AIRBASE.PersianGulf.Abu_Dhabi_International_Airport`
|
-- * `AIRBASE.PersianGulf.Abu_Dhabi_Intl`
|
||||||
-- * `AIRBASE.PersianGulf.Al_Bateen_Airport`
|
-- * `AIRBASE.PersianGulf.Al_Bateen`
|
||||||
-- * `AIRBASE.PersianGulf.Kish_International_Airport`
|
-- * `AIRBASE.PersianGulf.Kish_Intl`
|
||||||
-- * `AIRBASE.PersianGulf.Al_Ain_International_Airport`
|
-- * `AIRBASE.PersianGulf.Al_Ain_Intl`
|
||||||
-- * `AIRBASE.PersianGulf.Lavan_Island_Airport`
|
-- * `AIRBASE.PersianGulf.Lavan_Island`
|
||||||
-- * `AIRBASE.PersianGulf.Jiroft_Airport`
|
-- * `AIRBASE.PersianGulf.Jiroft`
|
||||||
--
|
--
|
||||||
-- # Installation
|
-- # Installation
|
||||||
--
|
--
|
||||||
@@ -1391,8 +1405,8 @@ end
|
|||||||
-- AirbasePoliceCaucasus = ATC_GROUND_PERSIANGULF:New()
|
-- AirbasePoliceCaucasus = ATC_GROUND_PERSIANGULF:New()
|
||||||
--
|
--
|
||||||
-- ATC_Ground = ATC_GROUND_PERSIANGULF:New(
|
-- ATC_Ground = ATC_GROUND_PERSIANGULF:New(
|
||||||
-- { AIRBASE.PersianGulf.Kerman_Airport,
|
-- { AIRBASE.PersianGulf.Kerman,
|
||||||
-- AIRBASE.PersianGulf.Al_Minhad_AB
|
-- AIRBASE.PersianGulf.Al_Minhad_AFB
|
||||||
-- }
|
-- }
|
||||||
-- )
|
-- )
|
||||||
--
|
--
|
||||||
@@ -1441,12 +1455,11 @@ function ATC_GROUND_PERSIANGULF:Start( RepeatScanSeconds )
|
|||||||
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, RepeatScanSeconds )
|
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, RepeatScanSeconds )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---
|
||||||
-- @type ATC_GROUND_MARIANAISLANDS
|
-- @type ATC_GROUND_MARIANAISLANDS
|
||||||
-- @extends #ATC_GROUND
|
-- @extends #ATC_GROUND
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- # ATC\_GROUND\_MARIANA, extends @{#ATC_GROUND}
|
--- # ATC\_GROUND\_MARIANA, extends @{#ATC_GROUND}
|
||||||
--
|
--
|
||||||
-- The ATC\_GROUND\_MARIANA class monitors the speed of the airplanes at the airbase during taxi.
|
-- The ATC\_GROUND\_MARIANA class monitors the speed of the airplanes at the airbase during taxi.
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
-- @field #table currentMove Holds the current commanded move, if there is one assigned.
|
-- @field #table currentMove Holds the current commanded move, if there is one assigned.
|
||||||
-- @field #number Nammo0 Initial amount total ammunition (shells+rockets+missiles) of the whole group.
|
-- @field #number Nammo0 Initial amount total ammunition (shells+rockets+missiles) of the whole group.
|
||||||
-- @field #number Nshells0 Initial amount of shells of the whole group.
|
-- @field #number Nshells0 Initial amount of shells of the whole group.
|
||||||
|
-- @field #number Narty0 Initial amount of artillery shells of the whole group.
|
||||||
-- @field #number Nrockets0 Initial amount of rockets of the whole group.
|
-- @field #number Nrockets0 Initial amount of rockets of the whole group.
|
||||||
-- @field #number Nmissiles0 Initial amount of missiles of the whole group.
|
-- @field #number Nmissiles0 Initial amount of missiles of the whole group.
|
||||||
-- @field #number Nukes0 Initial amount of tactical nukes of the whole group. Default is 0.
|
-- @field #number Nukes0 Initial amount of tactical nukes of the whole group. Default is 0.
|
||||||
@@ -415,7 +416,7 @@
|
|||||||
-- arty set, battery "Paladin Alpha", rearming place
|
-- arty set, battery "Paladin Alpha", rearming place
|
||||||
--
|
--
|
||||||
-- Setting the rearming group is independent of the position of the mark. Just create one anywhere on the map and type
|
-- Setting the rearming group is independent of the position of the mark. Just create one anywhere on the map and type
|
||||||
-- arty set, battery "Mortar Bravo", rearming group "Ammo Truck M818"
|
-- arty set, battery "Mortar Bravo", rearming group "Ammo Truck M939"
|
||||||
-- Note that the name of the rearming group has to be given in quotation marks and spelt exactly as the group name defined in the mission editor.
|
-- Note that the name of the rearming group has to be given in quotation marks and spelt exactly as the group name defined in the mission editor.
|
||||||
--
|
--
|
||||||
-- ## Transporting
|
-- ## Transporting
|
||||||
@@ -453,7 +454,7 @@
|
|||||||
-- -- Creat a new ARTY object from a Paladin group.
|
-- -- Creat a new ARTY object from a Paladin group.
|
||||||
-- paladin=ARTY:New(GROUP:FindByName("Blue Paladin"))
|
-- paladin=ARTY:New(GROUP:FindByName("Blue Paladin"))
|
||||||
--
|
--
|
||||||
-- -- Define a rearming group. This is a Transport M818 truck.
|
-- -- Define a rearming group. This is a Transport M939 truck.
|
||||||
-- paladin:SetRearmingGroup(GROUP:FindByName("Blue Ammo Truck"))
|
-- paladin:SetRearmingGroup(GROUP:FindByName("Blue Ammo Truck"))
|
||||||
--
|
--
|
||||||
-- -- Set the max firing range. A Paladin unit has a range of 20 km.
|
-- -- Set the max firing range. A Paladin unit has a range of 20 km.
|
||||||
@@ -618,62 +619,147 @@ ARTY.WeaponType={
|
|||||||
}
|
}
|
||||||
|
|
||||||
--- Database of common artillery unit properties.
|
--- Database of common artillery unit properties.
|
||||||
|
-- @type ARTY.dbitem
|
||||||
|
-- @field #string displayname Name displayed in ME.
|
||||||
|
-- @field #number minrange Minimum firing range in meters.
|
||||||
|
-- @field #number maxrange Maximum firing range in meters.
|
||||||
|
-- @field #number reloadtime Reload time in seconds.
|
||||||
|
|
||||||
|
--- Database of common artillery unit properties.
|
||||||
|
-- Table key is the "type name" and table value is and `ARTY.dbitem`.
|
||||||
-- @type ARTY.db
|
-- @type ARTY.db
|
||||||
ARTY.db={
|
ARTY.db={
|
||||||
["2B11 mortar"] = { -- type "2B11 mortar"
|
["LeFH_18-40-105"] = {
|
||||||
minrange = 500, -- correct?
|
displayname = "FH LeFH-18 105mm", -- name displayed in the ME
|
||||||
maxrange = 7000, -- 7 km
|
minrange = 500, -- min range (green circle) in meters
|
||||||
reloadtime = 30, -- 30 sec
|
maxrange = 10500, -- max range (red circle) in meters
|
||||||
|
reloadtime = nil, -- reload time in seconds
|
||||||
},
|
},
|
||||||
["SPH 2S1 Gvozdika"] = { -- type "SAU Gvozdika"
|
["M2A1-105"] = {
|
||||||
minrange = 300, -- correct?
|
displayname = "FH M2A1 105mm",
|
||||||
maxrange = 15000, -- 15 km
|
minrange = 500,
|
||||||
reloadtime = nil, -- unknown
|
maxrange = 11500,
|
||||||
|
reloadtime = nil,
|
||||||
},
|
},
|
||||||
["SPH 2S19 Msta"] = { --type "SAU Msta", alias "2S19 Msta"
|
["Pak40"] = {
|
||||||
minrange = 300, -- correct?
|
displayname = "FH Pak 40 75mm",
|
||||||
maxrange = 23500, -- 23.5 km
|
minrange = 500,
|
||||||
reloadtime = nil, -- unknown
|
maxrange = 3000,
|
||||||
|
reloadtime = nil,
|
||||||
},
|
},
|
||||||
["SPH 2S3 Akatsia"] = { -- type "SAU Akatsia", alias "2S3 Akatsia"
|
["L118_Unit"] = {
|
||||||
minrange = 300, -- correct?
|
displayname = "L118 Light Artillery Gun",
|
||||||
maxrange = 17000, -- 17 km
|
minrange = 500,
|
||||||
reloadtime = nil, -- unknown
|
maxrange = 17500,
|
||||||
|
reloadtime = nil,
|
||||||
},
|
},
|
||||||
["SPH 2S9 Nona"] = { --type "SAU 2-C9"
|
["Smerch"] = {
|
||||||
minrange = 500, -- correct?
|
displayname = "MLRS 9A52 Smerch CM 300mm",
|
||||||
maxrange = 7000, -- 7 km
|
minrange = 20000,
|
||||||
reloadtime = nil, -- unknown
|
maxrange = 70000,
|
||||||
|
reloadtime = 2160,
|
||||||
},
|
},
|
||||||
["SPH M109 Paladin"] = { -- type "M-109", alias "M109"
|
["Smerch_HE"] = {
|
||||||
minrange = 300, -- correct?
|
displayname = "MLRS 9A52 Smerch HE 300mm",
|
||||||
maxrange = 22000, -- 22 km
|
minrange = 20000,
|
||||||
reloadtime = nil, -- unknown
|
maxrange = 70000,
|
||||||
|
reloadtime = 2160,
|
||||||
},
|
},
|
||||||
["SpGH Dana"] = { -- type "SpGH_Dana"
|
["Uragan_BM-27"] = {
|
||||||
minrange = 300, -- correct?
|
displayname = "MLRS 9K57 Uragan BM-27 220mm",
|
||||||
maxrange = 18700, -- 18.7 km
|
minrange = 11500,
|
||||||
reloadtime = nil, -- unknown
|
maxrange = 35800,
|
||||||
|
reloadtime = 840,
|
||||||
},
|
},
|
||||||
["MLRS BM-21 Grad"] = { --type "Grad-URAL", alias "MLRS BM-21 Grad"
|
["Grad-URAL"] = {
|
||||||
minrange = 5000, -- 5 km
|
displayname = "MLRS BM-21 Grad 122mm",
|
||||||
maxrange = 19000, -- 19 km
|
minrange = 5000,
|
||||||
reloadtime = 420, -- 7 min
|
maxrange = 19000,
|
||||||
|
reloadtime = 420,
|
||||||
},
|
},
|
||||||
["MLRS 9K57 Uragan BM-27"] = { -- type "Uragan_BM-27"
|
["HL_B8M1"] = {
|
||||||
minrange = 11500, -- 11.5 km
|
displayname = "MLRS HL with B8M1 80mm",
|
||||||
maxrange = 35800, -- 35.8 km
|
minrange = 500,
|
||||||
reloadtime = 840, -- 14 min
|
maxrange = 5000,
|
||||||
|
reloadtime = nil,
|
||||||
},
|
},
|
||||||
["MLRS 9A52 Smerch"] = { -- type "Smerch"
|
["tt_B8M1"] = {
|
||||||
minrange = 20000, -- 20 km
|
displayname = "MLRS LC with B8M1 80mm",
|
||||||
maxrange = 70000, -- 70 km
|
minrange = 500,
|
||||||
reloadtime = 2160, -- 36 min
|
maxrange = 5000,
|
||||||
|
reloadtime = nil,
|
||||||
},
|
},
|
||||||
["MLRS M270"] = { --type "MRLS", alias "M270 MRLS"
|
["MLRS"] = {
|
||||||
minrange = 10000, -- 10 km
|
displayname = "MLRS M270 227mm",
|
||||||
maxrange = 32000, -- 32 km
|
minrange = 10000,
|
||||||
reloadtime = 540, -- 9 min
|
maxrange = 32000,
|
||||||
|
reloadtime = 540,
|
||||||
|
},
|
||||||
|
["2B11 mortar"] = {
|
||||||
|
displayname = "Mortar 2B11 120mm",
|
||||||
|
minrange = 500,
|
||||||
|
maxrange = 7000,
|
||||||
|
reloadtime = 30,
|
||||||
|
},
|
||||||
|
["PLZ05"] = {
|
||||||
|
displayname = "PLZ-05",
|
||||||
|
minrange = 500,
|
||||||
|
maxrange = 23500,
|
||||||
|
reloadtime = nil,
|
||||||
|
},
|
||||||
|
["SAU Gvozdika"] = {
|
||||||
|
displayname = "SPH 2S1 Gvozdika 122mm",
|
||||||
|
minrange = 300,
|
||||||
|
maxrange = 15000,
|
||||||
|
reloadtime = nil,
|
||||||
|
},
|
||||||
|
["SAU Msta"] = {
|
||||||
|
displayname = "SPH 2S19 Msta 152mm",
|
||||||
|
minrange = 300,
|
||||||
|
maxrange = 23500,
|
||||||
|
reloadtime = nil,
|
||||||
|
},
|
||||||
|
["SAU Akatsia"] = {
|
||||||
|
displayname = "SPH 2S3 Akatsia 152mm",
|
||||||
|
minrange = 300,
|
||||||
|
maxrange = 17000,
|
||||||
|
reloadtime = nil,
|
||||||
|
},
|
||||||
|
["SpGH_Dana"] = {
|
||||||
|
displayname = "SPH Dana vz77 152mm",
|
||||||
|
minrange = 300,
|
||||||
|
maxrange = 18700,
|
||||||
|
reloadtime = nil,
|
||||||
|
},
|
||||||
|
["M-109"] = {
|
||||||
|
displayname = "SPH M109 Paladin 155mm",
|
||||||
|
minrange = 300,
|
||||||
|
maxrange = 22000,
|
||||||
|
reloadtime = nil,
|
||||||
|
},
|
||||||
|
["M12_GMC"] = {
|
||||||
|
displayname = "SPH M12 GMC 155mm",
|
||||||
|
minrange = 300,
|
||||||
|
maxrange = 18200,
|
||||||
|
reloadtime = nil,
|
||||||
|
},
|
||||||
|
["Wespe124"] = {
|
||||||
|
displayname = "SPH Sd.Kfz.124 Wespe 105mm",
|
||||||
|
minrange = 300,
|
||||||
|
maxrange = 7000,
|
||||||
|
reloadtime = nil,
|
||||||
|
},
|
||||||
|
["T155_Firtina"] = {
|
||||||
|
displayname = "SPH T155 Firtina 155mm",
|
||||||
|
minrange = 300,
|
||||||
|
maxrange = 41000,
|
||||||
|
reloadtime = nil,
|
||||||
|
},
|
||||||
|
["SAU 2-C9"] = {
|
||||||
|
displayname = "SPM 2S9 Nona 120mm M",
|
||||||
|
minrange = 500,
|
||||||
|
maxrange = 7000,
|
||||||
|
reloadtime = nil,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -694,7 +780,7 @@ ARTY.db={
|
|||||||
|
|
||||||
--- Arty script version.
|
--- Arty script version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
ARTY.version="1.3.0"
|
ARTY.version="1.3.3"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -707,7 +793,7 @@ ARTY.version="1.3.0"
|
|||||||
-- DONE: Add user defined rearm weapon types.
|
-- DONE: Add user defined rearm weapon types.
|
||||||
-- DONE: Check if target is in range. Maybe this requires a data base with the ranges of all arty units. <solved by user function>
|
-- DONE: Check if target is in range. Maybe this requires a data base with the ranges of all arty units. <solved by user function>
|
||||||
-- DONE: Make ARTY move to rearming position.
|
-- DONE: Make ARTY move to rearming position.
|
||||||
-- DONE: Check that right rearming vehicle is specified. Blue M818, Red Ural-375. Are there more? <user needs to know!>
|
-- DONE: Check that right rearming vehicle is specified. Blue M939, Red Ural-375. Are there more? <user needs to know!>
|
||||||
-- DONE: Check if ARTY group is still alive.
|
-- DONE: Check if ARTY group is still alive.
|
||||||
-- DONE: Handle dead events.
|
-- DONE: Handle dead events.
|
||||||
-- DONE: Abort firing task if no shooting event occured with 5(?) minutes. Something went wrong then. Min/max range for example.
|
-- DONE: Abort firing task if no shooting event occured with 5(?) minutes. Something went wrong then. Min/max range for example.
|
||||||
@@ -796,8 +882,8 @@ function ARTY:New(group, alias)
|
|||||||
-- Maximum speed in km/h.
|
-- Maximum speed in km/h.
|
||||||
self.SpeedMax=group:GetSpeedMax()
|
self.SpeedMax=group:GetSpeedMax()
|
||||||
|
|
||||||
-- Group is mobile or not (e.g. mortars).
|
-- Group is mobile or not (e.g. mortars). Some immobile units have a speed of 1 m/s = 3.6 km/h. So we check this number.
|
||||||
if self.SpeedMax>1 then
|
if self.SpeedMax>3.6 then
|
||||||
self.ismobile=true
|
self.ismobile=true
|
||||||
else
|
else
|
||||||
self.ismobile=false
|
self.ismobile=false
|
||||||
@@ -1532,7 +1618,7 @@ end
|
|||||||
|
|
||||||
--- Assign a group, which is responsible for rearming the ARTY group. If the group is too far away from the ARTY group it will be guided towards the ARTY group.
|
--- Assign a group, which is responsible for rearming the ARTY group. If the group is too far away from the ARTY group it will be guided towards the ARTY group.
|
||||||
-- @param #ARTY self
|
-- @param #ARTY self
|
||||||
-- @param Wrapper.Group#GROUP group Group that is supposed to rearm the ARTY group. For the blue coalition, this is often a unarmed M818 transport whilst for red an unarmed Ural-375 transport can be used.
|
-- @param Wrapper.Group#GROUP group Group that is supposed to rearm the ARTY group. For the blue coalition, this is often a unarmed M939 transport whilst for red an unarmed Ural-375 transport can be used.
|
||||||
-- @return self
|
-- @return self
|
||||||
function ARTY:SetRearmingGroup(group)
|
function ARTY:SetRearmingGroup(group)
|
||||||
self:F({group=group})
|
self:F({group=group})
|
||||||
@@ -1887,7 +1973,7 @@ function ARTY:onafterStart(Controllable, From, Event, To)
|
|||||||
MESSAGE:New(text, 5):ToAllIf(self.Debug)
|
MESSAGE:New(text, 5):ToAllIf(self.Debug)
|
||||||
|
|
||||||
-- Get Ammo.
|
-- Get Ammo.
|
||||||
self.Nammo0, self.Nshells0, self.Nrockets0, self.Nmissiles0=self:GetAmmo(self.Debug)
|
self.Nammo0, self.Nshells0, self.Nrockets0, self.Nmissiles0, self.Narty0=self:GetAmmo(self.Debug)
|
||||||
|
|
||||||
-- Init nuclear explosion parameters if they were not set by user.
|
-- Init nuclear explosion parameters if they were not set by user.
|
||||||
if self.nukerange==nil then
|
if self.nukerange==nil then
|
||||||
@@ -1922,7 +2008,7 @@ function ARTY:onafterStart(Controllable, From, Event, To)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Check if we have and arty type that is in the DB.
|
-- Check if we have and arty type that is in the DB.
|
||||||
local _dbproperties=self:_CheckDB(self.DisplayName)
|
local _dbproperties=self:_CheckDB(self.Type)
|
||||||
self:T({dbproperties=_dbproperties})
|
self:T({dbproperties=_dbproperties})
|
||||||
if _dbproperties~=nil then
|
if _dbproperties~=nil then
|
||||||
for property,value in pairs(_dbproperties) do
|
for property,value in pairs(_dbproperties) do
|
||||||
@@ -1968,8 +2054,8 @@ function ARTY:onafterStart(Controllable, From, Event, To)
|
|||||||
text=text..string.format("Type = %s\n", self.Type)
|
text=text..string.format("Type = %s\n", self.Type)
|
||||||
text=text..string.format("Display Name = %s\n", self.DisplayName)
|
text=text..string.format("Display Name = %s\n", self.DisplayName)
|
||||||
text=text..string.format("Number of units = %d\n", self.IniGroupStrength)
|
text=text..string.format("Number of units = %d\n", self.IniGroupStrength)
|
||||||
text=text..string.format("Speed max = %d km/h\n", self.SpeedMax)
|
text=text..string.format("Speed max = %.1f km/h\n", self.SpeedMax)
|
||||||
text=text..string.format("Speed default = %d km/h\n", self.Speed)
|
text=text..string.format("Speed default = %.1f km/h\n", self.Speed)
|
||||||
text=text..string.format("Is mobile = %s\n", tostring(self.ismobile))
|
text=text..string.format("Is mobile = %s\n", tostring(self.ismobile))
|
||||||
text=text..string.format("Is cargo = %s\n", tostring(self.iscargo))
|
text=text..string.format("Is cargo = %s\n", tostring(self.iscargo))
|
||||||
text=text..string.format("Min range = %.1f km\n", self.minrange/1000)
|
text=text..string.format("Min range = %.1f km\n", self.minrange/1000)
|
||||||
@@ -2093,7 +2179,7 @@ function ARTY:_StatusReport(display)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Get Ammo.
|
-- Get Ammo.
|
||||||
local Nammo, Nshells, Nrockets, Nmissiles=self:GetAmmo()
|
local Nammo, Nshells, Nrockets, Nmissiles, Narty=self:GetAmmo()
|
||||||
local Nnukes=self.Nukes
|
local Nnukes=self.Nukes
|
||||||
local Nillu=self.Nillu
|
local Nillu=self.Nillu
|
||||||
local Nsmoke=self.Nsmoke
|
local Nsmoke=self.Nsmoke
|
||||||
@@ -2106,7 +2192,7 @@ function ARTY:_StatusReport(display)
|
|||||||
text=text..string.format("Clock = %s\n", Clock)
|
text=text..string.format("Clock = %s\n", Clock)
|
||||||
text=text..string.format("FSM state = %s\n", self:GetState())
|
text=text..string.format("FSM state = %s\n", self:GetState())
|
||||||
text=text..string.format("Total ammo count = %d\n", Nammo)
|
text=text..string.format("Total ammo count = %d\n", Nammo)
|
||||||
text=text..string.format("Number of shells = %d\n", Nshells)
|
text=text..string.format("Number of shells = %d\n", Narty)
|
||||||
text=text..string.format("Number of rockets = %d\n", Nrockets)
|
text=text..string.format("Number of rockets = %d\n", Nrockets)
|
||||||
text=text..string.format("Number of missiles = %d\n", Nmissiles)
|
text=text..string.format("Number of missiles = %d\n", Nmissiles)
|
||||||
text=text..string.format("Number of nukes = %d\n", Nnukes)
|
text=text..string.format("Number of nukes = %d\n", Nnukes)
|
||||||
@@ -2293,7 +2379,7 @@ function ARTY:OnEventShot(EventData)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Get current ammo.
|
-- Get current ammo.
|
||||||
local _nammo,_nshells,_nrockets,_nmissiles=self:GetAmmo()
|
local _nammo,_nshells,_nrockets,_nmissiles,_narty=self:GetAmmo()
|
||||||
|
|
||||||
-- Decrease available nukes because we just fired one.
|
-- Decrease available nukes because we just fired one.
|
||||||
if self.currentTarget.weapontype==ARTY.WeaponType.TacticalNukes then
|
if self.currentTarget.weapontype==ARTY.WeaponType.TacticalNukes then
|
||||||
@@ -2323,7 +2409,7 @@ function ARTY:OnEventShot(EventData)
|
|||||||
|
|
||||||
-- Weapon type name for current target.
|
-- Weapon type name for current target.
|
||||||
local _weapontype=self:_WeaponTypeName(self.currentTarget.weapontype)
|
local _weapontype=self:_WeaponTypeName(self.currentTarget.weapontype)
|
||||||
self:T(self.lid..string.format("Group %s ammo: total=%d, shells=%d, rockets=%d, missiles=%d", self.groupname, _nammo, _nshells, _nrockets, _nmissiles))
|
self:T(self.lid..string.format("Group %s ammo: total=%d, shells=%d, rockets=%d, missiles=%d", self.groupname, _nammo, _narty, _nrockets, _nmissiles))
|
||||||
self:T(self.lid..string.format("Group %s uses weapontype %s for current target.", self.groupname, _weapontype))
|
self:T(self.lid..string.format("Group %s uses weapontype %s for current target.", self.groupname, _weapontype))
|
||||||
|
|
||||||
-- Default switches for cease fire and relocation.
|
-- Default switches for cease fire and relocation.
|
||||||
@@ -2771,7 +2857,7 @@ function ARTY:onafterStatus(Controllable, From, Event, To)
|
|||||||
self:_EventFromTo("onafterStatus", Event, From, To)
|
self:_EventFromTo("onafterStatus", Event, From, To)
|
||||||
|
|
||||||
-- Get ammo.
|
-- Get ammo.
|
||||||
local nammo, nshells, nrockets, nmissiles=self:GetAmmo()
|
local nammo, nshells, nrockets, nmissiles, narty=self:GetAmmo()
|
||||||
|
|
||||||
-- We have a cargo group ==> check if group was loaded into a carrier.
|
-- We have a cargo group ==> check if group was loaded into a carrier.
|
||||||
if self.iscargo and self.cargogroup then
|
if self.iscargo and self.cargogroup then
|
||||||
@@ -2788,7 +2874,7 @@ function ARTY:onafterStatus(Controllable, From, Event, To)
|
|||||||
|
|
||||||
-- FSM state.
|
-- FSM state.
|
||||||
local fsmstate=self:GetState()
|
local fsmstate=self:GetState()
|
||||||
self:T(self.lid..string.format("Status %s, Ammo total=%d: shells=%d [smoke=%d, illu=%d, nukes=%d*%.3f kT], rockets=%d, missiles=%d", fsmstate, nammo, nshells, self.Nsmoke, self.Nillu, self.Nukes, self.nukewarhead/1000000, nrockets, nmissiles))
|
self:T(self.lid..string.format("Status %s, Ammo total=%d: shells=%d [smoke=%d, illu=%d, nukes=%d*%.3f kT], rockets=%d, missiles=%d", fsmstate, nammo, narty, self.Nsmoke, self.Nillu, self.Nukes, self.nukewarhead/1000000, nrockets, nmissiles))
|
||||||
|
|
||||||
if self.Controllable and self.Controllable:IsAlive() then
|
if self.Controllable and self.Controllable:IsAlive() then
|
||||||
|
|
||||||
@@ -2872,19 +2958,18 @@ function ARTY:onafterStatus(Controllable, From, Event, To)
|
|||||||
self:CeaseFire(self.currentTarget)
|
self:CeaseFire(self.currentTarget)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Open fire on timed target.
|
if self:is("CombatReady") then
|
||||||
self:OpenFire(_timedTarget)
|
-- Open fire on timed target.
|
||||||
|
self:OpenFire(_timedTarget)
|
||||||
|
end
|
||||||
elseif _normalTarget then
|
elseif _normalTarget then
|
||||||
|
|
||||||
-- Open fire on normal target.
|
if self:is("CombatReady") then
|
||||||
self:OpenFire(_normalTarget)
|
-- Open fire on normal target.
|
||||||
|
self:OpenFire(_normalTarget)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Get ammo.
|
|
||||||
--local nammo, nshells, nrockets, nmissiles=self:GetAmmo()
|
|
||||||
|
|
||||||
-- Check if we have a target in the queue for which weapons are still available.
|
-- Check if we have a target in the queue for which weapons are still available.
|
||||||
local gotsome=false
|
local gotsome=false
|
||||||
if #self.targets>0 then
|
if #self.targets>0 then
|
||||||
@@ -3045,14 +3130,14 @@ function ARTY:onafterOpenFire(Controllable, From, Event, To, target)
|
|||||||
local range=Controllable:GetCoordinate():Get2DDistance(target.coord)
|
local range=Controllable:GetCoordinate():Get2DDistance(target.coord)
|
||||||
|
|
||||||
-- Get ammo.
|
-- Get ammo.
|
||||||
local Nammo, Nshells, Nrockets, Nmissiles=self:GetAmmo()
|
local Nammo, Nshells, Nrockets, Nmissiles, Narty=self:GetAmmo()
|
||||||
local nfire=Nammo
|
local nfire=Narty
|
||||||
local _type="shots"
|
local _type="shots"
|
||||||
if target.weapontype==ARTY.WeaponType.Auto then
|
if target.weapontype==ARTY.WeaponType.Auto then
|
||||||
nfire=Nammo
|
nfire=Nammo -- We take everything that is available
|
||||||
_type="shots"
|
_type="shots"
|
||||||
elseif target.weapontype==ARTY.WeaponType.Cannon then
|
elseif target.weapontype==ARTY.WeaponType.Cannon then
|
||||||
nfire=Nshells
|
nfire=Narty
|
||||||
_type="shells"
|
_type="shells"
|
||||||
elseif target.weapontype==ARTY.WeaponType.TacticalNukes then
|
elseif target.weapontype==ARTY.WeaponType.TacticalNukes then
|
||||||
nfire=self.Nukes
|
nfire=self.Nukes
|
||||||
@@ -3071,6 +3156,8 @@ function ARTY:onafterOpenFire(Controllable, From, Event, To, target)
|
|||||||
_type="cruise missiles"
|
_type="cruise missiles"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--env.info(string.format("FF type=%s, Nrockets=%d, Nfire=%d target.nshells=%d", _type, Nrockets, nfire, target.nshells))
|
||||||
|
|
||||||
-- Adjust if less than requested ammo is left.
|
-- Adjust if less than requested ammo is left.
|
||||||
target.nshells=math.min(target.nshells, nfire)
|
target.nshells=math.min(target.nshells, nfire)
|
||||||
|
|
||||||
@@ -3337,7 +3424,7 @@ function ARTY:_CheckRearmed()
|
|||||||
self:F2()
|
self:F2()
|
||||||
|
|
||||||
-- Get current ammo.
|
-- Get current ammo.
|
||||||
local nammo,nshells,nrockets,nmissiles=self:GetAmmo()
|
local nammo,nshells,nrockets,nmissiles,narty=self:GetAmmo()
|
||||||
|
|
||||||
-- Number of units still alive.
|
-- Number of units still alive.
|
||||||
local units=self.Controllable:GetUnits()
|
local units=self.Controllable:GetUnits()
|
||||||
@@ -3604,6 +3691,10 @@ function ARTY:_FireAtCoord(coord, radius, nshells, weapontype)
|
|||||||
weapontype=ARTY.WeaponType.Cannon
|
weapontype=ARTY.WeaponType.Cannon
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if group:HasTask() then
|
||||||
|
group:ClearTasks()
|
||||||
|
end
|
||||||
|
|
||||||
-- Set ROE to weapon free.
|
-- Set ROE to weapon free.
|
||||||
group:OptionROEOpenFire()
|
group:OptionROEOpenFire()
|
||||||
|
|
||||||
@@ -3614,7 +3705,7 @@ function ARTY:_FireAtCoord(coord, radius, nshells, weapontype)
|
|||||||
local fire=group:TaskFireAtPoint(vec2, radius, nshells, weapontype)
|
local fire=group:TaskFireAtPoint(vec2, radius, nshells, weapontype)
|
||||||
|
|
||||||
-- Execute task.
|
-- Execute task.
|
||||||
group:SetTask(fire)
|
group:SetTask(fire,1)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set task for attacking a group.
|
--- Set task for attacking a group.
|
||||||
@@ -3632,6 +3723,10 @@ function ARTY:_AttackGroup(target)
|
|||||||
weapontype=ARTY.WeaponType.Cannon
|
weapontype=ARTY.WeaponType.Cannon
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if group:HasTask() then
|
||||||
|
group:ClearTasks()
|
||||||
|
end
|
||||||
|
|
||||||
-- Set ROE to weapon free.
|
-- Set ROE to weapon free.
|
||||||
group:OptionROEOpenFire()
|
group:OptionROEOpenFire()
|
||||||
|
|
||||||
@@ -3642,7 +3737,7 @@ function ARTY:_AttackGroup(target)
|
|||||||
local fire=group:TaskAttackGroup(targetgroup, weapontype, AI.Task.WeaponExpend.ONE, 1)
|
local fire=group:TaskAttackGroup(targetgroup, weapontype, AI.Task.WeaponExpend.ONE, 1)
|
||||||
|
|
||||||
-- Execute task.
|
-- Execute task.
|
||||||
group:SetTask(fire)
|
group:SetTask(fire,1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -3915,6 +4010,7 @@ end
|
|||||||
-- @return #number Number of shells the group has left.
|
-- @return #number Number of shells the group has left.
|
||||||
-- @return #number Number of rockets the group has left.
|
-- @return #number Number of rockets the group has left.
|
||||||
-- @return #number Number of missiles the group has left.
|
-- @return #number Number of missiles the group has left.
|
||||||
|
-- @return #number Number of artillery shells the group has left.
|
||||||
function ARTY:GetAmmo(display)
|
function ARTY:GetAmmo(display)
|
||||||
self:F3({display=display})
|
self:F3({display=display})
|
||||||
|
|
||||||
@@ -3928,6 +4024,7 @@ function ARTY:GetAmmo(display)
|
|||||||
local nshells=0
|
local nshells=0
|
||||||
local nrockets=0
|
local nrockets=0
|
||||||
local nmissiles=0
|
local nmissiles=0
|
||||||
|
local nartyshells=0
|
||||||
|
|
||||||
-- Get all units.
|
-- Get all units.
|
||||||
local units=self.Controllable:GetUnits()
|
local units=self.Controllable:GetUnits()
|
||||||
@@ -4030,7 +4127,8 @@ function ARTY:GetAmmo(display)
|
|||||||
|
|
||||||
-- Add up all shells.
|
-- Add up all shells.
|
||||||
nshells=nshells+Nammo
|
nshells=nshells+Nammo
|
||||||
|
local _,_,_,_,_,shells = unit:GetAmmunition()
|
||||||
|
nartyshells=nartyshells+shells
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
text=text..string.format("- %d shells of type %s\n", Nammo, _weaponName)
|
text=text..string.format("- %d shells of type %s\n", Nammo, _weaponName)
|
||||||
|
|
||||||
@@ -4076,7 +4174,7 @@ function ARTY:GetAmmo(display)
|
|||||||
-- Total amount of ammunition.
|
-- Total amount of ammunition.
|
||||||
nammo=nshells+nrockets+nmissiles
|
nammo=nshells+nrockets+nmissiles
|
||||||
|
|
||||||
return nammo, nshells, nrockets, nmissiles
|
return nammo, nshells, nrockets, nmissiles, nartyshells
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Returns a name of a missile category.
|
--- Returns a name of a missile category.
|
||||||
@@ -4827,7 +4925,10 @@ function ARTY:_CheckShootingStarted()
|
|||||||
|
|
||||||
-- Check if we waited long enough and no shot was fired.
|
-- Check if we waited long enough and no shot was fired.
|
||||||
--if dt > self.WaitForShotTime and self.Nshots==0 then
|
--if dt > self.WaitForShotTime and self.Nshots==0 then
|
||||||
if dt > self.WaitForShotTime and (self.Nshots==0 or self.currentTarget.nshells >= self.Nshots) then --https://github.com/FlightControl-Master/MOOSE/issues/1356
|
|
||||||
|
self:T(string.format("dt = %d WaitTime = %d | shots = %d TargetShells = %d",dt,self.WaitForShotTime,self.Nshots,self.currentTarget.nshells))
|
||||||
|
|
||||||
|
if (dt > self.WaitForShotTime and self.Nshots==0) or (self.currentTarget.nshells <= self.Nshots) then --https://github.com/FlightControl-Master/MOOSE/issues/1356
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:T(self.lid..string.format("%s, no shot event after %d seconds. Removing current target %s from list.", self.groupname, self.WaitForShotTime, name))
|
self:T(self.lid..string.format("%s, no shot event after %d seconds. Removing current target %s from list.", self.groupname, self.WaitForShotTime, name))
|
||||||
@@ -4889,7 +4990,7 @@ end
|
|||||||
function ARTY:_CheckOutOfAmmo(targets)
|
function ARTY:_CheckOutOfAmmo(targets)
|
||||||
|
|
||||||
-- Get current ammo.
|
-- Get current ammo.
|
||||||
local _nammo,_nshells,_nrockets,_nmissiles=self:GetAmmo()
|
local _nammo,_nshells,_nrockets,_nmissiles,_narty=self:GetAmmo()
|
||||||
|
|
||||||
-- Special weapon type requested ==> Check if corresponding ammo is empty.
|
-- Special weapon type requested ==> Check if corresponding ammo is empty.
|
||||||
local _partlyoutofammo=false
|
local _partlyoutofammo=false
|
||||||
@@ -4901,7 +5002,7 @@ function ARTY:_CheckOutOfAmmo(targets)
|
|||||||
self:T(self.lid..string.format("Group %s, auto weapon requested for target %s but all ammo is empty.", self.groupname, Target.name))
|
self:T(self.lid..string.format("Group %s, auto weapon requested for target %s but all ammo is empty.", self.groupname, Target.name))
|
||||||
_partlyoutofammo=true
|
_partlyoutofammo=true
|
||||||
|
|
||||||
elseif Target.weapontype==ARTY.WeaponType.Cannon and _nshells==0 then
|
elseif Target.weapontype==ARTY.WeaponType.Cannon and _narty==0 then
|
||||||
|
|
||||||
self:T(self.lid..string.format("Group %s, cannons requested for target %s but shells empty.", self.groupname, Target.name))
|
self:T(self.lid..string.format("Group %s, cannons requested for target %s but shells empty.", self.groupname, Target.name))
|
||||||
_partlyoutofammo=true
|
_partlyoutofammo=true
|
||||||
@@ -4945,14 +5046,14 @@ end
|
|||||||
function ARTY:_CheckWeaponTypeAvailable(target)
|
function ARTY:_CheckWeaponTypeAvailable(target)
|
||||||
|
|
||||||
-- Get current ammo of group.
|
-- Get current ammo of group.
|
||||||
local Nammo, Nshells, Nrockets, Nmissiles=self:GetAmmo()
|
local Nammo, Nshells, Nrockets, Nmissiles, Narty=self:GetAmmo()
|
||||||
|
|
||||||
-- Check if enough ammo is there for the selected weapon type.
|
-- Check if enough ammo is there for the selected weapon type.
|
||||||
local nfire=Nammo
|
local nfire=Nammo
|
||||||
if target.weapontype==ARTY.WeaponType.Auto then
|
if target.weapontype==ARTY.WeaponType.Auto then
|
||||||
nfire=Nammo
|
nfire=Nammo
|
||||||
elseif target.weapontype==ARTY.WeaponType.Cannon then
|
elseif target.weapontype==ARTY.WeaponType.Cannon then
|
||||||
nfire=Nshells
|
nfire=Narty
|
||||||
elseif target.weapontype==ARTY.WeaponType.TacticalNukes then
|
elseif target.weapontype==ARTY.WeaponType.TacticalNukes then
|
||||||
nfire=self.Nukes
|
nfire=self.Nukes
|
||||||
elseif target.weapontype==ARTY.WeaponType.IlluminationShells then
|
elseif target.weapontype==ARTY.WeaponType.IlluminationShells then
|
||||||
|
|||||||
@@ -354,7 +354,7 @@ function CLEANUP_AIRBASE.__:EventAddForCleanUp( Event )
|
|||||||
self:F({Event})
|
self:F({Event})
|
||||||
|
|
||||||
|
|
||||||
if Event.IniDCSUnit and Event.IniCategory == Object.Category.UNIT then
|
if Event.IniDCSUnit and Event.IniUnit and Event.IniCategory == Object.Category.UNIT then
|
||||||
if self.CleanUpList[Event.IniDCSUnitName] == nil then
|
if self.CleanUpList[Event.IniDCSUnitName] == nil then
|
||||||
if self:IsInAirbase( Event.IniUnit:GetVec2() ) then
|
if self:IsInAirbase( Event.IniUnit:GetVec2() ) then
|
||||||
self:AddForCleanUp( Event.IniUnit, Event.IniDCSUnitName )
|
self:AddForCleanUp( Event.IniUnit, Event.IniDCSUnitName )
|
||||||
@@ -362,7 +362,7 @@ function CLEANUP_AIRBASE.__:EventAddForCleanUp( Event )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if Event.TgtDCSUnit and Event.TgtCategory == Object.Category.UNIT then
|
if Event.TgtDCSUnit and Event.TgtUnit and Event.TgtCategory == Object.Category.UNIT then
|
||||||
if self.CleanUpList[Event.TgtDCSUnitName] == nil then
|
if self.CleanUpList[Event.TgtDCSUnitName] == nil then
|
||||||
if self:IsInAirbase( Event.TgtUnit:GetVec2() ) then
|
if self:IsInAirbase( Event.TgtUnit:GetVec2() ) then
|
||||||
self:AddForCleanUp( Event.TgtUnit, Event.TgtDCSUnitName )
|
self:AddForCleanUp( Event.TgtUnit, Event.TgtDCSUnitName )
|
||||||
@@ -384,7 +384,7 @@ function CLEANUP_AIRBASE.__:CleanUpSchedule()
|
|||||||
local CleanUpUnit = CleanUpListData.CleanUpUnit -- Wrapper.Unit#UNIT
|
local CleanUpUnit = CleanUpListData.CleanUpUnit -- Wrapper.Unit#UNIT
|
||||||
local CleanUpGroupName = CleanUpListData.CleanUpGroupName
|
local CleanUpGroupName = CleanUpListData.CleanUpGroupName
|
||||||
|
|
||||||
if CleanUpUnit:IsAlive() ~= nil then
|
if CleanUpUnit and CleanUpUnit:IsAlive() ~= nil then
|
||||||
|
|
||||||
if self:IsInAirbase( CleanUpUnit:GetVec2() ) then
|
if self:IsInAirbase( CleanUpUnit:GetVec2() ) then
|
||||||
|
|
||||||
@@ -411,7 +411,7 @@ function CLEANUP_AIRBASE.__:CleanUpSchedule()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- Clean Units which are waiting for a very long time in the CleanUpZone.
|
-- Clean Units which are waiting for a very long time in the CleanUpZone.
|
||||||
if CleanUpUnit and not CleanUpUnit:GetPlayerName() then
|
if CleanUpUnit and (CleanUpUnit.GetPlayerName == nil or not CleanUpUnit:GetPlayerName()) then
|
||||||
local CleanUpUnitVelocity = CleanUpUnit:GetVelocityKMH()
|
local CleanUpUnitVelocity = CleanUpUnit:GetVelocityKMH()
|
||||||
if CleanUpUnitVelocity < 1 then
|
if CleanUpUnitVelocity < 1 then
|
||||||
if CleanUpListData.CleanUpMoved then
|
if CleanUpListData.CleanUpMoved then
|
||||||
|
|||||||
687
Moose Development/Moose/Functional/ClientWatch.lua
Normal file
687
Moose Development/Moose/Functional/ClientWatch.lua
Normal file
@@ -0,0 +1,687 @@
|
|||||||
|
--- **Functional** - Manage and track client slots easily to add your own client-based menus and modules to.
|
||||||
|
--
|
||||||
|
-- The @{#CLIENTWATCH} class adds a simplified way to create scripts and menus for individual clients. Instead of creating large algorithms and juggling multiple event handlers, you can simply provide one or more prefixes to the class and use the callback functions on spawn, despawn, and any aircraft related events to script to your hearts content.
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
|
--
|
||||||
|
-- ## Features:
|
||||||
|
--
|
||||||
|
-- * Find clients by prefixes or by providing a Wrapper.CLIENT object
|
||||||
|
-- * Trigger functions when the client spawns and despawns
|
||||||
|
-- * Create multiple client instances without overwriting event handlers between instances
|
||||||
|
-- * More reliable aircraft lost events for when DCS thinks the aircraft id dead but a dead event fails to trigger
|
||||||
|
-- * Easily manage clients spawned in dynamic slots
|
||||||
|
--
|
||||||
|
-- ====
|
||||||
|
--
|
||||||
|
-- ### Author: **Statua**
|
||||||
|
--
|
||||||
|
-- ### Contributions: **FlightControl**: Wrapper.CLIENT
|
||||||
|
--
|
||||||
|
-- ====
|
||||||
|
-- @module Functional.ClientWatch
|
||||||
|
-- @image clientwatch.jpg
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
--- CLIENTWATCH class
|
||||||
|
-- @type CLIENTWATCH
|
||||||
|
-- @field #string ClassName Name of the class.
|
||||||
|
-- @field #boolean Debug Write Debug messages to DCS log file and send Debug messages to all players.
|
||||||
|
-- @field #string lid String for DCS log file.
|
||||||
|
-- @field #number FilterCoalition If not nil, will only activate for aircraft of the given coalition value.
|
||||||
|
-- @field #number FilterCategory If not nil, will only activate for aircraft of the given category value.
|
||||||
|
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
||||||
|
|
||||||
|
--- Manage and track client slots easily to add your own client-based menus and modules to.
|
||||||
|
--
|
||||||
|
-- ## Creating a new instance
|
||||||
|
--
|
||||||
|
-- To start, you must first create a new instance of the client manager and provide it with either a Wrapper.Client#CLIENT object, a string prefix of the unit name, or a table of string prefixes for unit names. These are used to capture the client unit when it spawns and apply your scripted functions to it. Only fixed wing and rotary wing aircraft controlled by players can be used by this class.
|
||||||
|
-- **This will not work if the client aircraft is alive!**
|
||||||
|
--
|
||||||
|
-- ### Examples
|
||||||
|
--
|
||||||
|
-- -- Create an instance with a Wrapper.Client#CLIENT object
|
||||||
|
-- local heliClient = CLIENT:FindByName('Rotary1-1')
|
||||||
|
-- local clientInstance = CLIENTWATCH:New(heliClient)
|
||||||
|
--
|
||||||
|
-- -- Create an instance with part of the unit name in the Mission Editor
|
||||||
|
-- local clientInstance = CLIENTWATCH:New("Rotary")
|
||||||
|
--
|
||||||
|
-- -- Create an instance using prefixes for a few units as well as a FARP name for any dynamic spawns coming out of it
|
||||||
|
-- local clientInstance = CLIENTWATCH:New({"Rescue","UH-1H","FARP ALPHA"})
|
||||||
|
--
|
||||||
|
-- ## Applying functions and methods to client aircraft when they spawn
|
||||||
|
--
|
||||||
|
-- Once the instance is created, it will watch for birth events. If the unit name of the client aircraft matches the one provided in the instance, the callback method @{#CLIENTWATCH:OnAfterSpawn}() can be used to apply functions and methods to the client object.
|
||||||
|
--
|
||||||
|
-- In the OnAfterSpawn() callback method are four values. From, Event, To, and ClientObject. From,Event,To are standard FSM strings for the state changes. ClientObject is where the magic happens. This is a special object which you can use to access all the data of the client aircraft. The following entries in ClientObject are available for you to use:
|
||||||
|
--
|
||||||
|
-- * **ClientObject.Unit**: The Moose @{Wrapper.Unit#UNIT} of the client aircraft
|
||||||
|
-- * **ClientObject.Group**: The Moose @{Wrapper.Group#GRUP} of the client aircraft
|
||||||
|
-- * **ClientObject.Client**: The Moose @{Wrapper.Client#CLIENT} of the client aircraft
|
||||||
|
-- * **ClientObject.PlayerName**: A #string of the player controlling the aircraft
|
||||||
|
-- * **ClientObject.UnitName**: A #string of the client aircraft unit.
|
||||||
|
-- * **ClientObject.GroupName**: A #string of the client aircraft group.
|
||||||
|
--
|
||||||
|
-- ### Examples
|
||||||
|
--
|
||||||
|
-- -- Create an instance with a client unit prefix and send them a message when they spawn
|
||||||
|
-- local clientInstance = CLIENTWATCH:New("Rotary")
|
||||||
|
-- function clientInstance:OnAfterSpawn(From,Event,To,ClientObject,EventData)
|
||||||
|
-- MESSAGE:New("Welcome to your aircraft!",10):ToUnit(ClientObject.Unit)
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- ## Using event callbacks
|
||||||
|
--
|
||||||
|
-- In a normal setting, you can only use a callback function for a specific option in one location. If you have multiple scripts that rely on the same callback from the same object, this can get quite messy. With the ClientWatch module, these callbacks are isolated t the instances and therefore open the possibility to use many instances with the same callback doing different things. ClientWatch instances subscribe to all events that are applicable to player controlled aircraft and provides callbacks for each, forwarding the EventData in the callback function.
|
||||||
|
--
|
||||||
|
-- The following event callbacks can be used inside the OnAfterSpawn() callback:
|
||||||
|
--
|
||||||
|
-- * **:OnAfterDespawn(From,Event,To)**: Triggers whenever DCS no longer sees the aircraft as 'alive'. No event data is given in this callback as it is derived from other events
|
||||||
|
-- * **:OnAfterHit(From,Event,To,EventData)**: Triggers every time the aircraft takes damage or is struck by a weapon/explosion
|
||||||
|
-- * **:OnAfterKill(From,Event,To,EventData)**: Triggers after the aircraft kills something with its weapons
|
||||||
|
-- * **:OnAfterScore(From,Event,To,EventData)**: Triggers after accumulating score
|
||||||
|
-- * **:OnAfterShot(From,Event,To,EventData)**: Triggers after a single-shot weapon is released
|
||||||
|
-- * **:OnAfterShootingStart(From,Event,To,EventData)**: Triggers when an automatic weapon begins firing
|
||||||
|
-- * **:OnAfterShootingEnd(From,Event,To,EventData)**: Triggers when an automatic weapon stops firing
|
||||||
|
-- * **:OnAfterLand(From,Event,To,EventData)**: Triggers when an aircraft transitions from being airborne to on the ground
|
||||||
|
-- * **:OnAfterTakeoff(From,Event,To,EventData)**: Triggers when an aircraft transitions from being on the ground to airborne
|
||||||
|
-- * **:OnAfterRunwayTakeoff(From,Event,To,EventData)**: Triggers after lifting off from a runway
|
||||||
|
-- * **:OnAfterRunwayTouch(From,Event,To,EventData)**: Triggers when an aircraft's gear makes contact with a runway
|
||||||
|
-- * **:OnAfterRefueling(From,Event,To,EventData)**: Triggers when an aircraft begins taking on fuel
|
||||||
|
-- * **:OnAfterRefuelingStop(From,Event,To,EventData)**: Triggers when an aircraft stops taking on fuel
|
||||||
|
-- * **:OnAfterPlayerLeaveUnit(From,Event,To,EventData)**: Triggers when a player leaves an operational aircraft
|
||||||
|
-- * **:OnAfterCrash(From,Event,To,EventData)**: Triggers when an aircraft is destroyed (may fail to trigger if the aircraft is only partially destroyed)
|
||||||
|
-- * **:OnAfterDead(From,Event,To,EventData)**: Triggers when an aircraft is considered dead (may fail to trigger if the aircraft was partially destroyed first)
|
||||||
|
-- * **:OnAfterPilotDead(From,Event,To,EventData)**: Triggers when the pilot is killed (may fail to trigger if the aircraft was partially destroyed first)
|
||||||
|
-- * **:OnAfterUnitLost(From,Event,To,EventData)**: Triggers when an aircraft is lost for any reason (may fail to trigger if the aircraft was partially destroyed first)
|
||||||
|
-- * **:OnAfterEjection(From,Event,To,EventData)**: Triggers when a pilot ejects from an aircraft
|
||||||
|
-- * **:OnAfterHumanFailure(From,Event,To,EventData)**: Triggers when an aircraft or system is damaged from any source or action by the player
|
||||||
|
-- * **:OnAfterHumanAircraftRepairStart(From,Event,To,EventData)**: Triggers when an aircraft repair is started
|
||||||
|
-- * **:OnAfterHumanAircraftRepairFinish(From,Event,To,EventData)**: Triggers when an aircraft repair is completed
|
||||||
|
-- * **:OnAfterEngineStartup(From,Event,To,EventData)**: Triggers when the engine enters what DCS considers to be a started state. Parameters vary by aircraft
|
||||||
|
-- * **:OnAfterEngineShutdown(From,Event,To,EventData)**: Triggers when the engine enters what DCS considers to be a stopped state. Parameters vary by aircraft
|
||||||
|
-- * **:OnAfterWeaponAdd(From,Event,To,EventData)**: Triggers when an item is added to an aircraft's payload
|
||||||
|
-- * **:OnAfterWeaponDrop(From,Event,To,EventData)**: Triggers when an item is jettisoned or dropped from an aircraft (unconfirmed)
|
||||||
|
-- * **:OnAfterWeaponRearm(From,Event,To,EventData)**: Triggers when an item with internal supply is restored (unconfirmed)
|
||||||
|
--
|
||||||
|
-- ### Examples
|
||||||
|
--
|
||||||
|
-- -- Show a message to player when they take damage from a weapon
|
||||||
|
-- local clientInstance = CLIENTWATCH:New("Rotary")
|
||||||
|
-- function clientInstance:OnAfterSpawn(From,Event,To,ClientObject,EventData)
|
||||||
|
-- function ClientObject:OnAfterHit(From,Event,To,EventData)
|
||||||
|
-- local typeShooter = EventData.IniTypeName
|
||||||
|
-- local nameWeapon = EventData.weapon_name
|
||||||
|
-- MESSAGE:New("A "..typeShooter.." hit you with a "..nameWeapon,20):ToUnit(ClientObject.Unit)
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- @field #CLIENTWATCH
|
||||||
|
CLIENTWATCH = {}
|
||||||
|
CLIENTWATCH.ClassName = "CLIENTWATCH"
|
||||||
|
CLIENTWATCH.Debug = false
|
||||||
|
CLIENTWATCH.DebugEventData = false
|
||||||
|
CLIENTWATCH.lid = nil
|
||||||
|
|
||||||
|
-- @type CLIENTWATCHTools
|
||||||
|
-- @field #table Unit Wrapper.UNIT of the cient object
|
||||||
|
-- @field #table Group Wrapper.GROUP of the cient object
|
||||||
|
-- @field #table Client Wrapper.CLIENT of the cient object
|
||||||
|
-- @field #string PlayerName Name of the player controlling the client object
|
||||||
|
-- @field #string UnitName Name of the unit that is the client object
|
||||||
|
-- @field #string GroupName Name of the group the client object belongs to
|
||||||
|
CLIENTWATCHTools = {}
|
||||||
|
|
||||||
|
--- CLIENTWATCH version
|
||||||
|
-- @field #string version
|
||||||
|
CLIENTWATCH.version="1.0.1"
|
||||||
|
|
||||||
|
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
--- Creates a new instance of CLIENTWATCH to add scripts to. Can be used multiple times with the same client/prefixes if you need it for multiple scripts.
|
||||||
|
-- @param #CLIENTWATCH self
|
||||||
|
-- @param #string Will watch for clients whos UNIT NAME or GROUP NAME matches part of the #string as a prefix.
|
||||||
|
-- @param #table Put strings in a table to use multiple prefixes for the above method.
|
||||||
|
-- @param Wrapper.Client#CLIENT Provide a Moose CLIENT object to apply to that specific aircraft slot (static slots only!)
|
||||||
|
-- @param #nil Leave blank to activate for ALL CLIENTS
|
||||||
|
-- @return #CLIENTWATCH self
|
||||||
|
function CLIENTWATCH:New(client)
|
||||||
|
--Init FSM
|
||||||
|
local self=BASE:Inherit(self, FSM:New())
|
||||||
|
self:SetStartState( "Idle" )
|
||||||
|
self:AddTransition( "*", "Spawn", "*" )
|
||||||
|
|
||||||
|
self.FilterCoalition = nil
|
||||||
|
self.FilterCategory = nil
|
||||||
|
|
||||||
|
--- User function for OnAfter "Spawn" event.
|
||||||
|
-- @function [parent=#CLIENTWATCH] OnAfterSpawn
|
||||||
|
-- @param #CLIENTWATCH self
|
||||||
|
-- @param Wrapper.Controllable#CONTROLLABLE Controllable Controllable of the group.
|
||||||
|
-- @param #string From From state.
|
||||||
|
-- @param #string Event Event.
|
||||||
|
-- @param #string To To state.
|
||||||
|
-- @param #table clientObject Custom object that handles events and stores Moose object data. See top documentation for more details.
|
||||||
|
-- @param #table eventdata Data from EVENTS.Birth.
|
||||||
|
|
||||||
|
--Set up spawn tracking
|
||||||
|
if not client then
|
||||||
|
if self.Debug then self:I({"New client instance created. ClientType = All clients"}) end
|
||||||
|
self:HandleEvent(EVENTS.Birth)
|
||||||
|
function self:OnEventBirth(eventdata)
|
||||||
|
if (eventdata.IniCategory == 0 or eventdata.IniCategory == 1) and eventdata.IniPlayerName
|
||||||
|
and (not self.FilterCoalition or self.FilterCoalition == eventdata.IniCoalition)
|
||||||
|
and (not self.FilterCategory or self.FilterCategory == eventdata.IniCategory) then
|
||||||
|
if self.Debug then
|
||||||
|
self:I({"Client spawned in.",IniCategory = eventdata.IniCategory})
|
||||||
|
end
|
||||||
|
local clientWatchDebug = self.Debug
|
||||||
|
local clientObject = CLIENTWATCHTools:_newClient(clientWatchDebug,eventdata)
|
||||||
|
self:Spawn(clientObject,eventdata)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif type(client) == "table" or type(client) == "string" then
|
||||||
|
if type(client) == "table" then
|
||||||
|
|
||||||
|
--CLIENT TABLE
|
||||||
|
if client.ClassName == "CLIENT" then
|
||||||
|
if self.Debug then self:I({"New client instance created. ClientType = Wrapper.CLIENT",client}) end
|
||||||
|
self.ClientName = client:GetName()
|
||||||
|
self:HandleEvent(EVENTS.Birth)
|
||||||
|
function self:OnEventBirth(eventdata)
|
||||||
|
if (eventdata.IniCategory == 0 or eventdata.IniCategory == 1) and eventdata.IniPlayerName
|
||||||
|
and (not self.FilterCoalition or self.FilterCoalition == eventdata.IniCoalition)
|
||||||
|
and (not self.FilterCategory or self.FilterCategory == eventdata.IniCategory) then
|
||||||
|
if self.ClientName == eventdata.IniUnitName then
|
||||||
|
if self.Debug then
|
||||||
|
self:I({"Client spawned in.",IniCategory = eventdata.IniCategory})
|
||||||
|
end
|
||||||
|
local clientWatchDebug = self.Debug
|
||||||
|
local clientObject = CLIENTWATCHTools:_newClient(clientWatchDebug,eventdata)
|
||||||
|
self:Spawn(clientObject,eventdata)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--STRING TABLE
|
||||||
|
else
|
||||||
|
if self.Debug then self:I({"New client instance created. ClientType = Multiple Prefixes",client}) end
|
||||||
|
local tableValid = true
|
||||||
|
for _,entry in pairs(client) do
|
||||||
|
if type(entry) ~= "string" then
|
||||||
|
tableValid = false
|
||||||
|
self:E({"The base handler failed to start because at least one entry in param1's table is not a string!",InvalidEntry = entry})
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if tableValid then
|
||||||
|
self:HandleEvent(EVENTS.Birth)
|
||||||
|
function self:OnEventBirth(eventdata)
|
||||||
|
for _,entry in pairs(client) do
|
||||||
|
if (eventdata.IniCategory == 0 or eventdata.IniCategory == 1) and eventdata.IniPlayerName
|
||||||
|
and (not self.FilterCoalition or self.FilterCoalition == eventdata.IniCoalition)
|
||||||
|
and (not self.FilterCategory or self.FilterCategory == eventdata.IniCategory) then
|
||||||
|
if string.match(eventdata.IniUnitName,entry) or string.match(eventdata.IniGroupName,entry) then
|
||||||
|
if self.Debug then
|
||||||
|
self:I({"Client spawned in.",IniCategory = eventdata.IniCategory})
|
||||||
|
end
|
||||||
|
local clientWatchDebug = self.Debug
|
||||||
|
local clientObject = CLIENTWATCHTools:_newClient(clientWatchDebug,eventdata)
|
||||||
|
self:Spawn(clientObject,eventdata)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if self.Debug then self:I({"New client instance created. ClientType = Single Prefix",client}) end
|
||||||
|
|
||||||
|
--SOLO STRING
|
||||||
|
self:HandleEvent(EVENTS.Birth)
|
||||||
|
function self:OnEventBirth(eventdata)
|
||||||
|
if (eventdata.IniCategory == 0 or eventdata.IniCategory == 1) and eventdata.IniPlayerName
|
||||||
|
and (not self.FilterCoalition or self.FilterCoalition == eventdata.IniCoalition)
|
||||||
|
and (not self.FilterCategory or self.FilterCategory == eventdata.IniCategory) then
|
||||||
|
if string.match(eventdata.IniUnitName,client) or string.match(eventdata.IniGroupName,client) then
|
||||||
|
if self.Debug then
|
||||||
|
self:I({"Client spawned in.",IniCategory = eventdata.IniCategory})
|
||||||
|
end
|
||||||
|
local clientWatchDebug = self.Debug
|
||||||
|
local clientObject = CLIENTWATCHTools:_newClient(clientWatchDebug,eventdata)
|
||||||
|
self:Spawn(clientObject,eventdata)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self:E({"The base handler failed to start because param1 is not a CLIENT object or a prefix string!",param1 = client})
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Filter out all clients not belonging to the provided coalition
|
||||||
|
-- @param #CLIENTWATCH self
|
||||||
|
-- @param #number Coalition number (1 = red, 2 = blue)
|
||||||
|
-- @param #string Coalition string ('red' or 'blue')
|
||||||
|
function CLIENTWATCH:FilterByCoalition(value)
|
||||||
|
if value == 1 or value == "red" then
|
||||||
|
self.FilterCoalition = 1
|
||||||
|
else
|
||||||
|
self.FilterCoalition = 2
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Filter out all clients that are not of the given category
|
||||||
|
-- @param #CLIENTWATCH self
|
||||||
|
-- @param #number Category number (0 = airplane, 1 = helicopter)
|
||||||
|
-- @param #string Category string ('airplane' or 'helicopter')
|
||||||
|
function CLIENTWATCH:FilterByCategory(value)
|
||||||
|
if value == 1 or value == "helicopter" then
|
||||||
|
self.FilterCategory = 1
|
||||||
|
else
|
||||||
|
self.FilterCategory = 0
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
--- Internal function for creating a new client on birth. Do not use!!!.
|
||||||
|
-- @param #CLIENTWATCHTools self
|
||||||
|
-- @param #EVENTS.Birth EventData
|
||||||
|
-- @return #CLIENTWATCHTools self
|
||||||
|
function CLIENTWATCHTools:_newClient(clientWatchDebug,eventdata)
|
||||||
|
--Init FSM
|
||||||
|
local self=BASE:Inherit(self, FSM:New())
|
||||||
|
self:SetStartState( "Alive" )
|
||||||
|
self:AddTransition( "Alive", "Despawn", "Dead" )
|
||||||
|
|
||||||
|
self.Unit = eventdata.IniUnit
|
||||||
|
self.Group = self.Unit:GetGroup()
|
||||||
|
self.Client = self.Unit:GetClient()
|
||||||
|
self.PlayerName = self.Unit:GetPlayerName()
|
||||||
|
self.UnitName = self.Unit:GetName()
|
||||||
|
self.GroupName = self.Group:GetName()
|
||||||
|
|
||||||
|
--Event events
|
||||||
|
self:AddTransition( "*", "Hit", "*" )
|
||||||
|
self:AddTransition( "*", "Kill", "*" )
|
||||||
|
self:AddTransition( "*", "Score", "*" )
|
||||||
|
self:AddTransition( "*", "Shot", "*" )
|
||||||
|
self:AddTransition( "*", "ShootingStart", "*" )
|
||||||
|
self:AddTransition( "*", "ShootingEnd", "*" )
|
||||||
|
self:AddTransition( "*", "Land", "*" )
|
||||||
|
self:AddTransition( "*", "Takeoff", "*" )
|
||||||
|
self:AddTransition( "*", "RunwayTakeoff", "*" )
|
||||||
|
self:AddTransition( "*", "RunwayTouch", "*" )
|
||||||
|
self:AddTransition( "*", "Refueling", "*" )
|
||||||
|
self:AddTransition( "*", "RefuelingStop", "*" )
|
||||||
|
self:AddTransition( "*", "PlayerLeaveUnit", "*" )
|
||||||
|
self:AddTransition( "*", "Crash", "*" )
|
||||||
|
self:AddTransition( "*", "Dead", "*" )
|
||||||
|
self:AddTransition( "*", "PilotDead", "*" )
|
||||||
|
self:AddTransition( "*", "UnitLost", "*" )
|
||||||
|
self:AddTransition( "*", "Ejection", "*" )
|
||||||
|
self:AddTransition( "*", "HumanFailure", "*" )
|
||||||
|
self:AddTransition( "*", "HumanAircraftRepairFinish", "*" )
|
||||||
|
self:AddTransition( "*", "HumanAircraftRepairStart", "*" )
|
||||||
|
self:AddTransition( "*", "EngineShutdown", "*" )
|
||||||
|
self:AddTransition( "*", "EngineStartup", "*" )
|
||||||
|
self:AddTransition( "*", "WeaponAdd", "*" )
|
||||||
|
self:AddTransition( "*", "WeaponDrop", "*" )
|
||||||
|
self:AddTransition( "*", "WeaponRearm", "*" )
|
||||||
|
|
||||||
|
--Event Handlers
|
||||||
|
self:HandleEvent( EVENTS.Hit )
|
||||||
|
self:HandleEvent( EVENTS.Kill )
|
||||||
|
self:HandleEvent( EVENTS.Score )
|
||||||
|
self:HandleEvent( EVENTS.Shot )
|
||||||
|
self:HandleEvent( EVENTS.ShootingStart )
|
||||||
|
self:HandleEvent( EVENTS.ShootingEnd )
|
||||||
|
self:HandleEvent( EVENTS.Land )
|
||||||
|
self:HandleEvent( EVENTS.Takeoff )
|
||||||
|
self:HandleEvent( EVENTS.RunwayTakeoff )
|
||||||
|
self:HandleEvent( EVENTS.RunwayTouch )
|
||||||
|
self:HandleEvent( EVENTS.Refueling )
|
||||||
|
self:HandleEvent( EVENTS.RefuelingStop )
|
||||||
|
self:HandleEvent( EVENTS.PlayerLeaveUnit )
|
||||||
|
self:HandleEvent( EVENTS.Crash )
|
||||||
|
self:HandleEvent( EVENTS.Dead )
|
||||||
|
self:HandleEvent( EVENTS.PilotDead )
|
||||||
|
self:HandleEvent( EVENTS.UnitLost )
|
||||||
|
self:HandleEvent( EVENTS.Ejection )
|
||||||
|
self:HandleEvent( EVENTS.HumanFailure )
|
||||||
|
self:HandleEvent( EVENTS.HumanAircraftRepairFinish )
|
||||||
|
self:HandleEvent( EVENTS.HumanAircraftRepairStart )
|
||||||
|
self:HandleEvent( EVENTS.EngineShutdown )
|
||||||
|
self:HandleEvent( EVENTS.EngineStartup )
|
||||||
|
self:HandleEvent( EVENTS.WeaponAdd )
|
||||||
|
self:HandleEvent( EVENTS.WeaponDrop )
|
||||||
|
self:HandleEvent( EVENTS.WeaponRearm )
|
||||||
|
|
||||||
|
function self:OnEventHit(EventData)
|
||||||
|
if EventData.TgtUnitName == self.UnitName then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client triggered hit event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
|
||||||
|
end
|
||||||
|
self:Hit(EventData)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function self:OnEventKill(EventData)
|
||||||
|
if EventData.IniUnitName == self.UnitName then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client triggered kill event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
|
||||||
|
end
|
||||||
|
self:Kill(EventData)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function self:OnEventScore(EventData)
|
||||||
|
if EventData.IniUnitName == self.UnitName then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client triggered score event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
|
||||||
|
end
|
||||||
|
self:Score(EventData)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function self:OnEventShot(EventData)
|
||||||
|
if EventData.IniUnitName == self.UnitName then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client triggered shot event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
|
||||||
|
end
|
||||||
|
self:Shot(EventData)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function self:OnEventShootingStart(EventData)
|
||||||
|
if EventData.IniUnitName == self.UnitName then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client triggered shooting start event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
|
||||||
|
end
|
||||||
|
self:ShootingStart(EventData)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function self:OnEventShootingEnd(EventData)
|
||||||
|
if EventData.IniUnitName == self.UnitName then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client triggered shooting end event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
|
||||||
|
end
|
||||||
|
self:ShootingEnd(EventData)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function self:OnEventLand(EventData)
|
||||||
|
if EventData.IniUnitName == self.UnitName then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client triggered land event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
|
||||||
|
end
|
||||||
|
self:Land(EventData)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function self:OnEventTakeoff(EventData)
|
||||||
|
if EventData.IniUnitName == self.UnitName then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client triggered takeoff event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
|
||||||
|
end
|
||||||
|
self:Takeoff(EventData)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function self:OnEventRunwayTakeoff(EventData)
|
||||||
|
if EventData.IniUnitName == self.UnitName then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client triggered runway takeoff event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
|
||||||
|
end
|
||||||
|
self:RunwayTakeoff(EventData)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function self:OnEventRunwayTouch(EventData)
|
||||||
|
if EventData.IniUnitName == self.UnitName then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client triggered runway touch event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
|
||||||
|
end
|
||||||
|
self:RunwayTouch(EventData)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function self:OnEventRefueling(EventData)
|
||||||
|
if EventData.IniUnitName == self.UnitName then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client triggered refueling event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
|
||||||
|
end
|
||||||
|
self:Refueling(EventData)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function self:OnEventRefuelingStop(EventData)
|
||||||
|
if EventData.IniUnitName == self.UnitName then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client triggered refueling event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
|
||||||
|
end
|
||||||
|
self:RefuelingStop(EventData)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function self:OnEventPlayerLeaveUnit(EventData)
|
||||||
|
if EventData.IniUnitName == self.UnitName then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client triggered leave unit event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
|
||||||
|
end
|
||||||
|
self:PlayerLeaveUnit(EventData)
|
||||||
|
self._deadRoutine()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function self:OnEventCrash(EventData)
|
||||||
|
if EventData.IniUnitName == self.UnitName then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client triggered crash event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
|
||||||
|
end
|
||||||
|
self:Crash(EventData)
|
||||||
|
self._deadRoutine()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function self:OnEventDead(EventData)
|
||||||
|
if EventData.IniUnitName == self.UnitName then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client triggered dead event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
|
||||||
|
end
|
||||||
|
self:Dead(EventData)
|
||||||
|
self._deadRoutine()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function self:OnEventPilotDead(EventData)
|
||||||
|
if EventData.IniUnitName == self.UnitName then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client triggered pilot dead event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
|
||||||
|
end
|
||||||
|
self:PilotDead(EventData)
|
||||||
|
self._deadRoutine()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function self:OnEventUnitLost(EventData)
|
||||||
|
if EventData.IniUnitName == self.UnitName then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client triggered unit lost event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
|
||||||
|
end
|
||||||
|
self:UnitLost(EventData)
|
||||||
|
self._deadRoutine()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function self:OnEventEjection(EventData)
|
||||||
|
if EventData.IniUnitName == self.UnitName then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client triggered ejection event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
|
||||||
|
end
|
||||||
|
self:Ejection(EventData)
|
||||||
|
self._deadRoutine()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function self:OnEventHumanFailure(EventData)
|
||||||
|
if EventData.IniUnitName == self.UnitName then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client triggered human failure event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
|
||||||
|
end
|
||||||
|
self:HumanFailure(EventData)
|
||||||
|
if not self.Unit:IsAlive() then
|
||||||
|
self._deadRoutine()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function self:OnEventHumanAircraftRepairFinish(EventData)
|
||||||
|
if EventData.IniUnitName == self.UnitName then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client triggered repair finished event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
|
||||||
|
end
|
||||||
|
self:HumanAircraftRepairFinish(EventData)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function self:OnEventHumanAircraftRepairStart(EventData)
|
||||||
|
if EventData.IniUnitName == self.UnitName then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client triggered repair start event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
|
||||||
|
end
|
||||||
|
self:HumanAircraftRepairStart(EventData)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function self:OnEventEngineShutdown(EventData)
|
||||||
|
if EventData.IniUnitName == self.UnitName then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client triggered engine shutdown event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
|
||||||
|
end
|
||||||
|
self:EngineShutdown(EventData)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function self:OnEventEngineStartup(EventData)
|
||||||
|
if EventData.IniUnitName == self.UnitName then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client triggered engine startup event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
|
||||||
|
end
|
||||||
|
self:EngineStartup(EventData)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function self:OnEventWeaponAdd(EventData)
|
||||||
|
if EventData.IniUnitName == self.UnitName then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client triggered weapon add event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
|
||||||
|
end
|
||||||
|
self:WeaponAdd(EventData)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function self:OnEventWeaponDrop(EventData)
|
||||||
|
if EventData.IniUnitName == self.UnitName then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client triggered weapon drop event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
|
||||||
|
end
|
||||||
|
self:WeaponDrop(EventData)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function self:OnEventWeaponRearm(EventData)
|
||||||
|
if EventData.IniUnitName == self.UnitName then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client triggered weapon rearm event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
|
||||||
|
end
|
||||||
|
self:WeaponRearm(EventData)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--Fallback timer
|
||||||
|
self.FallbackTimer = TIMER:New(function()
|
||||||
|
if not self.Unit:IsAlive() then
|
||||||
|
if clientWatchDebug then
|
||||||
|
self:I({"Client is registered as dead without an event trigger. Running fallback dead routine.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
||||||
|
end
|
||||||
|
self._deadRoutine()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
self.FallbackTimer:Start(5,5)
|
||||||
|
|
||||||
|
--Stop event handlers and trigger Despawn
|
||||||
|
function self._deadRoutine()
|
||||||
|
if clientWatchDebug then self:I({"Client dead routine triggered. Shutting down tracking...",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName}) end
|
||||||
|
self:UnHandleEvent( EVENTS.Hit )
|
||||||
|
self:UnHandleEvent( EVENTS.Kill )
|
||||||
|
self:UnHandleEvent( EVENTS.Score )
|
||||||
|
self:UnHandleEvent( EVENTS.Shot )
|
||||||
|
self:UnHandleEvent( EVENTS.ShootingStart )
|
||||||
|
self:UnHandleEvent( EVENTS.ShootingEnd )
|
||||||
|
self:UnHandleEvent( EVENTS.Land )
|
||||||
|
self:UnHandleEvent( EVENTS.Takeoff )
|
||||||
|
self:UnHandleEvent( EVENTS.RunwayTakeoff )
|
||||||
|
self:UnHandleEvent( EVENTS.RunwayTouch )
|
||||||
|
self:UnHandleEvent( EVENTS.Refueling )
|
||||||
|
self:UnHandleEvent( EVENTS.RefuelingStop )
|
||||||
|
self:UnHandleEvent( EVENTS.PlayerLeaveUnit )
|
||||||
|
self:UnHandleEvent( EVENTS.Crash )
|
||||||
|
self:UnHandleEvent( EVENTS.Dead )
|
||||||
|
self:UnHandleEvent( EVENTS.PilotDead )
|
||||||
|
self:UnHandleEvent( EVENTS.UnitLost )
|
||||||
|
self:UnHandleEvent( EVENTS.Ejection )
|
||||||
|
self:UnHandleEvent( EVENTS.HumanFailure )
|
||||||
|
self:UnHandleEvent( EVENTS.HumanAircraftRepairFinish )
|
||||||
|
self:UnHandleEvent( EVENTS.HumanAircraftRepairStart )
|
||||||
|
self:UnHandleEvent( EVENTS.EngineShutdown )
|
||||||
|
self:UnHandleEvent( EVENTS.EngineStartup )
|
||||||
|
self:UnHandleEvent( EVENTS.WeaponAdd )
|
||||||
|
self:UnHandleEvent( EVENTS.WeaponDrop )
|
||||||
|
self:UnHandleEvent( EVENTS.WeaponRearm )
|
||||||
|
self.FallbackTimer:Stop()
|
||||||
|
self:Despawn()
|
||||||
|
end
|
||||||
|
|
||||||
|
self:I({"Detected client spawn and applied internal functions and events.", PlayerName = self.PlayerName, UnitName = self.UnitName, GroupName = self.GroupName})
|
||||||
|
return self
|
||||||
|
end
|
||||||
@@ -184,7 +184,7 @@
|
|||||||
|
|
||||||
do -- DESIGNATE
|
do -- DESIGNATE
|
||||||
|
|
||||||
--- @type DESIGNATE
|
-- @type DESIGNATE
|
||||||
-- @extends Core.Fsm#FSM_PROCESS
|
-- @extends Core.Fsm#FSM_PROCESS
|
||||||
|
|
||||||
--- Manage the designation of detected targets.
|
--- Manage the designation of detected targets.
|
||||||
@@ -525,7 +525,7 @@ do -- DESIGNATE
|
|||||||
|
|
||||||
self.AttackSet:ForEachGroupAlive(
|
self.AttackSet:ForEachGroupAlive(
|
||||||
|
|
||||||
--- @param Wrapper.Group#GROUP AttackGroup
|
-- @param Wrapper.Group#GROUP AttackGroup
|
||||||
function( AttackGroup )
|
function( AttackGroup )
|
||||||
self.FlashStatusMenu[AttackGroup] = FlashMenu
|
self.FlashStatusMenu[AttackGroup] = FlashMenu
|
||||||
end
|
end
|
||||||
@@ -554,7 +554,7 @@ do -- DESIGNATE
|
|||||||
|
|
||||||
self.AttackSet:ForEachGroupAlive(
|
self.AttackSet:ForEachGroupAlive(
|
||||||
|
|
||||||
--- @param Wrapper.Group#GROUP AttackGroup
|
-- @param Wrapper.Group#GROUP AttackGroup
|
||||||
function( AttackGroup )
|
function( AttackGroup )
|
||||||
self.FlashDetectionMessage[AttackGroup] = FlashDetectionMessage
|
self.FlashDetectionMessage[AttackGroup] = FlashDetectionMessage
|
||||||
end
|
end
|
||||||
@@ -826,7 +826,7 @@ do -- DESIGNATE
|
|||||||
-- This Detection is obsolete, remove from the designate scope
|
-- This Detection is obsolete, remove from the designate scope
|
||||||
self.Designating[DesignateIndex] = nil
|
self.Designating[DesignateIndex] = nil
|
||||||
self.AttackSet:ForEachGroupAlive(
|
self.AttackSet:ForEachGroupAlive(
|
||||||
--- @param Wrapper.Group#GROUP AttackGroup
|
-- @param Wrapper.Group#GROUP AttackGroup
|
||||||
function( AttackGroup )
|
function( AttackGroup )
|
||||||
if AttackGroup:IsAlive() == true then
|
if AttackGroup:IsAlive() == true then
|
||||||
local DetectionText = self.Detection:DetectedItemReportSummary( DetectedItem, AttackGroup ):Text( ", " )
|
local DetectionText = self.Detection:DetectedItemReportSummary( DetectedItem, AttackGroup ):Text( ", " )
|
||||||
@@ -903,7 +903,7 @@ do -- DESIGNATE
|
|||||||
|
|
||||||
self.AttackSet:ForEachGroupAlive(
|
self.AttackSet:ForEachGroupAlive(
|
||||||
|
|
||||||
--- @param Wrapper.Group#GROUP GroupReport
|
-- @param Wrapper.Group#GROUP GroupReport
|
||||||
function( AttackGroup )
|
function( AttackGroup )
|
||||||
|
|
||||||
if self.FlashStatusMenu[AttackGroup] or ( MenuAttackGroup and ( AttackGroup:GetName() == MenuAttackGroup:GetName() ) ) then
|
if self.FlashStatusMenu[AttackGroup] or ( MenuAttackGroup and ( AttackGroup:GetName() == MenuAttackGroup:GetName() ) ) then
|
||||||
@@ -1060,7 +1060,7 @@ do -- DESIGNATE
|
|||||||
|
|
||||||
self.AttackSet:ForEachGroupAlive(
|
self.AttackSet:ForEachGroupAlive(
|
||||||
|
|
||||||
--- @param Wrapper.Group#GROUP GroupReport
|
-- @param Wrapper.Group#GROUP GroupReport
|
||||||
function( AttackGroup )
|
function( AttackGroup )
|
||||||
|
|
||||||
self:ScheduleOnce( Delay, self.SetMenu, self, AttackGroup )
|
self:ScheduleOnce( Delay, self.SetMenu, self, AttackGroup )
|
||||||
@@ -1198,7 +1198,7 @@ do -- DESIGNATE
|
|||||||
--local ReportTypes = REPORT:New()
|
--local ReportTypes = REPORT:New()
|
||||||
--local ReportLaserCodes = REPORT:New()
|
--local ReportLaserCodes = REPORT:New()
|
||||||
|
|
||||||
TargetSetUnit:Flush( self )
|
--TargetSetUnit:Flush( self )
|
||||||
|
|
||||||
--self:F( { Recces = self.Recces } )
|
--self:F( { Recces = self.Recces } )
|
||||||
for TargetUnit, RecceData in pairs( self.Recces ) do
|
for TargetUnit, RecceData in pairs( self.Recces ) do
|
||||||
@@ -1229,10 +1229,12 @@ do -- DESIGNATE
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if TargetSetUnit == nil then return end
|
||||||
|
|
||||||
if self.AutoLase or ( not self.AutoLase and ( self.LaseStart + Duration >= timer.getTime() ) ) then
|
if self.AutoLase or ( not self.AutoLase and ( self.LaseStart + Duration >= timer.getTime() ) ) then
|
||||||
|
|
||||||
TargetSetUnit:ForEachUnitPerThreatLevel( 10, 0,
|
TargetSetUnit:ForEachUnitPerThreatLevel( 10, 0,
|
||||||
--- @param Wrapper.Unit#UNIT SmokeUnit
|
-- @param Wrapper.Unit#UNIT SmokeUnit
|
||||||
function( TargetUnit )
|
function( TargetUnit )
|
||||||
|
|
||||||
self:F( { TargetUnit = TargetUnit:GetName() } )
|
self:F( { TargetUnit = TargetUnit:GetName() } )
|
||||||
@@ -1253,7 +1255,7 @@ do -- DESIGNATE
|
|||||||
|
|
||||||
local RecceUnit = UnitData -- Wrapper.Unit#UNIT
|
local RecceUnit = UnitData -- Wrapper.Unit#UNIT
|
||||||
local RecceUnitDesc = RecceUnit:GetDesc()
|
local RecceUnitDesc = RecceUnit:GetDesc()
|
||||||
--self:F( { RecceUnit = RecceUnit:GetName(), RecceDescription = RecceUnitDesc } )
|
--self:F( { RecceUnit = RecceUnit:GetName(), RecceDescription = RecceUnitDesc } )x
|
||||||
|
|
||||||
if RecceUnit:IsLasing() == false then
|
if RecceUnit:IsLasing() == false then
|
||||||
--self:F( { IsDetected = RecceUnit:IsDetected( TargetUnit ), IsLOS = RecceUnit:IsLOS( TargetUnit ) } )
|
--self:F( { IsDetected = RecceUnit:IsDetected( TargetUnit ), IsLOS = RecceUnit:IsLOS( TargetUnit ) } )
|
||||||
@@ -1275,9 +1277,10 @@ do -- DESIGNATE
|
|||||||
local Spot = RecceUnit:LaseUnit( TargetUnit, LaserCode, Duration )
|
local Spot = RecceUnit:LaseUnit( TargetUnit, LaserCode, Duration )
|
||||||
local AttackSet = self.AttackSet
|
local AttackSet = self.AttackSet
|
||||||
local DesignateName = self.DesignateName
|
local DesignateName = self.DesignateName
|
||||||
|
local typename = TargetUnit:GetTypeName()
|
||||||
|
|
||||||
function Spot:OnAfterDestroyed( From, Event, To )
|
function Spot:OnAfterDestroyed( From, Event, To )
|
||||||
self.Recce:MessageToSetGroup( "Target " .. TargetUnit:GetTypeName() .. " destroyed. " .. TargetSetUnit:Count() .. " targets left.",
|
self.Recce:MessageToSetGroup( "Target " ..typename .. " destroyed. " .. TargetSetUnit:CountAlive() .. " targets left.",
|
||||||
5, AttackSet, self.DesignateName )
|
5, AttackSet, self.DesignateName )
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1285,7 +1288,7 @@ do -- DESIGNATE
|
|||||||
-- OK. We have assigned for the Recce a TargetUnit. We can exit the function.
|
-- OK. We have assigned for the Recce a TargetUnit. We can exit the function.
|
||||||
MarkingCount = MarkingCount + 1
|
MarkingCount = MarkingCount + 1
|
||||||
local TargetUnitType = TargetUnit:GetTypeName()
|
local TargetUnitType = TargetUnit:GetTypeName()
|
||||||
RecceUnit:MessageToSetGroup( "Marking " .. TargetUnit:GetTypeName() .. " with laser " .. RecceUnit:GetSpot().LaserCode .. " for " .. Duration .. "s.",
|
RecceUnit:MessageToSetGroup( "Marking " .. TargetUnitType .. " with laser " .. RecceUnit:GetSpot().LaserCode .. " for " .. Duration .. "s.",
|
||||||
10, self.AttackSet, DesignateName )
|
10, self.AttackSet, DesignateName )
|
||||||
if not MarkedTypes[TargetUnitType] then
|
if not MarkedTypes[TargetUnitType] then
|
||||||
MarkedTypes[TargetUnitType] = true
|
MarkedTypes[TargetUnitType] = true
|
||||||
@@ -1392,7 +1395,7 @@ do -- DESIGNATE
|
|||||||
local MarkedCount = 0
|
local MarkedCount = 0
|
||||||
|
|
||||||
TargetSetUnit:ForEachUnitPerThreatLevel( 10, 0,
|
TargetSetUnit:ForEachUnitPerThreatLevel( 10, 0,
|
||||||
--- @param Wrapper.Unit#UNIT SmokeUnit
|
-- @param Wrapper.Unit#UNIT SmokeUnit
|
||||||
function( SmokeUnit )
|
function( SmokeUnit )
|
||||||
|
|
||||||
if MarkedCount < self.MaximumMarkings then
|
if MarkedCount < self.MaximumMarkings then
|
||||||
@@ -1457,9 +1460,10 @@ do -- DESIGNATE
|
|||||||
-- @param #DESIGNATE self
|
-- @param #DESIGNATE self
|
||||||
-- @return #DESIGNATE
|
-- @return #DESIGNATE
|
||||||
function DESIGNATE:onafterDoneSmoking( From, Event, To, Index )
|
function DESIGNATE:onafterDoneSmoking( From, Event, To, Index )
|
||||||
|
if self.Designating[Index] ~= nil then
|
||||||
self.Designating[Index] = string.gsub( self.Designating[Index], "S", "" )
|
self.Designating[Index] = string.gsub( self.Designating[Index], "S", "" )
|
||||||
self:SetDesignateMenu()
|
self:SetDesignateMenu()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- DoneIlluminating
|
--- DoneIlluminating
|
||||||
@@ -1472,5 +1476,3 @@ do -- DESIGNATE
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -545,7 +545,7 @@ do -- DETECTION_BASE
|
|||||||
-- @param #string To The To State string.
|
-- @param #string To The To State string.
|
||||||
function DETECTION_BASE:onafterDetect( From, Event, To )
|
function DETECTION_BASE:onafterDetect( From, Event, To )
|
||||||
|
|
||||||
local DetectDelay = 0.1
|
local DetectDelay = 0.15
|
||||||
self.DetectionCount = 0
|
self.DetectionCount = 0
|
||||||
self.DetectionRun = 0
|
self.DetectionRun = 0
|
||||||
self:UnIdentifyAllDetectedObjects() -- Resets the DetectedObjectsIdentified table
|
self:UnIdentifyAllDetectedObjects() -- Resets the DetectedObjectsIdentified table
|
||||||
@@ -596,6 +596,7 @@ do -- DETECTION_BASE
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---
|
||||||
-- @param #DETECTION_BASE self
|
-- @param #DETECTION_BASE self
|
||||||
-- @param #string From The From State string.
|
-- @param #string From The From State string.
|
||||||
-- @param #string Event The Event string.
|
-- @param #string Event The Event string.
|
||||||
@@ -604,7 +605,7 @@ do -- DETECTION_BASE
|
|||||||
-- @param #number DetectionTimeStamp Time stamp of detection event.
|
-- @param #number DetectionTimeStamp Time stamp of detection event.
|
||||||
function DETECTION_BASE:onafterDetection( From, Event, To, Detection, DetectionTimeStamp )
|
function DETECTION_BASE:onafterDetection( From, Event, To, Detection, DetectionTimeStamp )
|
||||||
|
|
||||||
-- self:F( { DetectedObjects = self.DetectedObjects } )
|
self:T( { DetectedObjects = self.DetectedObjects } )
|
||||||
|
|
||||||
self.DetectionRun = self.DetectionRun + 1
|
self.DetectionRun = self.DetectionRun + 1
|
||||||
|
|
||||||
@@ -612,14 +613,14 @@ do -- DETECTION_BASE
|
|||||||
|
|
||||||
if Detection and Detection:IsAlive() then
|
if Detection and Detection:IsAlive() then
|
||||||
|
|
||||||
-- self:T( { "DetectionGroup is Alive", DetectionGroup:GetName() } )
|
self:T( { "DetectionGroup is Alive", Detection:GetName() } )
|
||||||
|
|
||||||
local DetectionGroupName = Detection:GetName()
|
local DetectionGroupName = Detection:GetName()
|
||||||
local DetectionUnit = Detection:GetUnit( 1 )
|
local DetectionUnit = Detection:GetFirstUnitAlive()
|
||||||
|
|
||||||
local DetectedUnits = {}
|
local DetectedUnits = {}
|
||||||
|
|
||||||
local DetectedTargets = Detection:GetDetectedTargets(
|
local DetectedTargets = DetectionUnit:GetDetectedTargets(
|
||||||
self.DetectVisual,
|
self.DetectVisual,
|
||||||
self.DetectOptical,
|
self.DetectOptical,
|
||||||
self.DetectRadar,
|
self.DetectRadar,
|
||||||
@@ -628,9 +629,11 @@ do -- DETECTION_BASE
|
|||||||
self.DetectDLINK
|
self.DetectDLINK
|
||||||
)
|
)
|
||||||
|
|
||||||
self:F( { DetectedTargets = DetectedTargets } )
|
--self:T( { DetectedTargets = DetectedTargets } )
|
||||||
|
--self:T(UTILS.PrintTableToLog(DetectedTargets))
|
||||||
|
|
||||||
for DetectionObjectID, Detection in pairs( DetectedTargets ) do
|
|
||||||
|
for DetectionObjectID, Detection in pairs( DetectedTargets or {}) do
|
||||||
local DetectedObject = Detection.object -- DCS#Object
|
local DetectedObject = Detection.object -- DCS#Object
|
||||||
|
|
||||||
if DetectedObject and DetectedObject:isExist() and DetectedObject.id_ < 50000000 then -- and ( DetectedObject:getCategory() == Object.Category.UNIT or DetectedObject:getCategory() == Object.Category.STATIC ) then
|
if DetectedObject and DetectedObject:isExist() and DetectedObject.id_ < 50000000 then -- and ( DetectedObject:getCategory() == Object.Category.UNIT or DetectedObject:getCategory() == Object.Category.STATIC ) then
|
||||||
@@ -643,13 +646,13 @@ do -- DETECTION_BASE
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for DetectionObjectName, DetectedObjectData in pairs( self.DetectedObjects ) do
|
for DetectionObjectName, DetectedObjectData in pairs( self.DetectedObjects or {}) do
|
||||||
|
|
||||||
local DetectedObject = DetectedObjectData.Object
|
local DetectedObject = DetectedObjectData.Object
|
||||||
|
|
||||||
if DetectedObject:isExist() then
|
if DetectedObject:isExist() then
|
||||||
|
|
||||||
local TargetIsDetected, TargetIsVisible, TargetLastTime, TargetKnowType, TargetKnowDistance, TargetLastPos, TargetLastVelocity = DetectionUnit:IsTargetDetected(
|
local TargetIsDetected, TargetIsVisible, TargetKnowType, TargetKnowDistance, TargetLastTime, TargetLastPos, TargetLastVelocity = DetectionUnit:IsTargetDetected(
|
||||||
DetectedObject,
|
DetectedObject,
|
||||||
self.DetectVisual,
|
self.DetectVisual,
|
||||||
self.DetectOptical,
|
self.DetectOptical,
|
||||||
|
|||||||
@@ -1154,8 +1154,6 @@ function ESCORT:_ReportTargetsScheduler()
|
|||||||
|
|
||||||
if self.EscortGroup:IsAlive() and self.EscortClient:IsAlive() then
|
if self.EscortGroup:IsAlive() and self.EscortClient:IsAlive() then
|
||||||
|
|
||||||
if true then
|
|
||||||
|
|
||||||
local EscortGroupName = self.EscortGroup:GetName()
|
local EscortGroupName = self.EscortGroup:GetName()
|
||||||
|
|
||||||
self.EscortMenuAttackNearbyTargets:RemoveSubMenus()
|
self.EscortMenuAttackNearbyTargets:RemoveSubMenus()
|
||||||
@@ -1226,177 +1224,6 @@ function ESCORT:_ReportTargetsScheduler()
|
|||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
else
|
|
||||||
-- local EscortGroupName = self.EscortGroup:GetName()
|
|
||||||
-- local EscortTargets = self.EscortGroup:GetDetectedTargets()
|
|
||||||
--
|
|
||||||
-- local ClientEscortTargets = self.EscortClient._EscortGroups[EscortGroupName].Targets
|
|
||||||
--
|
|
||||||
-- local EscortTargetMessages = ""
|
|
||||||
-- for EscortTargetID, EscortTarget in pairs( EscortTargets ) do
|
|
||||||
-- local EscortObject = EscortTarget.object
|
|
||||||
-- self:T( EscortObject )
|
|
||||||
-- if EscortObject and EscortObject:isExist() and EscortObject.id_ < 50000000 then
|
|
||||||
--
|
|
||||||
-- local EscortTargetUnit = UNIT:Find( EscortObject )
|
|
||||||
-- local EscortTargetUnitName = EscortTargetUnit:GetName()
|
|
||||||
--
|
|
||||||
--
|
|
||||||
--
|
|
||||||
-- -- local EscortTargetIsDetected,
|
|
||||||
-- -- EscortTargetIsVisible,
|
|
||||||
-- -- EscortTargetLastTime,
|
|
||||||
-- -- EscortTargetKnowType,
|
|
||||||
-- -- EscortTargetKnowDistance,
|
|
||||||
-- -- EscortTargetLastPos,
|
|
||||||
-- -- EscortTargetLastVelocity
|
|
||||||
-- -- = self.EscortGroup:IsTargetDetected( EscortObject )
|
|
||||||
-- --
|
|
||||||
-- -- self:T( { EscortTargetIsDetected,
|
|
||||||
-- -- EscortTargetIsVisible,
|
|
||||||
-- -- EscortTargetLastTime,
|
|
||||||
-- -- EscortTargetKnowType,
|
|
||||||
-- -- EscortTargetKnowDistance,
|
|
||||||
-- -- EscortTargetLastPos,
|
|
||||||
-- -- EscortTargetLastVelocity } )
|
|
||||||
--
|
|
||||||
--
|
|
||||||
-- local EscortTargetUnitVec3 = EscortTargetUnit:GetVec3()
|
|
||||||
-- local EscortVec3 = self.EscortGroup:GetVec3()
|
|
||||||
-- local Distance = ( ( EscortTargetUnitVec3.x - EscortVec3.x )^2 +
|
|
||||||
-- ( EscortTargetUnitVec3.y - EscortVec3.y )^2 +
|
|
||||||
-- ( EscortTargetUnitVec3.z - EscortVec3.z )^2
|
|
||||||
-- ) ^ 0.5 / 1000
|
|
||||||
--
|
|
||||||
-- self:T( { self.EscortGroup:GetName(), EscortTargetUnit:GetName(), Distance, EscortTarget } )
|
|
||||||
--
|
|
||||||
-- if Distance <= 15 then
|
|
||||||
--
|
|
||||||
-- if not ClientEscortTargets[EscortTargetUnitName] then
|
|
||||||
-- ClientEscortTargets[EscortTargetUnitName] = {}
|
|
||||||
-- end
|
|
||||||
-- ClientEscortTargets[EscortTargetUnitName].AttackUnit = EscortTargetUnit
|
|
||||||
-- ClientEscortTargets[EscortTargetUnitName].visible = EscortTarget.visible
|
|
||||||
-- ClientEscortTargets[EscortTargetUnitName].type = EscortTarget.type
|
|
||||||
-- ClientEscortTargets[EscortTargetUnitName].distance = EscortTarget.distance
|
|
||||||
-- else
|
|
||||||
-- if ClientEscortTargets[EscortTargetUnitName] then
|
|
||||||
-- ClientEscortTargets[EscortTargetUnitName] = nil
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
--
|
|
||||||
-- self:T( { "Sorting Targets Table:", ClientEscortTargets } )
|
|
||||||
-- table.sort( ClientEscortTargets, function( a, b ) return a.Distance < b.Distance end )
|
|
||||||
-- self:T( { "Sorted Targets Table:", ClientEscortTargets } )
|
|
||||||
--
|
|
||||||
-- -- Remove the sub menus of the Attack menu of the Escort for the EscortGroup.
|
|
||||||
-- self.EscortMenuAttackNearbyTargets:RemoveSubMenus()
|
|
||||||
--
|
|
||||||
-- if self.EscortMenuTargetAssistance then
|
|
||||||
-- self.EscortMenuTargetAssistance:RemoveSubMenus()
|
|
||||||
-- end
|
|
||||||
--
|
|
||||||
-- --for MenuIndex = 1, #self.EscortMenuAttackTargets do
|
|
||||||
-- -- self:T( { "Remove Menu:", self.EscortMenuAttackTargets[MenuIndex] } )
|
|
||||||
-- -- self.EscortMenuAttackTargets[MenuIndex] = self.EscortMenuAttackTargets[MenuIndex]:Remove()
|
|
||||||
-- --end
|
|
||||||
--
|
|
||||||
--
|
|
||||||
-- if ClientEscortTargets then
|
|
||||||
-- for ClientEscortTargetUnitName, ClientEscortTargetData in pairs( ClientEscortTargets ) do
|
|
||||||
--
|
|
||||||
-- for ClientEscortGroupName, EscortGroupData in pairs( self.EscortClient._EscortGroups ) do
|
|
||||||
--
|
|
||||||
-- if ClientEscortTargetData and ClientEscortTargetData.AttackUnit:IsAlive() then
|
|
||||||
--
|
|
||||||
-- local EscortTargetMessage = ""
|
|
||||||
-- local EscortTargetCategoryName = ClientEscortTargetData.AttackUnit:GetCategoryName()
|
|
||||||
-- local EscortTargetCategoryType = ClientEscortTargetData.AttackUnit:GetTypeName()
|
|
||||||
-- if ClientEscortTargetData.type then
|
|
||||||
-- EscortTargetMessage = EscortTargetMessage .. EscortTargetCategoryName .. " (" .. EscortTargetCategoryType .. ") at "
|
|
||||||
-- else
|
|
||||||
-- EscortTargetMessage = EscortTargetMessage .. "Unknown target at "
|
|
||||||
-- end
|
|
||||||
--
|
|
||||||
-- local EscortTargetUnitVec3 = ClientEscortTargetData.AttackUnit:GetVec3()
|
|
||||||
-- local EscortVec3 = self.EscortGroup:GetVec3()
|
|
||||||
-- local Distance = ( ( EscortTargetUnitVec3.x - EscortVec3.x )^2 +
|
|
||||||
-- ( EscortTargetUnitVec3.y - EscortVec3.y )^2 +
|
|
||||||
-- ( EscortTargetUnitVec3.z - EscortVec3.z )^2
|
|
||||||
-- ) ^ 0.5 / 1000
|
|
||||||
--
|
|
||||||
-- self:T( { self.EscortGroup:GetName(), ClientEscortTargetData.AttackUnit:GetName(), Distance, ClientEscortTargetData.AttackUnit } )
|
|
||||||
-- if ClientEscortTargetData.visible == false then
|
|
||||||
-- EscortTargetMessage = EscortTargetMessage .. string.format( "%.2f", Distance ) .. " estimated km"
|
|
||||||
-- else
|
|
||||||
-- EscortTargetMessage = EscortTargetMessage .. string.format( "%.2f", Distance ) .. " km"
|
|
||||||
-- end
|
|
||||||
--
|
|
||||||
-- if ClientEscortTargetData.visible then
|
|
||||||
-- EscortTargetMessage = EscortTargetMessage .. ", visual"
|
|
||||||
-- end
|
|
||||||
--
|
|
||||||
-- if ClientEscortGroupName == EscortGroupName then
|
|
||||||
--
|
|
||||||
-- MENU_GROUP_COMMAND:New( self.EscortClient,
|
|
||||||
-- EscortTargetMessage,
|
|
||||||
-- self.EscortMenuAttackNearbyTargets,
|
|
||||||
-- ESCORT._AttackTarget,
|
|
||||||
-- { ParamSelf = self,
|
|
||||||
-- ParamUnit = ClientEscortTargetData.AttackUnit
|
|
||||||
-- }
|
|
||||||
-- )
|
|
||||||
-- EscortTargetMessages = EscortTargetMessages .. "\n - " .. EscortTargetMessage
|
|
||||||
-- else
|
|
||||||
-- if self.EscortMenuTargetAssistance then
|
|
||||||
-- local MenuTargetAssistance = MENU_GROUP:New( self.EscortClient, EscortGroupData.EscortName, self.EscortMenuTargetAssistance )
|
|
||||||
-- MENU_GROUP_COMMAND:New( self.EscortClient,
|
|
||||||
-- EscortTargetMessage,
|
|
||||||
-- MenuTargetAssistance,
|
|
||||||
-- ESCORT._AssistTarget,
|
|
||||||
-- self,
|
|
||||||
-- EscortGroupData.EscortGroup,
|
|
||||||
-- ClientEscortTargetData.AttackUnit
|
|
||||||
-- )
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- else
|
|
||||||
-- ClientEscortTargetData = nil
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
--
|
|
||||||
-- if EscortTargetMessages ~= "" and self.ReportTargets == true then
|
|
||||||
-- self.EscortGroup:MessageToClient( "Detected targets within 15 km range:" .. EscortTargetMessages:gsub("\n$",""), 20, self.EscortClient )
|
|
||||||
-- else
|
|
||||||
-- self.EscortGroup:MessageToClient( "No targets detected!", 20, self.EscortClient )
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
--
|
|
||||||
-- if self.EscortMenuResumeMission then
|
|
||||||
-- self.EscortMenuResumeMission:RemoveSubMenus()
|
|
||||||
--
|
|
||||||
-- -- if self.EscortMenuResumeWayPoints then
|
|
||||||
-- -- for MenuIndex = 1, #self.EscortMenuResumeWayPoints do
|
|
||||||
-- -- self:T( { "Remove Menu:", self.EscortMenuResumeWayPoints[MenuIndex] } )
|
|
||||||
-- -- self.EscortMenuResumeWayPoints[MenuIndex] = self.EscortMenuResumeWayPoints[MenuIndex]:Remove()
|
|
||||||
-- -- end
|
|
||||||
-- -- end
|
|
||||||
--
|
|
||||||
-- local TaskPoints = self:RegisterRoute()
|
|
||||||
-- for WayPointID, WayPoint in pairs( TaskPoints ) do
|
|
||||||
-- local EscortVec3 = self.EscortGroup:GetVec3()
|
|
||||||
-- local Distance = ( ( WayPoint.x - EscortVec3.x )^2 +
|
|
||||||
-- ( WayPoint.y - EscortVec3.z )^2
|
|
||||||
-- ) ^ 0.5 / 1000
|
|
||||||
-- MENU_GROUP_COMMAND:New( self.EscortClient, "Waypoint " .. WayPointID .. " at " .. string.format( "%.2f", Distance ).. "km", self.EscortMenuResumeMission, ESCORT._ResumeMission, { ParamSelf = self, ParamWayPoint = WayPointID } )
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
--
|
|
||||||
-- return true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -141,7 +141,6 @@ FOX = {
|
|||||||
explosiondist = 200,
|
explosiondist = 200,
|
||||||
explosiondist2 = 500,
|
explosiondist2 = 500,
|
||||||
bigmissilemass = 50,
|
bigmissilemass = 50,
|
||||||
destroy = nil,
|
|
||||||
dt50 = 5,
|
dt50 = 5,
|
||||||
dt10 = 1,
|
dt10 = 1,
|
||||||
dt05 = 0.5,
|
dt05 = 0.5,
|
||||||
@@ -1060,7 +1059,7 @@ function FOX:onafterMissileLaunch(From, Event, To, missile)
|
|||||||
|
|
||||||
-- Tracking info and init of last bomb position.
|
-- Tracking info and init of last bomb position.
|
||||||
local text=string.format("FOX: Tracking missile %s(%s) - target %s - shooter %s", missile.missileType, missile.missileName, tostring(missile.targetName), missile.shooterName)
|
local text=string.format("FOX: Tracking missile %s(%s) - target %s - shooter %s", missile.missileType, missile.missileName, tostring(missile.targetName), missile.shooterName)
|
||||||
self:I(FOX.lid..text)
|
self:T(FOX.lid..text)
|
||||||
MESSAGE:New(text, 10):ToAllIf(self.Debug)
|
MESSAGE:New(text, 10):ToAllIf(self.Debug)
|
||||||
|
|
||||||
-- Loop over players.
|
-- Loop over players.
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
-- @module Functional.Mantis
|
-- @module Functional.Mantis
|
||||||
-- @image Functional.Mantis.jpg
|
-- @image Functional.Mantis.jpg
|
||||||
--
|
--
|
||||||
-- Last Update: Feb 2024
|
-- Last Update: May 2025
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
--- **MANTIS** class, extends Core.Base#BASE
|
--- **MANTIS** class, extends Core.Base#BASE
|
||||||
@@ -58,6 +58,13 @@
|
|||||||
-- @field #boolean ShoradLink If true, #MANTIS has #SHORAD enabled
|
-- @field #boolean ShoradLink If true, #MANTIS has #SHORAD enabled
|
||||||
-- @field #number ShoradTime Timer in seconds, how long #SHORAD will be active after a detection inside of the defense range
|
-- @field #number ShoradTime Timer in seconds, how long #SHORAD will be active after a detection inside of the defense range
|
||||||
-- @field #number ShoradActDistance Distance of an attacker in meters from a Mantis SAM site, on which Shorad will be switched on. Useful to not give away Shorad sites too early. Default 15km. Should be smaller than checkradius.
|
-- @field #number ShoradActDistance Distance of an attacker in meters from a Mantis SAM site, on which Shorad will be switched on. Useful to not give away Shorad sites too early. Default 15km. Should be smaller than checkradius.
|
||||||
|
-- @field #boolean checkforfriendlies If true, do not activate a SAM installation if a friendly aircraft is in firing range.
|
||||||
|
-- @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 #number SmokeDecoyColor Color to use, defaults to SMOKECOLOR.White
|
||||||
|
-- @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
|
||||||
|
|
||||||
|
|
||||||
@@ -69,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) can 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
|
||||||
--
|
--
|
||||||
@@ -84,6 +90,7 @@
|
|||||||
-- * SAM sites, e.g. each **group name** begins with "Red SAM"
|
-- * SAM sites, e.g. each **group name** begins with "Red SAM"
|
||||||
-- * EWR network and AWACS, e.g. each **group name** begins with "Red EWR" and *not* e.g. "Red SAM EWR" (overlap with "Red SAM"), "Red EWR Awacs" will be found by "Red EWR"
|
-- * EWR network and AWACS, e.g. each **group name** begins with "Red EWR" and *not* e.g. "Red SAM EWR" (overlap with "Red SAM"), "Red EWR Awacs" will be found by "Red EWR"
|
||||||
-- * SHORAD, e.g. each **group name** begins with "Red SHORAD" and *not" e.g. just "SHORAD" because you might also have "Blue SHORAD"
|
-- * SHORAD, e.g. each **group name** begins with "Red SHORAD" and *not" e.g. just "SHORAD" because you might also have "Blue SHORAD"
|
||||||
|
-- * Point Defense, e.g. each **group name** begins with "Red AAA" and *not" e.g. just "AAA" because you might also have "Blue AAA"
|
||||||
--
|
--
|
||||||
-- It's important to get this right because of the nature of the filter-system in @{Core.Set#SET_GROUP}. Filters are "greedy", that is they
|
-- It's important to get this right because of the nature of the filter-system in @{Core.Set#SET_GROUP}. Filters are "greedy", that is they
|
||||||
-- will match *any* string that contains the search string - hence we need to avoid that SAMs, EWR and SHORAD step on each other\'s toes.
|
-- will match *any* string that contains the search string - hence we need to avoid that SAMs, EWR and SHORAD step on each other\'s toes.
|
||||||
@@ -127,10 +134,10 @@
|
|||||||
--
|
--
|
||||||
-- # 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.
|
||||||
--
|
--
|
||||||
@@ -142,6 +149,7 @@
|
|||||||
-- **Location** is of highest importance here. Whilst AWACS in DCS has almost the "all seeing eye", EWR don't have that. Choose your location wisely, against a mountain backdrop or inside a valley even the best EWR system
|
-- **Location** is of highest importance here. Whilst AWACS in DCS has almost the "all seeing eye", EWR don't have that. Choose your location wisely, against a mountain backdrop or inside a valley even the best EWR system
|
||||||
-- doesn't work well. Prefer higher-up locations with a good view; use F7 in-game to check where you actually placed your EWR and have a look around. Apart from the obvious choice, do also consider other radar units
|
-- doesn't work well. Prefer higher-up locations with a good view; use F7 in-game to check where you actually placed your EWR and have a look around. Apart from the obvious choice, do also consider other radar units
|
||||||
-- for this role, most have "SR" (search radar) or "STR" (search and track radar) in their names, use the encyclopedia to see what they actually do.
|
-- for this role, most have "SR" (search radar) or "STR" (search and track radar) in their names, use the encyclopedia to see what they actually do.
|
||||||
|
-- **HINT** Set at least one EWR on invisible and immortal so MANTIS doesn't stop working.
|
||||||
--
|
--
|
||||||
-- ## 1.2 SAM sites
|
-- ## 1.2 SAM sites
|
||||||
--
|
--
|
||||||
@@ -181,35 +189,41 @@
|
|||||||
--
|
--
|
||||||
-- ## 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
|
||||||
-- -- it is inside any AcceptZone. Then RejectZones are checked, which enforces both borders, but also overlaps of
|
-- -- it is inside any AcceptZone. Then RejectZones are checked, which enforces both borders, but also overlaps of
|
||||||
-- -- Accept- and RejectZones. Last, if it is inside a conflict zone, it is accepted.
|
-- -- Accept- and RejectZones. Last, if it is inside a conflict zone, it is accepted.
|
||||||
-- `mybluemantis:AddZones(AcceptZones,RejectZones,ConflictZones)`
|
-- mybluemantis:AddZones(AcceptZones,RejectZones,ConflictZones)
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
-- ### 2.1.2 Change the number of long-, mid- and short-range systems going live on a detected target:
|
-- ### 2.1.2 Change the number of long-, mid- and short-range, point defense systems going live on a detected target:
|
||||||
--
|
--
|
||||||
-- -- parameters are numbers. Defaults are 1,2,2,6 respectively
|
-- -- parameters are numbers. Defaults are 1,2,2,6,6 respectively
|
||||||
-- `mybluemantis:SetMaxActiveSAMs(Short,Mid,Long,Classic)`
|
-- mybluemantis:SetMaxActiveSAMs(Short,Mid,Long,Classic,Point)
|
||||||
--
|
--
|
||||||
-- ### 2.1.3 SHORAD will automatically be added from SAM sites of type "short-range"
|
-- ### 2.1.3 SHORAD/Point defense will automatically be added from SAM sites of type "point" or if the range is less than 5km or if the type is AAA.
|
||||||
--
|
--
|
||||||
-- ### 2.1.4 Advanced features
|
-- ### 2.1.4 Advanced features
|
||||||
--
|
--
|
||||||
-- -- switch off auto mode **before** you start MANTIS.
|
-- -- Option to set the scale of the activation range, i.e. don't activate at the fringes of max range, defaults below.
|
||||||
-- `mybluemantis.automode = false`
|
|
||||||
--
|
|
||||||
-- -- switch off auto shorad **before** you start MANTIS.
|
|
||||||
-- `mybluemantis.autoshorad = false`
|
|
||||||
--
|
|
||||||
-- -- 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
|
||||||
-- ` self.radiusscale[MANTIS.SamType.MEDIUM] = 1.2`
|
-- self.radiusscale[MANTIS.SamType.MEDIUM] = 1.2
|
||||||
-- ` self.radiusscale[MANTIS.SamType.SHORT] = 1.3`
|
-- self.radiusscale[MANTIS.SamType.SHORT] = 1.3
|
||||||
|
-- self.radiusscale[MANTIS.SamType.POINT] = 1.4
|
||||||
|
--
|
||||||
|
-- ### 2.1.5 Friendlies check in firing range
|
||||||
|
--
|
||||||
|
-- -- 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
|
||||||
|
--
|
||||||
|
-- ### 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]
|
||||||
--
|
--
|
||||||
@@ -233,25 +247,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]
|
-- # 5. Integrated SEAD
|
||||||
--
|
|
||||||
-- You can also choose to integrate Mantis with @{Functional.Shorad#SHORAD} for protection against HARMs and AGMs. 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
|
||||||
@@ -289,6 +285,7 @@ MANTIS = {
|
|||||||
SAM_Table_Long = {},
|
SAM_Table_Long = {},
|
||||||
SAM_Table_Medium = {},
|
SAM_Table_Medium = {},
|
||||||
SAM_Table_Short = {},
|
SAM_Table_Short = {},
|
||||||
|
SAM_Table_PointDef = {},
|
||||||
lid = "",
|
lid = "",
|
||||||
Detection = nil,
|
Detection = nil,
|
||||||
AWACS_Detection = nil,
|
AWACS_Detection = nil,
|
||||||
@@ -321,6 +318,12 @@ MANTIS = {
|
|||||||
automode = true,
|
automode = true,
|
||||||
autoshorad = true,
|
autoshorad = true,
|
||||||
ShoradGroupSet = nil,
|
ShoradGroupSet = nil,
|
||||||
|
checkforfriendlies = false,
|
||||||
|
SmokeDecoy = false,
|
||||||
|
SmokeDecoyColor = SMOKECOLOR.White,
|
||||||
|
checkcounter = 1,
|
||||||
|
DLinkCacheTime = 120,
|
||||||
|
logsamstatus = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Advanced state enumerator
|
--- Advanced state enumerator
|
||||||
@@ -337,8 +340,17 @@ MANTIS.SamType = {
|
|||||||
SHORT = "Short",
|
SHORT = "Short",
|
||||||
MEDIUM = "Medium",
|
MEDIUM = "Medium",
|
||||||
LONG = "Long",
|
LONG = "Long",
|
||||||
|
POINT = "Point",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
--- SAM Radiusscale
|
||||||
|
-- @type MANTIS.radiusscale
|
||||||
|
MANTIS.radiusscale = {}
|
||||||
|
MANTIS.radiusscale[MANTIS.SamType.LONG] = 1.1
|
||||||
|
MANTIS.radiusscale[MANTIS.SamType.MEDIUM] = 1.2
|
||||||
|
MANTIS.radiusscale[MANTIS.SamType.SHORT] = 1.75
|
||||||
|
MANTIS.radiusscale[MANTIS.SamType.POINT] = 3
|
||||||
|
|
||||||
--- SAM data
|
--- SAM data
|
||||||
-- @type MANTIS.SamData
|
-- @type MANTIS.SamData
|
||||||
-- @field #number Range Max firing range in km
|
-- @field #number Range Max firing range in km
|
||||||
@@ -346,10 +358,11 @@ MANTIS.SamType = {
|
|||||||
-- @field #number Height Max firing height in km
|
-- @field #number Height Max firing height in km
|
||||||
-- @field #string Type #MANTIS.SamType of SAM, i.e. SHORT, MEDIUM or LONG (range)
|
-- @field #string Type #MANTIS.SamType of SAM, i.e. SHORT, MEDIUM or LONG (range)
|
||||||
-- @field #string Radar Radar typename on unit level (used as key)
|
-- @field #string Radar Radar typename on unit level (used as key)
|
||||||
|
-- @field #string Point Point defense capable
|
||||||
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" },
|
||||||
@@ -357,24 +370,25 @@ 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="Short", 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="Short", Radar="Strela" },
|
["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" },
|
||||||
["SA-19"] = { Range=8, Blindspot=0, Height=3, Type="Short", Radar="Tunguska" },
|
["SA-19"] = { Range=8, Blindspot=0, Height=3, Type="Short", Radar="Tunguska" },
|
||||||
["SA-15"] = { Range=11, Blindspot=0, Height=6, Type="Short", Radar="Tor 9A331" },
|
["SA-15"] = { Range=11, Blindspot=0, Height=6, Type="Point", Radar="Tor 9A331", Point="true" },
|
||||||
["SA-13"] = { Range=5, Blindspot=0, Height=3, Type="Short", Radar="Strela" },
|
["SA-13"] = { Range=5, Blindspot=0, Height=3, Type="Point", Radar="Strela", Point="true" },
|
||||||
["Avenger"] = { Range=4, Blindspot=0, Height=3, Type="Short", Radar="Avenger" },
|
["Avenger"] = { Range=4, Blindspot=0, Height=3, Type="Short", Radar="Avenger" },
|
||||||
["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="Short", Radar="Linebacker" },
|
["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=30, 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" },
|
||||||
["SHORAD"] = { Range=3, Blindspot=0, Height=3, Type="Short", Radar="Igla" },
|
|
||||||
["TAMIR IDFA"] = { Range=20, Blindspot=0.6, Height=12.3, Type="Short", Radar="IRON_DOME_LN" },
|
["TAMIR IDFA"] = { Range=20, Blindspot=0.6, Height=12.3, Type="Short", Radar="IRON_DOME_LN" },
|
||||||
["STUNNER IDFA"] = { Range=250, Blindspot=1, Height=45, Type="Long", Radar="DAVID_SLING_LN" },
|
["STUNNER IDFA"] = { Range=250, Blindspot=1, Height=45, Type="Long", Radar="DAVID_SLING_LN" },
|
||||||
}
|
}
|
||||||
@@ -386,6 +400,7 @@ MANTIS.SamData = {
|
|||||||
-- @field #number Height Max firing height in km
|
-- @field #number Height Max firing height in km
|
||||||
-- @field #string Type #MANTIS.SamType of SAM, i.e. SHORT, MEDIUM or LONG (range)
|
-- @field #string Type #MANTIS.SamType of SAM, i.e. SHORT, MEDIUM or LONG (range)
|
||||||
-- @field #string Radar Radar typename on unit level (used as key)
|
-- @field #string Radar Radar typename on unit level (used as key)
|
||||||
|
-- @field #string Point Point defense capable
|
||||||
MANTIS.SamDataHDS = {
|
MANTIS.SamDataHDS = {
|
||||||
-- units from HDS Mod, multi launcher options is tricky
|
-- units from HDS Mod, multi launcher options is tricky
|
||||||
-- group name MUST contain HDS to ID launcher type correctly!
|
-- group name MUST contain HDS to ID launcher type correctly!
|
||||||
@@ -407,20 +422,21 @@ MANTIS.SamDataHDS = {
|
|||||||
-- @field #number Height Max firing height in km
|
-- @field #number Height Max firing height in km
|
||||||
-- @field #string Type #MANTIS.SamType of SAM, i.e. SHORT, MEDIUM or LONG (range)
|
-- @field #string Type #MANTIS.SamType of SAM, i.e. SHORT, MEDIUM or LONG (range)
|
||||||
-- @field #string Radar Radar typename on unit level (used as key)
|
-- @field #string Radar Radar typename on unit level (used as key)
|
||||||
|
-- @field #string Point Point defense capable
|
||||||
MANTIS.SamDataSMA = {
|
MANTIS.SamDataSMA = {
|
||||||
-- units from SMA Mod (Sweedish Military Assets)
|
-- units from SMA Mod (Sweedish Military Assets)
|
||||||
-- https://forum.dcs.world/topic/295202-swedish-military-assets-for-dcs-by-currenthill/
|
-- https://forum.dcs.world/topic/295202-swedish-military-assets-for-dcs-by-currenthill/
|
||||||
-- group name MUST contain SMA to ID launcher type correctly!
|
-- group name MUST contain SMA to ID launcher type correctly!
|
||||||
["RBS98M SMA"] = { Range=20, Blindspot=0, Height=8, Type="Short", Radar="RBS-98" },
|
["RBS98M SMA"] = { Range=20, Blindspot=0.2, Height=8, Type="Short", Radar="RBS-98" },
|
||||||
["RBS70 SMA"] = { Range=8, Blindspot=0, Height=5.5, Type="Short", Radar="RBS-70" },
|
["RBS70 SMA"] = { Range=8, Blindspot=0.25, Height=6, Type="Short", Radar="RBS-70" },
|
||||||
["RBS70M SMA"] = { Range=8, Blindspot=0, Height=5.5, Type="Short", Radar="BV410_RBS70" },
|
["RBS70M SMA"] = { Range=8, Blindspot=0.25, Height=6, Type="Short", Radar="BV410_RBS70" },
|
||||||
["RBS90 SMA"] = { Range=8, Blindspot=0, Height=5.5, Type="Short", Radar="RBS-90" },
|
["RBS90 SMA"] = { Range=8, Blindspot=0.25, Height=6, Type="Short", Radar="RBS-90" },
|
||||||
["RBS90M SMA"] = { Range=8, Blindspot=0, Height=5.5, Type="Short", Radar="BV410_RBS90" },
|
["RBS90M SMA"] = { Range=8, Blindspot=0.25, Height=6, Type="Short", Radar="BV410_RBS90" },
|
||||||
["RBS103A SMA"] = { Range=150, Blindspot=3, Height=24.5, Type="Long", Radar="LvS-103_Lavett103_Rb103A" },
|
["RBS103A SMA"] = { Range=160, Blindspot=1, Height=36, Type="Long", Radar="LvS-103_Lavett103_Rb103A" },
|
||||||
["RBS103B SMA"] = { Range=35, Blindspot=0, Height=36, Type="Medium", Radar="LvS-103_Lavett103_Rb103B" },
|
["RBS103B SMA"] = { Range=120, Blindspot=3, Height=24.5, Type="Long", Radar="LvS-103_Lavett103_Rb103B" },
|
||||||
["RBS103AM SMA"] = { Range=150, Blindspot=3, Height=24.5, Type="Long", Radar="LvS-103_Lavett103_HX_Rb103A" },
|
["RBS103AM SMA"] = { Range=160, Blindspot=1, Height=36, Type="Long", Radar="LvS-103_Lavett103_HX_Rb103A" },
|
||||||
["RBS103BM SMA"] = { Range=35, Blindspot=0, Height=36, Type="Medium", Radar="LvS-103_Lavett103_HX_Rb103B" },
|
["RBS103BM SMA"] = { Range=120, Blindspot=3, Height=24.5, Type="Long", Radar="LvS-103_Lavett103_HX_Rb103B" },
|
||||||
["Lvkv9040M SMA"] = { Range=4, Blindspot=0, Height=2.5, Type="Short", Radar="LvKv9040" },
|
["Lvkv9040M SMA"] = { Range=2, Blindspot=0.1, Height=1.2, Type="Point", Radar="LvKv9040",Point="true" },
|
||||||
}
|
}
|
||||||
|
|
||||||
--- SAM data CH
|
--- SAM data CH
|
||||||
@@ -430,28 +446,54 @@ MANTIS.SamDataSMA = {
|
|||||||
-- @field #number Height Max firing height in km
|
-- @field #number Height Max firing height in km
|
||||||
-- @field #string Type #MANTIS.SamType of SAM, i.e. SHORT, MEDIUM or LONG (range)
|
-- @field #string Type #MANTIS.SamType of SAM, i.e. SHORT, MEDIUM or LONG (range)
|
||||||
-- @field #string Radar Radar typename on unit level (used as key)
|
-- @field #string Radar Radar typename on unit level (used as key)
|
||||||
|
-- @field #string Point Point defense capable
|
||||||
MANTIS.SamDataCH = {
|
MANTIS.SamDataCH = {
|
||||||
-- units from CH (Military Assets by Currenthill)
|
-- units from CH (Military Assets by Currenthill)
|
||||||
-- https://www.currenthill.com/
|
-- https://www.currenthill.com/
|
||||||
-- group name MUST contain CHM to ID launcher type correctly!
|
-- group name MUST contain CHM to ID launcher type correctly!
|
||||||
["2S38 CH"] = { Range=8, Blindspot=0.5, Height=6, Type="Short", Radar="2S38" },
|
["2S38 CHM"] = { Range=6, Blindspot=0.1, Height=4.5, Type="Short", Radar="2S38" },
|
||||||
["PantsirS1 CH"] = { Range=20, Blindspot=1.2, Height=15, Type="Short", Radar="PantsirS1" },
|
["PantsirS1 CHM"] = { Range=20, Blindspot=1.2, Height=15, Type="Short", Radar="PantsirS1" },
|
||||||
["PantsirS2 CH"] = { Range=30, Blindspot=1.2, Height=18, Type="Medium", Radar="PantsirS2" },
|
["PantsirS2 CHM"] = { Range=30, Blindspot=1.2, Height=18, Type="Medium", Radar="PantsirS2" },
|
||||||
["PGL-625 CH"] = { Range=10, Blindspot=0.5, Height=5, Type="Short", Radar="PGL_625" },
|
["PGL-625 CHM"] = { Range=10, Blindspot=1, Height=5, Type="Short", Radar="PGL_625" },
|
||||||
["HQ-17A CH"] = { Range=20, Blindspot=1.5, Height=10, Type="Short", Radar="HQ17A" },
|
["HQ-17A CHM"] = { Range=15, Blindspot=1.5, Height=10, Type="Short", Radar="HQ17A" },
|
||||||
["M903PAC2 CH"] = { Range=160, Blindspot=3, Height=24.5, Type="Long", Radar="MIM104_M903_PAC2" },
|
["M903PAC2 CHM"] = { Range=120, Blindspot=3, Height=24.5, Type="Long", Radar="MIM104_M903_PAC2" },
|
||||||
["M903PAC3 CH"] = { Range=120, Blindspot=1, Height=40, Type="Long", Radar="MIM104_M903_PAC3" },
|
["M903PAC3 CHM"] = { Range=160, Blindspot=1, Height=40, Type="Long", Radar="MIM104_M903_PAC3" },
|
||||||
["TorM2 CH"] = { Range=12, Blindspot=1, Height=10, Type="Short", Radar="TorM2" },
|
["TorM2 CHM"] = { Range=12, Blindspot=1, Height=10, Type="Short", Radar="TorM2" },
|
||||||
["TorM2K CH"] = { Range=12, Blindspot=1, Height=10, Type="Short", Radar="TorM2K" },
|
["TorM2K CHM"] = { Range=12, Blindspot=1, Height=10, Type="Short", Radar="TorM2K" },
|
||||||
["TorM2M CH"] = { Range=16, Blindspot=1, Height=10, Type="Short", Radar="TorM2M" },
|
["TorM2M CHM"] = { Range=16, Blindspot=1, Height=10, Type="Short", Radar="TorM2M" },
|
||||||
["NASAMS3-AMRAAMER CH"] = { Range=50, Blindspot=2, Height=35.7, Type="Medium", Radar="CH_NASAMS3_LN_AMRAAM_ER" },
|
["NASAMS3-AMRAAMER CHM"] = { Range=50, Blindspot=2, Height=35.7, Type="Medium", Radar="CH_NASAMS3_LN_AMRAAM_ER" },
|
||||||
["NASAMS3-AIM9X2 CH"] = { Range=20, Blindspot=0.2, Height=18, Type="Short", Radar="CH_NASAMS3_LN_AIM9X2" },
|
["NASAMS3-AIM9X2 CHM"] = { Range=20, Blindspot=0.2, Height=18, Type="Short", Radar="CH_NASAMS3_LN_AIM9X2" },
|
||||||
["C-RAM CH"] = { Range=2, Blindspot=0, Height=2, Type="Short", Radar="CH_Centurion_C_RAM" },
|
["C-RAM CHM"] = { Range=2, Blindspot=0, Height=2, Type="Point", Radar="CH_Centurion_C_RAM", Point="true" },
|
||||||
["PGZ-09 CH"] = { Range=4, Blindspot=0, Height=3, Type="Short", Radar="CH_PGZ09" },
|
["PGZ-09 CHM"] = { Range=4, Blindspot=0.5, Height=3, Type="Point", Radar="CH_PGZ09", Point="true" },
|
||||||
["S350-9M100 CH"] = { Range=15, Blindspot=1.5, Height=8, Type="Short", Radar="CH_S350_50P6_9M100" },
|
["S350-9M100 CHM"] = { Range=15, Blindspot=1, Height=8, Type="Short", Radar="CH_S350_50P6_9M100" },
|
||||||
["S350-9M96D CH"] = { Range=150, Blindspot=2.5, Height=30, Type="Long", Radar="CH_S350_50P6_9M96D" },
|
["S350-9M96D CHM"] = { Range=150, Blindspot=2.5, Height=30, Type="Long", Radar="CH_S350_50P6_9M96D" },
|
||||||
["LAV-AD CH"] = { Range=8, Blindspot=0.2, Height=4.8, Type="Short", Radar="CH_LAVAD" },
|
["LAV-AD CHM"] = { Range=8, Blindspot=0.16, Height=4.8, Type="Short", Radar="CH_LAVAD" },
|
||||||
["HQ-22 CH"] = { Range=170, Blindspot=5, Height=27, Type="Long", Radar="CH_HQ22_LN" },
|
["HQ-22 CHM"] = { Range=170, Blindspot=5, Height=27, Type="Long", Radar="CH_HQ22_LN" },
|
||||||
|
["PGZ-95 CHM"] = { Range=2.5, Blindspot=0.5, Height=2, Type="Point", Radar="CH_PGZ95",Point="true" },
|
||||||
|
["LD-3000 CHM"] = { Range=2.5, Blindspot=0.1, Height=3, Type="Point", Radar="CH_LD3000_stationary", Point="true" },
|
||||||
|
["LD-3000M CHM"] = { Range=2.5, Blindspot=0.1, Height=3, Type="Point", Radar="CH_LD3000", Point="true" },
|
||||||
|
["FlaRakRad CHM"] = { Range=8, Blindspot=1.5, Height=6, Type="Short", Radar="CH_FlaRakRad" },
|
||||||
|
["IRIS-T SLM CHM"] = { Range=40, Blindspot=0.5, Height=20, Type="Medium", Radar="CH_IRIST_SLM" },
|
||||||
|
["M903PAC2KAT1 CHM"] = { Range=120, Blindspot=3, Height=24.5, Type="Long", Radar="CH_MIM104_M903_PAC2_KAT1" },
|
||||||
|
["Skynex CHM"] = { Range=3.5, Blindspot=0.1, Height=3.5, Type="Point", Radar="CH_SkynexHX", Point="true" },
|
||||||
|
["Skyshield CHM"] = { Range=3.5, Blindspot=0.1, Height=3.5, Type="Point", Radar="CH_Skyshield_Gun", Point="true" },
|
||||||
|
["WieselOzelot CHM"] = { Range=8, Blindspot=0.16, Height=4.8, Type="Short", Radar="CH_Wiesel2Ozelot" },
|
||||||
|
["BukM3-9M317M CHM"] = { Range=70, Blindspot=0.25, Height=35, Type="Medium", Radar="CH_BukM3_9A317M" },
|
||||||
|
["BukM3-9M317MA CHM"] = { Range=70, Blindspot=0.25, Height=35, Type="Medium", Radar="CH_BukM3_9A317MA" },
|
||||||
|
["SkySabre CHM"] = { Range=30, Blindspot=0.5, Height=10, Type="Medium", Radar="CH_SkySabreLN" },
|
||||||
|
["Stormer CHM"] = { Range=7.5, Blindspot=0.3, Height=7, Type="Short", Radar="CH_StormerHVM" },
|
||||||
|
["THAAD CHM"] = { Range=200, Blindspot=40, Height=150, Type="Long", Radar="CH_THAAD_M1120" },
|
||||||
|
["USInfantryFIM92K CHM"] = { Range=8, Blindspot=0.16, Height=4.8, Type="Short", Radar="CH_USInfantry_FIM92" },
|
||||||
|
["RBS98M CHM"] = { Range=20, Blindspot=0.2, Height=8, Type="Short", Radar="RBS-98" },
|
||||||
|
["RBS70 CHM"] = { Range=8, Blindspot=0.25, Height=6, Type="Short", Radar="RBS-70" },
|
||||||
|
["RBS70M CHM"] = { Range=8, Blindspot=0.25, Height=6, Type="Short", Radar="BV410_RBS70" },
|
||||||
|
["RBS90 CHM"] = { Range=8, Blindspot=0.25, Height=6, Type="Short", Radar="RBS-90" },
|
||||||
|
["RBS90M CHM"] = { Range=8, Blindspot=0.25, Height=6, Type="Short", Radar="BV410_RBS90" },
|
||||||
|
["RBS103A CHM"] = { Range=160, Blindspot=1, Height=36, Type="Long", Radar="LvS-103_Lavett103_Rb103A" },
|
||||||
|
["RBS103B CHM"] = { Range=120, Blindspot=3, Height=24.5, Type="Long", Radar="LvS-103_Lavett103_Rb103B" },
|
||||||
|
["RBS103AM CHM"] = { Range=160, Blindspot=1, Height=36, Type="Long", Radar="LvS-103_Lavett103_HX_Rb103A" },
|
||||||
|
["RBS103BM CHM"] = { Range=120, Blindspot=3, Height=24.5, Type="Long", Radar="LvS-103_Lavett103_HX_Rb103B" },
|
||||||
|
["Lvkv9040M CHM"] = { Range=2, Blindspot=0.1, Height=1.2, Type="Point", Radar="LvKv9040",Point="true" },
|
||||||
}
|
}
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@@ -503,6 +545,7 @@ do
|
|||||||
-- DONE: Allow tables of prefixes for the setup
|
-- DONE: Allow tables of prefixes for the setup
|
||||||
-- DONE: Auto-Mode with range setups for various known SAM types.
|
-- DONE: Auto-Mode with range setups for various known SAM types.
|
||||||
|
|
||||||
|
self.name = name or "mymantis"
|
||||||
self.SAM_Templates_Prefix = samprefix or "Red SAM"
|
self.SAM_Templates_Prefix = samprefix or "Red SAM"
|
||||||
self.EWR_Templates_Prefix = ewrprefix or "Red EWR"
|
self.EWR_Templates_Prefix = ewrprefix or "Red EWR"
|
||||||
self.HQ_Template_CC = hq or nil
|
self.HQ_Template_CC = hq or nil
|
||||||
@@ -511,6 +554,7 @@ do
|
|||||||
self.SAM_Table_Long = {}
|
self.SAM_Table_Long = {}
|
||||||
self.SAM_Table_Medium = {}
|
self.SAM_Table_Medium = {}
|
||||||
self.SAM_Table_Short = {}
|
self.SAM_Table_Short = {}
|
||||||
|
self.SAM_Table_PointDef = {}
|
||||||
self.dynamic = dynamic or false
|
self.dynamic = dynamic or false
|
||||||
self.checkradius = 25000
|
self.checkradius = 25000
|
||||||
self.grouping = 5000
|
self.grouping = 5000
|
||||||
@@ -539,10 +583,6 @@ do
|
|||||||
self.SuppressedGroups = {}
|
self.SuppressedGroups = {}
|
||||||
-- 0.8 additions
|
-- 0.8 additions
|
||||||
self.automode = true
|
self.automode = true
|
||||||
self.radiusscale = {}
|
|
||||||
self.radiusscale[MANTIS.SamType.LONG] = 1.1
|
|
||||||
self.radiusscale[MANTIS.SamType.MEDIUM] = 1.2
|
|
||||||
self.radiusscale[MANTIS.SamType.SHORT] = 1.3
|
|
||||||
--self.SAMCheckRanges = {}
|
--self.SAMCheckRanges = {}
|
||||||
self.usezones = false
|
self.usezones = false
|
||||||
self.AcceptZones = {}
|
self.AcceptZones = {}
|
||||||
@@ -551,6 +591,7 @@ do
|
|||||||
self.maxlongrange = 1
|
self.maxlongrange = 1
|
||||||
self.maxmidrange = 2
|
self.maxmidrange = 2
|
||||||
self.maxshortrange = 2
|
self.maxshortrange = 2
|
||||||
|
self.maxpointdefrange = 6
|
||||||
self.maxclassic = 6
|
self.maxclassic = 6
|
||||||
self.autoshorad = true
|
self.autoshorad = true
|
||||||
self.ShoradGroupSet = SET_GROUP:New() -- Core.Set#SET_GROUP
|
self.ShoradGroupSet = SET_GROUP:New() -- Core.Set#SET_GROUP
|
||||||
@@ -560,6 +601,9 @@ do
|
|||||||
self.SkateNumber = 3
|
self.SkateNumber = 3
|
||||||
self.shootandscoot = false
|
self.shootandscoot = false
|
||||||
|
|
||||||
|
self.SmokeDecoy = false
|
||||||
|
self.SmokeDecoyColor = SMOKECOLOR.White
|
||||||
|
|
||||||
self.UseEmOnOff = true
|
self.UseEmOnOff = true
|
||||||
if EmOnOff == false then
|
if EmOnOff == false then
|
||||||
self.UseEmOnOff = false
|
self.UseEmOnOff = false
|
||||||
@@ -571,6 +615,8 @@ 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)
|
||||||
|
|
||||||
@@ -603,6 +649,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)
|
||||||
@@ -629,9 +677,12 @@ do
|
|||||||
self.HQ_CC = GROUP:FindByName(self.HQ_Template_CC)
|
self.HQ_CC = GROUP:FindByName(self.HQ_Template_CC)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- counter for SAM table updates
|
||||||
|
self.checkcounter = 1
|
||||||
|
|
||||||
-- TODO Version
|
-- TODO Version
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
self.version="0.8.16"
|
self.version="0.9.30"
|
||||||
self:I(string.format("***** Starting MANTIS Version %s *****", self.version))
|
self:I(string.format("***** Starting MANTIS Version %s *****", self.version))
|
||||||
|
|
||||||
--- FSM Functions ---
|
--- FSM Functions ---
|
||||||
@@ -828,7 +879,7 @@ do
|
|||||||
self.AcceptZones = AcceptZones or {}
|
self.AcceptZones = AcceptZones or {}
|
||||||
self.RejectZones = RejectZones or {}
|
self.RejectZones = RejectZones or {}
|
||||||
self.ConflictZones = ConflictZones or {}
|
self.ConflictZones = ConflictZones or {}
|
||||||
if #AcceptZones > 0 or #RejectZones > 0 or #ConflictZones > 0 then
|
if #self.AcceptZones > 0 or #self.RejectZones > 0 or #self.ConflictZones > 0 then
|
||||||
self.usezones = true
|
self.usezones = true
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
@@ -867,19 +918,31 @@ do
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Function to set Short Range SAMs to spit out smoke as decoy, if an enemy plane is in range.
|
||||||
|
-- @param #MANTIS self
|
||||||
|
-- @param #boolean Onoff Set to true for on and nil/false for off.
|
||||||
|
-- @param #number Color (Optional) Color to use, defaults to `SMOKECOLOR.White`
|
||||||
|
function MANTIS:SetSmokeDecoy(Onoff,Color)
|
||||||
|
self.SmokeDecoy = Onoff
|
||||||
|
self.SmokeDecoyColor = Color or SMOKECOLOR.White
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Function to set number of SAMs going active on a valid, detected thread
|
--- Function to set number of SAMs going active on a valid, detected thread
|
||||||
-- @param #MANTIS self
|
-- @param #MANTIS self
|
||||||
-- @param #number Short Number of short-range systems activated, defaults to 1.
|
-- @param #number Short Number of short-range systems activated, defaults to 1.
|
||||||
-- @param #number Mid Number of mid-range systems activated, defaults to 2.
|
-- @param #number Mid Number of mid-range systems activated, defaults to 2.
|
||||||
-- @param #number Long Number of long-range systems activated, defaults to 2.
|
-- @param #number Long Number of long-range systems activated, defaults to 2.
|
||||||
-- @param #number Classic (non-automode) Number of overall systems activated, defaults to 6.
|
-- @param #number Classic (non-automode) Number of overall systems activated, defaults to 6.
|
||||||
|
-- @param #number Point Number of point defense and AAA systems activated, defaults to 6.
|
||||||
-- @return #MANTIS self
|
-- @return #MANTIS self
|
||||||
function MANTIS:SetMaxActiveSAMs(Short,Mid,Long,Classic)
|
function MANTIS:SetMaxActiveSAMs(Short,Mid,Long,Classic,Point)
|
||||||
self:T(self.lid .. "SetMaxActiveSAMs")
|
self:T(self.lid .. "SetMaxActiveSAMs")
|
||||||
self.maxclassic = Classic or 6
|
self.maxclassic = Classic or 6
|
||||||
self.maxlongrange = Long or 1
|
self.maxlongrange = Long or 1
|
||||||
self.maxmidrange = Mid or 2
|
self.maxmidrange = Mid or 2
|
||||||
self.maxshortrange = Short or 2
|
self.maxshortrange = Short or 2
|
||||||
|
self.maxpointdefrange= Point or 6
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -970,6 +1033,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
|
||||||
@@ -1082,6 +1155,24 @@ do
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- [Internal] Check if any EWR or AWACS is still alive
|
||||||
|
-- @param #MANTIS self
|
||||||
|
-- @return #boolean outcome
|
||||||
|
function MANTIS:_CheckAnyEWRAlive()
|
||||||
|
self:T(self.lid .. "_CheckAnyEWRAlive")
|
||||||
|
local alive = false
|
||||||
|
if self.EWR_Group:CountAlive() > 0 then
|
||||||
|
alive = true
|
||||||
|
end
|
||||||
|
if not alive and self.AWACS_Prefix then
|
||||||
|
local awacs = GROUP:FindByName(self.AWACS_Prefix)
|
||||||
|
if awacs and awacs:IsAlive() then
|
||||||
|
alive = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return alive
|
||||||
|
end
|
||||||
|
|
||||||
--- [Internal] Function to determine state of the advanced mode
|
--- [Internal] Function to determine state of the advanced mode
|
||||||
-- @param #MANTIS self
|
-- @param #MANTIS self
|
||||||
-- @return #number Newly calculated interval
|
-- @return #number Newly calculated interval
|
||||||
@@ -1222,10 +1313,10 @@ do
|
|||||||
function MANTIS:_PreFilterHeight(height)
|
function MANTIS:_PreFilterHeight(height)
|
||||||
self:T(self.lid.."_PreFilterHeight")
|
self:T(self.lid.."_PreFilterHeight")
|
||||||
local set = {}
|
local set = {}
|
||||||
local dlink = self.Detection -- Ops.Intelligence#INTEL_DLINK
|
local dlink = self.Detection -- Ops.Intel#INTEL_DLINK
|
||||||
local detectedgroups = dlink:GetContactTable()
|
local detectedgroups = dlink:GetContactTable()
|
||||||
for _,_contact in pairs(detectedgroups) do
|
for _,_contact in pairs(detectedgroups) do
|
||||||
local contact = _contact -- Ops.Intelligence#INTEL.Contact
|
local contact = _contact -- Ops.Intel#INTEL.Contact
|
||||||
local grp = contact.group -- Wrapper.Group#GROUP
|
local grp = contact.group -- Wrapper.Group#GROUP
|
||||||
if grp:IsAlive() then
|
if grp:IsAlive() then
|
||||||
if grp:GetHeight(true) < height then
|
if grp:GetHeight(true) < height then
|
||||||
@@ -1255,6 +1346,10 @@ do
|
|||||||
-- DEBUG
|
-- DEBUG
|
||||||
set = self:_PreFilterHeight(height)
|
set = self:_PreFilterHeight(height)
|
||||||
end
|
end
|
||||||
|
--self.friendlyset -- Core.Set#SET_GROUP
|
||||||
|
if self.checkforfriendlies == true and self.friendlyset == nil then
|
||||||
|
self.friendlyset = SET_GROUP:New():FilterCoalitions(self.Coalition):FilterCategories({"plane","helicopter"}):FilterFunction(function(grp) if grp and grp:InAir() then return true else return false end end):FilterStart()
|
||||||
|
end
|
||||||
for _,_coord in pairs (set) do
|
for _,_coord in pairs (set) do
|
||||||
local coord = _coord -- get current coord to check
|
local coord = _coord -- get current coord to check
|
||||||
-- output for cross-check
|
-- output for cross-check
|
||||||
@@ -1269,18 +1364,27 @@ do
|
|||||||
zonecheck = self:_CheckCoordinateInZones(coord)
|
zonecheck = self:_CheckCoordinateInZones(coord)
|
||||||
end
|
end
|
||||||
if self.verbose and self.debug then
|
if self.verbose and self.debug then
|
||||||
local dectstring = coord:ToStringLLDMS()
|
--local dectstring = coord:ToStringLLDMS()
|
||||||
local samstring = samcoordinate:ToStringLLDMS()
|
local samstring = samcoordinate:ToStringMGRS({MGRS_Accuracy=0})
|
||||||
|
samstring = string.gsub(samstring,"%s","")
|
||||||
local inrange = "false"
|
local inrange = "false"
|
||||||
if targetdistance <= rad then
|
if targetdistance <= rad then
|
||||||
inrange = "true"
|
inrange = "true"
|
||||||
end
|
end
|
||||||
local text = string.format("Checking SAM at %s | Targetdist %d | Rad %d | Inrange %s", samstring, targetdistance, rad, inrange)
|
local text = string.format("Checking SAM at %s | Tgtdist %.1fkm | Rad %.1fkm | Inrange %s", samstring, targetdistance/1000, rad/1000, inrange)
|
||||||
local m = MESSAGE:New(text,10,"Check"):ToAllIf(self.debug)
|
local m = MESSAGE:New(text,10,"Check"):ToAllIf(self.debug)
|
||||||
self:T(self.lid..text)
|
self:T(self.lid..text)
|
||||||
end
|
end
|
||||||
|
-- friendlies around?
|
||||||
|
local nofriendlies = true
|
||||||
|
if self.checkforfriendlies == true then
|
||||||
|
local closestfriend, distance = self.friendlyset:GetClosestGroup(samcoordinate)
|
||||||
|
if closestfriend and distance and distance < rad then
|
||||||
|
nofriendlies = false
|
||||||
|
end
|
||||||
|
end
|
||||||
-- end output to cross-check
|
-- end output to cross-check
|
||||||
if targetdistance <= rad and zonecheck then
|
if targetdistance <= rad and zonecheck == true and nofriendlies == true then
|
||||||
return true, targetdistance
|
return true, targetdistance
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1330,7 +1434,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)
|
||||||
@@ -1375,7 +1481,7 @@ do
|
|||||||
-- @return #string type Long, medium or short range
|
-- @return #string type Long, medium or short range
|
||||||
-- @return #number blind "blind" spot
|
-- @return #number blind "blind" spot
|
||||||
function MANTIS:_GetSAMDataFromUnits(grpname,mod,sma,chm)
|
function MANTIS:_GetSAMDataFromUnits(grpname,mod,sma,chm)
|
||||||
self:T(self.lid.."_GetSAMRangeFromUnits")
|
self:T(self.lid.."_GetSAMDataFromUnits")
|
||||||
local found = false
|
local found = false
|
||||||
local range = self.checkradius
|
local range = self.checkradius
|
||||||
local height = 3000
|
local height = 3000
|
||||||
@@ -1392,7 +1498,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())
|
||||||
@@ -1414,6 +1520,17 @@ do
|
|||||||
end
|
end
|
||||||
if found then break end
|
if found then break end
|
||||||
end
|
end
|
||||||
|
--- AAA or Point Defense
|
||||||
|
if not found then
|
||||||
|
local grp = GROUP:FindByName(grpname)
|
||||||
|
if (grp and grp:IsAlive() and grp:IsAAA()) or string.find(grpname,"AAA",1,true) then
|
||||||
|
range = 2000
|
||||||
|
height = 2000
|
||||||
|
blind = 50
|
||||||
|
type = MANTIS.SamType.POINT
|
||||||
|
found = true
|
||||||
|
end
|
||||||
|
end
|
||||||
if not found then
|
if not found then
|
||||||
self:E(self.lid .. string.format("*****Could not match radar data for %s! Will default to midrange values!",grpname))
|
self:E(self.lid .. string.format("*****Could not match radar data for %s! Will default to midrange values!",grpname))
|
||||||
end
|
end
|
||||||
@@ -1428,7 +1545,7 @@ do
|
|||||||
-- @return #string type Long, medium or short range
|
-- @return #string type Long, medium or short range
|
||||||
-- @return #number blind "blind" spot
|
-- @return #number blind "blind" spot
|
||||||
function MANTIS:_GetSAMRange(grpname)
|
function MANTIS:_GetSAMRange(grpname)
|
||||||
self:T(self.lid.."_GetSAMRange")
|
self:T(self.lid.."_GetSAMRange for "..tostring(grpname))
|
||||||
local range = self.checkradius
|
local range = self.checkradius
|
||||||
local height = 3000
|
local height = 3000
|
||||||
local type = MANTIS.SamType.MEDIUM
|
local type = MANTIS.SamType.MEDIUM
|
||||||
@@ -1445,9 +1562,9 @@ do
|
|||||||
elseif string.find(grpname,"CHM",1,true) then
|
elseif string.find(grpname,"CHM",1,true) then
|
||||||
CHMod = true
|
CHMod = true
|
||||||
end
|
end
|
||||||
if self.automode then
|
--if self.automode then
|
||||||
for idx,entry in pairs(self.SamData) do
|
for idx,entry in pairs(self.SamData) do
|
||||||
--self:I("ID = " .. idx)
|
self:T2("ID = " .. idx)
|
||||||
if string.find(grpname,idx,1,true) then
|
if string.find(grpname,idx,1,true) then
|
||||||
local _entry = entry -- #MANTIS.SamData
|
local _entry = entry -- #MANTIS.SamData
|
||||||
type = _entry.Type
|
type = _entry.Type
|
||||||
@@ -1455,18 +1572,32 @@ do
|
|||||||
range = _entry.Range * 1000 * radiusscale -- max firing range
|
range = _entry.Range * 1000 * radiusscale -- max firing range
|
||||||
height = _entry.Height * 1000 -- max firing height
|
height = _entry.Height * 1000 -- max firing height
|
||||||
blind = _entry.Blindspot
|
blind = _entry.Blindspot
|
||||||
--self:I("Matching Groupname = " .. grpname .. " Range= " .. range)
|
self:T("Matching Groupname = " .. grpname .. " Range= " .. range)
|
||||||
found = true
|
found = true
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
--end
|
||||||
|
--- Secondary - AAA or Point Defense
|
||||||
|
if not found then
|
||||||
|
local grp = GROUP:FindByName(grpname)
|
||||||
|
if (grp and grp:IsAlive() and grp:IsAAA()) or string.find(grpname,"AAA",1,true) then
|
||||||
|
range = 2000
|
||||||
|
height = 2000
|
||||||
|
blind = 50
|
||||||
|
type = MANTIS.SamType.POINT
|
||||||
|
found = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
-- secondary filter if not found
|
--- Tertiary filter if not found
|
||||||
if (not found and self.automode) or HDSmod or SMAMod or CHMod then
|
if (not found) or HDSmod or SMAMod or CHMod then
|
||||||
range, height, type = self:_GetSAMDataFromUnits(grpname,HDSmod,SMAMod,CHMod)
|
range, height, type = self:_GetSAMDataFromUnits(grpname,HDSmod,SMAMod,CHMod)
|
||||||
elseif not found then
|
elseif not found then
|
||||||
self:E(self.lid .. string.format("*****Could not match radar data for %s! Will default to midrange values!",grpname))
|
self:E(self.lid .. string.format("*****Could not match radar data for %s! Will default to midrange values!",grpname))
|
||||||
end
|
end
|
||||||
|
if found and string.find(grpname,"SHORAD",1,true) then
|
||||||
|
type = MANTIS.SamType.POINT -- force short on match
|
||||||
|
end
|
||||||
return range, height, type, blind
|
return range, height, type, blind
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1484,6 +1615,7 @@ do
|
|||||||
local SAM_Tbl_lg = {} -- table of long range SAM defense zones
|
local SAM_Tbl_lg = {} -- table of long range SAM defense zones
|
||||||
local SAM_Tbl_md = {} -- table of mid range SAM defense zones
|
local SAM_Tbl_md = {} -- table of mid range SAM defense zones
|
||||||
local SAM_Tbl_sh = {} -- table of short range SAM defense zones
|
local SAM_Tbl_sh = {} -- table of short range SAM defense zones
|
||||||
|
local SAM_Tbl_pt = {} -- table of point defense/AAA
|
||||||
local SEAD_Grps = {} -- table of SAM names to make evasive
|
local SEAD_Grps = {} -- table of SAM names to make evasive
|
||||||
local engagerange = self.engagerange -- firing range in % of max
|
local engagerange = self.engagerange -- firing range in % of max
|
||||||
--cycle through groups and set alarm state etc
|
--cycle through groups and set alarm state etc
|
||||||
@@ -1502,19 +1634,23 @@ 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)
|
||||||
table.insert( SAM_Tbl, {grpname, grpcoord, grprange, grpheight, blind})
|
table.insert( SAM_Tbl, {grpname, grpcoord, grprange, grpheight, blind, type})
|
||||||
--table.insert( SEAD_Grps, grpname )
|
--table.insert( SEAD_Grps, grpname )
|
||||||
if type == MANTIS.SamType.LONG then
|
if type == MANTIS.SamType.LONG then
|
||||||
table.insert( SAM_Tbl_lg, {grpname, grpcoord, grprange, grpheight, blind})
|
table.insert( SAM_Tbl_lg, {grpname, grpcoord, grprange, grpheight, blind, type})
|
||||||
table.insert( SEAD_Grps, grpname )
|
table.insert( SEAD_Grps, grpname )
|
||||||
--self:T("SAM "..grpname.." is type LONG")
|
self:T("SAM "..grpname.." is type LONG")
|
||||||
elseif type == MANTIS.SamType.MEDIUM then
|
elseif type == MANTIS.SamType.MEDIUM then
|
||||||
table.insert( SAM_Tbl_md, {grpname, grpcoord, grprange, grpheight, blind})
|
table.insert( SAM_Tbl_md, {grpname, grpcoord, grprange, grpheight, blind, type})
|
||||||
table.insert( SEAD_Grps, grpname )
|
table.insert( SEAD_Grps, grpname )
|
||||||
--self:T("SAM "..grpname.." is type MEDIUM")
|
self:T("SAM "..grpname.." is type MEDIUM")
|
||||||
elseif type == MANTIS.SamType.SHORT then
|
elseif type == MANTIS.SamType.SHORT then
|
||||||
table.insert( SAM_Tbl_sh, {grpname, grpcoord, grprange, grpheight, blind})
|
table.insert( SAM_Tbl_sh, {grpname, grpcoord, grprange, grpheight, blind, type})
|
||||||
--self:T("SAM "..grpname.." is type SHORT")
|
table.insert( SEAD_Grps, grpname )
|
||||||
|
self:T("SAM "..grpname.." is type SHORT")
|
||||||
|
elseif type == MANTIS.SamType.POINT then
|
||||||
|
table.insert( SAM_Tbl_pt, {grpname, grpcoord, grprange, grpheight, blind, type})
|
||||||
|
self:T("SAM "..grpname.." is type POINT")
|
||||||
self.ShoradGroupSet:Add(grpname,group)
|
self.ShoradGroupSet:Add(grpname,group)
|
||||||
if not self.autoshorad then
|
if not self.autoshorad then
|
||||||
table.insert( SEAD_Grps, grpname )
|
table.insert( SEAD_Grps, grpname )
|
||||||
@@ -1527,6 +1663,7 @@ do
|
|||||||
self.SAM_Table_Long = SAM_Tbl_lg
|
self.SAM_Table_Long = SAM_Tbl_lg
|
||||||
self.SAM_Table_Medium = SAM_Tbl_md
|
self.SAM_Table_Medium = SAM_Tbl_md
|
||||||
self.SAM_Table_Short = SAM_Tbl_sh
|
self.SAM_Table_Short = SAM_Tbl_sh
|
||||||
|
self.SAM_Table_PointDef = SAM_Tbl_pt
|
||||||
-- make SAMs evasive
|
-- make SAMs evasive
|
||||||
local mysead = SEAD:New( SEAD_Grps, self.Padding ) -- Functional.Sead#SEAD
|
local mysead = SEAD:New( SEAD_Grps, self.Padding ) -- Functional.Sead#SEAD
|
||||||
mysead:SetEngagementRange(engagerange)
|
mysead:SetEngagementRange(engagerange)
|
||||||
@@ -1550,7 +1687,8 @@ do
|
|||||||
local SAM_Tbl = {} -- table of SAM defense zones
|
local SAM_Tbl = {} -- table of SAM defense zones
|
||||||
local SAM_Tbl_lg = {} -- table of long range SAM defense zones
|
local SAM_Tbl_lg = {} -- table of long range SAM defense zones
|
||||||
local SAM_Tbl_md = {} -- table of mid range SAM defense zones
|
local SAM_Tbl_md = {} -- table of mid range SAM defense zones
|
||||||
local SAM_Tbl_sh = {} -- table of short range SAM defense zon
|
local SAM_Tbl_sh = {} -- table of short range SAM defense zones
|
||||||
|
local SAM_Tbl_pt = {} -- table of point defense/AAA
|
||||||
local SEAD_Grps = {} -- table of SAM names to make evasive
|
local SEAD_Grps = {} -- table of SAM names to make evasive
|
||||||
local engagerange = self.engagerange -- firing range in % of max
|
local engagerange = self.engagerange -- firing range in % of max
|
||||||
--cycle through groups and set alarm state etc
|
--cycle through groups and set alarm state etc
|
||||||
@@ -1561,17 +1699,23 @@ 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)
|
||||||
table.insert( SAM_Tbl, {grpname, grpcoord, grprange, grpheight, blind}) -- make the table lighter, as I don't really use the zone here
|
-- 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( SEAD_Grps, grpname )
|
table.insert( SEAD_Grps, grpname )
|
||||||
if type == MANTIS.SamType.LONG then
|
if type == MANTIS.SamType.LONG and radaralive then
|
||||||
table.insert( SAM_Tbl_lg, {grpname, grpcoord, grprange, grpheight, blind})
|
table.insert( SAM_Tbl_lg, {grpname, grpcoord, grprange, grpheight, blind, type})
|
||||||
--self:I({grpname,grprange, grpheight})
|
self:T({grpname,grprange, grpheight})
|
||||||
elseif type == MANTIS.SamType.MEDIUM then
|
elseif type == MANTIS.SamType.MEDIUM and radaralive then
|
||||||
table.insert( SAM_Tbl_md, {grpname, grpcoord, grprange, grpheight, blind})
|
table.insert( SAM_Tbl_md, {grpname, grpcoord, grprange, grpheight, blind, type})
|
||||||
--self:I({grpname,grprange, grpheight})
|
self:T({grpname,grprange, grpheight})
|
||||||
elseif type == MANTIS.SamType.SHORT then
|
elseif type == MANTIS.SamType.SHORT and radaralive then
|
||||||
table.insert( SAM_Tbl_sh, {grpname, grpcoord, grprange, grpheight, blind})
|
table.insert( SAM_Tbl_sh, {grpname, grpcoord, grprange, grpheight, blind, type})
|
||||||
-- self:I({grpname,grprange, grpheight})
|
self:T({grpname,grprange, grpheight})
|
||||||
|
elseif type == MANTIS.SamType.POINT or (not radaralive) then
|
||||||
|
table.insert( SAM_Tbl_pt, {grpname, grpcoord, grprange, grpheight, blind, type})
|
||||||
|
self:T({grpname,grprange, grpheight})
|
||||||
self.ShoradGroupSet:Add(grpname,group)
|
self.ShoradGroupSet:Add(grpname,group)
|
||||||
if self.autoshorad then
|
if self.autoshorad then
|
||||||
self.Shorad.Groupset = self.ShoradGroupSet
|
self.Shorad.Groupset = self.ShoradGroupSet
|
||||||
@@ -1583,6 +1727,7 @@ do
|
|||||||
self.SAM_Table_Long = SAM_Tbl_lg
|
self.SAM_Table_Long = SAM_Tbl_lg
|
||||||
self.SAM_Table_Medium = SAM_Tbl_md
|
self.SAM_Table_Medium = SAM_Tbl_md
|
||||||
self.SAM_Table_Short = SAM_Tbl_sh
|
self.SAM_Table_Short = SAM_Tbl_sh
|
||||||
|
self.SAM_Table_PointDef = SAM_Tbl_pt
|
||||||
-- make SAMs evasive
|
-- make SAMs evasive
|
||||||
if self.mysead ~= nil then
|
if self.mysead ~= nil then
|
||||||
local mysead = self.mysead
|
local mysead = self.mysead
|
||||||
@@ -1626,20 +1771,33 @@ do
|
|||||||
-- @param #table detset Table of COORDINATES
|
-- @param #table detset Table of COORDINATES
|
||||||
-- @param #boolean dlink Using DLINK
|
-- @param #boolean dlink Using DLINK
|
||||||
-- @param #number limit of SAM sites to go active on a contact
|
-- @param #number limit of SAM sites to go active on a contact
|
||||||
-- @return #MANTIS self
|
-- @return #number instatusred
|
||||||
|
-- @return #number instatusgreen
|
||||||
|
-- @return #number activeshorads
|
||||||
function MANTIS:_CheckLoop(samset,detset,dlink,limit)
|
function MANTIS:_CheckLoop(samset,detset,dlink,limit)
|
||||||
self:T(self.lid .. "CheckLoop " .. #detset .. " Coordinates")
|
self:T(self.lid .. "CheckLoop " .. #detset .. " Coordinates")
|
||||||
local switchedon = 0
|
local switchedon = 0
|
||||||
|
local instatusred = 0
|
||||||
|
local instatusgreen = 0
|
||||||
|
local activeshorads = 0
|
||||||
|
local SEADactive = 0
|
||||||
for _,_data in pairs (samset) do
|
for _,_data in pairs (samset) do
|
||||||
local samcoordinate = _data[2]
|
local samcoordinate = _data[2]
|
||||||
local name = _data[1]
|
local name = _data[1]
|
||||||
local radius = _data[3]
|
local radius = _data[3]
|
||||||
local height = _data[4]
|
local height = _data[4]
|
||||||
local blind = _data[5] * 1.25 + 1
|
local blind = _data[5] * 1.25 + 1
|
||||||
|
local shortsam = (_data[6] == MANTIS.SamType.SHORT) and true or false
|
||||||
|
if not shortsam then
|
||||||
|
shortsam = (_data[6] == MANTIS.SamType.POINT) and true or false
|
||||||
|
end
|
||||||
local samgroup = GROUP:FindByName(name)
|
local samgroup = GROUP:FindByName(name)
|
||||||
local IsInZone, Distance = self:_CheckObjectInZone(detset, samcoordinate, radius, height, dlink)
|
local IsInZone, Distance = self:_CheckObjectInZone(detset, samcoordinate, radius, height, dlink)
|
||||||
local suppressed = self.SuppressedGroups[name] or false
|
local suppressed = self.SuppressedGroups[name] or false
|
||||||
local activeshorad = self.Shorad.ActiveGroups[name] or false
|
local activeshorad = false
|
||||||
|
if self.Shorad and self.Shorad.ActiveGroups and self.Shorad.ActiveGroups[name] then
|
||||||
|
activeshorad = true
|
||||||
|
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
|
||||||
@@ -1658,6 +1816,17 @@ do
|
|||||||
self:__RedState(1,samgroup)
|
self:__RedState(1,samgroup)
|
||||||
self.SamStateTracker[name] = "RED"
|
self.SamStateTracker[name] = "RED"
|
||||||
end
|
end
|
||||||
|
-- TODO doesn't work
|
||||||
|
if shortsam == true and self.SmokeDecoy == true then
|
||||||
|
self:T("Smoking")
|
||||||
|
local units = samgroup:GetUnits() or {}
|
||||||
|
local smoke = self.SmokeDecoyColor or SMOKECOLOR.White
|
||||||
|
for _,unit in pairs(units) do
|
||||||
|
if unit and unit:IsAlive() then
|
||||||
|
unit:GetCoordinate():Smoke(smoke)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
-- 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
|
||||||
@@ -1670,7 +1839,7 @@ do
|
|||||||
-- debug output
|
-- debug output
|
||||||
if (self.debug or self.verbose) and switch then
|
if (self.debug or self.verbose) and switch then
|
||||||
local text = string.format("SAM %s in alarm state RED!", name)
|
local text = string.format("SAM %s in alarm state RED!", name)
|
||||||
local m=MESSAGE:New(text,10,"MANTIS"):ToAllIf(self.debug)
|
--local m=MESSAGE:New(text,10,"MANTIS"):ToAllIf(self.debug
|
||||||
if self.verbose then self:I(self.lid..text) end
|
if self.verbose then self:I(self.lid..text) end
|
||||||
end
|
end
|
||||||
end --end alive
|
end --end alive
|
||||||
@@ -1688,41 +1857,81 @@ do
|
|||||||
end
|
end
|
||||||
if self.debug or self.verbose then
|
if self.debug or self.verbose then
|
||||||
local text = string.format("SAM %s in alarm state GREEN!", name)
|
local text = string.format("SAM %s in alarm state GREEN!", name)
|
||||||
local m=MESSAGE:New(text,10,"MANTIS"):ToAllIf(self.debug)
|
--local m=MESSAGE:New(text,10,"MANTIS"):ToAllIf(self.debug)
|
||||||
if self.verbose then self:I(self.lid..text) end
|
if self.verbose then self:I(self.lid..text) end
|
||||||
end
|
end
|
||||||
end --end alive
|
end --end alive
|
||||||
end --end check
|
end --end check
|
||||||
end --for for loop
|
end --for loop
|
||||||
return self
|
if self.debug or self.verbose or self.logsamstatus then
|
||||||
|
for _,_status in pairs(self.SamStateTracker) do
|
||||||
|
if _status == "GREEN" then
|
||||||
|
instatusgreen=instatusgreen+1
|
||||||
|
elseif _status == "RED" then
|
||||||
|
instatusred=instatusred+1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if self.Shorad then
|
||||||
|
for _,_name in pairs(self.Shorad.ActiveGroups or {}) do
|
||||||
|
activeshorads=activeshorads+1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return instatusred, instatusgreen, activeshorads
|
||||||
end
|
end
|
||||||
|
|
||||||
--- [Internal] Check detection function
|
--- [Internal] Check detection function
|
||||||
-- @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()
|
||||||
--self:T("Check:", {detset})
|
--self:T("Check:", {detset})
|
||||||
-- randomly update SAM Table
|
-- update SAM Table evey 3 runs
|
||||||
local rand = math.random(1,100)
|
if self.checkcounter%3 == 0 then
|
||||||
if rand > 65 then -- 1/3 of cases
|
|
||||||
self:_RefreshSAMTable()
|
self:_RefreshSAMTable()
|
||||||
end
|
end
|
||||||
|
self.checkcounter = self.checkcounter + 1
|
||||||
|
local instatusred = 0
|
||||||
|
local instatusgreen = 0
|
||||||
|
local activeshorads = 0
|
||||||
-- switch SAMs on/off if (n)one of the detected groups is inside their reach
|
-- switch SAMs on/off if (n)one of the detected groups is inside their reach
|
||||||
if self.automode then
|
if self.automode then
|
||||||
local samset = self.SAM_Table_Long -- table of i.1=names, i.2=coordinates, i.3=firing range, i.4=firing height
|
local samset = self.SAM_Table_Long -- table of i.1=names, i.2=coordinates, i.3=firing range, i.4=firing height
|
||||||
self:_CheckLoop(samset,detset,dlink,self.maxlongrange)
|
local instatusredl, instatusgreenl, activeshoradsl = self:_CheckLoop(samset,detset,dlink,self.maxlongrange)
|
||||||
local samset = self.SAM_Table_Medium -- table of i.1=names, i.2=coordinates, i.3=firing range, i.4=firing height
|
local samset = self.SAM_Table_Medium -- table of i.1=names, i.2=coordinates, i.3=firing range, i.4=firing height
|
||||||
self:_CheckLoop(samset,detset,dlink,self.maxmidrange)
|
local instatusredm, instatusgreenm, activeshoradsm = self:_CheckLoop(samset,detset,dlink,self.maxmidrange)
|
||||||
local samset = self.SAM_Table_Short -- table of i.1=names, i.2=coordinates, i.3=firing range, i.4=firing height
|
local samset = self.SAM_Table_Short -- table of i.1=names, i.2=coordinates, i.3=firing range, i.4=firing height
|
||||||
self:_CheckLoop(samset,detset,dlink,self.maxshortrange)
|
local instatusreds, instatusgreens, activeshoradss = self:_CheckLoop(samset,detset,dlink,self.maxshortrange)
|
||||||
|
local samset = self.SAM_Table_PointDef -- 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.maxpointdefrange)
|
||||||
else
|
else
|
||||||
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
|
||||||
self:_CheckLoop(samset,detset,dlink,self.maxclassic)
|
instatusred, instatusgreen, activeshorads = self:_CheckLoop(samset,detset,dlink,self.maxclassic)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function GetReport()
|
||||||
|
local statusreport = REPORT:New("\nMANTIS Status "..self.name)
|
||||||
|
statusreport:Add("+-----------------------------+")
|
||||||
|
statusreport:Add(string.format("+ SAM in RED State: %2d",instatusred))
|
||||||
|
statusreport:Add(string.format("+ SAM in GREEN State: %2d",instatusgreen))
|
||||||
|
if self.Shorad then
|
||||||
|
statusreport:Add(string.format("+ SHORAD active: %2d",activeshorads))
|
||||||
|
end
|
||||||
|
statusreport:Add("+-----------------------------+")
|
||||||
|
return statusreport
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.debug or self.verbose then
|
||||||
|
local statusreport = GetReport()
|
||||||
|
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
|
||||||
@@ -1777,7 +1986,7 @@ do
|
|||||||
-- @return #MANTIS self
|
-- @return #MANTIS self
|
||||||
function MANTIS:_CheckDLinkState()
|
function MANTIS:_CheckDLinkState()
|
||||||
self:T(self.lid .. "_CheckDLinkState")
|
self:T(self.lid .. "_CheckDLinkState")
|
||||||
local dlink = self.Detection -- Ops.Intelligence#INTEL_DLINK
|
local dlink = self.Detection -- Ops.Intel#INTEL_DLINK
|
||||||
local TS = timer.getAbsTime()
|
local TS = timer.getAbsTime()
|
||||||
if not dlink:Is("Running") and (TS - self.DLTimeStamp > 29) then
|
if not dlink:Is("Running") and (TS - self.DLTimeStamp > 29) then
|
||||||
self.DLink = false
|
self.DLink = false
|
||||||
@@ -1807,7 +2016,7 @@ do
|
|||||||
end
|
end
|
||||||
--]]
|
--]]
|
||||||
if self.autoshorad then
|
if self.autoshorad then
|
||||||
self.Shorad = SHORAD:New(self.name.."-SHORAD",self.name.."-SHORAD",self.SAM_Group,self.ShoradActDistance,self.ShoradTime,self.coalition,self.UseEmOnOff)
|
self.Shorad = SHORAD:New(self.name.."-SHORAD","SHORAD",self.SAM_Group,self.ShoradActDistance,self.ShoradTime,self.coalition,self.UseEmOnOff)
|
||||||
self.Shorad:SetDefenseLimits(80,95)
|
self.Shorad:SetDefenseLimits(80,95)
|
||||||
self.ShoradLink = true
|
self.ShoradLink = true
|
||||||
self.Shorad.Groupset=self.ShoradGroupSet
|
self.Shorad.Groupset=self.ShoradGroupSet
|
||||||
@@ -1830,14 +2039,36 @@ 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
|
||||||
|
|
||||||
--[[ check Awacs
|
local EWRAlive = self:_CheckAnyEWRAlive()
|
||||||
if self.advAwacs and not self.state2flag then
|
|
||||||
self:_Check(self.AWACS_Detection,false)
|
local function FindSAMSRTR()
|
||||||
|
for i=1,1000 do
|
||||||
|
local randomsam = self.SAM_Group:GetRandom()
|
||||||
|
if randomsam and randomsam:IsAlive() then
|
||||||
|
if randomsam:IsSAM() then return randomsam end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Switch on a random SR/TR if no EWR left over
|
||||||
|
if not EWRAlive then
|
||||||
|
local randomsam = FindSAMSRTR() -- Wrapper.Group#GROUP
|
||||||
|
if randomsam and randomsam:IsAlive() then
|
||||||
|
if self.UseEmOnOff then
|
||||||
|
randomsam:EnableEmission(true)
|
||||||
|
else
|
||||||
|
randomsam:OptionAlarmStateRed()
|
||||||
|
end
|
||||||
|
local name = randomsam:GetName()
|
||||||
|
if self.SamStateTracker[name] ~= "RED" then
|
||||||
|
self:__RedState(1,randomsam)
|
||||||
|
self.SamStateTracker[name] = "RED"
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
--]]
|
|
||||||
|
|
||||||
-- relocate HQ and EWR
|
-- relocate HQ and EWR
|
||||||
if self.autorelocate then
|
if self.autorelocate then
|
||||||
@@ -1847,8 +2078,6 @@ do
|
|||||||
|
|
||||||
local halfintv = math.floor(timepassed / relointerval)
|
local halfintv = math.floor(timepassed / relointerval)
|
||||||
|
|
||||||
--self:T({timepassed=timepassed, halfintv=halfintv})
|
|
||||||
|
|
||||||
if halfintv >= 1 then
|
if halfintv >= 1 then
|
||||||
self.TimeStamp = timer.getAbsTime()
|
self.TimeStamp = timer.getAbsTime()
|
||||||
self:_Relocate()
|
self:_Relocate()
|
||||||
@@ -1977,7 +2206,7 @@ do
|
|||||||
local Shorad = self.Shorad
|
local Shorad = self.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, nil, true)
|
||||||
self:__ShoradActivated(1,Name, radius, ontime)
|
self:__ShoradActivated(1,Name, radius, ontime)
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
|
|||||||
@@ -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.
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -2052,6 +2052,10 @@ function RAT:_InitAircraft(DCSgroup)
|
|||||||
self.aircraft.length=16
|
self.aircraft.length=16
|
||||||
self.aircraft.height=5
|
self.aircraft.height=5
|
||||||
self.aircraft.width=9
|
self.aircraft.width=9
|
||||||
|
elseif DCStype == "Saab340" then -- <- These lines added
|
||||||
|
self.aircraft.length=19.73 -- <- These lines added
|
||||||
|
self.aircraft.height=6.97 -- <- These lines added
|
||||||
|
self.aircraft.width=21.44 -- <- These lines added
|
||||||
end
|
end
|
||||||
self.aircraft.box=math.max(self.aircraft.length,self.aircraft.width)
|
self.aircraft.box=math.max(self.aircraft.length,self.aircraft.width)
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
-- Implementation is based on the [Simple Range Script](https://forums.eagle.ru/showthread.php?t=157991) by Ciribob, which itself was motivated
|
-- Implementation is based on the [Simple Range Script](https://forums.eagle.ru/showthread.php?t=157991) by Ciribob, which itself was motivated
|
||||||
-- by a script by SNAFU [see here](https://forums.eagle.ru/showthread.php?t=109174).
|
-- by a script by SNAFU [see here](https://forums.eagle.ru/showthread.php?t=109174).
|
||||||
--
|
--
|
||||||
-- [476th - Air Weapons Range Objects mod](http://www.476vfightergroup.com/downloads.php?do=file&id=287) is highly recommended for this class.
|
-- [476th - Air Weapons Range Objects mod](https://www.476vfightergroup.com/downloads.php?do=download&downloadid=482) is highly recommended for this class.
|
||||||
--
|
--
|
||||||
-- **Main Features:**
|
-- **Main Features:**
|
||||||
--
|
--
|
||||||
@@ -106,6 +106,10 @@
|
|||||||
-- @field Sound.SRS#MSRS instructmsrs SRS wrapper for range instructor.
|
-- @field Sound.SRS#MSRS instructmsrs SRS wrapper for range instructor.
|
||||||
-- @field Sound.SRS#MSRSQUEUE instructsrsQ SRS queue for range instructor.
|
-- @field Sound.SRS#MSRSQUEUE instructsrsQ SRS queue for range instructor.
|
||||||
-- @field #number Coalition Coalition side for the menu, if any.
|
-- @field #number Coalition Coalition side for the menu, if any.
|
||||||
|
-- @field Core.Menu#MENU_MISSION menuF10root Specific user defined root F10 menu.
|
||||||
|
-- @field #number ceilingaltitude Range ceiling altitude in ft MSL. Aircraft above this altitude are not considered to be in the range. Default is 20000 ft.
|
||||||
|
-- @field #boolean ceilingenabled Range has a ceiling and is not unlimited. Default is false.
|
||||||
|
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
--- *Don't only practice your art, but force your way into its secrets; art deserves that, for it and knowledge can raise man to the Divine.* - Ludwig van Beethoven
|
--- *Don't only practice your art, but force your way into its secrets; art deserves that, for it and knowledge can raise man to the Divine.* - Ludwig van Beethoven
|
||||||
@@ -272,6 +276,10 @@
|
|||||||
-- -- Create a range object.
|
-- -- Create a range object.
|
||||||
-- GoldwaterRange=RANGE:New("Goldwater Range")
|
-- GoldwaterRange=RANGE:New("Goldwater Range")
|
||||||
--
|
--
|
||||||
|
-- -- Set and enable the range ceiling altitude in feet MSL. If aircraft are above this altitude they are not considered to be in the range.
|
||||||
|
-- GoldwaterRange:SetRangeCeiling(20000)
|
||||||
|
-- GoldwaterRange:EnableRangeCeiling(true)
|
||||||
|
--
|
||||||
-- -- Distance between strafe target and foul line. You have to specify the names of the unit or static objects.
|
-- -- Distance between strafe target and foul line. You have to specify the names of the unit or static objects.
|
||||||
-- -- Note that this could also be done manually by simply measuring the distance between the target and the foul line in the ME.
|
-- -- Note that this could also be done manually by simply measuring the distance between the target and the foul line in the ME.
|
||||||
-- GoldwaterRange:GetFoullineDistance("GWR Strafe Pit Left 1", "GWR Foul Line Left")
|
-- GoldwaterRange:GetFoullineDistance("GWR Strafe Pit Left 1", "GWR Foul Line Left")
|
||||||
@@ -357,6 +365,8 @@ RANGE = {
|
|||||||
targetpath = nil,
|
targetpath = nil,
|
||||||
targetprefix = nil,
|
targetprefix = nil,
|
||||||
Coalition = nil,
|
Coalition = nil,
|
||||||
|
ceilingaltitude = 20000,
|
||||||
|
ceilingenabled = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Default range parameters.
|
--- Default range parameters.
|
||||||
@@ -593,13 +603,14 @@ RANGE.MenuF10Root = nil
|
|||||||
|
|
||||||
--- Range script version.
|
--- Range script version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
RANGE.version = "2.7.3"
|
RANGE.version = "2.8.0"
|
||||||
|
|
||||||
-- TODO list:
|
-- TODO list:
|
||||||
-- TODO: Verbosity level for messages.
|
-- TODO: Verbosity level for messages.
|
||||||
-- TODO: Add option for default settings such as smoke off.
|
-- TODO: Add option for default settings such as smoke off.
|
||||||
-- TODO: Add custom weapons, which can be specified by the user.
|
-- TODO: Add custom weapons, which can be specified by the user.
|
||||||
-- TODO: Check if units are still alive.
|
-- TODO: Check if units are still alive.
|
||||||
|
-- TODO: Option for custom sound files.
|
||||||
-- DONE: Scenery as targets.
|
-- DONE: Scenery as targets.
|
||||||
-- DONE: Add statics for strafe pits.
|
-- DONE: Add statics for strafe pits.
|
||||||
-- DONE: Add missiles.
|
-- DONE: Add missiles.
|
||||||
@@ -858,16 +869,16 @@ function RANGE:onafterStart()
|
|||||||
self.rangecontrol.schedonce = true
|
self.rangecontrol.schedonce = true
|
||||||
|
|
||||||
-- Init numbers.
|
-- Init numbers.
|
||||||
self.rangecontrol:SetDigit( 0, RANGE.Sound.RC0.filename, RANGE.Sound.RC0.duration, self.soundpath )
|
self.rangecontrol:SetDigit( 0, self.Sound.RC0.filename, self.Sound.RC0.duration, self.soundpath )
|
||||||
self.rangecontrol:SetDigit( 1, RANGE.Sound.RC1.filename, RANGE.Sound.RC1.duration, self.soundpath )
|
self.rangecontrol:SetDigit( 1, self.Sound.RC1.filename, self.Sound.RC1.duration, self.soundpath )
|
||||||
self.rangecontrol:SetDigit( 2, RANGE.Sound.RC2.filename, RANGE.Sound.RC2.duration, self.soundpath )
|
self.rangecontrol:SetDigit( 2, self.Sound.RC2.filename, self.Sound.RC2.duration, self.soundpath )
|
||||||
self.rangecontrol:SetDigit( 3, RANGE.Sound.RC3.filename, RANGE.Sound.RC3.duration, self.soundpath )
|
self.rangecontrol:SetDigit( 3, self.Sound.RC3.filename, self.Sound.RC3.duration, self.soundpath )
|
||||||
self.rangecontrol:SetDigit( 4, RANGE.Sound.RC4.filename, RANGE.Sound.RC4.duration, self.soundpath )
|
self.rangecontrol:SetDigit( 4, self.Sound.RC4.filename, self.Sound.RC4.duration, self.soundpath )
|
||||||
self.rangecontrol:SetDigit( 5, RANGE.Sound.RC5.filename, RANGE.Sound.RC5.duration, self.soundpath )
|
self.rangecontrol:SetDigit( 5, self.Sound.RC5.filename, self.Sound.RC5.duration, self.soundpath )
|
||||||
self.rangecontrol:SetDigit( 6, RANGE.Sound.RC6.filename, RANGE.Sound.RC6.duration, self.soundpath )
|
self.rangecontrol:SetDigit( 6, self.Sound.RC6.filename, self.Sound.RC6.duration, self.soundpath )
|
||||||
self.rangecontrol:SetDigit( 7, RANGE.Sound.RC7.filename, RANGE.Sound.RC7.duration, self.soundpath )
|
self.rangecontrol:SetDigit( 7, self.Sound.RC7.filename, self.Sound.RC7.duration, self.soundpath )
|
||||||
self.rangecontrol:SetDigit( 8, RANGE.Sound.RC8.filename, RANGE.Sound.RC8.duration, self.soundpath )
|
self.rangecontrol:SetDigit( 8, self.Sound.RC8.filename, self.Sound.RC8.duration, self.soundpath )
|
||||||
self.rangecontrol:SetDigit( 9, RANGE.Sound.RC9.filename, RANGE.Sound.RC9.duration, self.soundpath )
|
self.rangecontrol:SetDigit( 9, self.Sound.RC9.filename, self.Sound.RC9.duration, self.soundpath )
|
||||||
|
|
||||||
-- Set location where the messages are transmitted from.
|
-- Set location where the messages are transmitted from.
|
||||||
self.rangecontrol:SetSenderCoordinate( self.location )
|
self.rangecontrol:SetSenderCoordinate( self.location )
|
||||||
@@ -884,16 +895,16 @@ function RANGE:onafterStart()
|
|||||||
self.instructor.schedonce = true
|
self.instructor.schedonce = true
|
||||||
|
|
||||||
-- Init numbers.
|
-- Init numbers.
|
||||||
self.instructor:SetDigit( 0, RANGE.Sound.IR0.filename, RANGE.Sound.IR0.duration, self.soundpath )
|
self.instructor:SetDigit( 0, self.Sound.IR0.filename, self.Sound.IR0.duration, self.soundpath )
|
||||||
self.instructor:SetDigit( 1, RANGE.Sound.IR1.filename, RANGE.Sound.IR1.duration, self.soundpath )
|
self.instructor:SetDigit( 1, self.Sound.IR1.filename, self.Sound.IR1.duration, self.soundpath )
|
||||||
self.instructor:SetDigit( 2, RANGE.Sound.IR2.filename, RANGE.Sound.IR2.duration, self.soundpath )
|
self.instructor:SetDigit( 2, self.Sound.IR2.filename, self.Sound.IR2.duration, self.soundpath )
|
||||||
self.instructor:SetDigit( 3, RANGE.Sound.IR3.filename, RANGE.Sound.IR3.duration, self.soundpath )
|
self.instructor:SetDigit( 3, self.Sound.IR3.filename, self.Sound.IR3.duration, self.soundpath )
|
||||||
self.instructor:SetDigit( 4, RANGE.Sound.IR4.filename, RANGE.Sound.IR4.duration, self.soundpath )
|
self.instructor:SetDigit( 4, self.Sound.IR4.filename, self.Sound.IR4.duration, self.soundpath )
|
||||||
self.instructor:SetDigit( 5, RANGE.Sound.IR5.filename, RANGE.Sound.IR5.duration, self.soundpath )
|
self.instructor:SetDigit( 5, self.Sound.IR5.filename, self.Sound.IR5.duration, self.soundpath )
|
||||||
self.instructor:SetDigit( 6, RANGE.Sound.IR6.filename, RANGE.Sound.IR6.duration, self.soundpath )
|
self.instructor:SetDigit( 6, self.Sound.IR6.filename, self.Sound.IR6.duration, self.soundpath )
|
||||||
self.instructor:SetDigit( 7, RANGE.Sound.IR7.filename, RANGE.Sound.IR7.duration, self.soundpath )
|
self.instructor:SetDigit( 7, self.Sound.IR7.filename, self.Sound.IR7.duration, self.soundpath )
|
||||||
self.instructor:SetDigit( 8, RANGE.Sound.IR8.filename, RANGE.Sound.IR8.duration, self.soundpath )
|
self.instructor:SetDigit( 8, self.Sound.IR8.filename, self.Sound.IR8.duration, self.soundpath )
|
||||||
self.instructor:SetDigit( 9, RANGE.Sound.IR9.filename, RANGE.Sound.IR9.duration, self.soundpath )
|
self.instructor:SetDigit( 9, self.Sound.IR9.filename, self.Sound.IR9.duration, self.soundpath )
|
||||||
|
|
||||||
-- Set location where the messages are transmitted from.
|
-- Set location where the messages are transmitted from.
|
||||||
self.instructor:SetSenderCoordinate( self.location )
|
self.instructor:SetSenderCoordinate( self.location )
|
||||||
@@ -920,13 +931,23 @@ function RANGE:onafterStart()
|
|||||||
self.rangezone:SmokeZone( SMOKECOLOR.White )
|
self.rangezone:SmokeZone( SMOKECOLOR.White )
|
||||||
end
|
end
|
||||||
|
|
||||||
self:__Status( -60 )
|
self:__Status( -10 )
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- User Functions
|
-- User Functions
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
--- Set the root F10 menu under which the range F10 menu is created.
|
||||||
|
-- @param #RANGE self
|
||||||
|
-- @param Core.Menu#MENU_MISSION menu The root F10 menu.
|
||||||
|
-- @return #RANGE self
|
||||||
|
function RANGE:SetMenuRoot(menu)
|
||||||
|
self.menuF10root=menu
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Set maximal strafing altitude. Player entering a strafe pit above that altitude are not registered for a valid pass.
|
--- Set maximal strafing altitude. Player entering a strafe pit above that altitude are not registered for a valid pass.
|
||||||
-- @param #RANGE self
|
-- @param #RANGE self
|
||||||
-- @param #number maxalt Maximum altitude in meters AGL. Default is 914 m = 3000 ft.
|
-- @param #number maxalt Maximum altitude in meters AGL. Default is 914 m = 3000 ft.
|
||||||
@@ -1066,10 +1087,44 @@ end
|
|||||||
-- @param Core.Zone#ZONE zone MOOSE zone defining the range perimeters.
|
-- @param Core.Zone#ZONE zone MOOSE zone defining the range perimeters.
|
||||||
-- @return #RANGE self
|
-- @return #RANGE self
|
||||||
function RANGE:SetRangeZone( zone )
|
function RANGE:SetRangeZone( zone )
|
||||||
|
if zone and type(zone)=="string" then
|
||||||
|
zone=ZONE:FindByName(zone)
|
||||||
|
end
|
||||||
self.rangezone = zone
|
self.rangezone = zone
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set range ceiling altitude in feet MSL.
|
||||||
|
-- @param #RANGE self
|
||||||
|
-- @param #number altitude (optional) Ceiling altitude of the range in ft MSL. Default 20000ft MSL
|
||||||
|
-- @return #RANGE self
|
||||||
|
function RANGE:SetRangeCeiling( altitude )
|
||||||
|
self:T(self.lid.."SetRangeCeiling")
|
||||||
|
if altitude and type(altitude) == "number" then
|
||||||
|
self.ceilingaltitude=altitude
|
||||||
|
else
|
||||||
|
self:E(self.lid.."Altitude either not provided or is not a number, using default setting (20000).")
|
||||||
|
self.ceilingaltitude=20000
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Enable range ceiling. Aircraft must be below the ceiling altitude to be considered in the range zone.
|
||||||
|
-- @param #RANGE self
|
||||||
|
-- @param #boolean enabled True if you would like to enable the ceiling check. If no value give, will Default to false.
|
||||||
|
-- @return #RANGE self
|
||||||
|
function RANGE:EnableRangeCeiling( enabled )
|
||||||
|
self:T(self.lid.."EnableRangeCeiling")
|
||||||
|
if enabled and type(enabled) == "boolean" then
|
||||||
|
self.ceilingenabled=enabled
|
||||||
|
else
|
||||||
|
self:E(self.lid.."Enabled either not provide or is not a boolean, using default setting (false).")
|
||||||
|
self.ceilingenabled=false
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Set smoke color for marking bomb targets. By default bomb targets are marked by red smoke.
|
--- Set smoke color for marking bomb targets. By default bomb targets are marked by red smoke.
|
||||||
-- @param #RANGE self
|
-- @param #RANGE self
|
||||||
-- @param Utilities.Utils#SMOKECOLOR colorid Color id. Default `SMOKECOLOR.Red`.
|
-- @param Utilities.Utils#SMOKECOLOR colorid Color id. Default `SMOKECOLOR.Red`.
|
||||||
@@ -1226,8 +1281,10 @@ function RANGE:SetSRS(PathToSRS, Port, Coalition, Frequency, Modulation, Volume,
|
|||||||
self.instructsrsQ = MSRSQUEUE:New("INSTRUCT")
|
self.instructsrsQ = MSRSQUEUE:New("INSTRUCT")
|
||||||
|
|
||||||
if PathToGoogleKey then
|
if PathToGoogleKey then
|
||||||
self.controlmsrs:SetGoogle(PathToGoogleKey)
|
self.controlmsrs:SetProviderOptionsGoogle(PathToGoogleKey,PathToGoogleKey)
|
||||||
self.instructmsrs:SetGoogle(PathToGoogleKey)
|
self.controlmsrs:SetProvider(MSRS.Provider.GOOGLE)
|
||||||
|
self.instructmsrs:SetProviderOptionsGoogle(PathToGoogleKey,PathToGoogleKey)
|
||||||
|
self.instructmsrs:SetProvider(MSRS.Provider.GOOGLE)
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
@@ -1323,10 +1380,57 @@ end
|
|||||||
-- @return #RANGE self
|
-- @return #RANGE self
|
||||||
function RANGE:SetSoundfilesPath( path )
|
function RANGE:SetSoundfilesPath( path )
|
||||||
self.soundpath = tostring( path or "Range Soundfiles/" )
|
self.soundpath = tostring( path or "Range Soundfiles/" )
|
||||||
self:I( self.lid .. string.format( "Setting sound files path to %s", self.soundpath ) )
|
self:T2( self.lid .. string.format( "Setting sound files path to %s", self.soundpath ) )
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set the path to the csv file that contains information about the used sound files.
|
||||||
|
-- The parameter file has to be located on your local disk (**not** inside the miz file).
|
||||||
|
-- @param #RANGE self
|
||||||
|
-- @param #string csvfile Full path to the csv file on your local disk.
|
||||||
|
-- @return #RANGE self
|
||||||
|
function RANGE:SetSoundfilesInfo( csvfile )
|
||||||
|
|
||||||
|
--- Local function to return the ATIS.Soundfile for a given file name
|
||||||
|
local function getSound(filename)
|
||||||
|
for key,_soundfile in pairs(self.Sound) do
|
||||||
|
local soundfile=_soundfile --#RANGE.Soundfile
|
||||||
|
if filename==soundfile.filename then
|
||||||
|
return soundfile
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Read csv file
|
||||||
|
local data=UTILS.ReadCSV(csvfile)
|
||||||
|
|
||||||
|
if data then
|
||||||
|
|
||||||
|
for i,sound in pairs(data) do
|
||||||
|
|
||||||
|
-- Get the ATIS.Soundfile
|
||||||
|
local soundfile=getSound(sound.filename..".ogg") --#RANGE.Soundfile
|
||||||
|
|
||||||
|
if soundfile then
|
||||||
|
|
||||||
|
-- Set duration
|
||||||
|
soundfile.duration=tonumber(sound.duration)
|
||||||
|
|
||||||
|
else
|
||||||
|
self:E(string.format("ERROR: Could not get info for sound file %s", sound.filename))
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self:E(string.format("ERROR: Could not read sound csv file!"))
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Add new strafe pit. For a strafe pit, hits from guns are counted. One pit can consist of several units.
|
--- Add new strafe pit. For a strafe pit, hits from guns are counted. One pit can consist of several units.
|
||||||
-- A strafe run approach is only valid if the player enters via a zone in front of the pit, which is defined by boxlength, boxwidth, and heading.
|
-- A strafe run approach is only valid if the player enters via a zone in front of the pit, which is defined by boxlength, boxwidth, and heading.
|
||||||
-- Furthermore, the player must not be too high and fly in the direction of the pit to make a valid target apporoach.
|
-- Furthermore, the player must not be too high and fly in the direction of the pit to make a valid target apporoach.
|
||||||
@@ -1572,9 +1676,9 @@ function RANGE:AddBombingTargetUnit( unit, goodhitrange, randommove )
|
|||||||
|
|
||||||
-- Debug or error output.
|
-- Debug or error output.
|
||||||
if _isstatic == true then
|
if _isstatic == true then
|
||||||
self:I( self.lid .. string.format( "Adding STATIC bombing target %s with good hit range %d. Random move = %s.", name, goodhitrange, tostring( randommove ) ) )
|
self:T( self.lid .. string.format( "Adding STATIC bombing target %s with good hit range %d. Random move = %s.", name, goodhitrange, tostring( randommove ) ) )
|
||||||
elseif _isstatic == false then
|
elseif _isstatic == false then
|
||||||
self:I( self.lid .. string.format( "Adding UNIT bombing target %s with good hit range %d. Random move = %s.", name, goodhitrange, tostring( randommove ) ) )
|
self:T( self.lid .. string.format( "Adding UNIT bombing target %s with good hit range %d. Random move = %s.", name, goodhitrange, tostring( randommove ) ) )
|
||||||
else
|
else
|
||||||
self:E( self.lid .. string.format( "ERROR! No bombing target with name %s could be found. Carefully check all UNIT and STATIC names defined in the mission editor!", name ) )
|
self:E( self.lid .. string.format( "ERROR! No bombing target with name %s could be found. Carefully check all UNIT and STATIC names defined in the mission editor!", name ) )
|
||||||
end
|
end
|
||||||
@@ -1642,7 +1746,7 @@ function RANGE:AddBombingTargetScenery( scenery, goodhitrange)
|
|||||||
|
|
||||||
-- Debug or error output.
|
-- Debug or error output.
|
||||||
if name then
|
if name then
|
||||||
self:I( self.lid .. string.format( "Adding SCENERY bombing target %s with good hit range %d", name, goodhitrange) )
|
self:T( self.lid .. string.format( "Adding SCENERY bombing target %s with good hit range %d", name, goodhitrange) )
|
||||||
else
|
else
|
||||||
self:E( self.lid .. string.format( "ERROR! No bombing target with name %s could be found!", name ) )
|
self:E( self.lid .. string.format( "ERROR! No bombing target with name %s could be found!", name ) )
|
||||||
end
|
end
|
||||||
@@ -1665,13 +1769,17 @@ end
|
|||||||
|
|
||||||
--- Add all units of a group as bombing targets.
|
--- Add all units of a group as bombing targets.
|
||||||
-- @param #RANGE self
|
-- @param #RANGE self
|
||||||
-- @param Wrapper.Group#GROUP group Group of bombing targets.
|
-- @param Wrapper.Group#GROUP group Group of bombing targets. Can also be given as group name.
|
||||||
-- @param #number goodhitrange Max distance from unit which is considered as a good hit.
|
-- @param #number goodhitrange Max distance from unit which is considered as a good hit.
|
||||||
-- @param #boolean randommove If true, unit will move randomly within the range. Default is false.
|
-- @param #boolean randommove If true, unit will move randomly within the range. Default is false.
|
||||||
-- @return #RANGE self
|
-- @return #RANGE self
|
||||||
function RANGE:AddBombingTargetGroup( group, goodhitrange, randommove )
|
function RANGE:AddBombingTargetGroup( group, goodhitrange, randommove )
|
||||||
self:F( { group = group, goodhitrange = goodhitrange, randommove = randommove } )
|
self:F( { group = group, goodhitrange = goodhitrange, randommove = randommove } )
|
||||||
|
|
||||||
|
if group and type(group)=="string" then
|
||||||
|
group=GROUP:FindByName(group)
|
||||||
|
end
|
||||||
|
|
||||||
if group then
|
if group then
|
||||||
|
|
||||||
local _units = group:GetUnits()
|
local _units = group:GetUnits()
|
||||||
@@ -1743,7 +1851,7 @@ function RANGE:OnEventBirth( EventData )
|
|||||||
if not EventData.IniPlayerName then return end
|
if not EventData.IniPlayerName then return end
|
||||||
|
|
||||||
local _unitName = EventData.IniUnitName
|
local _unitName = EventData.IniUnitName
|
||||||
local _unit, _playername = self:_GetPlayerUnitAndName( _unitName )
|
local _unit, _playername = self:_GetPlayerUnitAndName( _unitName, EventData.IniPlayerName )
|
||||||
|
|
||||||
self:T3( self.lid .. "BIRTH: unit = " .. tostring( EventData.IniUnitName ) )
|
self:T3( self.lid .. "BIRTH: unit = " .. tostring( EventData.IniUnitName ) )
|
||||||
self:T3( self.lid .. "BIRTH: group = " .. tostring( EventData.IniGroupName ) )
|
self:T3( self.lid .. "BIRTH: group = " .. tostring( EventData.IniGroupName ) )
|
||||||
@@ -1825,7 +1933,7 @@ function RANGE:OnEventHit( EventData )
|
|||||||
local _currentTarget = self.strafeStatus[_unitID] --#RANGE.StrafeStatus
|
local _currentTarget = self.strafeStatus[_unitID] --#RANGE.StrafeStatus
|
||||||
|
|
||||||
-- Player has rolled in on a strafing target.
|
-- Player has rolled in on a strafing target.
|
||||||
if _currentTarget and target:IsAlive() then
|
if _currentTarget and target and target:IsAlive() then
|
||||||
|
|
||||||
local playerPos = _unit:GetCoordinate()
|
local playerPos = _unit:GetCoordinate()
|
||||||
local targetPos = target:GetCoordinate()
|
local targetPos = target:GetCoordinate()
|
||||||
@@ -1900,6 +2008,8 @@ end
|
|||||||
-- @param #number attackVel Attack velocity.
|
-- @param #number attackVel Attack velocity.
|
||||||
function RANGE._OnImpact(weapon, self, playerData, attackHdg, attackAlt, attackVel)
|
function RANGE._OnImpact(weapon, self, playerData, attackHdg, attackAlt, attackVel)
|
||||||
|
|
||||||
|
if not playerData then return end
|
||||||
|
|
||||||
-- Get closet target to last position.
|
-- Get closet target to last position.
|
||||||
local _closetTarget = nil -- #RANGE.BombTarget
|
local _closetTarget = nil -- #RANGE.BombTarget
|
||||||
local _distance = nil
|
local _distance = nil
|
||||||
@@ -1916,13 +2026,13 @@ function RANGE._OnImpact(weapon, self, playerData, attackHdg, attackAlt, attackV
|
|||||||
-- Coordinate of impact point.
|
-- Coordinate of impact point.
|
||||||
local impactcoord = weapon:GetImpactCoordinate()
|
local impactcoord = weapon:GetImpactCoordinate()
|
||||||
|
|
||||||
-- Check if impact happened in range zone.
|
-- Check if impact happened in range zone.+
|
||||||
local insidezone = self.rangezone:IsCoordinateInZone( impactcoord )
|
local insidezone = self.rangezone:IsCoordinateInZone( impactcoord )
|
||||||
|
|
||||||
|
|
||||||
-- Smoke impact point of bomb.
|
-- Smoke impact point of bomb.
|
||||||
if playerData.smokebombimpact and insidezone then
|
if playerData and playerData.smokebombimpact and insidezone then
|
||||||
if playerData.delaysmoke then
|
if playerData and playerData.delaysmoke then
|
||||||
timer.scheduleFunction( self._DelayedSmoke, { coord = impactcoord, color = playerData.smokecolor }, timer.getTime() + self.TdelaySmoke )
|
timer.scheduleFunction( self._DelayedSmoke, { coord = impactcoord, color = playerData.smokecolor }, timer.getTime() + self.TdelaySmoke )
|
||||||
else
|
else
|
||||||
impactcoord:Smoke( playerData.smokecolor )
|
impactcoord:Smoke( playerData.smokecolor )
|
||||||
@@ -1992,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 )
|
||||||
@@ -2016,7 +2131,7 @@ function RANGE._OnImpact(weapon, self, playerData, attackHdg, attackAlt, attackV
|
|||||||
if self.useSRS then
|
if self.useSRS then
|
||||||
self.controlsrsQ:NewTransmission(_message,nil,self.controlmsrs,nil,1)
|
self.controlsrsQ:NewTransmission(_message,nil,self.controlmsrs,nil,1)
|
||||||
else
|
else
|
||||||
self.rangecontrol:NewTransmission( RANGE.Sound.RCWeaponImpactedTooFar.filename, RANGE.Sound.RCWeaponImpactedTooFar.duration, self.soundpath, nil, nil, _message, self.subduration )
|
self.rangecontrol:NewTransmission( self.Sound.RCWeaponImpactedTooFar.filename, self.Sound.RCWeaponImpactedTooFar.duration, self.soundpath, nil, nil, _message, self.subduration )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -2047,7 +2162,7 @@ function RANGE:OnEventShot( EventData )
|
|||||||
local _unitName = EventData.IniUnitName
|
local _unitName = EventData.IniUnitName
|
||||||
|
|
||||||
-- Get player unit and name.
|
-- Get player unit and name.
|
||||||
local _unit, _playername = self:_GetPlayerUnitAndName( _unitName )
|
local _unit, _playername = self:_GetPlayerUnitAndName( _unitName, EventData.IniPlayerName )
|
||||||
|
|
||||||
-- Distance Player-to-Range. Set this to larger value than the threshold.
|
-- Distance Player-to-Range. Set this to larger value than the threshold.
|
||||||
local dPR = self.BombtrackThreshold * 2
|
local dPR = self.BombtrackThreshold * 2
|
||||||
@@ -2059,11 +2174,13 @@ function RANGE:OnEventShot( EventData )
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Only track if distance player to range is < 25 km. Also check that a player shot. No need to track AI weapons.
|
-- Only track if distance player to range is < 25 km. Also check that a player shot. No need to track AI weapons.
|
||||||
if _track and dPR <= self.BombtrackThreshold and _unit and _playername then
|
if _track and dPR <= self.BombtrackThreshold and _unit and _playername and self.PlayerSettings[_playername] then
|
||||||
|
|
||||||
-- Player data.
|
-- Player data.
|
||||||
local playerData = self.PlayerSettings[_playername] -- #RANGE.PlayerData
|
local playerData = self.PlayerSettings[_playername] -- #RANGE.PlayerData
|
||||||
|
|
||||||
|
if not playerData then return end
|
||||||
|
|
||||||
-- Attack parameters.
|
-- Attack parameters.
|
||||||
local attackHdg=_unit:GetHeading()
|
local attackHdg=_unit:GetHeading()
|
||||||
local attackAlt=_unit:GetHeight()
|
local attackAlt=_unit:GetHeight()
|
||||||
@@ -2124,7 +2241,7 @@ function RANGE:onafterStatus( From, Event, To )
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Check range status.
|
-- Check range status.
|
||||||
self:I( self.lid .. text )
|
self:T( self.lid .. text )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -2163,15 +2280,15 @@ function RANGE:onafterEnterRange( From, Event, To, player )
|
|||||||
-- Radio message that player entered the range
|
-- Radio message that player entered the range
|
||||||
|
|
||||||
-- You entered the bombing range. For hit assessment, contact the range controller at xy MHz
|
-- You entered the bombing range. For hit assessment, contact the range controller at xy MHz
|
||||||
self.instructor:NewTransmission( RANGE.Sound.IREnterRange.filename, RANGE.Sound.IREnterRange.duration, self.soundpath )
|
self.instructor:NewTransmission( self.Sound.IREnterRange.filename, self.Sound.IREnterRange.duration, self.soundpath )
|
||||||
self.instructor:Number2Transmission( RF[1] )
|
self.instructor:Number2Transmission( RF[1] )
|
||||||
|
|
||||||
if tonumber( RF[2] ) > 0 then
|
if tonumber( RF[2] ) > 0 then
|
||||||
self.instructor:NewTransmission( RANGE.Sound.IRDecimal.filename, RANGE.Sound.IRDecimal.duration, self.soundpath )
|
self.instructor:NewTransmission( self.Sound.IRDecimal.filename, self.Sound.IRDecimal.duration, self.soundpath )
|
||||||
self.instructor:Number2Transmission( RF[2] )
|
self.instructor:Number2Transmission( RF[2] )
|
||||||
end
|
end
|
||||||
|
|
||||||
self.instructor:NewTransmission( RANGE.Sound.IRMegaHertz.filename, RANGE.Sound.IRMegaHertz.duration, self.soundpath )
|
self.instructor:NewTransmission( self.Sound.IRMegaHertz.filename, self.Sound.IRMegaHertz.duration, self.soundpath )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -2207,7 +2324,7 @@ function RANGE:onafterExitRange( From, Event, To, player )
|
|||||||
|
|
||||||
self.instructsrsQ:NewTransmission(text, nil, self.instructmsrs, nil, 1, {player.client:GetGroup()}, text, 10)
|
self.instructsrsQ:NewTransmission(text, nil, self.instructmsrs, nil, 1, {player.client:GetGroup()}, text, 10)
|
||||||
else
|
else
|
||||||
self.instructor:NewTransmission( RANGE.Sound.IRExitRange.filename, RANGE.Sound.IRExitRange.duration, self.soundpath )
|
self.instructor:NewTransmission( self.Sound.IRExitRange.filename, self.Sound.IRExitRange.duration, self.soundpath )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -2243,20 +2360,20 @@ function RANGE:onafterImpact( From, Event, To, result, player )
|
|||||||
local group = player.client:GetGroup()
|
local group = player.client:GetGroup()
|
||||||
self.controlsrsQ:NewTransmission(text,nil,self.controlmsrs,nil,1,{group},text,10)
|
self.controlsrsQ:NewTransmission(text,nil,self.controlmsrs,nil,1,{group},text,10)
|
||||||
else
|
else
|
||||||
self.rangecontrol:NewTransmission( RANGE.Sound.RCImpact.filename, RANGE.Sound.RCImpact.duration, self.soundpath, nil, nil, text, self.subduration )
|
self.rangecontrol:NewTransmission( self.Sound.RCImpact.filename, self.Sound.RCImpact.duration, self.soundpath, nil, nil, text, self.subduration )
|
||||||
self.rangecontrol:Number2Transmission( string.format( "%03d", result.radial ), nil, 0.1 )
|
self.rangecontrol:Number2Transmission( string.format( "%03d", result.radial ), nil, 0.1 )
|
||||||
self.rangecontrol:NewTransmission( RANGE.Sound.RCDegrees.filename, RANGE.Sound.RCDegrees.duration, self.soundpath )
|
self.rangecontrol:NewTransmission( self.Sound.RCDegrees.filename, self.Sound.RCDegrees.duration, self.soundpath )
|
||||||
self.rangecontrol:NewTransmission( RANGE.Sound.RCFor.filename, RANGE.Sound.RCFor.duration, self.soundpath )
|
self.rangecontrol:NewTransmission( self.Sound.RCFor.filename, self.Sound.RCFor.duration, self.soundpath )
|
||||||
self.rangecontrol:Number2Transmission( string.format( "%d", UTILS.MetersToFeet( result.distance ) ) )
|
self.rangecontrol:Number2Transmission( string.format( "%d", UTILS.MetersToFeet( result.distance ) ) )
|
||||||
self.rangecontrol:NewTransmission( RANGE.Sound.RCFeet.filename, RANGE.Sound.RCFeet.duration, self.soundpath )
|
self.rangecontrol:NewTransmission( self.Sound.RCFeet.filename, self.Sound.RCFeet.duration, self.soundpath )
|
||||||
if result.quality == "POOR" then
|
if result.quality == "POOR" then
|
||||||
self.rangecontrol:NewTransmission( RANGE.Sound.RCPoorHit.filename, RANGE.Sound.RCPoorHit.duration, self.soundpath, nil, 0.5 )
|
self.rangecontrol:NewTransmission( self.Sound.RCPoorHit.filename, self.Sound.RCPoorHit.duration, self.soundpath, nil, 0.5 )
|
||||||
elseif result.quality == "INEFFECTIVE" then
|
elseif result.quality == "INEFFECTIVE" then
|
||||||
self.rangecontrol:NewTransmission( RANGE.Sound.RCIneffectiveHit.filename, RANGE.Sound.RCIneffectiveHit.duration, self.soundpath, nil, 0.5 )
|
self.rangecontrol:NewTransmission( self.Sound.RCIneffectiveHit.filename, self.Sound.RCIneffectiveHit.duration, self.soundpath, nil, 0.5 )
|
||||||
elseif result.quality == "GOOD" then
|
elseif result.quality == "GOOD" then
|
||||||
self.rangecontrol:NewTransmission( RANGE.Sound.RCGoodHit.filename, RANGE.Sound.RCGoodHit.duration, self.soundpath, nil, 0.5 )
|
self.rangecontrol:NewTransmission( self.Sound.RCGoodHit.filename, self.Sound.RCGoodHit.duration, self.soundpath, nil, 0.5 )
|
||||||
elseif result.quality == "EXCELLENT" then
|
elseif result.quality == "EXCELLENT" then
|
||||||
self.rangecontrol:NewTransmission( RANGE.Sound.RCExcellentHit.filename, RANGE.Sound.RCExcellentHit.duration, self.soundpath, nil, 0.5 )
|
self.rangecontrol:NewTransmission( self.Sound.RCExcellentHit.filename, self.Sound.RCExcellentHit.duration, self.soundpath, nil, 0.5 )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -2325,14 +2442,14 @@ function RANGE:onafterSave( From, Event, To )
|
|||||||
if f then
|
if f then
|
||||||
f:write( data )
|
f:write( data )
|
||||||
f:close()
|
f:close()
|
||||||
self:I( self.lid .. string.format( "Saving player results to file %s", tostring( filename ) ) )
|
self:T( self.lid .. string.format( "Saving player results to file %s", tostring( filename ) ) )
|
||||||
else
|
else
|
||||||
self:E( self.lid .. string.format( "ERROR: Could not save results to file %s", tostring( filename ) ) )
|
self:E( self.lid .. string.format( "ERROR: Could not save results to file %s", tostring( filename ) ) )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Path.
|
-- Path.
|
||||||
local path = lfs.writedir() .. [[Logs\]]
|
local path = self.targetpath or lfs.writedir() .. [[Logs\]]
|
||||||
|
|
||||||
-- Set file name.
|
-- Set file name.
|
||||||
local filename = path .. string.format( "RANGE-%s_BombingResults.csv", self.rangename )
|
local filename = path .. string.format( "RANGE-%s_BombingResults.csv", self.rangename )
|
||||||
@@ -2397,14 +2514,14 @@ function RANGE:onafterLoad( From, Event, To )
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Path in DCS log file.
|
-- Path in DCS log file.
|
||||||
local path = lfs.writedir() .. [[Logs\]]
|
local path = self.targetpath or lfs.writedir() .. [[Logs\]]
|
||||||
|
|
||||||
-- Set file name.
|
-- Set file name.
|
||||||
local filename = path .. string.format( "RANGE-%s_BombingResults.csv", self.rangename )
|
local filename = path .. string.format( "RANGE-%s_BombingResults.csv", self.rangename )
|
||||||
|
|
||||||
-- Info message.
|
-- Info message.
|
||||||
local text = string.format( "Loading player bomb results from file %s", filename )
|
local text = string.format( "Loading player bomb results from file %s", filename )
|
||||||
self:I( self.lid .. text )
|
self:T( self.lid .. text )
|
||||||
|
|
||||||
-- Load asset data from file.
|
-- Load asset data from file.
|
||||||
local data = _loadfile( filename )
|
local data = _loadfile( filename )
|
||||||
@@ -2777,7 +2894,7 @@ function RANGE:_DisplayRangeInfo( _unitname )
|
|||||||
|
|
||||||
-- Check if we have a player.
|
-- Check if we have a player.
|
||||||
if unit and playername then
|
if unit and playername then
|
||||||
self:I(playername)
|
--self:I(playername)
|
||||||
-- Message text.
|
-- Message text.
|
||||||
local text = ""
|
local text = ""
|
||||||
|
|
||||||
@@ -2915,7 +3032,7 @@ function RANGE:_DisplayBombTargets( _unitname )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self:_DisplayMessageToGroup( _unit, _text, 120, true, true, _multiplayer )
|
self:_DisplayMessageToGroup( _unit, _text, 150, true, true, _multiplayer )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -3040,7 +3157,10 @@ function RANGE:_CheckPlayers()
|
|||||||
|
|
||||||
if unit and unit:IsAlive() then
|
if unit and unit:IsAlive() then
|
||||||
|
|
||||||
if unit:IsInZone( self.rangezone ) then
|
local unitalt = unit:GetAltitude(false)
|
||||||
|
local unitaltinfeet = UTILS.MetersToFeet(unitalt)
|
||||||
|
|
||||||
|
if unit:IsInZone(self.rangezone) and (not self.ceilingenabled or unitaltinfeet < self.ceilingaltitude) then
|
||||||
|
|
||||||
------------------------------
|
------------------------------
|
||||||
-- Player INSIDE Range Zone --
|
-- Player INSIDE Range Zone --
|
||||||
@@ -3152,7 +3272,7 @@ function RANGE:_CheckInZone( _unitName )
|
|||||||
self.controlsrsQ:NewTransmission(text,nil,self.controlmsrs,nil,1)
|
self.controlsrsQ:NewTransmission(text,nil,self.controlmsrs,nil,1)
|
||||||
else
|
else
|
||||||
-- You left the strafing zone too quickly! No score!
|
-- You left the strafing zone too quickly! No score!
|
||||||
self.rangecontrol:NewTransmission( RANGE.Sound.RCLeftStrafePitTooQuickly.filename, RANGE.Sound.RCLeftStrafePitTooQuickly.duration, self.soundpath )
|
self.rangecontrol:NewTransmission( self.Sound.RCLeftStrafePitTooQuickly.filename, self.Sound.RCLeftStrafePitTooQuickly.duration, self.soundpath )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -3179,23 +3299,23 @@ function RANGE:_CheckInZone( _unitName )
|
|||||||
local resulttext=""
|
local resulttext=""
|
||||||
if _result.pastfoulline == true then --
|
if _result.pastfoulline == true then --
|
||||||
resulttext = "* INVALID - PASSED FOUL LINE *"
|
resulttext = "* INVALID - PASSED FOUL LINE *"
|
||||||
_sound = RANGE.Sound.RCPoorPass --
|
_sound = self.Sound.RCPoorPass --
|
||||||
else
|
else
|
||||||
if accur >= 90 then
|
if accur >= 90 then
|
||||||
resulttext = "DEADEYE PASS"
|
resulttext = "DEADEYE PASS"
|
||||||
_sound = RANGE.Sound.RCExcellentPass
|
_sound = self.Sound.RCExcellentPass
|
||||||
elseif accur >= 75 then
|
elseif accur >= 75 then
|
||||||
resulttext = "EXCELLENT PASS"
|
resulttext = "EXCELLENT PASS"
|
||||||
_sound = RANGE.Sound.RCExcellentPass
|
_sound = self.Sound.RCExcellentPass
|
||||||
elseif accur >= 50 then
|
elseif accur >= 50 then
|
||||||
resulttext = "GOOD PASS"
|
resulttext = "GOOD PASS"
|
||||||
_sound = RANGE.Sound.RCGoodPass
|
_sound = self.Sound.RCGoodPass
|
||||||
elseif accur >= 25 then
|
elseif accur >= 25 then
|
||||||
resulttext = "INEFFECTIVE PASS"
|
resulttext = "INEFFECTIVE PASS"
|
||||||
_sound = RANGE.Sound.RCIneffectivePass
|
_sound = self.Sound.RCIneffectivePass
|
||||||
else
|
else
|
||||||
resulttext = "POOR PASS"
|
resulttext = "POOR PASS"
|
||||||
_sound = RANGE.Sound.RCPoorPass
|
_sound = self.Sound.RCPoorPass
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -3242,14 +3362,14 @@ function RANGE:_CheckInZone( _unitName )
|
|||||||
if self.useSRS then
|
if self.useSRS then
|
||||||
self.controlsrsQ:NewTransmission(ttstext,nil,self.controlmsrs,nil,1)
|
self.controlsrsQ:NewTransmission(ttstext,nil,self.controlmsrs,nil,1)
|
||||||
else
|
else
|
||||||
self.rangecontrol:NewTransmission( RANGE.Sound.RCHitsOnTarget.filename, RANGE.Sound.RCHitsOnTarget.duration, self.soundpath )
|
self.rangecontrol:NewTransmission( self.Sound.RCHitsOnTarget.filename, self.Sound.RCHitsOnTarget.duration, self.soundpath )
|
||||||
self.rangecontrol:Number2Transmission( string.format( "%d", _result.hits ) )
|
self.rangecontrol:Number2Transmission( string.format( "%d", _result.hits ) )
|
||||||
if shots and accur then
|
if shots and accur then
|
||||||
self.rangecontrol:NewTransmission( RANGE.Sound.RCTotalRoundsFired.filename, RANGE.Sound.RCTotalRoundsFired.duration, self.soundpath, nil, 0.2 )
|
self.rangecontrol:NewTransmission( self.Sound.RCTotalRoundsFired.filename, self.Sound.RCTotalRoundsFired.duration, self.soundpath, nil, 0.2 )
|
||||||
self.rangecontrol:Number2Transmission( string.format( "%d", shots ), nil, 0.2 )
|
self.rangecontrol:Number2Transmission( string.format( "%d", shots ), nil, 0.2 )
|
||||||
self.rangecontrol:NewTransmission( RANGE.Sound.RCAccuracy.filename, RANGE.Sound.RCAccuracy.duration, self.soundpath, nil, 0.2 )
|
self.rangecontrol:NewTransmission( self.Sound.RCAccuracy.filename, self.Sound.RCAccuracy.duration, self.soundpath, nil, 0.2 )
|
||||||
self.rangecontrol:Number2Transmission( string.format( "%d", UTILS.Round( accur, 0 ) ) )
|
self.rangecontrol:Number2Transmission( string.format( "%d", UTILS.Round( accur, 0 ) ) )
|
||||||
self.rangecontrol:NewTransmission( RANGE.Sound.RCPercent.filename, RANGE.Sound.RCPercent.duration, self.soundpath )
|
self.rangecontrol:NewTransmission( self.Sound.RCPercent.filename, self.Sound.RCPercent.duration, self.soundpath )
|
||||||
end
|
end
|
||||||
self.rangecontrol:NewTransmission( _sound.filename, _sound.duration, self.soundpath, nil, 0.5 )
|
self.rangecontrol:NewTransmission( _sound.filename, _sound.duration, self.soundpath, nil, 0.5 )
|
||||||
end
|
end
|
||||||
@@ -3294,7 +3414,7 @@ function RANGE:_CheckInZone( _unitName )
|
|||||||
if self.useSRS then
|
if self.useSRS then
|
||||||
self.controlsrsQ:NewTransmission(_msg,nil,self.controlmsrs,nil,1)
|
self.controlsrsQ:NewTransmission(_msg,nil,self.controlmsrs,nil,1)
|
||||||
else
|
else
|
||||||
self.rangecontrol:NewTransmission( RANGE.Sound.RCRollingInOnStrafeTarget.filename, RANGE.Sound.RCRollingInOnStrafeTarget.duration, self.soundpath )
|
self.rangecontrol:NewTransmission( self.Sound.RCRollingInOnStrafeTarget.filename, self.Sound.RCRollingInOnStrafeTarget.duration, self.soundpath )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -3343,16 +3463,23 @@ function RANGE:_AddF10Commands( _unitName )
|
|||||||
self.MenuAddedTo[_gid] = true
|
self.MenuAddedTo[_gid] = true
|
||||||
|
|
||||||
-- Range root menu path.
|
-- Range root menu path.
|
||||||
local _rangePath = nil
|
local _rootMenu = nil
|
||||||
|
|
||||||
if RANGE.MenuF10Root then
|
if self.menuF10root then
|
||||||
|
|
||||||
-------------------
|
-------------------
|
||||||
-- MISSION LEVEL --
|
-- MISSION LEVEL --
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
-- _rangePath = missionCommands.addSubMenuForGroup(_gid, self.rangename, RANGE.MenuF10Root)
|
--_rootMenu = MENU_GROUP:New( group, self.rangename, self.menuF10root )
|
||||||
_rangePath = MENU_GROUP:New( group, "On the Range" )
|
_rootMenu = self.menuF10root
|
||||||
|
self:T2(self.lid..string.format("Creating F10 menu for group %s", group:GetName()))
|
||||||
|
|
||||||
|
elseif RANGE.MenuF10Root then
|
||||||
|
|
||||||
|
-- Main F10 menu: F10/<RANGE.MenuF10Root>/<Range Name>
|
||||||
|
--_rootMenu = MENU_GROUP:New( group, self.rangename, RANGE.MenuF10Root )
|
||||||
|
_rootMenu = RANGE.MenuF10Root
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
@@ -3362,17 +3489,22 @@ function RANGE:_AddF10Commands( _unitName )
|
|||||||
|
|
||||||
-- Main F10 menu: F10/On the Range/<Range Name>/
|
-- Main F10 menu: F10/On the Range/<Range Name>/
|
||||||
if RANGE.MenuF10[_gid] == nil then
|
if RANGE.MenuF10[_gid] == nil then
|
||||||
-- RANGE.MenuF10[_gid]=missionCommands.addSubMenuForGroup(_gid, "On the Range")
|
self:T2(self.lid..string.format("Creating F10 menu 'On the Range' for group %s", group:GetName()))
|
||||||
RANGE.MenuF10[_gid] = MENU_GROUP:New( group, "On the Range" )
|
else
|
||||||
|
self:T2(self.lid..string.format("F10 menu 'On the Range' already EXISTS for group %s", group:GetName()))
|
||||||
end
|
end
|
||||||
-- _rangePath = missionCommands.addSubMenuForGroup(_gid, self.rangename, RANGE.MenuF10[_gid])
|
|
||||||
_rangePath = MENU_GROUP:New( group, self.rangename, RANGE.MenuF10[_gid] )
|
_rootMenu=RANGE.MenuF10[_gid] or MENU_GROUP:New( group, "On the Range" )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local _statsPath = MENU_GROUP:New( group, "Statistics", _rangePath )
|
-- Range menu
|
||||||
local _markPath = MENU_GROUP:New( group, "Mark Targets", _rangePath )
|
local _rangePath = MENU_GROUP:New( group, self.rangename, _rootMenu )
|
||||||
local _settingsPath = MENU_GROUP:New( group, "My Settings", _rangePath )
|
|
||||||
local _infoPath = MENU_GROUP:New( group, "Range Info", _rangePath )
|
local _infoPath = MENU_GROUP:New( group, "Range Info", _rangePath )
|
||||||
|
local _markPath = MENU_GROUP:New( group, "Mark Targets", _rangePath )
|
||||||
|
local _statsPath = MENU_GROUP:New( group, "Statistics", _rangePath )
|
||||||
|
local _settingsPath = MENU_GROUP:New( group, "My Settings", _rangePath )
|
||||||
|
|
||||||
-- F10/On the Range/<Range Name>/My Settings/
|
-- F10/On the Range/<Range Name>/My Settings/
|
||||||
local _mysmokePath = MENU_GROUP:New( group, "Smoke Color", _settingsPath )
|
local _mysmokePath = MENU_GROUP:New( group, "Smoke Color", _settingsPath )
|
||||||
@@ -3776,13 +3908,13 @@ function RANGE:_TargetsheetOnOff( _unitname )
|
|||||||
|
|
||||||
-- Inform player.
|
-- Inform player.
|
||||||
if playerData and playerData.targeton == true then
|
if playerData and playerData.targeton == true then
|
||||||
text = string.format( "roger, your targetsheets are now SAVED." )
|
text = string.format( "Roger, your targetsheets are now SAVED." )
|
||||||
else
|
else
|
||||||
text = string.format( "affirm, your targetsheets are NOT SAVED." )
|
text = string.format( "Affirm, your targetsheets are NOT SAVED." )
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
text = "negative, target sheet data recorder is broken on this range."
|
text = "Negative, target sheet data recorder is broken on this range."
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Message to player.
|
-- Message to player.
|
||||||
@@ -4019,8 +4151,8 @@ end
|
|||||||
-- @return Wrapper.Unit#UNIT Unit of player.
|
-- @return Wrapper.Unit#UNIT Unit of player.
|
||||||
-- @return #string Name of the player.
|
-- @return #string Name of the player.
|
||||||
-- @return #boolean If true, group has > 1 player in it
|
-- @return #boolean If true, group has > 1 player in it
|
||||||
function RANGE:_GetPlayerUnitAndName( _unitName )
|
function RANGE:_GetPlayerUnitAndName( _unitName, PlayerName )
|
||||||
self:F2( _unitName )
|
--self:I( _unitName )
|
||||||
|
|
||||||
if _unitName ~= nil then
|
if _unitName ~= nil then
|
||||||
|
|
||||||
@@ -4029,9 +4161,9 @@ function RANGE:_GetPlayerUnitAndName( _unitName )
|
|||||||
-- Get DCS unit from its name.
|
-- Get DCS unit from its name.
|
||||||
local DCSunit = Unit.getByName( _unitName )
|
local DCSunit = Unit.getByName( _unitName )
|
||||||
|
|
||||||
if DCSunit then
|
if DCSunit and DCSunit.getPlayerName then
|
||||||
|
|
||||||
local playername = DCSunit:getPlayerName()
|
local playername = DCSunit:getPlayerName() or PlayerName or "None"
|
||||||
local unit = UNIT:Find( DCSunit )
|
local unit = UNIT:Find( DCSunit )
|
||||||
|
|
||||||
self:T2( { DCSunit = DCSunit, unit = unit, playername = playername } )
|
self:T2( { DCSunit = DCSunit, unit = unit, playername = playername } )
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
--
|
--
|
||||||
-- ### Authors: **applevangelist**, **FlightControl**
|
-- ### Authors: **applevangelist**, **FlightControl**
|
||||||
--
|
--
|
||||||
-- Last Update: Dec 2023
|
-- Last Update: Dec 2024
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -28,6 +28,16 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
-- @type SEAD
|
-- @type SEAD
|
||||||
|
-- @field #string ClassName The Class Name.
|
||||||
|
-- @field #table TargetSkill Table of target skills.
|
||||||
|
-- @field #table SEADGroupPrefixes Table of SEAD prefixes.
|
||||||
|
-- @field #table SuppressedGroups Table of currently suppressed groups.
|
||||||
|
-- @field #number EngagementRange Engagement Range.
|
||||||
|
-- @field #number Padding Padding in seconds.
|
||||||
|
-- @field #function CallBack Callback function for suppression plans.
|
||||||
|
-- @field #boolean UseCallBack Switch for callback function to be used.
|
||||||
|
-- @field #boolean debug Debug switch.
|
||||||
|
-- @field #boolen WeaponTrack Track switch, if true track weapon speed for 30 secs.
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
--- Make SAM sites execute evasive and defensive behaviour when being fired upon.
|
--- Make SAM sites execute evasive and defensive behaviour when being fired upon.
|
||||||
@@ -56,10 +66,11 @@ SEAD = {
|
|||||||
SEADGroupPrefixes = {},
|
SEADGroupPrefixes = {},
|
||||||
SuppressedGroups = {},
|
SuppressedGroups = {},
|
||||||
EngagementRange = 75, -- default 75% engagement range Feature Request #1355
|
EngagementRange = 75, -- default 75% engagement range Feature Request #1355
|
||||||
Padding = 10,
|
Padding = 15,
|
||||||
CallBack = nil,
|
CallBack = nil,
|
||||||
UseCallBack = false,
|
UseCallBack = false,
|
||||||
debug = false,
|
debug = false,
|
||||||
|
WeaponTrack = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Missile enumerators
|
--- Missile enumerators
|
||||||
@@ -69,6 +80,7 @@ SEAD = {
|
|||||||
["AGM_122"] = "AGM_122",
|
["AGM_122"] = "AGM_122",
|
||||||
["AGM_84"] = "AGM_84",
|
["AGM_84"] = "AGM_84",
|
||||||
["AGM_45"] = "AGM_45",
|
["AGM_45"] = "AGM_45",
|
||||||
|
["AGM_65"] = "AGM_65",
|
||||||
["ALARM"] = "ALARM",
|
["ALARM"] = "ALARM",
|
||||||
["LD-10"] = "LD-10",
|
["LD-10"] = "LD-10",
|
||||||
["X_58"] = "X_58",
|
["X_58"] = "X_58",
|
||||||
@@ -88,6 +100,7 @@ SEAD = {
|
|||||||
-- km and mach
|
-- km and mach
|
||||||
["AGM_88"] = { 150, 3},
|
["AGM_88"] = { 150, 3},
|
||||||
["AGM_45"] = { 12, 2},
|
["AGM_45"] = { 12, 2},
|
||||||
|
["AGM_65"] = { 16, 0.9},
|
||||||
["AGM_122"] = { 16.5, 2.3},
|
["AGM_122"] = { 16.5, 2.3},
|
||||||
["AGM_84"] = { 280, 0.8},
|
["AGM_84"] = { 280, 0.8},
|
||||||
["ALARM"] = { 45, 2},
|
["ALARM"] = { 45, 2},
|
||||||
@@ -144,7 +157,7 @@ function SEAD:New( SEADGroupPrefixes, Padding )
|
|||||||
self:AddTransition("*", "ManageEvasion", "*")
|
self:AddTransition("*", "ManageEvasion", "*")
|
||||||
self:AddTransition("*", "CalculateHitZone", "*")
|
self:AddTransition("*", "CalculateHitZone", "*")
|
||||||
|
|
||||||
self:I("*** SEAD - Started Version 0.4.6")
|
self:I("*** SEAD - Started Version 0.4.9")
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -371,7 +384,7 @@ function SEAD:onafterManageEvasion(From,Event,To,_targetskill,_targetgroup,SEADP
|
|||||||
reach = wpndata[1] * 1.1
|
reach = wpndata[1] * 1.1
|
||||||
local mach = wpndata[2]
|
local mach = wpndata[2]
|
||||||
wpnspeed = math.floor(mach * 340.29)
|
wpnspeed = math.floor(mach * 340.29)
|
||||||
if Weapon then
|
if Weapon and Weapon:GetSpeed() > 0 then
|
||||||
wpnspeed = Weapon:GetSpeed()
|
wpnspeed = Weapon:GetSpeed()
|
||||||
self:T(string.format("*** SEAD - Weapon Speed from WEAPON: %f m/s",wpnspeed))
|
self:T(string.format("*** SEAD - Weapon Speed from WEAPON: %f m/s",wpnspeed))
|
||||||
end
|
end
|
||||||
@@ -452,29 +465,38 @@ end
|
|||||||
-- @return #SEAD self
|
-- @return #SEAD self
|
||||||
function SEAD:HandleEventShot( EventData )
|
function SEAD:HandleEventShot( EventData )
|
||||||
self:T( { EventData.id } )
|
self:T( { EventData.id } )
|
||||||
local SEADPlane = EventData.IniUnit -- Wrapper.Unit#UNIT
|
|
||||||
local SEADGroup = EventData.IniGroup -- Wrapper.Group#GROUP
|
|
||||||
local SEADPlanePos = SEADPlane:GetCoordinate() -- Core.Point#COORDINATE
|
|
||||||
local SEADUnit = EventData.IniDCSUnit
|
|
||||||
local SEADUnitName = EventData.IniDCSUnitName
|
|
||||||
local SEADWeapon = EventData.Weapon -- Identify the weapon fired
|
local SEADWeapon = EventData.Weapon -- Identify the weapon fired
|
||||||
local SEADWeaponName = EventData.WeaponName -- return weapon type
|
local SEADWeaponName = EventData.WeaponName or "None" -- return weapon type
|
||||||
|
|
||||||
local WeaponWrapper = WEAPON:New(EventData.Weapon)
|
|
||||||
--local SEADWeaponSpeed = WeaponWrapper:GetSpeed() -- mps
|
|
||||||
|
|
||||||
self:T( "*** SEAD - Missile Launched = " .. SEADWeaponName)
|
|
||||||
--self:T({ SEADWeapon })
|
|
||||||
|
|
||||||
if self:_CheckHarms(SEADWeaponName) then
|
if self:_CheckHarms(SEADWeaponName) then
|
||||||
|
--UTILS.PrintTableToLog(EventData)
|
||||||
|
local SEADPlane = EventData.IniUnit -- Wrapper.Unit#UNIT
|
||||||
|
|
||||||
|
if not SEADPlane then return self end -- case IniUnit is empty
|
||||||
|
|
||||||
|
local SEADGroup = EventData.IniGroup -- Wrapper.Group#GROUP
|
||||||
|
local SEADPlanePos = SEADPlane:GetCoordinate() -- Core.Point#COORDINATE
|
||||||
|
local SEADUnit = EventData.IniDCSUnit
|
||||||
|
local SEADUnitName = EventData.IniDCSUnitName
|
||||||
|
|
||||||
|
local WeaponWrapper = WEAPON:New(EventData.Weapon) -- Wrapper.Weapon#WEAPON
|
||||||
|
|
||||||
|
self:T( "*** SEAD - Missile Launched = " .. SEADWeaponName)
|
||||||
|
|
||||||
self:T( '*** SEAD - Weapon Match' )
|
self:T( '*** SEAD - Weapon Match' )
|
||||||
|
if self.WeaponTrack == true then
|
||||||
|
WeaponWrapper:SetFuncTrack(function(weapon) env.info(string.format("*** Weapon Speed: %d m/s",weapon:GetSpeed() or -1)) end)
|
||||||
|
WeaponWrapper:StartTrack(0.1)
|
||||||
|
WeaponWrapper:StopTrack(30)
|
||||||
|
end
|
||||||
local _targetskill = "Random"
|
local _targetskill = "Random"
|
||||||
local _targetgroupname = "none"
|
local _targetgroupname = "none"
|
||||||
local _target = EventData.Weapon:getTarget() -- Identify target
|
local _target = EventData.Weapon:getTarget() -- Identify target
|
||||||
if not _target or self.debug then -- AGM-88 or 154 w/o target data
|
if not _target or self.debug then -- AGM-88 or 154 w/o target data
|
||||||
self:E("***** SEAD - No target data for " .. (SEADWeaponName or "None"))
|
self:E("***** SEAD - No target data for " .. (SEADWeaponName or "None"))
|
||||||
if string.find(SEADWeaponName,"AGM_88",1,true) or string.find(SEADWeaponName,"AGM_154",1,true) then
|
if string.find(SEADWeaponName,"AGM_88",1,true) or string.find(SEADWeaponName,"AGM_154",1,true) then
|
||||||
self:I("**** Tracking AGM-88/154 with no target data.")
|
self:T("**** Tracking AGM-88/154 with no target data.")
|
||||||
local pos0 = SEADPlane:GetCoordinate()
|
local pos0 = SEADPlane:GetCoordinate()
|
||||||
local fheight = SEADPlane:GetHeight()
|
local fheight = SEADPlane:GetHeight()
|
||||||
self:__CalculateHitZone(20,SEADWeapon,pos0,fheight,SEADGroup,SEADWeaponName)
|
self:__CalculateHitZone(20,SEADWeapon,pos0,fheight,SEADGroup,SEADWeaponName)
|
||||||
@@ -520,7 +542,7 @@ function SEAD:HandleEventShot( EventData )
|
|||||||
end
|
end
|
||||||
if SEADGroupFound == true then -- yes we are being attacked
|
if SEADGroupFound == true then -- yes we are being attacked
|
||||||
if string.find(SEADWeaponName,"ADM_141",1,true) then
|
if string.find(SEADWeaponName,"ADM_141",1,true) then
|
||||||
self:__ManageEvasion(2,_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,0,WeaponWrapper)
|
self:__ManageEvasion(2,_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,2,WeaponWrapper)
|
||||||
else
|
else
|
||||||
self:ManageEvasion(_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,0,WeaponWrapper)
|
self:ManageEvasion(_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,0,WeaponWrapper)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
-- @image Functional.Shorad.jpg
|
-- @image Functional.Shorad.jpg
|
||||||
--
|
--
|
||||||
-- Date: Nov 2021
|
-- Date: Nov 2021
|
||||||
-- Last Update: Nov 2023
|
-- Last Update: Jan 2025
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
--- **SHORAD** class, extends Core.Base#BASE
|
--- **SHORAD** class, extends Core.Base#BASE
|
||||||
@@ -113,7 +113,7 @@ SHORAD = {
|
|||||||
SkateNumber = 3,
|
SkateNumber = 3,
|
||||||
SkateZones = nil,
|
SkateZones = nil,
|
||||||
minscootdist = 100,
|
minscootdist = 100,
|
||||||
minscootdist = 3000,
|
maxscootdist = 3000,
|
||||||
scootrandomcoord = false,
|
scootrandomcoord = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -443,7 +443,9 @@ do
|
|||||||
for _,_groups in pairs (shoradset) do
|
for _,_groups in pairs (shoradset) do
|
||||||
local groupname = _groups:GetName()
|
local groupname = _groups:GetName()
|
||||||
if string.find(groupname, tgtgrp, 1, true) then
|
if string.find(groupname, tgtgrp, 1, true) then
|
||||||
returnname = true
|
if _groups:IsSAM() then
|
||||||
|
returnname = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return returnname
|
return returnname
|
||||||
@@ -470,6 +472,7 @@ do
|
|||||||
-- @param #number Radius Radius of the #ZONE
|
-- @param #number Radius Radius of the #ZONE
|
||||||
-- @param #number ActiveTimer Number of seconds to stay active
|
-- @param #number ActiveTimer Number of seconds to stay active
|
||||||
-- @param #number TargetCat (optional) Category, i.e. Object.Category.UNIT or Object.Category.STATIC
|
-- @param #number TargetCat (optional) Category, i.e. Object.Category.UNIT or Object.Category.STATIC
|
||||||
|
-- @param #boolean ShotAt If true, function is called after a shot
|
||||||
-- @return #SHORAD self
|
-- @return #SHORAD self
|
||||||
-- @usage Use this function to integrate with other systems, example
|
-- @usage Use this function to integrate with other systems, example
|
||||||
--
|
--
|
||||||
@@ -479,7 +482,7 @@ do
|
|||||||
-- mymantis = MANTIS:New("BlueMantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs")
|
-- mymantis = MANTIS:New("BlueMantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs")
|
||||||
-- mymantis:AddShorad(myshorad,720)
|
-- mymantis:AddShorad(myshorad,720)
|
||||||
-- mymantis:Start()
|
-- mymantis:Start()
|
||||||
function SHORAD:onafterWakeUpShorad(From, Event, To, TargetGroup, Radius, ActiveTimer, TargetCat)
|
function SHORAD:onafterWakeUpShorad(From, Event, To, TargetGroup, Radius, ActiveTimer, TargetCat, ShotAt)
|
||||||
self:T(self.lid .. " WakeUpShorad")
|
self:T(self.lid .. " WakeUpShorad")
|
||||||
self:T({TargetGroup, Radius, ActiveTimer, TargetCat})
|
self:T({TargetGroup, Radius, ActiveTimer, TargetCat})
|
||||||
local targetcat = TargetCat or Object.Category.UNIT
|
local targetcat = TargetCat or Object.Category.UNIT
|
||||||
@@ -521,7 +524,27 @@ do
|
|||||||
-- go through set and find the one(s) to activate
|
-- go through set and find the one(s) to activate
|
||||||
local TDiff = 4
|
local TDiff = 4
|
||||||
for _,_group in pairs (shoradset) do
|
for _,_group in pairs (shoradset) do
|
||||||
if _group:IsAnyInZone(targetzone) then
|
|
||||||
|
local groupname = _group:GetName()
|
||||||
|
|
||||||
|
if groupname == TargetGroup and ShotAt==true then
|
||||||
|
-- Shot at a SHORAD group
|
||||||
|
if self.UseEmOnOff then
|
||||||
|
_group:EnableEmission(false)
|
||||||
|
end
|
||||||
|
_group:OptionAlarmStateGreen()
|
||||||
|
self.ActiveGroups[groupname] = nil
|
||||||
|
local text = string.format("Shot at SHORAD %s! Evading!", _group:GetName())
|
||||||
|
self:T(text)
|
||||||
|
local m = MESSAGE:New(text,10,"SHORAD"):ToAllIf(self.debug)
|
||||||
|
|
||||||
|
--Shoot and Scoot
|
||||||
|
if self.shootandscoot then
|
||||||
|
self:__ShootAndScoot(1,_group)
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif _group:IsAnyInZone(targetzone) or groupname == TargetGroup then
|
||||||
|
-- shot at a group we protect
|
||||||
local text = string.format("Waking up SHORAD %s", _group:GetName())
|
local text = string.format("Waking up SHORAD %s", _group:GetName())
|
||||||
self:T(text)
|
self:T(text)
|
||||||
local m = MESSAGE:New(text,10,"SHORAD"):ToAllIf(self.debug)
|
local m = MESSAGE:New(text,10,"SHORAD"):ToAllIf(self.debug)
|
||||||
@@ -529,7 +552,6 @@ do
|
|||||||
_group:EnableEmission(true)
|
_group:EnableEmission(true)
|
||||||
end
|
end
|
||||||
_group:OptionAlarmStateRed()
|
_group:OptionAlarmStateRed()
|
||||||
local groupname = _group:GetName()
|
|
||||||
if self.ActiveGroups[groupname] == nil then -- no timer yet for this group
|
if self.ActiveGroups[groupname] == nil then -- no timer yet for this group
|
||||||
self.ActiveGroups[groupname] = { Timing = ActiveTimer }
|
self.ActiveGroups[groupname] = { Timing = ActiveTimer }
|
||||||
local endtime = timer.getTime() + (ActiveTimer * math.random(75,100) / 100 ) -- randomize wakeup a bit
|
local endtime = timer.getTime() + (ActiveTimer * math.random(75,100) / 100 ) -- randomize wakeup a bit
|
||||||
@@ -607,7 +629,7 @@ do
|
|||||||
_targetgroupname = tgtgrp:GetName() -- group name
|
_targetgroupname = tgtgrp:GetName() -- group name
|
||||||
_targetskill = tgtgrp:GetUnit(1):GetSkill()
|
_targetskill = tgtgrp:GetUnit(1):GetSkill()
|
||||||
self:T("*** Found Target = ".. _targetgroupname)
|
self:T("*** Found Target = ".. _targetgroupname)
|
||||||
self:WakeUpShorad(_targetgroupname, self.Radius, self.ActiveTimer, Object.Category.UNIT)
|
self:WakeUpShorad(_targetgroupname, self.Radius, self.ActiveTimer, Object.Category.UNIT,true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -736,7 +758,7 @@ do
|
|||||||
-- if being shot at, find closest SHORADs to activate
|
-- if being shot at, find closest SHORADs to activate
|
||||||
if shotatsams or shotatus then
|
if shotatsams or shotatus then
|
||||||
self:T({shotatsams=shotatsams,shotatus=shotatus})
|
self:T({shotatsams=shotatsams,shotatus=shotatus})
|
||||||
self:WakeUpShorad(targetgroupname, self.Radius, self.ActiveTimer, targetcat)
|
self:WakeUpShorad(targetgroupname, self.Radius, self.ActiveTimer, targetcat, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1629,7 +1629,7 @@ WAREHOUSE = {
|
|||||||
-- @field #boolean arrived If true, asset arrived at its destination.
|
-- @field #boolean arrived If true, asset arrived at its destination.
|
||||||
--
|
--
|
||||||
-- @field #number damage Damage of asset group in percent.
|
-- @field #number damage Damage of asset group in percent.
|
||||||
-- @field Ops.AirWing#AIRWING.Payload payload The payload of the asset.
|
-- @field Ops.Airwing#AIRWING.Payload payload The payload of the asset.
|
||||||
-- @field Ops.OpsGroup#OPSGROUP flightgroup The flightgroup object.
|
-- @field Ops.OpsGroup#OPSGROUP flightgroup The flightgroup object.
|
||||||
-- @field Ops.Cohort#COHORT cohort The cohort this asset belongs to.
|
-- @field Ops.Cohort#COHORT cohort The cohort this asset belongs to.
|
||||||
-- @field Ops.Legion#LEGION legion The legion this asset belonts to.
|
-- @field Ops.Legion#LEGION legion The legion this asset belonts to.
|
||||||
@@ -6047,7 +6047,7 @@ function WAREHOUSE:_SpawnAssetAircraft(alias, asset, request, parking, uncontrol
|
|||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
if #parking<#template.units and not airstart then
|
if parking and #parking<#template.units and not airstart then
|
||||||
local text=string.format("ERROR: Not enough parking! Free parking = %d < %d aircraft to be spawned.", #parking, #template.units)
|
local text=string.format("ERROR: Not enough parking! Free parking = %d < %d aircraft to be spawned.", #parking, #template.units)
|
||||||
self:_DebugMessage(text)
|
self:_DebugMessage(text)
|
||||||
return nil
|
return nil
|
||||||
@@ -6089,7 +6089,7 @@ function WAREHOUSE:_SpawnAssetAircraft(alias, asset, request, parking, uncontrol
|
|||||||
terminal=parking[i].TerminalID
|
terminal=parking[i].TerminalID
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Debug then
|
if self.Debug and terminal then
|
||||||
local text=string.format("Spawnplace unit %s terminal %d.", unit.name, terminal)
|
local text=string.format("Spawnplace unit %s terminal %d.", unit.name, terminal)
|
||||||
coord:MarkToAll(text)
|
coord:MarkToAll(text)
|
||||||
env.info(text)
|
env.info(text)
|
||||||
@@ -6732,7 +6732,7 @@ end
|
|||||||
-- @param Wrapper.Group#GROUP deadgroup Group of unit that died.
|
-- @param Wrapper.Group#GROUP deadgroup Group of unit that died.
|
||||||
-- @param #WAREHOUSE.Pendingitem request Request that needs to be updated.
|
-- @param #WAREHOUSE.Pendingitem request Request that needs to be updated.
|
||||||
function WAREHOUSE:_UnitDead(deadunit, deadgroup, request)
|
function WAREHOUSE:_UnitDead(deadunit, deadgroup, request)
|
||||||
self:F(self.lid.."FF unit dead "..deadunit:GetName())
|
--self:F(self.lid.."FF unit dead "..deadunit:GetName())
|
||||||
|
|
||||||
-- Find opsgroup.
|
-- Find opsgroup.
|
||||||
local opsgroup=_DATABASE:FindOpsGroup(deadgroup)
|
local opsgroup=_DATABASE:FindOpsGroup(deadgroup)
|
||||||
@@ -7946,10 +7946,12 @@ function WAREHOUSE:_FindParkingForAssets(airbase, assets)
|
|||||||
local clients=_DATABASE.CLIENTS
|
local clients=_DATABASE.CLIENTS
|
||||||
for clientname, client in pairs(clients) do
|
for clientname, client in pairs(clients) do
|
||||||
local template=_DATABASE:GetGroupTemplateFromUnitName(clientname)
|
local template=_DATABASE:GetGroupTemplateFromUnitName(clientname)
|
||||||
local units=template.units
|
if template then
|
||||||
for i,unit in pairs(units) do
|
local units=template.units
|
||||||
local coord=COORDINATE:New(unit.x, unit.alt, unit.y)
|
for i,unit in pairs(units) do
|
||||||
coords[unit.name]=coord
|
local coord=COORDINATE:New(unit.x, unit.alt, unit.y)
|
||||||
|
coords[unit.name]=coord
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -8120,9 +8122,11 @@ function WAREHOUSE:_FindParkingForAssets(airbase, assets)
|
|||||||
-- Debug output for occupied spots.
|
-- Debug output for occupied spots.
|
||||||
if self.Debug then
|
if self.Debug then
|
||||||
local coord=problem.coord --Core.Point#COORDINATE
|
local coord=problem.coord --Core.Point#COORDINATE
|
||||||
local text=string.format("Obstacle %s [type=%s] blocking spot=%d! Size=%.1f m and distance=%.1f m.", problem.name, problem.type, _termid, problem.size, problem.dist)
|
if coord then
|
||||||
self:I(self.lid..text)
|
local text=string.format("Obstacle %s [type=%s] blocking spot=%d! Size=%.1f m and distance=%.1f m.", problem.name, problem.type, _termid, problem.size, problem.dist)
|
||||||
coord:MarkToAll(string.format(text))
|
self:I(self.lid..text)
|
||||||
|
coord:MarkToAll(text)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
self:T(self.lid..string.format("Parking spot %d is occupied or not big enough!", _termid))
|
self:T(self.lid..string.format("Parking spot %d is occupied or not big enough!", _termid))
|
||||||
end
|
end
|
||||||
@@ -8432,11 +8436,13 @@ function WAREHOUSE:_GetAttribute(group)
|
|||||||
|
|
||||||
if group then
|
if group then
|
||||||
|
|
||||||
|
local groupCat=group:GetCategory()
|
||||||
|
|
||||||
-----------
|
-----------
|
||||||
--- Air ---
|
--- Air ---
|
||||||
-----------
|
-----------
|
||||||
-- Planes
|
-- Planes
|
||||||
local transportplane=group:HasAttribute("Transports") and group:HasAttribute("Planes")
|
local transportplane=group:HasAttribute("Transports") and group:HasAttribute("Planes") and groupCat==Group.Category.AIRPLANE
|
||||||
local awacs=group:HasAttribute("AWACS")
|
local awacs=group:HasAttribute("AWACS")
|
||||||
local fighter=group:HasAttribute("Fighters") or group:HasAttribute("Interceptors") or group:HasAttribute("Multirole fighters") or (group:HasAttribute("Bombers") and not group:HasAttribute("Strategic bombers"))
|
local fighter=group:HasAttribute("Fighters") or group:HasAttribute("Interceptors") or group:HasAttribute("Multirole fighters") or (group:HasAttribute("Bombers") and not group:HasAttribute("Strategic bombers"))
|
||||||
local bomber=group:HasAttribute("Strategic bombers")
|
local bomber=group:HasAttribute("Strategic bombers")
|
||||||
@@ -8591,7 +8597,6 @@ end
|
|||||||
-- @param #WAREHOUSE.Queueitem qitem Item of queue to be removed.
|
-- @param #WAREHOUSE.Queueitem qitem Item of queue to be removed.
|
||||||
-- @param #table queue The queue from which the item should be deleted.
|
-- @param #table queue The queue from which the item should be deleted.
|
||||||
function WAREHOUSE:_DeleteQueueItem(qitem, queue)
|
function WAREHOUSE:_DeleteQueueItem(qitem, queue)
|
||||||
self:F({qitem=qitem, queue=queue})
|
|
||||||
|
|
||||||
for i=1,#queue do
|
for i=1,#queue do
|
||||||
local _item=queue[i] --#WAREHOUSE.Queueitem
|
local _item=queue[i] --#WAREHOUSE.Queueitem
|
||||||
|
|||||||
@@ -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
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ _SCHEDULEDISPATCHER = SCHEDULEDISPATCHER:New() -- Core.ScheduleDispatcher#SCHEDU
|
|||||||
_DATABASE = DATABASE:New() -- Core.Database#DATABASE
|
_DATABASE = DATABASE:New() -- Core.Database#DATABASE
|
||||||
|
|
||||||
--- Settings
|
--- Settings
|
||||||
_SETTINGS = SETTINGS:Set()
|
_SETTINGS = SETTINGS:Set() -- Core.Settings#SETTINGS
|
||||||
_SETTINGS:SetPlayerMenuOn()
|
_SETTINGS:SetPlayerMenuOn()
|
||||||
|
|
||||||
--- Register cargos.
|
--- Register cargos.
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Enums.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Enums.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Utils.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Utils.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Profiler.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Profiler.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Templates.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/STTS.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/FiFo.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/FiFo.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Socket.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Socket.lua' )
|
||||||
|
|
||||||
@@ -48,6 +46,7 @@ __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Marker.lua' )
|
|||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Weapon.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Weapon.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Net.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Net.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Storage.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Storage.lua' )
|
||||||
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/DynamicCargo.lua' )
|
||||||
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/Cargo.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/Cargo.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/CargoUnit.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/CargoUnit.lua' )
|
||||||
@@ -77,6 +76,7 @@ __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Warehouse.lua' )
|
|||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Fox.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Fox.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Mantis.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Mantis.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Shorad.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Shorad.lua' )
|
||||||
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/ClientWatch.lua' )
|
||||||
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Airboss.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Airboss.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/RecoveryTanker.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/RecoveryTanker.lua' )
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -255,6 +255,7 @@
|
|||||||
-- @field #boolean skipperUturn U-turn on/off via menu.
|
-- @field #boolean skipperUturn U-turn on/off via menu.
|
||||||
-- @field #number skipperOffset Holding offset angle in degrees for Case II/III manual recoveries.
|
-- @field #number skipperOffset Holding offset angle in degrees for Case II/III manual recoveries.
|
||||||
-- @field #number skipperTime Recovery time in min for manual recovery.
|
-- @field #number skipperTime Recovery time in min for manual recovery.
|
||||||
|
-- @field #boolean intowindold If true, use old into wind calculation.
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
--- Be the boss!
|
--- Be the boss!
|
||||||
@@ -1911,6 +1912,9 @@ function AIRBOSS:New( carriername, alias )
|
|||||||
-- Set max section members. Default 2.
|
-- Set max section members. Default 2.
|
||||||
self:SetMaxSectionSize()
|
self:SetMaxSectionSize()
|
||||||
|
|
||||||
|
-- Set max section distance. Default 100 meters.
|
||||||
|
self:SetMaxSectionDistance()
|
||||||
|
|
||||||
-- Set max flights per stack. Default is 2.
|
-- Set max flights per stack. Default is 2.
|
||||||
self:SetMaxFlightsPerStack()
|
self:SetMaxFlightsPerStack()
|
||||||
|
|
||||||
@@ -2724,6 +2728,18 @@ function AIRBOSS:SetLSOCallInterval( TimeInterval )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set if old into wind calculation is used when carrier turns into the wind for a recovery.
|
||||||
|
-- @param #AIRBOSS self
|
||||||
|
-- @param #boolean SwitchOn If `true` or `nil`, use old into wind calculation.
|
||||||
|
-- @return #AIRBOSS self
|
||||||
|
function AIRBOSS:SetIntoWindLegacy( SwitchOn )
|
||||||
|
if SwitchOn==nil then
|
||||||
|
SwitchOn=true
|
||||||
|
end
|
||||||
|
self.intowindold=SwitchOn
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Airboss is a rather nice guy and not strictly following the rules. Fore example, he does allow you into the landing pattern if you are not coming from the Marshal stack.
|
--- Airboss is a rather nice guy and not strictly following the rules. Fore example, he does allow you into the landing pattern if you are not coming from the Marshal stack.
|
||||||
-- @param #AIRBOSS self
|
-- @param #AIRBOSS self
|
||||||
-- @param #boolean Switch If true or nil, Airboss bends the rules a bit.
|
-- @param #boolean Switch If true or nil, Airboss bends the rules a bit.
|
||||||
@@ -3330,6 +3346,22 @@ function AIRBOSS:SetMaxSectionSize( nmax )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set maximum distance up to which section members are allowed (default: 100 meters).
|
||||||
|
-- @param #AIRBOSS self
|
||||||
|
-- @param #number dmax Max distance in meters (default 100 m). Minimum is 10 m, maximum is 5000 m.
|
||||||
|
-- @return #AIRBOSS self
|
||||||
|
function AIRBOSS:SetMaxSectionDistance( dmax )
|
||||||
|
if dmax then
|
||||||
|
if dmax < 10 then
|
||||||
|
dmax = 10
|
||||||
|
elseif dmax > 5000 then
|
||||||
|
dmax = 5000
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.maxsectiondistance = dmax or 100
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Set max number of flights per stack. All members of a section count as one "flight".
|
--- Set max number of flights per stack. All members of a section count as one "flight".
|
||||||
-- @param #AIRBOSS self
|
-- @param #AIRBOSS self
|
||||||
-- @param #number nmax Number of max allowed flights per stack. Default is two. Minimum is one, maximum is 4.
|
-- @param #number nmax Number of max allowed flights per stack. Default is two. Minimum is one, maximum is 4.
|
||||||
@@ -3601,7 +3633,7 @@ function AIRBOSS:onafterStart( From, Event, To )
|
|||||||
|
|
||||||
-- Handle events.
|
-- Handle events.
|
||||||
self:HandleEvent( EVENTS.Birth )
|
self:HandleEvent( EVENTS.Birth )
|
||||||
self:HandleEvent( EVENTS.Land )
|
self:HandleEvent( EVENTS.RunwayTouch )
|
||||||
self:HandleEvent( EVENTS.EngineShutdown )
|
self:HandleEvent( EVENTS.EngineShutdown )
|
||||||
self:HandleEvent( EVENTS.Takeoff )
|
self:HandleEvent( EVENTS.Takeoff )
|
||||||
self:HandleEvent( EVENTS.Crash )
|
self:HandleEvent( EVENTS.Crash )
|
||||||
@@ -3641,6 +3673,12 @@ function AIRBOSS:onafterStatus( From, Event, To )
|
|||||||
local pos = self:GetCoordinate()
|
local pos = self:GetCoordinate()
|
||||||
local speed = self.carrier:GetVelocityKNOTS()
|
local speed = self.carrier:GetVelocityKNOTS()
|
||||||
|
|
||||||
|
-- Update magnetic variation if we can get it from DCS.
|
||||||
|
if require then
|
||||||
|
self.magvar=pos:GetMagneticDeclination()
|
||||||
|
--env.info(string.format("FF magvar=%.1f", self.magvar))
|
||||||
|
end
|
||||||
|
|
||||||
-- Check water is ahead.
|
-- Check water is ahead.
|
||||||
local collision = false -- self:_CheckCollisionCoord(pos:Translate(self.collisiondist, hdg))
|
local collision = false -- self:_CheckCollisionCoord(pos:Translate(self.collisiondist, hdg))
|
||||||
|
|
||||||
@@ -4360,7 +4398,7 @@ function AIRBOSS:onafterStop( From, Event, To )
|
|||||||
|
|
||||||
-- Unhandle events.
|
-- Unhandle events.
|
||||||
self:UnHandleEvent( EVENTS.Birth )
|
self:UnHandleEvent( EVENTS.Birth )
|
||||||
self:UnHandleEvent( EVENTS.Land )
|
self:UnHandleEvent( EVENTS.RunwayTouch )
|
||||||
self:UnHandleEvent( EVENTS.EngineShutdown )
|
self:UnHandleEvent( EVENTS.EngineShutdown )
|
||||||
self:UnHandleEvent( EVENTS.Takeoff )
|
self:UnHandleEvent( EVENTS.Takeoff )
|
||||||
self:UnHandleEvent( EVENTS.Crash )
|
self:UnHandleEvent( EVENTS.Crash )
|
||||||
@@ -5200,6 +5238,7 @@ function AIRBOSS:_InitVoiceOvers()
|
|||||||
TOMCAT = { file = "PILOT-Tomcat", suffix = "ogg", loud = false, subtitle = "", duration = 0.66, subduration = 5 },
|
TOMCAT = { file = "PILOT-Tomcat", suffix = "ogg", loud = false, subtitle = "", duration = 0.66, subduration = 5 },
|
||||||
HORNET = { file = "PILOT-Hornet", suffix = "ogg", loud = false, subtitle = "", duration = 0.56, subduration = 5 },
|
HORNET = { file = "PILOT-Hornet", suffix = "ogg", loud = false, subtitle = "", duration = 0.56, subduration = 5 },
|
||||||
VIKING = { file = "PILOT-Viking", suffix = "ogg", loud = false, subtitle = "", duration = 0.61, subduration = 5 },
|
VIKING = { file = "PILOT-Viking", suffix = "ogg", loud = false, subtitle = "", duration = 0.61, subduration = 5 },
|
||||||
|
GREYHOUND = { file = "PILOT-Greyhound", suffix = "ogg", loud = false, subtitle = "", duration = 0.61, subduration = 5 },
|
||||||
BALL = { file = "PILOT-Ball", suffix = "ogg", loud = false, subtitle = "", duration = 0.50, subduration = 5 },
|
BALL = { file = "PILOT-Ball", suffix = "ogg", loud = false, subtitle = "", duration = 0.50, subduration = 5 },
|
||||||
BINGOFUEL = { file = "PILOT-BingoFuel", suffix = "ogg", loud = false, subtitle = "", duration = 0.80 },
|
BINGOFUEL = { file = "PILOT-BingoFuel", suffix = "ogg", loud = false, subtitle = "", duration = 0.80 },
|
||||||
GASATDIVERT = { file = "PILOT-GasAtDivert", suffix = "ogg", loud = false, subtitle = "", duration = 1.80 },
|
GASATDIVERT = { file = "PILOT-GasAtDivert", suffix = "ogg", loud = false, subtitle = "", duration = 1.80 },
|
||||||
@@ -6474,7 +6513,7 @@ function AIRBOSS:_LandAI( flight )
|
|||||||
or flight.actype == AIRBOSS.AircraftCarrier.RHINOF
|
or flight.actype == AIRBOSS.AircraftCarrier.RHINOF
|
||||||
or flight.actype == AIRBOSS.AircraftCarrier.GROWLER then
|
or flight.actype == AIRBOSS.AircraftCarrier.GROWLER then
|
||||||
Speed = UTILS.KnotsToKmph( 200 )
|
Speed = UTILS.KnotsToKmph( 200 )
|
||||||
elseif flight.actype == AIRBOSS.AircraftCarrier.E2D then
|
elseif flight.actype == AIRBOSS.AircraftCarrier.E2D or flight.actype == AIRBOSS.AircraftCarrier.C2A then
|
||||||
Speed = UTILS.KnotsToKmph( 150 )
|
Speed = UTILS.KnotsToKmph( 150 )
|
||||||
elseif flight.actype == AIRBOSS.AircraftCarrier.F14A_AI or flight.actype == AIRBOSS.AircraftCarrier.F14A or flight.actype == AIRBOSS.AircraftCarrier.F14B then
|
elseif flight.actype == AIRBOSS.AircraftCarrier.F14A_AI or flight.actype == AIRBOSS.AircraftCarrier.F14A or flight.actype == AIRBOSS.AircraftCarrier.F14B then
|
||||||
Speed = UTILS.KnotsToKmph( 175 )
|
Speed = UTILS.KnotsToKmph( 175 )
|
||||||
@@ -8269,7 +8308,7 @@ end
|
|||||||
--- Airboss event handler for event land.
|
--- Airboss event handler for event land.
|
||||||
-- @param #AIRBOSS self
|
-- @param #AIRBOSS self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AIRBOSS:OnEventLand( EventData )
|
function AIRBOSS:OnEventRunwayTouch( EventData )
|
||||||
self:F3( { eventland = EventData } )
|
self:F3( { eventland = EventData } )
|
||||||
|
|
||||||
-- Nil checks.
|
-- Nil checks.
|
||||||
@@ -8702,13 +8741,13 @@ function AIRBOSS:OnEventRemoveUnit( EventData )
|
|||||||
|
|
||||||
-- Nil checks.
|
-- Nil checks.
|
||||||
if EventData == nil then
|
if EventData == nil then
|
||||||
self:E( self.lid .. "ERROR: EventData=nil in event REMOVEUNIT!" )
|
self:T( self.lid .. "ERROR: EventData=nil in event REMOVEUNIT!" )
|
||||||
self:E( EventData )
|
self:T( EventData )
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if EventData.IniUnit == nil then
|
if EventData.IniUnit == nil then
|
||||||
self:E( self.lid .. "ERROR: EventData.IniUnit=nil in event REMOVEUNIT!" )
|
self:T( self.lid .. "ERROR: EventData.IniUnit=nil in event REMOVEUNIT!" )
|
||||||
self:E( EventData )
|
self:T( EventData )
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -11475,7 +11514,7 @@ end
|
|||||||
|
|
||||||
--- Get wind direction and speed at carrier position.
|
--- Get wind direction and speed at carrier position.
|
||||||
-- @param #AIRBOSS self
|
-- @param #AIRBOSS self
|
||||||
-- @param #number alt Altitude ASL in meters. Default 15 m.
|
-- @param #number alt Altitude ASL in meters. Default 18 m.
|
||||||
-- @param #boolean magnetic Direction including magnetic declination.
|
-- @param #boolean magnetic Direction including magnetic declination.
|
||||||
-- @param Core.Point#COORDINATE coord (Optional) Coordinate at which to get the wind. Default is current carrier position.
|
-- @param Core.Point#COORDINATE coord (Optional) Coordinate at which to get the wind. Default is current carrier position.
|
||||||
-- @return #number Direction the wind is blowing **from** in degrees.
|
-- @return #number Direction the wind is blowing **from** in degrees.
|
||||||
@@ -11547,10 +11586,31 @@ end
|
|||||||
|
|
||||||
--- Get true (or magnetic) heading of carrier into the wind. This accounts for the angled runway.
|
--- Get true (or magnetic) heading of carrier into the wind. This accounts for the angled runway.
|
||||||
-- @param #AIRBOSS self
|
-- @param #AIRBOSS self
|
||||||
|
-- @param #number vdeck Desired wind velocity over deck in knots.
|
||||||
-- @param #boolean magnetic If true, calculate magnetic heading. By default true heading is returned.
|
-- @param #boolean magnetic If true, calculate magnetic heading. By default true heading is returned.
|
||||||
-- @param Core.Point#COORDINATE coord (Optional) Coordinate from which heading is calculated. Default is current carrier position.
|
-- @param Core.Point#COORDINATE coord (Optional) Coordinate from which heading is calculated. Default is current carrier position.
|
||||||
-- @return #number Carrier heading in degrees.
|
-- @return #number Carrier heading in degrees.
|
||||||
function AIRBOSS:GetHeadingIntoWind_old( magnetic, coord )
|
-- @return #number Carrier speed in knots to reach desired wind speed on deck.
|
||||||
|
function AIRBOSS:GetHeadingIntoWind(vdeck, magnetic, coord )
|
||||||
|
|
||||||
|
if self.intowindold then
|
||||||
|
--env.info("FF use OLD into wind")
|
||||||
|
return self:GetHeadingIntoWind_old(vdeck, magnetic, coord)
|
||||||
|
else
|
||||||
|
--env.info("FF use NEW into wind")
|
||||||
|
return self:GetHeadingIntoWind_new(vdeck, magnetic, coord)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Get true (or magnetic) heading of carrier into the wind. This accounts for the angled runway.
|
||||||
|
-- @param #AIRBOSS self
|
||||||
|
-- @param #number vdeck Desired wind velocity over deck in knots.
|
||||||
|
-- @param #boolean magnetic If true, calculate magnetic heading. By default true heading is returned.
|
||||||
|
-- @param Core.Point#COORDINATE coord (Optional) Coordinate from which heading is calculated. Default is current carrier position.
|
||||||
|
-- @return #number Carrier heading in degrees.
|
||||||
|
function AIRBOSS:GetHeadingIntoWind_old( vdeck, magnetic, coord )
|
||||||
|
|
||||||
local function adjustDegreesForWindSpeed(windSpeed)
|
local function adjustDegreesForWindSpeed(windSpeed)
|
||||||
local degreesAdjustment = 0
|
local degreesAdjustment = 0
|
||||||
@@ -11607,7 +11667,13 @@ function AIRBOSS:GetHeadingIntoWind_old( magnetic, coord )
|
|||||||
intowind = intowind + 360
|
intowind = intowind + 360
|
||||||
end
|
end
|
||||||
|
|
||||||
return intowind
|
-- Wind speed.
|
||||||
|
--local _, vwind = self:GetWind()
|
||||||
|
|
||||||
|
-- Speed of carrier in m/s but at least 4 knots.
|
||||||
|
local vtot = math.max(vdeck-UTILS.MpsToKnots(vwind), 4)
|
||||||
|
|
||||||
|
return intowind, vtot
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get true (or magnetic) heading of carrier into the wind. This accounts for the angled runway.
|
--- Get true (or magnetic) heading of carrier into the wind. This accounts for the angled runway.
|
||||||
@@ -11618,7 +11684,7 @@ end
|
|||||||
-- @param Core.Point#COORDINATE coord (Optional) Coordinate from which heading is calculated. Default is current carrier position.
|
-- @param Core.Point#COORDINATE coord (Optional) Coordinate from which heading is calculated. Default is current carrier position.
|
||||||
-- @return #number Carrier heading in degrees.
|
-- @return #number Carrier heading in degrees.
|
||||||
-- @return #number Carrier speed in knots to reach desired wind speed on deck.
|
-- @return #number Carrier speed in knots to reach desired wind speed on deck.
|
||||||
function AIRBOSS:GetHeadingIntoWind( vdeck, magnetic, coord )
|
function AIRBOSS:GetHeadingIntoWind_new( vdeck, magnetic, coord )
|
||||||
|
|
||||||
-- Default offset angle.
|
-- Default offset angle.
|
||||||
local Offset=self.carrierparam.rwyangle or 0
|
local Offset=self.carrierparam.rwyangle or 0
|
||||||
@@ -14279,6 +14345,8 @@ function AIRBOSS:_GetACNickname( actype )
|
|||||||
nickname = "Harrier"
|
nickname = "Harrier"
|
||||||
elseif actype == AIRBOSS.AircraftCarrier.E2D then
|
elseif actype == AIRBOSS.AircraftCarrier.E2D then
|
||||||
nickname = "Hawkeye"
|
nickname = "Hawkeye"
|
||||||
|
elseif actype == AIRBOSS.AircraftCarrier.C2A then
|
||||||
|
nickname = "Greyhound"
|
||||||
elseif actype == AIRBOSS.AircraftCarrier.F14A_AI or actype == AIRBOSS.AircraftCarrier.F14A or actype == AIRBOSS.AircraftCarrier.F14B then
|
elseif actype == AIRBOSS.AircraftCarrier.F14A_AI or actype == AIRBOSS.AircraftCarrier.F14A or actype == AIRBOSS.AircraftCarrier.F14B then
|
||||||
nickname = "Tomcat"
|
nickname = "Tomcat"
|
||||||
elseif actype == AIRBOSS.AircraftCarrier.FA18C or actype == AIRBOSS.AircraftCarrier.HORNET then
|
elseif actype == AIRBOSS.AircraftCarrier.FA18C or actype == AIRBOSS.AircraftCarrier.HORNET then
|
||||||
@@ -14316,32 +14384,55 @@ function AIRBOSS:_GetOnboardNumbers( group, playeronly )
|
|||||||
-- Debug text.
|
-- Debug text.
|
||||||
local text = string.format( "Onboard numbers of group %s:", groupname )
|
local text = string.format( "Onboard numbers of group %s:", groupname )
|
||||||
|
|
||||||
-- Units of template group.
|
local template=group:GetTemplate()
|
||||||
local units = group:GetTemplate().units
|
|
||||||
|
|
||||||
-- Get numbers.
|
|
||||||
local numbers = {}
|
local numbers = {}
|
||||||
for _, unit in pairs( units ) do
|
if template then
|
||||||
|
|
||||||
-- Onboard number and unit name.
|
-- Units of template group.
|
||||||
local n = tostring( unit.onboard_num )
|
local units = template.units
|
||||||
local name = unit.name
|
|
||||||
local skill = unit.skill or "Unknown"
|
|
||||||
|
|
||||||
-- Debug text.
|
-- Get numbers.
|
||||||
text = text .. string.format( "\n- unit %s: onboard #=%s skill=%s", name, n, tostring( skill ) )
|
for _, unit in pairs( units ) do
|
||||||
|
|
||||||
if playeronly and skill == "Client" or skill == "Player" then
|
-- Onboard number and unit name.
|
||||||
-- There can be only one player in the group, so we skip everything else.
|
local n = tostring( unit.onboard_num )
|
||||||
return n
|
local name = unit.name
|
||||||
|
local skill = unit.skill or "Unknown"
|
||||||
|
|
||||||
|
-- Debug text.
|
||||||
|
text = text .. string.format( "\n- unit %s: onboard #=%s skill=%s", name, n, tostring( skill ) )
|
||||||
|
|
||||||
|
if playeronly and skill == "Client" or skill == "Player" then
|
||||||
|
-- There can be only one player in the group, so we skip everything else.
|
||||||
|
return n
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Table entry.
|
||||||
|
numbers[name] = n
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Table entry.
|
-- Debug info.
|
||||||
numbers[name] = n
|
self:T2( self.lid .. text )
|
||||||
end
|
|
||||||
|
|
||||||
-- Debug info.
|
else
|
||||||
self:T2( self.lid .. text )
|
|
||||||
|
if playeronly then
|
||||||
|
return 101
|
||||||
|
else
|
||||||
|
|
||||||
|
local units=group:GetUnits()
|
||||||
|
|
||||||
|
for i,_unit in pairs(units) do
|
||||||
|
local name=_unit:GetName()
|
||||||
|
|
||||||
|
numbers[name]=100+i
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
return numbers
|
return numbers
|
||||||
end
|
end
|
||||||
@@ -14606,7 +14697,7 @@ function AIRBOSS:_GetPlayerUnitAndName( _unitName )
|
|||||||
-- Get DCS unit from its name.
|
-- Get DCS unit from its name.
|
||||||
local DCSunit = Unit.getByName( _unitName )
|
local DCSunit = Unit.getByName( _unitName )
|
||||||
|
|
||||||
if DCSunit then
|
if DCSunit and DCSunit.getPlayerName then
|
||||||
|
|
||||||
-- Get player name if any.
|
-- Get player name if any.
|
||||||
local playername = DCSunit:getPlayerName()
|
local playername = DCSunit:getPlayerName()
|
||||||
@@ -15577,7 +15668,7 @@ function AIRBOSS:_Number2Sound( playerData, sender, number, delay )
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Split string into characters.
|
-- Split string into characters.
|
||||||
local numbers = _split( number )
|
local numbers = _split( tostring(number) )
|
||||||
|
|
||||||
local wait = 0
|
local wait = 0
|
||||||
for i = 1, #numbers do
|
for i = 1, #numbers do
|
||||||
@@ -15645,7 +15736,7 @@ function AIRBOSS:_Number2Radio( radio, number, delay, interval, pilotcall )
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Split string into characters.
|
-- Split string into characters.
|
||||||
local numbers = _split( number )
|
local numbers = _split( tostring(number) )
|
||||||
|
|
||||||
local wait = 0
|
local wait = 0
|
||||||
for i = 1, #numbers do
|
for i = 1, #numbers do
|
||||||
@@ -16975,7 +17066,7 @@ function AIRBOSS:_RemoveSectionMember( playerData, sectionmember )
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set all flights within 100 meters to be part of my section.
|
--- Set all flights within maxsectiondistance meters to be part of my section (default: 100 meters).
|
||||||
-- @param #AIRBOSS self
|
-- @param #AIRBOSS self
|
||||||
-- @param #string _unitName Name of the player unit.
|
-- @param #string _unitName Name of the player unit.
|
||||||
function AIRBOSS:_SetSection( _unitName )
|
function AIRBOSS:_SetSection( _unitName )
|
||||||
@@ -16993,7 +17084,7 @@ function AIRBOSS:_SetSection( _unitName )
|
|||||||
local mycoord = _unit:GetCoordinate()
|
local mycoord = _unit:GetCoordinate()
|
||||||
|
|
||||||
-- Max distance up to which section members are allowed.
|
-- Max distance up to which section members are allowed.
|
||||||
local dmax = 100
|
local dmax = self.maxsectiondistance
|
||||||
|
|
||||||
-- Check if player is in Marshal or pattern queue already.
|
-- Check if player is in Marshal or pattern queue already.
|
||||||
local text
|
local text
|
||||||
@@ -18013,7 +18104,7 @@ function AIRBOSS:_MarkCaseZones( _unitName, flare )
|
|||||||
self:_GetZoneArcIn( case ):FlareZone( FLARECOLOR.White, 45 )
|
self:_GetZoneArcIn( case ):FlareZone( FLARECOLOR.White, 45 )
|
||||||
text = text .. "\n* arc turn in with WHITE flares"
|
text = text .. "\n* arc turn in with WHITE flares"
|
||||||
self:_GetZoneArcOut( case ):FlareZone( FLARECOLOR.White, 45 )
|
self:_GetZoneArcOut( case ):FlareZone( FLARECOLOR.White, 45 )
|
||||||
text = text .. "\n* arc trun out with WHITE flares"
|
text = text .. "\n* arc turn out with WHITE flares"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -18065,7 +18156,7 @@ function AIRBOSS:_MarkCaseZones( _unitName, flare )
|
|||||||
self:_GetZoneArcIn( case ):SmokeZone( SMOKECOLOR.Blue, 45 )
|
self:_GetZoneArcIn( case ):SmokeZone( SMOKECOLOR.Blue, 45 )
|
||||||
text = text .. "\n* arc turn in with BLUE smoke"
|
text = text .. "\n* arc turn in with BLUE smoke"
|
||||||
self:_GetZoneArcOut( case ):SmokeZone( SMOKECOLOR.Blue, 45 )
|
self:_GetZoneArcOut( case ):SmokeZone( SMOKECOLOR.Blue, 45 )
|
||||||
text = text .. "\n* arc trun out with BLUE smoke"
|
text = text .. "\n* arc turn out with BLUE smoke"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
-- @image OPS_CSAR.jpg
|
-- @image OPS_CSAR.jpg
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Last Update April 2024
|
-- Last Update May 2025
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
--- **CSAR** class, extends Core.Base#BASE, Core.Fsm#FSM
|
--- **CSAR** class, extends Core.Base#BASE, Core.Fsm#FSM
|
||||||
@@ -41,6 +41,7 @@
|
|||||||
-- @field #string lid Class id string for output to DCS log file.
|
-- @field #string lid Class id string for output to DCS log file.
|
||||||
-- @field #number coalition Coalition side number, e.g. `coalition.side.RED`.
|
-- @field #number coalition Coalition side number, e.g. `coalition.side.RED`.
|
||||||
-- @field Core.Set#SET_GROUP allheligroupset Set of CSAR heli groups.
|
-- @field Core.Set#SET_GROUP allheligroupset Set of CSAR heli groups.
|
||||||
|
-- @field Core.Set#SET_GROUP UserSetGroup Set of CSAR heli groups as designed by the mission designer (if any set).
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
--- *Combat search and rescue (CSAR) are search and rescue operations that are carried out during war that are within or near combat zones.* (Wikipedia)
|
--- *Combat search and rescue (CSAR) are search and rescue operations that are carried out during war that are within or near combat zones.* (Wikipedia)
|
||||||
@@ -91,7 +92,7 @@
|
|||||||
-- mycsar.immortalcrew = true -- Set to true to make wounded crew immortal.
|
-- mycsar.immortalcrew = true -- Set to true to make wounded crew immortal.
|
||||||
-- mycsar.invisiblecrew = false -- Set to true to make wounded crew insvisible.
|
-- mycsar.invisiblecrew = false -- Set to true to make wounded crew insvisible.
|
||||||
-- mycsar.loadDistance = 75 -- configure distance for pilots to get into helicopter in meters.
|
-- mycsar.loadDistance = 75 -- configure distance for pilots to get into helicopter in meters.
|
||||||
-- mycsar.mashprefix = {"MASH"} -- prefixes of #GROUP objects used as MASHes.
|
-- mycsar.mashprefix = {"MASH"} -- prefixes of #GROUP objects used as MASHes. Will also try to add ZONE and STATIC objects with this prefix once at startup.
|
||||||
-- mycsar.max_units = 6 -- max number of pilots that can be carried if #CSAR.AircraftType is undefined.
|
-- mycsar.max_units = 6 -- max number of pilots that can be carried if #CSAR.AircraftType is undefined.
|
||||||
-- mycsar.messageTime = 15 -- Time to show messages for in seconds. Doubled for long messages.
|
-- mycsar.messageTime = 15 -- Time to show messages for in seconds. Doubled for long messages.
|
||||||
-- mycsar.radioSound = "beacon.ogg" -- the name of the sound file to use for the pilots\' radio beacons.
|
-- mycsar.radioSound = "beacon.ogg" -- the name of the sound file to use for the pilots\' radio beacons.
|
||||||
@@ -116,8 +117,17 @@
|
|||||||
-- mycsar.topmenuname = "CSAR" -- set the menu entry name
|
-- mycsar.topmenuname = "CSAR" -- set the menu entry name
|
||||||
-- mycsar.ADFRadioPwr = 1000 -- ADF Beacons sending with 1KW as default
|
-- mycsar.ADFRadioPwr = 1000 -- ADF Beacons sending with 1KW as default
|
||||||
-- mycsar.PilotWeight = 80 -- Loaded pilots weigh 80kgs each
|
-- mycsar.PilotWeight = 80 -- Loaded pilots weigh 80kgs each
|
||||||
|
-- mycsar.AllowIRStrobe = false -- Allow a menu item to request an IR strobe to find a downed pilot at night (requires NVGs to see it).
|
||||||
|
-- mycsar.IRStrobeRuntime = 300 -- If an IR Strobe is activated, it runs for 300 seconds (5 mins).
|
||||||
--
|
--
|
||||||
-- ## 2.1 SRS Features and Other Features
|
-- ## 2.1 Create own SET_GROUP to manage CTLD Pilot groups
|
||||||
|
--
|
||||||
|
-- -- Parameter: Set The SET_GROUP object created by the mission designer/user to represent the CSAR pilot groups.
|
||||||
|
-- -- Needs to be set before starting the CSAR instance.
|
||||||
|
-- local myset = SET_GROUP:New():FilterPrefixes("Helikopter"):FilterCoalitions("red"):FilterStart()
|
||||||
|
-- mycsar:SetOwnSetPilotGroups(myset)
|
||||||
|
--
|
||||||
|
-- ## 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\\" -- adjust your own path in your SRS installation -- server(!)
|
||||||
@@ -136,6 +146,7 @@
|
|||||||
-- mycsar.csarUsePara = false -- If set to true, will use the LandingAfterEjection Event instead of Ejection. Requires mycsar.enableForAI to be set to true. --shagrat
|
-- mycsar.csarUsePara = false -- If set to true, will use the LandingAfterEjection Event instead of Ejection. Requires mycsar.enableForAI to be set to true. --shagrat
|
||||||
-- mycsar.wetfeettemplate = "man in floating thingy" -- if you use a mod to have a pilot in a rescue float, put the template name in here for wet feet spawns. Note: in conjunction with csarUsePara this might create dual ejected pilots in edge cases.
|
-- mycsar.wetfeettemplate = "man in floating thingy" -- if you use a mod to have a pilot in a rescue float, put the template name in here for wet feet spawns. Note: in conjunction with csarUsePara this might create dual ejected pilots in edge cases.
|
||||||
-- mycsar.allowbronco = false -- set to true to use the Bronco mod as a CSAR plane
|
-- mycsar.allowbronco = false -- set to true to use the Bronco mod as a CSAR plane
|
||||||
|
-- mycsar.CreateRadioBeacons = true -- set to false to disallow creating ADF radio beacons.
|
||||||
--
|
--
|
||||||
-- ## 3. Results
|
-- ## 3. Results
|
||||||
--
|
--
|
||||||
@@ -252,10 +263,15 @@ 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,
|
||||||
PilotWeight = 80,
|
PilotWeight = 80,
|
||||||
|
CreateRadioBeacons = true,
|
||||||
|
UserSetGroup = nil,
|
||||||
|
AllowIRStrobe = false,
|
||||||
|
IRStrobeRuntime = 300,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Downed pilots info.
|
--- Downed pilots info.
|
||||||
@@ -272,6 +288,7 @@ CSAR = {
|
|||||||
-- @field #number timestamp Timestamp for approach process.
|
-- @field #number timestamp Timestamp for approach process.
|
||||||
-- @field #boolean alive Group is alive or dead/rescued.
|
-- @field #boolean alive Group is alive or dead/rescued.
|
||||||
-- @field #boolean wetfeet Group is spawned over (deep) water.
|
-- @field #boolean wetfeet Group is spawned over (deep) water.
|
||||||
|
-- @field #string BeaconName Name of radio beacon - if any.
|
||||||
|
|
||||||
--- All slot / Limit settings
|
--- All slot / Limit settings
|
||||||
-- @type CSAR.AircraftType
|
-- @type CSAR.AircraftType
|
||||||
@@ -292,10 +309,12 @@ CSAR.AircraftType["AH-64D_BLK_II"] = 2
|
|||||||
CSAR.AircraftType["Bronco-OV-10A"] = 2
|
CSAR.AircraftType["Bronco-OV-10A"] = 2
|
||||||
CSAR.AircraftType["MH-60R"] = 10
|
CSAR.AircraftType["MH-60R"] = 10
|
||||||
CSAR.AircraftType["OH-6A"] = 2
|
CSAR.AircraftType["OH-6A"] = 2
|
||||||
|
CSAR.AircraftType["OH58D"] = 2
|
||||||
|
CSAR.AircraftType["CH-47Fbl1"] = 31
|
||||||
|
|
||||||
--- CSAR class version.
|
--- CSAR class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
CSAR.version="1.0.22"
|
CSAR.version="1.0.33"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- ToDo list
|
-- ToDo list
|
||||||
@@ -450,11 +469,14 @@ 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
|
||||||
|
|
||||||
|
-- Own SET_GROUP if any
|
||||||
|
self.UserSetGroup = nil
|
||||||
|
|
||||||
-- WARNING - here\'ll be dragons
|
-- WARNING - here\'ll be dragons
|
||||||
-- 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)
|
||||||
@@ -632,7 +654,7 @@ end
|
|||||||
-- @param #string Playername Name of Player (if applicable)
|
-- @param #string Playername Name of Player (if applicable)
|
||||||
-- @param #boolean Wetfeet Ejected over water
|
-- @param #boolean Wetfeet Ejected over water
|
||||||
-- @return #CSAR self.
|
-- @return #CSAR self.
|
||||||
function CSAR:_CreateDownedPilotTrack(Group,Groupname,Side,OriginalUnit,Description,Typename,Frequency,Playername,Wetfeet)
|
function CSAR:_CreateDownedPilotTrack(Group,Groupname,Side,OriginalUnit,Description,Typename,Frequency,Playername,Wetfeet,BeaconName)
|
||||||
self:T({"_CreateDownedPilotTrack",Groupname,Side,OriginalUnit,Description,Typename,Frequency,Playername})
|
self:T({"_CreateDownedPilotTrack",Groupname,Side,OriginalUnit,Description,Typename,Frequency,Playername})
|
||||||
|
|
||||||
-- create new entry
|
-- create new entry
|
||||||
@@ -640,7 +662,7 @@ function CSAR:_CreateDownedPilotTrack(Group,Groupname,Side,OriginalUnit,Descript
|
|||||||
DownedPilot.desc = Description or ""
|
DownedPilot.desc = Description or ""
|
||||||
DownedPilot.frequency = Frequency or 0
|
DownedPilot.frequency = Frequency or 0
|
||||||
DownedPilot.index = self.downedpilotcounter
|
DownedPilot.index = self.downedpilotcounter
|
||||||
DownedPilot.name = Groupname or ""
|
DownedPilot.name = Groupname or Playername or ""
|
||||||
DownedPilot.originalUnit = OriginalUnit or ""
|
DownedPilot.originalUnit = OriginalUnit or ""
|
||||||
DownedPilot.player = Playername or ""
|
DownedPilot.player = Playername or ""
|
||||||
DownedPilot.side = Side or 0
|
DownedPilot.side = Side or 0
|
||||||
@@ -649,6 +671,7 @@ function CSAR:_CreateDownedPilotTrack(Group,Groupname,Side,OriginalUnit,Descript
|
|||||||
DownedPilot.timestamp = 0
|
DownedPilot.timestamp = 0
|
||||||
DownedPilot.alive = true
|
DownedPilot.alive = true
|
||||||
DownedPilot.wetfeet = Wetfeet or false
|
DownedPilot.wetfeet = Wetfeet or false
|
||||||
|
DownedPilot.BeaconName = BeaconName
|
||||||
|
|
||||||
-- Add Pilot
|
-- Add Pilot
|
||||||
local PilotTable = self.downedPilots
|
local PilotTable = self.downedPilots
|
||||||
@@ -735,7 +758,6 @@ function CSAR:_SpawnPilotInField(country,point,frequency,wetfeet)
|
|||||||
:NewWithAlias(template,alias)
|
:NewWithAlias(template,alias)
|
||||||
:InitCoalition(coalition)
|
:InitCoalition(coalition)
|
||||||
:InitCountry(country)
|
:InitCountry(country)
|
||||||
:InitAIOnOff(pilotcacontrol)
|
|
||||||
:InitDelayOff()
|
:InitDelayOff()
|
||||||
:SpawnFromCoordinate(point)
|
:SpawnFromCoordinate(point)
|
||||||
|
|
||||||
@@ -788,6 +810,8 @@ end
|
|||||||
-- @param #boolean noMessage
|
-- @param #boolean noMessage
|
||||||
-- @param #string _description Description
|
-- @param #string _description Description
|
||||||
-- @param #boolean forcedesc Use the description only for the pilot track entry
|
-- @param #boolean forcedesc Use the description only for the pilot track entry
|
||||||
|
-- @return Wrapper.Group#GROUP PilotInField Pilot GROUP object
|
||||||
|
-- @return #string AliasName Alias display name
|
||||||
function CSAR:_AddCsar(_coalition , _country, _point, _typeName, _unitName, _playerName, _freq, noMessage, _description, forcedesc )
|
function CSAR:_AddCsar(_coalition , _country, _point, _typeName, _unitName, _playerName, _freq, noMessage, _description, forcedesc )
|
||||||
self:T(self.lid .. " _AddCsar")
|
self:T(self.lid .. " _AddCsar")
|
||||||
self:T({_coalition , _country, _point, _typeName, _unitName, _playerName, _freq, noMessage, _description})
|
self:T({_coalition , _country, _point, _typeName, _unitName, _playerName, _freq, noMessage, _description})
|
||||||
@@ -817,8 +841,18 @@ function CSAR:_AddCsar(_coalition , _country, _point, _typeName, _unitName, _pla
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local BeaconName
|
||||||
|
|
||||||
|
if _playerName then
|
||||||
|
BeaconName = _playerName..math.random(1,10000)
|
||||||
|
elseif _unitName then
|
||||||
|
BeaconName = _unitName..math.random(1,10000)
|
||||||
|
else
|
||||||
|
BeaconName = "Ghost-1-1"..math.random(1,10000)
|
||||||
|
end
|
||||||
|
|
||||||
if (_freq and _freq ~= 0) then --shagrat only add beacon if _freq is NOT 0
|
if (_freq and _freq ~= 0) then --shagrat only add beacon if _freq is NOT 0
|
||||||
self:_AddBeaconToGroup(_spawnedGroup, _freq)
|
self:_AddBeaconToGroup(_spawnedGroup, _freq, BeaconName)
|
||||||
end
|
end
|
||||||
|
|
||||||
self:_AddSpecialOptions(_spawnedGroup)
|
self:_AddSpecialOptions(_spawnedGroup)
|
||||||
@@ -843,11 +877,11 @@ function CSAR:_AddCsar(_coalition , _country, _point, _typeName, _unitName, _pla
|
|||||||
|
|
||||||
local _GroupName = _spawnedGroup:GetName() or _alias
|
local _GroupName = _spawnedGroup:GetName() or _alias
|
||||||
|
|
||||||
self:_CreateDownedPilotTrack(_spawnedGroup,_GroupName,_coalition,_unitName,_text,_typeName,_freq,_playerName,wetfeet)
|
self:_CreateDownedPilotTrack(_spawnedGroup,_GroupName,_coalition,_unitName,_text,_typeName,_freq,_playerName,wetfeet,BeaconName)
|
||||||
|
|
||||||
self:_InitSARForPilot(_spawnedGroup, _unitName, _freq, noMessage, _playerName) --shagrat use unitName to have the aircraft callsign / descriptive "name" etc.
|
self:_InitSARForPilot(_spawnedGroup, _unitName, _freq, noMessage, _playerName) --shagrat use unitName to have the aircraft callsign / descriptive "name" etc.
|
||||||
|
|
||||||
return self
|
return _spawnedGroup, _alias
|
||||||
end
|
end
|
||||||
|
|
||||||
--- (Internal) Function to add a CSAR object into the scene at a zone coordinate. For mission designers wanting to add e.g. PoWs to the scene.
|
--- (Internal) Function to add a CSAR object into the scene at a zone coordinate. For mission designers wanting to add e.g. PoWs to the scene.
|
||||||
@@ -961,7 +995,6 @@ end
|
|||||||
-- @param Core.Point#COORDINATE Point
|
-- @param Core.Point#COORDINATE Point
|
||||||
-- @param #number Coalition Coalition.
|
-- @param #number Coalition Coalition.
|
||||||
-- @param #string Description (optional) Description.
|
-- @param #string Description (optional) Description.
|
||||||
-- @param #boolean addBeacon (optional) yes or no.
|
|
||||||
-- @param #boolean Nomessage (optional) If true, don\'t send a message to SAR.
|
-- @param #boolean Nomessage (optional) If true, don\'t send a message to SAR.
|
||||||
-- @param #string Unitname (optional) Name of the lost unit.
|
-- @param #string Unitname (optional) Name of the lost unit.
|
||||||
-- @param #string Typename (optional) Type of plane.
|
-- @param #string Typename (optional) Type of plane.
|
||||||
@@ -1113,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
|
||||||
@@ -1137,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()
|
||||||
|
|
||||||
@@ -1239,10 +1291,24 @@ function CSAR:_InitSARForPilot(_downedGroup, _GroupName, _freq, _nomessage, _pla
|
|||||||
if not _nomessage then
|
if not _nomessage then
|
||||||
if _freq ~= 0 then --shagrat
|
if _freq ~= 0 then --shagrat
|
||||||
local _text = string.format("%s requests SAR at %s, beacon at %.2f KHz", _groupName, _coordinatesText, _freqk)--shagrat _groupName to prevent 'f15_Pilot_Parachute'
|
local _text = string.format("%s requests SAR at %s, beacon at %.2f KHz", _groupName, _coordinatesText, _freqk)--shagrat _groupName to prevent 'f15_Pilot_Parachute'
|
||||||
self:_DisplayToAllSAR(_text,self.coalition,self.messageTime)
|
if self.coordtype ~= 2 then --not MGRS
|
||||||
|
self:_DisplayToAllSAR(_text,self.coalition,self.messageTime)
|
||||||
|
else
|
||||||
|
self:_DisplayToAllSAR(_text,self.coalition,self.messageTime,false,true)
|
||||||
|
local coordtext = UTILS.MGRSStringToSRSFriendly(_coordinatesText,true)
|
||||||
|
local _text = string.format("%s requests SAR at %s, beacon at %.2f kilo hertz", _groupName, coordtext, _freqk)
|
||||||
|
self:_DisplayToAllSAR(_text,self.coalition,self.messageTime,true,false)
|
||||||
|
end
|
||||||
else --shagrat CASEVAC msg
|
else --shagrat CASEVAC msg
|
||||||
local _text = string.format("Pickup Zone at %s.", _coordinatesText )
|
local _text = string.format("Pickup Zone at %s.", _coordinatesText )
|
||||||
self:_DisplayToAllSAR(_text,self.coalition,self.messageTime)
|
if self.coordtype ~= 2 then --not MGRS
|
||||||
|
self:_DisplayToAllSAR(_text,self.coalition,self.messageTime)
|
||||||
|
else
|
||||||
|
self:_DisplayToAllSAR(_text,self.coalition,self.messageTime,false,true)
|
||||||
|
local coordtext = UTILS.MGRSStringToSRSFriendly(_coordinatesText,true)
|
||||||
|
local _text = string.format("Pickup Zone at %s.", coordtext )
|
||||||
|
self:_DisplayToAllSAR(_text,self.coalition,self.messageTime,true,false)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1777,9 +1843,6 @@ function CSAR:_DisplayMessageToSAR(_unit, _text, _time, _clear, _speak, _overrid
|
|||||||
end
|
end
|
||||||
_text = string.gsub(_text,"km"," kilometer")
|
_text = string.gsub(_text,"km"," kilometer")
|
||||||
_text = string.gsub(_text,"nm"," nautical miles")
|
_text = string.gsub(_text,"nm"," nautical miles")
|
||||||
--self.msrs:SetVoice(self.SRSVoice)
|
|
||||||
--self.SRSQueue:NewTransmission(_text,nil,self.msrs,nil,1)
|
|
||||||
--self:I("Voice = "..self.SRSVoice)
|
|
||||||
self.SRSQueue:NewTransmission(_text,duration,self.msrs,tstart,2,subgroups,subtitle,subduration,self.SRSchannel,self.SRSModulation,gender,culture,self.SRSVoice,volume,label,coord)
|
self.SRSQueue:NewTransmission(_text,duration,self.msrs,tstart,2,subgroups,subtitle,subduration,self.SRSchannel,self.SRSModulation,gender,culture,self.SRSVoice,volume,label,coord)
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
@@ -1788,8 +1851,9 @@ end
|
|||||||
--- (Internal) Function to get string of a group\'s position.
|
--- (Internal) Function to get string of a group\'s position.
|
||||||
-- @param #CSAR self
|
-- @param #CSAR self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE _woundedGroup Group or Unit object.
|
-- @param Wrapper.Controllable#CONTROLLABLE _woundedGroup Group or Unit object.
|
||||||
|
-- @param Wrapper.Unit#UNIT _Unit Requesting helo pilot unit
|
||||||
-- @return #string Coordinates as Text
|
-- @return #string Coordinates as Text
|
||||||
function CSAR:_GetPositionOfWounded(_woundedGroup)
|
function CSAR:_GetPositionOfWounded(_woundedGroup,_Unit)
|
||||||
self:T(self.lid .. " _GetPositionOfWounded")
|
self:T(self.lid .. " _GetPositionOfWounded")
|
||||||
local _coordinate = _woundedGroup:GetCoordinate()
|
local _coordinate = _woundedGroup:GetCoordinate()
|
||||||
local _coordinatesText = "None"
|
local _coordinatesText = "None"
|
||||||
@@ -1804,6 +1868,26 @@ function CSAR:_GetPositionOfWounded(_woundedGroup)
|
|||||||
_coordinatesText = _coordinate:ToStringBULLS(self.coalition)
|
_coordinatesText = _coordinate:ToStringBULLS(self.coalition)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if _Unit and _Unit:GetPlayerName() then
|
||||||
|
local playername = _Unit:GetPlayerName()
|
||||||
|
if playername then
|
||||||
|
local settings = _DATABASE:GetPlayerSettings(playername) or _SETTINGS
|
||||||
|
if settings then
|
||||||
|
self:T("Get Settings ok!")
|
||||||
|
if settings:IsA2G_MGRS() then
|
||||||
|
_coordinatesText = _coordinate:ToStringMGRS(settings)
|
||||||
|
elseif settings:IsA2G_LL_DMS() then
|
||||||
|
_coordinatesText = _coordinate:ToStringLLDMS(settings)
|
||||||
|
elseif settings:IsA2G_LL_DDM() then
|
||||||
|
_coordinatesText = _coordinate:ToStringLLDDM(settings)
|
||||||
|
elseif settings:IsA2G_BR() then
|
||||||
|
-- attention this is the distance from the ASKING unit to target, not from RECCE to target!
|
||||||
|
local startcoordinate = _Unit:GetCoordinate()
|
||||||
|
_coordinatesText = _coordinate:ToStringBR(startcoordinate,settings)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
return _coordinatesText
|
return _coordinatesText
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1829,22 +1913,26 @@ function CSAR:_DisplayActiveSAR(_unitName)
|
|||||||
self:T({Table=_value})
|
self:T({Table=_value})
|
||||||
local _woundedGroup = _value.group
|
local _woundedGroup = _value.group
|
||||||
if _woundedGroup and _value.alive then
|
if _woundedGroup and _value.alive then
|
||||||
local _coordinatesText = self:_GetPositionOfWounded(_woundedGroup)
|
local _coordinatesText = self:_GetPositionOfWounded(_woundedGroup,_heli)
|
||||||
local _helicoord = _heli:GetCoordinate()
|
local _helicoord = _heli:GetCoordinate()
|
||||||
local _woundcoord = _woundedGroup:GetCoordinate()
|
local _woundcoord = _woundedGroup:GetCoordinate()
|
||||||
local _distance = self:_GetDistance(_helicoord, _woundcoord)
|
local _distance = self:_GetDistance(_helicoord, _woundcoord)
|
||||||
self:T({_distance = _distance})
|
self:T({_distance = _distance})
|
||||||
local distancetext = ""
|
local distancetext = ""
|
||||||
if _SETTINGS:IsImperial() then
|
local settings = _SETTINGS
|
||||||
|
if _heli:GetPlayerName() then
|
||||||
|
settings = _DATABASE:GetPlayerSettings(_heli:GetPlayerName()) or _SETTINGS
|
||||||
|
end
|
||||||
|
if settings:IsImperial() then
|
||||||
distancetext = string.format("%.1fnm",UTILS.MetersToNM(_distance))
|
distancetext = string.format("%.1fnm",UTILS.MetersToNM(_distance))
|
||||||
else
|
else
|
||||||
distancetext = string.format("%.1fkm", _distance/1000.0)
|
distancetext = string.format("%.1fkm", _distance/1000.0)
|
||||||
end
|
end
|
||||||
if _value.frequency == 0 then--shagrat insert CASEVAC without Frequency
|
if _value.frequency == 0 or self.CreateRadioBeacons == false then--shagrat insert CASEVAC without Frequency
|
||||||
table.insert(_csarList, { dist = _distance, msg = string.format("%s at %s - %s ", _value.desc, _coordinatesText, distancetext) })
|
table.insert(_csarList, { dist = _distance, msg = string.format("%s at %s - %s ", _value.desc, _coordinatesText, distancetext) })
|
||||||
else
|
else
|
||||||
table.insert(_csarList, { dist = _distance, msg = string.format("%s at %s - %.2f KHz ADF - %s ", _value.desc, _coordinatesText, _value.frequency / 1000, distancetext) })
|
table.insert(_csarList, { dist = _distance, msg = string.format("%s at %s - %.2f KHz ADF - %s ", _value.desc, _coordinatesText, _value.frequency / 1000, distancetext) })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1925,7 +2013,7 @@ function CSAR:_SignalFlare(_unitName)
|
|||||||
else
|
else
|
||||||
_distance = string.format("%.1fkm",_closest.distance/1000)
|
_distance = string.format("%.1fkm",_closest.distance/1000)
|
||||||
end
|
end
|
||||||
local _msg = string.format("%s - Popping signal flare at your %s o\'clock. Distance %s", self:_GetCustomCallSign(_unitName), _clockDir, _distance)
|
local _msg = string.format("%s - Firing signal flare at your %s o\'clock. Distance %s", self:_GetCustomCallSign(_unitName), _clockDir, _distance)
|
||||||
self:_DisplayMessageToSAR(_heli, _msg, self.messageTime, false, true, true)
|
self:_DisplayMessageToSAR(_heli, _msg, self.messageTime, false, true, true)
|
||||||
|
|
||||||
local _coord = _closest.pilot:GetCoordinate()
|
local _coord = _closest.pilot:GetCoordinate()
|
||||||
@@ -1948,26 +2036,66 @@ end
|
|||||||
-- @param #string _message Message to display.
|
-- @param #string _message Message to display.
|
||||||
-- @param #number _side Coalition of message.
|
-- @param #number _side Coalition of message.
|
||||||
-- @param #number _messagetime How long to show.
|
-- @param #number _messagetime How long to show.
|
||||||
function CSAR:_DisplayToAllSAR(_message, _side, _messagetime)
|
-- @param #boolean ToSRS If true or nil, send to SRS TTS
|
||||||
|
-- @param #boolean ToScreen If true or nil, send to Screen
|
||||||
|
function CSAR:_DisplayToAllSAR(_message, _side, _messagetime,ToSRS,ToScreen)
|
||||||
self:T(self.lid .. " _DisplayToAllSAR")
|
self:T(self.lid .. " _DisplayToAllSAR")
|
||||||
local messagetime = _messagetime or self.messageTime
|
local messagetime = _messagetime or self.messageTime
|
||||||
if self.msrs then
|
self:T({_message,ToSRS=ToSRS,ToScreen=ToScreen})
|
||||||
|
if self.msrs and (ToSRS == true or ToSRS == nil) then
|
||||||
local voice = self.CSARVoice or MSRS.Voices.Google.Standard.en_GB_Standard_F
|
local voice = self.CSARVoice or MSRS.Voices.Google.Standard.en_GB_Standard_F
|
||||||
if self.msrs:GetProvider() == MSRS.Provider.WINDOWS then
|
if self.msrs:GetProvider() == MSRS.Provider.WINDOWS then
|
||||||
voice = self.CSARVoiceMS or MSRS.Voices.Microsoft.Hedda
|
voice = self.CSARVoiceMS or MSRS.Voices.Microsoft.Hedda
|
||||||
end
|
end
|
||||||
self:I("Voice = "..voice)
|
--self:F("Voice = "..voice)
|
||||||
self.SRSQueue:NewTransmission(_message,duration,self.msrs,tstart,2,subgroups,subtitle,subduration,self.SRSchannel,self.SRSModulation,gender,culture,voice,volume,label,self.coordinate)
|
self.SRSQueue:NewTransmission(_message,duration,self.msrs,tstart,2,subgroups,subtitle,subduration,self.SRSchannel,self.SRSModulation,gender,culture,voice,volume,label,self.coordinate)
|
||||||
end
|
end
|
||||||
for _, _unitName in pairs(self.csarUnits) do
|
if ToScreen == true or ToScreen == nil then
|
||||||
local _unit = self:_GetSARHeli(_unitName)
|
for _, _unitName in pairs(self.csarUnits) do
|
||||||
if _unit and not self.suppressmessages then
|
local _unit = self:_GetSARHeli(_unitName)
|
||||||
self:_DisplayMessageToSAR(_unit, _message, _messagetime)
|
if _unit and not self.suppressmessages then
|
||||||
|
self:_DisplayMessageToSAR(_unit, _message, _messagetime)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---(Internal) Request IR Strobe at closest downed pilot.
|
||||||
|
--@param #CSAR self
|
||||||
|
--@param #string _unitName Name of the helicopter
|
||||||
|
function CSAR:_ReqIRStrobe( _unitName )
|
||||||
|
self:T(self.lid .. " _ReqIRStrobe")
|
||||||
|
local _heli = self:_GetSARHeli(_unitName)
|
||||||
|
if _heli == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local smokedist = 8000
|
||||||
|
if smokedist < self.approachdist_far then smokedist = self.approachdist_far end
|
||||||
|
local _closest = self:_GetClosestDownedPilot(_heli)
|
||||||
|
if _closest ~= nil and _closest.pilot ~= nil and _closest.distance > 0 and _closest.distance < smokedist then
|
||||||
|
local _clockDir = self:_GetClockDirection(_heli, _closest.pilot)
|
||||||
|
local _distance = string.format("%.1fkm",_closest.distance/1000)
|
||||||
|
if _SETTINGS:IsImperial() then
|
||||||
|
_distance = string.format("%.1fnm",UTILS.MetersToNM(_closest.distance))
|
||||||
|
else
|
||||||
|
_distance = string.format("%.1fkm",_closest.distance/1000)
|
||||||
|
end
|
||||||
|
local _msg = string.format("%s - IR Strobe active at your %s o\'clock. Distance %s", self:_GetCustomCallSign(_unitName), _clockDir, _distance)
|
||||||
|
self:_DisplayMessageToSAR(_heli, _msg, self.messageTime, false, true, true)
|
||||||
|
_closest.pilot:NewIRMarker(true,self.IRStrobeRuntime or 300)
|
||||||
|
else
|
||||||
|
local _distance = string.format("%.1fkm",smokedist/1000)
|
||||||
|
if _SETTINGS:IsImperial() then
|
||||||
|
_distance = string.format("%.1fnm",UTILS.MetersToNM(smokedist))
|
||||||
|
else
|
||||||
|
_distance = string.format("%.1fkm",smokedist/1000)
|
||||||
|
end
|
||||||
|
self:_DisplayMessageToSAR(_heli, string.format("No Pilots within %s",_distance), self.messageTime, false, false, true)
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
---(Internal) Request smoke at closest downed pilot.
|
---(Internal) Request smoke at closest downed pilot.
|
||||||
--@param #CSAR self
|
--@param #CSAR self
|
||||||
--@param #string _unitName Name of the helicopter
|
--@param #string _unitName Name of the helicopter
|
||||||
@@ -2008,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
|
||||||
_distance = self:_GetDistance(_helicoord, _mashcoord)
|
if _mashUnit and (not _mashUnit:IsInstanceOf("ZONE_BASE")) and _mashUnit:IsAlive() then
|
||||||
if _distance ~= nil and (_shortestDistance == -1 or _distance < _shortestDistance) then
|
_mashcoord = _mashUnit:GetCoordinate()
|
||||||
_shortestDistance = _distance
|
elseif _mashUnit and _mashUnit:IsInstanceOf("ZONE_BASE") then
|
||||||
end
|
_mashcoord = _mashUnit:GetCoordinate()
|
||||||
end
|
end
|
||||||
|
_distance = self:_GetDistance(_helicoord, _mashcoord)
|
||||||
|
if _distance ~= nil and (_shortestDistance == -1 or _distance < _shortestDistance) then
|
||||||
|
_shortestDistance = _distance
|
||||||
|
MashName = _mashUnit:GetName() or "Unknown"
|
||||||
|
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.
|
||||||
@@ -2091,12 +2213,12 @@ function CSAR:_AddMedevacMenuItem()
|
|||||||
local coalition = self.coalition
|
local coalition = self.coalition
|
||||||
local allheligroupset = self.allheligroupset -- Core.Set#SET_GROUP
|
local allheligroupset = self.allheligroupset -- Core.Set#SET_GROUP
|
||||||
local _allHeliGroups = allheligroupset:GetSetObjects()
|
local _allHeliGroups = allheligroupset:GetSetObjects()
|
||||||
|
|
||||||
-- rebuild units table
|
-- rebuild units table
|
||||||
local _UnitList = {}
|
local _UnitList = {}
|
||||||
for _key, _group in pairs (_allHeliGroups) do
|
for _key, _group in pairs (_allHeliGroups) do
|
||||||
local _unit = _group:GetUnit(1) -- Asume that there is only one unit in the flight for players
|
local _unit = _group:GetFirstUnitAlive() -- Asume that there is only one unit in the flight for players
|
||||||
if _unit then
|
if _unit then
|
||||||
|
--self:T("Unitname ".._unit:GetName().." IsAlive "..tostring(_unit:IsAlive()).." IsPlayer "..tostring(_unit:IsPlayer()))
|
||||||
if _unit:IsAlive() and _unit:IsPlayer() then
|
if _unit:IsAlive() and _unit:IsPlayer() then
|
||||||
local unitName = _unit:GetName()
|
local unitName = _unit:GetName()
|
||||||
_UnitList[unitName] = unitName
|
_UnitList[unitName] = unitName
|
||||||
@@ -2119,7 +2241,12 @@ function CSAR:_AddMedevacMenuItem()
|
|||||||
local _rootMenu1 = MENU_GROUP_COMMAND:New(_group,"List Active CSAR",_rootPath, self._DisplayActiveSAR,self,_unitName)
|
local _rootMenu1 = MENU_GROUP_COMMAND:New(_group,"List Active CSAR",_rootPath, self._DisplayActiveSAR,self,_unitName)
|
||||||
local _rootMenu2 = MENU_GROUP_COMMAND:New(_group,"Check Onboard",_rootPath, self._CheckOnboard,self,_unitName)
|
local _rootMenu2 = MENU_GROUP_COMMAND:New(_group,"Check Onboard",_rootPath, self._CheckOnboard,self,_unitName)
|
||||||
local _rootMenu3 = MENU_GROUP_COMMAND:New(_group,"Request Signal Flare",_rootPath, self._SignalFlare,self,_unitName)
|
local _rootMenu3 = MENU_GROUP_COMMAND:New(_group,"Request Signal Flare",_rootPath, self._SignalFlare,self,_unitName)
|
||||||
local _rootMenu4 = MENU_GROUP_COMMAND:New(_group,"Request Smoke",_rootPath, self._Reqsmoke,self,_unitName):Refresh()
|
local _rootMenu4 = MENU_GROUP_COMMAND:New(_group,"Request Smoke",_rootPath, self._Reqsmoke,self,_unitName)
|
||||||
|
if self.AllowIRStrobe then
|
||||||
|
local _rootMenu5 = MENU_GROUP_COMMAND:New(_group,"Request IR Strobe",_rootPath, self._ReqIRStrobe,self,_unitName):Refresh()
|
||||||
|
else
|
||||||
|
_rootMenu4:Refresh()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -2210,9 +2337,13 @@ 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
|
||||||
function CSAR:_AddBeaconToGroup(_group, _freq)
|
-- @param #string BeaconName Beacon Name to use
|
||||||
|
-- @return #CSAR self
|
||||||
|
function CSAR:_AddBeaconToGroup(_group, _freq, BeaconName)
|
||||||
self:T(self.lid .. " _AddBeaconToGroup")
|
self:T(self.lid .. " _AddBeaconToGroup")
|
||||||
|
if self.CreateRadioBeacons == false then return end
|
||||||
local _group = _group
|
local _group = _group
|
||||||
|
|
||||||
if _group == nil then
|
if _group == nil then
|
||||||
--return frequency to pool of available
|
--return frequency to pool of available
|
||||||
for _i, _current in ipairs(self.UsedVHFFrequencies) do
|
for _i, _current in ipairs(self.UsedVHFFrequencies) do
|
||||||
@@ -2227,22 +2358,25 @@ function CSAR:_AddBeaconToGroup(_group, _freq)
|
|||||||
if _group:IsAlive() then
|
if _group:IsAlive() then
|
||||||
local _radioUnit = _group:GetUnit(1)
|
local _radioUnit = _group:GetUnit(1)
|
||||||
if _radioUnit then
|
if _radioUnit then
|
||||||
local name = _radioUnit:GetName()
|
|
||||||
local Frequency = _freq -- Freq in Hertz
|
|
||||||
local name = _radioUnit:GetName()
|
local name = _radioUnit:GetName()
|
||||||
|
local Frequency = _freq -- Freq in Hertz
|
||||||
|
--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..math.random(1,10000)) -- 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
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- (Internal) Helper function to (re-)add beacon to downed pilot.
|
--- (Internal) Helper function to (re-)add beacon to downed pilot.
|
||||||
-- @param #CSAR self
|
-- @param #CSAR self
|
||||||
-- @param #table _args Arguments
|
-- @return #CSAR self
|
||||||
function CSAR:_RefreshRadioBeacons()
|
function CSAR:_RefreshRadioBeacons()
|
||||||
self:T(self.lid .. " _RefreshRadioBeacons")
|
self:T(self.lid .. " _RefreshRadioBeacons")
|
||||||
|
if self.CreateRadioBeacons == false then return end
|
||||||
if self:_CountActiveDownedPilots() > 0 then
|
if self:_CountActiveDownedPilots() > 0 then
|
||||||
local PilotTable = self.downedPilots
|
local PilotTable = self.downedPilots
|
||||||
for _,_pilot in pairs (PilotTable) do
|
for _,_pilot in pairs (PilotTable) do
|
||||||
@@ -2250,8 +2384,14 @@ function CSAR:_RefreshRadioBeacons()
|
|||||||
local pilot = _pilot -- #CSAR.DownedPilot
|
local pilot = _pilot -- #CSAR.DownedPilot
|
||||||
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)
|
||||||
|
--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)
|
--self:_AddBeaconToGroup(group,frequency,bname)
|
||||||
|
else
|
||||||
|
if frequency > 0 then
|
||||||
|
trigger.action.stopRadioTransmission(bname)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -2281,13 +2421,38 @@ function CSAR:_ReachedPilotLimit()
|
|||||||
local limit = self.maxdownedpilots
|
local limit = self.maxdownedpilots
|
||||||
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
|
||||||
return true
|
if self.useFIFOLimitReplacement then
|
||||||
else
|
local oldIndex = -1
|
||||||
return false
|
local oldDownedPilot = nil
|
||||||
end
|
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
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- User - Function to add onw SET_GROUP Set-up for pilot filtering and assignment.
|
||||||
|
-- Needs to be set before starting the CSAR instance.
|
||||||
|
-- @param #CSAR self
|
||||||
|
-- @param Core.Set#SET_GROUP Set The SET_GROUP object created by the mission designer/user to represent the CSAR pilot groups.
|
||||||
|
-- @return #CSAR self
|
||||||
|
function CSAR:SetOwnSetPilotGroups(Set)
|
||||||
|
self.UserSetGroup = Set
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
------------------------------
|
------------------------------
|
||||||
--- FSM internal Functions ---
|
--- FSM internal Functions ---
|
||||||
------------------------------
|
------------------------------
|
||||||
@@ -2309,7 +2474,9 @@ function CSAR:onafterStart(From, Event, To)
|
|||||||
self:HandleEvent(EVENTS.PlayerEnterUnit, self._EventHandler)
|
self:HandleEvent(EVENTS.PlayerEnterUnit, self._EventHandler)
|
||||||
self:HandleEvent(EVENTS.PilotDead, self._EventHandler)
|
self:HandleEvent(EVENTS.PilotDead, self._EventHandler)
|
||||||
|
|
||||||
if self.allowbronco then
|
if self.UserSetGroup then
|
||||||
|
self.allheligroupset = self.UserSetGroup
|
||||||
|
elseif self.allowbronco then
|
||||||
local prefixes = self.csarPrefix or {}
|
local prefixes = self.csarPrefix or {}
|
||||||
self.allheligroupset = SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterPrefixes(prefixes):FilterStart()
|
self.allheligroupset = SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterPrefixes(prefixes):FilterStart()
|
||||||
elseif self.useprefix then
|
elseif self.useprefix then
|
||||||
@@ -2318,7 +2485,28 @@ function CSAR:onafterStart(From, Event, To)
|
|||||||
else
|
else
|
||||||
self.allheligroupset = SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterCategoryHelicopter():FilterStart()
|
self.allheligroupset = SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterCategoryHelicopter():FilterStart()
|
||||||
end
|
end
|
||||||
self.mash = SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterPrefixes(self.mashprefix):FilterStart() -- currently only GROUP objects, maybe support STATICs also?
|
|
||||||
|
self.mash = SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterPrefixes(self.mashprefix):FilterStart()
|
||||||
|
|
||||||
|
self.staticmashes = SET_STATIC:New():FilterCoalitions(self.coalitiontxt):FilterPrefixes(self.mashprefix):FilterStart()
|
||||||
|
self.zonemashes = SET_ZONE:New():FilterPrefixes(self.mashprefix):FilterStart()
|
||||||
|
|
||||||
|
--[[
|
||||||
|
if staticmashes:Count() > 0 then
|
||||||
|
for _,_mash in pairs(staticmashes.Set) do
|
||||||
|
self.mash:AddObject(_mash)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if zonemashes:Count() > 0 then
|
||||||
|
self:T("Adding zones to self.mash SET")
|
||||||
|
for _,_mash in pairs(zonemashes.Set) do
|
||||||
|
self.mash:AddObject(_mash)
|
||||||
|
end
|
||||||
|
self:T("Objects in SET: "..self.mash:Count())
|
||||||
|
end
|
||||||
|
--]]
|
||||||
|
|
||||||
if not self.coordinate then
|
if not self.coordinate then
|
||||||
local csarhq = self.mash:GetRandom()
|
local csarhq = self.mash:GetRandom()
|
||||||
if csarhq then
|
if csarhq then
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -660,9 +660,9 @@ function RECOVERYTANKER:SetRecoveryAirboss(switch)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set that the group takes the roll of an AWACS instead of a refueling tanker.
|
--- Set that the group takes the role of an AWACS instead of a refueling tanker.
|
||||||
-- @param #RECOVERYTANKER self
|
-- @param #RECOVERYTANKER self
|
||||||
-- @param #boolean switch If true or nil, set roll AWACS.
|
-- @param #boolean switch If true or nil, set role AWACS.
|
||||||
-- @param #boolean eplrs If true or nil, enable EPLRS. If false, EPLRS will be off.
|
-- @param #boolean eplrs If true or nil, enable EPLRS. If false, EPLRS will be off.
|
||||||
-- @return #RECOVERYTANKER self
|
-- @return #RECOVERYTANKER self
|
||||||
function RECOVERYTANKER:SetAWACS(switch, eplrs)
|
function RECOVERYTANKER:SetAWACS(switch, eplrs)
|
||||||
@@ -997,6 +997,8 @@ function RECOVERYTANKER:onafterStart(From, Event, To)
|
|||||||
|
|
||||||
-- Init status updates in 10 seconds.
|
-- Init status updates in 10 seconds.
|
||||||
self:__Status(10)
|
self:__Status(10)
|
||||||
|
|
||||||
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -963,6 +963,8 @@ function RESCUEHELO:onafterStart(From, Event, To)
|
|||||||
|
|
||||||
-- Init status check
|
-- Init status check
|
||||||
self:__Status(1)
|
self:__Status(1)
|
||||||
|
|
||||||
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- On after Status event. Checks player status.
|
--- On after Status event. Checks player status.
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ RADIO = {
|
|||||||
Power = 100,
|
Power = 100,
|
||||||
Loop = false,
|
Loop = false,
|
||||||
alias = nil,
|
alias = nil,
|
||||||
|
moduhasbeenset = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Create a new RADIO Object. This doesn't broadcast a transmission, though, use @{#RADIO.Broadcast} to actually broadcast.
|
--- Create a new RADIO Object. This doesn't broadcast a transmission, though, use @{#RADIO.Broadcast} to actually broadcast.
|
||||||
@@ -172,7 +173,8 @@ function RADIO:SetFrequency(Frequency)
|
|||||||
--if (Frequency >= 30 and Frequency <= 87.995) or (Frequency >= 108 and Frequency <= 173.995) or (Frequency >= 225 and Frequency <= 399.975) then
|
--if (Frequency >= 30 and Frequency <= 87.995) or (Frequency >= 108 and Frequency <= 173.995) or (Frequency >= 225 and Frequency <= 399.975) then
|
||||||
|
|
||||||
-- Convert frequency from MHz to Hz
|
-- Convert frequency from MHz to Hz
|
||||||
self.Frequency = Frequency * 1000000
|
self.Frequency = Frequency
|
||||||
|
self.HertzFrequency = Frequency * 1000000
|
||||||
|
|
||||||
-- If the RADIO is attached to a UNIT or a GROUP, we need to send the DCS Command "SetFrequency" to change the UNIT or GROUP frequency
|
-- If the RADIO is attached to a UNIT or a GROUP, we need to send the DCS Command "SetFrequency" to change the UNIT or GROUP frequency
|
||||||
if self.Positionable.ClassName == "UNIT" or self.Positionable.ClassName == "GROUP" then
|
if self.Positionable.ClassName == "UNIT" or self.Positionable.ClassName == "GROUP" then
|
||||||
@@ -180,7 +182,7 @@ function RADIO:SetFrequency(Frequency)
|
|||||||
local commandSetFrequency={
|
local commandSetFrequency={
|
||||||
id = "SetFrequency",
|
id = "SetFrequency",
|
||||||
params = {
|
params = {
|
||||||
frequency = self.Frequency,
|
frequency = self.HertzFrequency,
|
||||||
modulation = self.Modulation,
|
modulation = self.Modulation,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -197,7 +199,7 @@ function RADIO:SetFrequency(Frequency)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set AM or FM modulation of the radio transmitter.
|
--- Set AM or FM modulation of the radio transmitter. Set this before you set a frequency!
|
||||||
-- @param #RADIO self
|
-- @param #RADIO self
|
||||||
-- @param #number Modulation Modulation is either radio.modulation.AM or radio.modulation.FM.
|
-- @param #number Modulation Modulation is either radio.modulation.AM or radio.modulation.FM.
|
||||||
-- @return #RADIO self
|
-- @return #RADIO self
|
||||||
@@ -206,6 +208,10 @@ function RADIO:SetModulation(Modulation)
|
|||||||
if type(Modulation) == "number" then
|
if type(Modulation) == "number" then
|
||||||
if Modulation == radio.modulation.AM or Modulation == radio.modulation.FM then --TODO Maybe make this future proof if ED decides to add an other modulation ?
|
if Modulation == radio.modulation.AM or Modulation == radio.modulation.FM then --TODO Maybe make this future proof if ED decides to add an other modulation ?
|
||||||
self.Modulation = Modulation
|
self.Modulation = Modulation
|
||||||
|
if self.moduhasbeenset == false and Modulation == radio.modulation.FM then -- override default
|
||||||
|
self:SetFrequency(self.Frequency)
|
||||||
|
end
|
||||||
|
self.moduhasbeenset = true
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ function RADIOQUEUE:NewTransmission(filename, duration, path, tstart, interval,
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
if type(duration)~="number" then
|
if type(duration)~="number" then
|
||||||
self:E(self.lid.."ERROR: Duration specified is NOT a number.")
|
self:E(self.lid..string.format("ERROR: Duration specified is NOT a number but type=%s. Filename=%s, duration=%s", type(duration), tostring(filename), tostring(duration)))
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -361,6 +361,7 @@ end
|
|||||||
-- @param #RADIOQUEUE self
|
-- @param #RADIOQUEUE self
|
||||||
-- @param #RADIOQUEUE.Transmission transmission The transmission.
|
-- @param #RADIOQUEUE.Transmission transmission The transmission.
|
||||||
function RADIOQUEUE:Broadcast(transmission)
|
function RADIOQUEUE:Broadcast(transmission)
|
||||||
|
self:T("Broadcast")
|
||||||
|
|
||||||
if ((transmission.soundfile and transmission.soundfile.useSRS) or transmission.soundtext) and self.msrs then
|
if ((transmission.soundfile and transmission.soundfile.useSRS) or transmission.soundtext) and self.msrs then
|
||||||
self:_BroadcastSRS(transmission)
|
self:_BroadcastSRS(transmission)
|
||||||
@@ -379,7 +380,8 @@ function RADIOQUEUE:Broadcast(transmission)
|
|||||||
self:T(self.lid..string.format("Broadcasting from aircraft %s", sender:GetName()))
|
self:T(self.lid..string.format("Broadcasting from aircraft %s", sender:GetName()))
|
||||||
|
|
||||||
|
|
||||||
if not self.senderinit then
|
--if not self.senderinit then
|
||||||
|
-- TODO Seems to be a DCS bug - if I explode ANY unit in a group the BC assignment gets lost
|
||||||
|
|
||||||
-- Command to set the Frequency for the transmission.
|
-- Command to set the Frequency for the transmission.
|
||||||
local commandFrequency={
|
local commandFrequency={
|
||||||
@@ -393,7 +395,7 @@ function RADIOQUEUE:Broadcast(transmission)
|
|||||||
sender:SetCommand(commandFrequency)
|
sender:SetCommand(commandFrequency)
|
||||||
|
|
||||||
self.senderinit=true
|
self.senderinit=true
|
||||||
end
|
--end
|
||||||
|
|
||||||
-- Set subtitle only if duration>0 sec.
|
-- Set subtitle only if duration>0 sec.
|
||||||
local subtitle=nil
|
local subtitle=nil
|
||||||
@@ -425,7 +427,7 @@ function RADIOQUEUE:Broadcast(transmission)
|
|||||||
else
|
else
|
||||||
|
|
||||||
-- Broadcasting from carrier. No subtitle possible. Need to send messages to players.
|
-- Broadcasting from carrier. No subtitle possible. Need to send messages to players.
|
||||||
self:T(self.lid..string.format("Broadcasting via trigger.action.radioTransmission()."))
|
self:T(self.lid..string.format("Broadcasting via trigger.action.radioTransmission()"))
|
||||||
|
|
||||||
-- Position from where to transmit.
|
-- Position from where to transmit.
|
||||||
local vec3=nil
|
local vec3=nil
|
||||||
@@ -453,6 +455,8 @@ function RADIOQUEUE:Broadcast(transmission)
|
|||||||
local text=string.format("file=%s, freq=%.2f MHz, duration=%.2f sec, subtitle=%s", filename, self.frequency/1000000, transmission.duration, transmission.subtitle or "")
|
local text=string.format("file=%s, freq=%.2f MHz, duration=%.2f sec, subtitle=%s", filename, self.frequency/1000000, transmission.duration, transmission.subtitle or "")
|
||||||
MESSAGE:New(string.format(text, filename, transmission.duration, transmission.subtitle or ""), 5, "RADIOQUEUE "..self.alias):ToAll()
|
MESSAGE:New(string.format(text, filename, transmission.duration, transmission.subtitle or ""), 5, "RADIOQUEUE "..self.alias):ToAll()
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
self:E("ERROR: Could not get vec3 to determine transmission origin! Did you specify a sender and is it still alive?")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -482,7 +486,6 @@ end
|
|||||||
--- Check radio queue for transmissions to be broadcasted.
|
--- Check radio queue for transmissions to be broadcasted.
|
||||||
-- @param #RADIOQUEUE self
|
-- @param #RADIOQUEUE self
|
||||||
function RADIOQUEUE:_CheckRadioQueue()
|
function RADIOQUEUE:_CheckRadioQueue()
|
||||||
--env.info("FF check radio queue "..self.alias)
|
|
||||||
|
|
||||||
-- Check if queue is empty.
|
-- Check if queue is empty.
|
||||||
if #self.queue==0 then
|
if #self.queue==0 then
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
-- @field #table poptions Provider options. Each element is a data structure of type `MSRS.ProvierOptions`.
|
-- @field #table poptions Provider options. Each element is a data structure of type `MSRS.ProvierOptions`.
|
||||||
-- @field #string provider Provider of TTS (win, gcloud, azure, amazon).
|
-- @field #string provider Provider of TTS (win, gcloud, azure, amazon).
|
||||||
-- @field #string backend Backend used as interface to SRS (MSRS.Backend.SRSEXE or MSRS.Backend.GRPC).
|
-- @field #string backend Backend used as interface to SRS (MSRS.Backend.SRSEXE or MSRS.Backend.GRPC).
|
||||||
|
-- @field #boolean UsePowerShell Use PowerShell to execute the command and not cmd.exe
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
--- *It is a very sad thing that nowadays there is so little useless information.* - Oscar Wilde
|
--- *It is a very sad thing that nowadays there is so little useless information.* - Oscar Wilde
|
||||||
@@ -256,26 +257,156 @@ MSRS = {
|
|||||||
ConfigFilePath = "Config\\",
|
ConfigFilePath = "Config\\",
|
||||||
ConfigLoaded = false,
|
ConfigLoaded = false,
|
||||||
poptions = {},
|
poptions = {},
|
||||||
|
UsePowerShell = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- MSRS class version.
|
--- MSRS class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
MSRS.version="0.3.0"
|
MSRS.version="0.3.3"
|
||||||
|
|
||||||
--- Voices
|
--- Voices
|
||||||
-- @type MSRS.Voices
|
-- @type MSRS.Voices
|
||||||
MSRS.Voices = {
|
MSRS.Voices = {
|
||||||
|
Amazon = {
|
||||||
|
Generative = {
|
||||||
|
en_AU = {
|
||||||
|
Olivia = "Olivia",
|
||||||
|
},
|
||||||
|
en_GB = {
|
||||||
|
Amy = "Amy",
|
||||||
|
},
|
||||||
|
en_US = {
|
||||||
|
Danielle = "Danielle",
|
||||||
|
Joanna = "Joanna",
|
||||||
|
Ruth = "Ruth",
|
||||||
|
Stephen = "Stephen",
|
||||||
|
},
|
||||||
|
fr_FR = {
|
||||||
|
["Léa"] = "Léa",
|
||||||
|
["Rémi"] = "Rémi",
|
||||||
|
},
|
||||||
|
de_DE = {
|
||||||
|
Vicki = "Vicki",
|
||||||
|
Daniel = "Daniel",
|
||||||
|
},
|
||||||
|
it_IT = {
|
||||||
|
Bianca = "Bianca",
|
||||||
|
Adriano = "Adriano",
|
||||||
|
},
|
||||||
|
es_ES = {
|
||||||
|
Lucia = "Lucia",
|
||||||
|
Sergio = "Sergio",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
LongForm = {
|
||||||
|
en_US = {
|
||||||
|
Danielle = "Danielle",
|
||||||
|
Gregory = "Gregory",
|
||||||
|
Ivy = "Ivy",
|
||||||
|
Ruth = "Ruth",
|
||||||
|
Patrick = "Patrick",
|
||||||
|
},
|
||||||
|
es_ES = {
|
||||||
|
Alba = "Alba",
|
||||||
|
["Raúl"] = "Raúl",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Neural = {
|
||||||
|
en_AU = {
|
||||||
|
Olivia = "Olivia",
|
||||||
|
},
|
||||||
|
en_GB = {
|
||||||
|
Amy = "Amy",
|
||||||
|
Emma = "Emma",
|
||||||
|
Brian = "Brian",
|
||||||
|
Arthur = "Arthur",
|
||||||
|
},
|
||||||
|
en_US = {
|
||||||
|
Danielle = "Danielle",
|
||||||
|
Gregory = "Gregory",
|
||||||
|
Ivy = "Ivy",
|
||||||
|
Joanna = "Joanna",
|
||||||
|
Kendra = "Kendra",
|
||||||
|
Kimberly = "Kimberly",
|
||||||
|
Salli = "Salli",
|
||||||
|
Joey = "Joey",
|
||||||
|
Kevin = "Kevin",
|
||||||
|
Ruth = "Ruth",
|
||||||
|
Stephen = "Stephen",
|
||||||
|
},
|
||||||
|
fr_FR = {
|
||||||
|
["Léa"] = "Léa",
|
||||||
|
["Rémi"] = "Rémi",
|
||||||
|
},
|
||||||
|
de_DE = {
|
||||||
|
Vicki = "Vicki",
|
||||||
|
Daniel = "Daniel",
|
||||||
|
},
|
||||||
|
it_IT = {
|
||||||
|
Bianca = "Bianca",
|
||||||
|
Adriano = "Adriano",
|
||||||
|
},
|
||||||
|
es_ES = {
|
||||||
|
Lucia = "Lucia",
|
||||||
|
Sergio = "Sergio",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Standard = {
|
||||||
|
en_AU = {
|
||||||
|
Nicole = "Nicole",
|
||||||
|
Russel = "Russel",
|
||||||
|
},
|
||||||
|
en_GB = {
|
||||||
|
Amy = "Amy",
|
||||||
|
Emma = "Emma",
|
||||||
|
Brian = "Brian",
|
||||||
|
},
|
||||||
|
en_IN = {
|
||||||
|
Aditi = "Aditi",
|
||||||
|
Raveena = "Raveena",
|
||||||
|
},
|
||||||
|
en_US = {
|
||||||
|
Ivy = "Ivy",
|
||||||
|
Joanna = "Joanna",
|
||||||
|
Kendra = "Kendra",
|
||||||
|
Kimberly = "Kimberly",
|
||||||
|
Salli = "Salli",
|
||||||
|
Joey = "Joey",
|
||||||
|
Kevin = "Kevin",
|
||||||
|
},
|
||||||
|
fr_FR = {
|
||||||
|
Celine = "Celine",
|
||||||
|
["Léa"] = "Léa",
|
||||||
|
Mathieu = "Mathieu",
|
||||||
|
},
|
||||||
|
de_DE = {
|
||||||
|
Marlene = "Marlene",
|
||||||
|
Vicki = "Vicki",
|
||||||
|
Hans = "Hans",
|
||||||
|
},
|
||||||
|
it_IT = {
|
||||||
|
Carla = "Carla",
|
||||||
|
Bianca = "Bianca",
|
||||||
|
Giorgio = "Giorgio",
|
||||||
|
},
|
||||||
|
es_ES = {
|
||||||
|
Conchita = "Conchita",
|
||||||
|
Lucia = "Lucia",
|
||||||
|
Enrique = "Enrique",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
Microsoft = { -- working ones if not using gRPC and MS
|
Microsoft = { -- working ones if not using gRPC and MS
|
||||||
["Hedda"] = "Microsoft Hedda Desktop", -- de-DE
|
["Hedda"] = "Microsoft Hedda Desktop", -- de-DE
|
||||||
["Hazel"] = "Microsoft Hazel Desktop", -- en-GB
|
["Hazel"] = "Microsoft Hazel Desktop", -- en-GB
|
||||||
["David"] = "Microsoft David Desktop", -- en-US
|
["David"] = "Microsoft David Desktop", -- en-US
|
||||||
["Zira"] = "Microsoft Zira Desktop", -- en-US
|
["Zira"] = "Microsoft Zira Desktop", -- en-US
|
||||||
["Hortense"] = "Microsoft Hortense Desktop", --fr-FR
|
["Hortense"] = "Microsoft Hortense Desktop", --fr-FR
|
||||||
["de-DE-Hedda"] = "Microsoft Hedda Desktop", -- de-DE
|
["de_DE_Hedda"] = "Microsoft Hedda Desktop", -- de-DE
|
||||||
["en-GB-Hazel"] = "Microsoft Hazel Desktop", -- en-GB
|
["en_GB_Hazel"] = "Microsoft Hazel Desktop", -- en-GB
|
||||||
["en-US-David"] = "Microsoft David Desktop", -- en-US
|
["en_US_David"] = "Microsoft David Desktop", -- en-US
|
||||||
["en-US-Zira"] = "Microsoft Zira Desktop", -- en-US
|
["en_US_Zira"] = "Microsoft Zira Desktop", -- en-US
|
||||||
["fr-FR-Hortense"] = "Microsoft Hortense Desktop", --fr-FR
|
["fr_FR_Hortense"] = "Microsoft Hortense Desktop", --fr-FR
|
||||||
},
|
},
|
||||||
MicrosoftGRPC = { -- en-US/GB voices only as of Jan 2024, working ones if using gRPC and MS, if voice packs are installed
|
MicrosoftGRPC = { -- en-US/GB voices only as of Jan 2024, working ones if using gRPC and MS, if voice packs are installed
|
||||||
--["Hedda"] = "Hedda", -- de-DE
|
--["Hedda"] = "Hedda", -- de-DE
|
||||||
@@ -305,7 +436,6 @@ MSRS.Voices = {
|
|||||||
["en_IN_Ravi"] = "Ravi", --en-IN
|
["en_IN_Ravi"] = "Ravi", --en-IN
|
||||||
["en_IN_Heera"] = "Heera", --en-IN
|
["en_IN_Heera"] = "Heera", --en-IN
|
||||||
["en_IR_Sean"] = "Sean", --en-IR
|
["en_IR_Sean"] = "Sean", --en-IR
|
||||||
--]]
|
|
||||||
},
|
},
|
||||||
Google = {
|
Google = {
|
||||||
Standard = {
|
Standard = {
|
||||||
@@ -317,11 +447,14 @@ MSRS.Voices = {
|
|||||||
["en_IN_Standard_B"] = 'en-IN-Standard-B', -- [6] MALE
|
["en_IN_Standard_B"] = 'en-IN-Standard-B', -- [6] MALE
|
||||||
["en_IN_Standard_C"] = 'en-IN-Standard-C', -- [7] MALE
|
["en_IN_Standard_C"] = 'en-IN-Standard-C', -- [7] MALE
|
||||||
["en_IN_Standard_D"] = 'en-IN-Standard-D', -- [8] FEMALE
|
["en_IN_Standard_D"] = 'en-IN-Standard-D', -- [8] FEMALE
|
||||||
["en_GB_Standard_A"] = 'en-GB-Standard-A', -- [9] FEMALE
|
-- 2025 changes
|
||||||
["en_GB_Standard_B"] = 'en-GB-Standard-B', -- [10] MALE
|
["en_GB_Standard_A"] = 'en-GB-Standard-N', -- [9] FEMALE
|
||||||
["en_GB_Standard_C"] = 'en-GB-Standard-C', -- [11] FEMALE
|
["en_GB_Standard_B"] = 'en-GB-Standard-O', -- [10] MALE
|
||||||
["en_GB_Standard_D"] = 'en-GB-Standard-D', -- [12] MALE
|
["en_GB_Standard_C"] = 'en-GB-Standard-N', -- [11] FEMALE
|
||||||
["en_GB_Standard_F"] = 'en-GB-Standard-F', -- [13] FEMALE
|
["en_GB_Standard_D"] = 'en-GB-Standard-O', -- [12] MALE
|
||||||
|
["en_GB_Standard_F"] = 'en-GB-Standard-N', -- [13] FEMALE
|
||||||
|
["en_GB_Standard_O"] = 'en-GB-Standard-O', -- [12] MALE
|
||||||
|
["en_GB_Standard_N"] = 'en-GB-Standard-N', -- [13] FEMALE
|
||||||
["en_US_Standard_A"] = 'en-US-Standard-A', -- [14] MALE
|
["en_US_Standard_A"] = 'en-US-Standard-A', -- [14] MALE
|
||||||
["en_US_Standard_B"] = 'en-US-Standard-B', -- [15] MALE
|
["en_US_Standard_B"] = 'en-US-Standard-B', -- [15] MALE
|
||||||
["en_US_Standard_C"] = 'en-US-Standard-C', -- [16] FEMALE
|
["en_US_Standard_C"] = 'en-US-Standard-C', -- [16] FEMALE
|
||||||
@@ -332,25 +465,36 @@ MSRS.Voices = {
|
|||||||
["en_US_Standard_H"] = 'en-US-Standard-H', -- [21] FEMALE
|
["en_US_Standard_H"] = 'en-US-Standard-H', -- [21] FEMALE
|
||||||
["en_US_Standard_I"] = 'en-US-Standard-I', -- [22] MALE
|
["en_US_Standard_I"] = 'en-US-Standard-I', -- [22] MALE
|
||||||
["en_US_Standard_J"] = 'en-US-Standard-J', -- [23] MALE
|
["en_US_Standard_J"] = 'en-US-Standard-J', -- [23] MALE
|
||||||
["fr_FR_Standard_A"] = "fr-FR-Standard-A", -- Female
|
-- 2025 catalog changes
|
||||||
["fr_FR_Standard_B"] = "fr-FR-Standard-B", -- Male
|
["fr_FR_Standard_A"] = "fr-FR-Standard-F", -- Female
|
||||||
["fr_FR_Standard_C"] = "fr-FR-Standard-C", -- Female
|
["fr_FR_Standard_B"] = "fr-FR-Standard-G", -- Male
|
||||||
["fr_FR_Standard_D"] = "fr-FR-Standard-D", -- Male
|
["fr_FR_Standard_C"] = "fr-FR-Standard-F", -- Female
|
||||||
["fr_FR_Standard_E"] = "fr-FR-Standard-E", -- Female
|
["fr_FR_Standard_D"] = "fr-FR-Standard-G", -- Male
|
||||||
["de_DE_Standard_A"] = "de-DE-Standard-A", -- Female
|
["fr_FR_Standard_E"] = "fr-FR-Standard-F", -- Female
|
||||||
["de_DE_Standard_B"] = "de-DE-Standard-B", -- Male
|
["fr_FR_Standard_G"] = "fr-FR-Standard-G", -- Male
|
||||||
["de_DE_Standard_C"] = "de-DE-Standard-C", -- Female
|
["fr_FR_Standard_F"] = "fr-FR-Standard-F", -- Female
|
||||||
["de_DE_Standard_D"] = "de-DE-Standard-D", -- Male
|
-- 2025 catalog changes
|
||||||
["de_DE_Standard_E"] = "de-DE-Standard-E", -- Male
|
["de_DE_Standard_A"] = "de-DE-Standard-G", -- Female
|
||||||
["de_DE_Standard_F"] = "de-DE-Standard-F", -- Female
|
["de_DE_Standard_B"] = "de-DE-Standard-H", -- Male
|
||||||
["es_ES_Standard_A"] = "es-ES-Standard-A", -- Female
|
["de_DE_Standard_C"] = "de-DE-Standard-G", -- Female
|
||||||
["es_ES_Standard_B"] = "es-ES-Standard-B", -- Male
|
["de_DE_Standard_D"] = "de-DE-Standard-H", -- Male
|
||||||
["es_ES_Standard_C"] = "es-ES-Standard-C", -- Female
|
["de_DE_Standard_E"] = "de-DE-Standard-H", -- Male
|
||||||
["es_ES_Standard_D"] = "es-ES-Standard-D", -- Female
|
["de_DE_Standard_F"] = "de-DE-Standard-G", -- Female
|
||||||
["it_IT_Standard_A"] = "it-IT-Standard-A", -- Female
|
["de_DE_Standard_H"] = "de-DE-Standard-H", -- Male
|
||||||
["it_IT_Standard_B"] = "it-IT-Standard-B", -- Female
|
["de_DE_Standard_G"] = "de-DE-Standard-G", -- Female
|
||||||
["it_IT_Standard_C"] = "it-IT-Standard-C", -- Male
|
["es_ES_Standard_A"] = "es-ES-Standard-E", -- Female
|
||||||
["it_IT_Standard_D"] = "it-IT-Standard-D", -- Male
|
["es_ES_Standard_B"] = "es-ES-Standard-F", -- Male
|
||||||
|
["es_ES_Standard_C"] = "es-ES-Standard-E", -- Female
|
||||||
|
["es_ES_Standard_D"] = "es-ES-Standard-F", -- Male
|
||||||
|
["es_ES_Standard_E"] = "es-ES-Standard-E", -- Female
|
||||||
|
["es_ES_Standard_F"] = "es-ES-Standard-F", -- Male
|
||||||
|
-- 2025 catalog changes
|
||||||
|
["it_IT_Standard_A"] = "it-IT-Standard-E", -- Female
|
||||||
|
["it_IT_Standard_B"] = "it-IT-Standard-E", -- Female
|
||||||
|
["it_IT_Standard_C"] = "it-IT-Standard-F", -- Male
|
||||||
|
["it_IT_Standard_D"] = "it-IT-Standard-F", -- Male
|
||||||
|
["it_IT_Standard_E"] = "it-IT-Standard-E", -- Female
|
||||||
|
["it_IT_Standard_F"] = "it-IT-Standard-F", -- Male
|
||||||
},
|
},
|
||||||
Wavenet = {
|
Wavenet = {
|
||||||
["en_AU_Wavenet_A"] = 'en-AU-Wavenet-A', -- [1] FEMALE
|
["en_AU_Wavenet_A"] = 'en-AU-Wavenet-A', -- [1] FEMALE
|
||||||
@@ -361,11 +505,14 @@ MSRS.Voices = {
|
|||||||
["en_IN_Wavenet_B"] = 'en-IN-Wavenet-B', -- [6] MALE
|
["en_IN_Wavenet_B"] = 'en-IN-Wavenet-B', -- [6] MALE
|
||||||
["en_IN_Wavenet_C"] = 'en-IN-Wavenet-C', -- [7] MALE
|
["en_IN_Wavenet_C"] = 'en-IN-Wavenet-C', -- [7] MALE
|
||||||
["en_IN_Wavenet_D"] = 'en-IN-Wavenet-D', -- [8] FEMALE
|
["en_IN_Wavenet_D"] = 'en-IN-Wavenet-D', -- [8] FEMALE
|
||||||
["en_GB_Wavenet_A"] = 'en-GB-Wavenet-A', -- [9] FEMALE
|
-- 2025 changes
|
||||||
["en_GB_Wavenet_B"] = 'en-GB-Wavenet-B', -- [10] MALE
|
["en_GB_Wavenet_A"] = 'en-GB-Wavenet-N', -- [9] FEMALE
|
||||||
["en_GB_Wavenet_C"] = 'en-GB-Wavenet-C', -- [11] FEMALE
|
["en_GB_Wavenet_B"] = 'en-GB-Wavenet-O', -- [10] MALE
|
||||||
["en_GB_Wavenet_D"] = 'en-GB-Wavenet-D', -- [12] MALE
|
["en_GB_Wavenet_C"] = 'en-GB-Wavenet-N', -- [11] FEMALE
|
||||||
["en_GB_Wavenet_F"] = 'en-GB-Wavenet-F', -- [13] FEMALE
|
["en_GB_Wavenet_D"] = 'en-GB-Wavenet-O', -- [12] MALE
|
||||||
|
["en_GB_Wavenet_F"] = 'en-GB-Wavenet-N', -- [13] FEMALE
|
||||||
|
["en_GB_Wavenet_O"] = 'en-GB-Wavenet-O', -- [12] MALE
|
||||||
|
["en_GB_Wavenet_N"] = 'en-GB-Wavenet-N', -- [13] FEMALE
|
||||||
["en_US_Wavenet_A"] = 'en-US-Wavenet-A', -- [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
|
||||||
@@ -376,24 +523,35 @@ MSRS.Voices = {
|
|||||||
["en_US_Wavenet_H"] = 'en-US-Wavenet-H', -- [21] FEMALE
|
["en_US_Wavenet_H"] = 'en-US-Wavenet-H', -- [21] FEMALE
|
||||||
["en_US_Wavenet_I"] = 'en-US-Wavenet-I', -- [22] MALE
|
["en_US_Wavenet_I"] = 'en-US-Wavenet-I', -- [22] MALE
|
||||||
["en_US_Wavenet_J"] = 'en-US-Wavenet-J', -- [23] MALE
|
["en_US_Wavenet_J"] = 'en-US-Wavenet-J', -- [23] MALE
|
||||||
["fr_FR_Wavenet_A"] = "fr-FR-Wavenet-A", -- Female
|
-- 2025 catalog changes
|
||||||
["fr_FR_Wavenet_B"] = "fr-FR-Wavenet-B", -- Male
|
["fr_FR_Wavenet_A"] = "fr-FR-Wavenet-F", -- Female
|
||||||
["fr_FR_Wavenet_C"] = "fr-FR-Wavenet-C", -- Female
|
["fr_FR_Wavenet_B"] = "fr-FR-Wavenet-G", -- Male
|
||||||
["fr_FR_Wavenet_D"] = "fr-FR-Wavenet-D", -- Male
|
["fr_FR_Wavenet_C"] = "fr-FR-Wavenet-F", -- Female
|
||||||
["fr_FR_Wavenet_E"] = "fr-FR-Wavenet-E", -- Female
|
["fr_FR_Wavenet_D"] = "fr-FR-Wavenet-G", -- Male
|
||||||
["de_DE_Wavenet_A"] = "de-DE-Wavenet-A", -- Female
|
["fr_FR_Wavenet_E"] = "fr-FR-Wavenet-F", -- Female
|
||||||
["de_DE_Wavenet_B"] = "de-DE-Wavenet-B", -- Male
|
["fr_FR_Wavenet_G"] = "fr-FR-Wavenet-G", -- Male
|
||||||
["de_DE_Wavenet_C"] = "de-DE-Wavenet-C", -- Female
|
["fr_FR_Wavenet_F"] = "fr-FR-Wavenet-F", -- Female
|
||||||
["de_DE_Wavenet_D"] = "de-DE-Wavenet-D", -- Male
|
-- 2025 catalog changes
|
||||||
["de_DE_Wavenet_E"] = "de-DE-Wavenet-E", -- Male
|
["de_DE_Wavenet_A"] = "de-DE-Wavenet-G", -- Female
|
||||||
["de_DE_Wavenet_F"] = "de-DE-Wavenet-F", -- Female
|
["de_DE_Wavenet_B"] = "de-DE-Wavenet-H", -- Male
|
||||||
["es_ES_Wavenet_B"] = "es-ES-Wavenet-B", -- Male
|
["de_DE_Wavenet_C"] = "de-DE-Wavenet-G", -- Female
|
||||||
["es_ES_Wavenet_C"] = "es-ES-Wavenet-C", -- Female
|
["de_DE_Wavenet_D"] = "de-DE-Wavenet-H", -- Male
|
||||||
["es_ES_Wavenet_D"] = "es-ES-Wavenet-D", -- Female
|
["de_DE_Wavenet_E"] = "de-DE-Wavenet-H", -- Male
|
||||||
["it_IT_Wavenet_A"] = "it-IT-Wavenet-A", -- Female
|
["de_DE_Wavenet_F"] = "de-DE-Wavenet-G", -- Female
|
||||||
["it_IT_Wavenet_B"] = "it-IT-Wavenet-B", -- Female
|
["de_DE_Wavenet_H"] = "de-DE-Wavenet-H", -- Male
|
||||||
["it_IT_Wavenet_C"] = "it-IT-Wavenet-C", -- Male
|
["de_DE_Wavenet_G"] = "de-DE-Wavenet-G", -- Female
|
||||||
["it_IT_Wavenet_D"] = "it-IT-Wavenet-D", -- Male
|
["es_ES_Wavenet_B"] = "es-ES-Wavenet-E", -- Male
|
||||||
|
["es_ES_Wavenet_C"] = "es-ES-Wavenet-F", -- Female
|
||||||
|
["es_ES_Wavenet_D"] = "es-ES-Wavenet-E", -- Female
|
||||||
|
["es_ES_Wavenet_E"] = "es-ES-Wavenet-E", -- Male
|
||||||
|
["es_ES_Wavenet_F"] = "es-ES-Wavenet-F", -- Female
|
||||||
|
-- 2025 catalog changes
|
||||||
|
["it_IT_Wavenet_A"] = "it-IT-Wavenet-E", -- Female
|
||||||
|
["it_IT_Wavenet_B"] = "it-IT-Wavenet-E", -- Female
|
||||||
|
["it_IT_Wavenet_C"] = "it-IT-Wavenet-F", -- Male
|
||||||
|
["it_IT_Wavenet_D"] = "it-IT-Wavenet-F", -- Male
|
||||||
|
["it_IT_Wavenet_E"] = "it-IT-Wavenet-E", -- Female
|
||||||
|
["it_IT_Wavenet_F"] = "it-IT-Wavenet-F", -- Male
|
||||||
} ,
|
} ,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -589,7 +747,7 @@ function MSRS:SetBackendSRSEXE()
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Set the default backend.
|
--- Set the default backend.
|
||||||
-- @param #MSRS self
|
-- @param #string Backend
|
||||||
function MSRS.SetDefaultBackend(Backend)
|
function MSRS.SetDefaultBackend(Backend)
|
||||||
MSRS.backend=Backend or MSRS.Backend.SRSEXE
|
MSRS.backend=Backend or MSRS.Backend.SRSEXE
|
||||||
end
|
end
|
||||||
@@ -945,7 +1103,7 @@ end
|
|||||||
-- - `MSRS.Provider.WINDOWS`: Microsoft Windows (default)
|
-- - `MSRS.Provider.WINDOWS`: Microsoft Windows (default)
|
||||||
-- - `MSRS.Provider.GOOGLE`: Google Cloud
|
-- - `MSRS.Provider.GOOGLE`: Google Cloud
|
||||||
-- - `MSRS.Provider.AZURE`: Microsoft Azure (only with DCS-gRPC backend)
|
-- - `MSRS.Provider.AZURE`: Microsoft Azure (only with DCS-gRPC backend)
|
||||||
-- - `MSRS.Provier.AMAZON`: Amazone Web Service (only with DCS-gRPC backend)
|
-- - `MSRS.Provier.AMAZON`: Amazon Web Service (only with DCS-gRPC backend)
|
||||||
--
|
--
|
||||||
-- Note that all providers except Microsoft Windows need as additonal information the credentials of your account.
|
-- Note that all providers except Microsoft Windows need as additonal information the credentials of your account.
|
||||||
--
|
--
|
||||||
@@ -1155,6 +1313,7 @@ function MSRS:PlaySoundFile(Soundfile, Delay)
|
|||||||
|
|
||||||
-- Append file.
|
-- Append file.
|
||||||
command=command..' --file="'..tostring(soundfile)..'"'
|
command=command..' --file="'..tostring(soundfile)..'"'
|
||||||
|
command=string.gsub(command,"--ssml","-h")
|
||||||
|
|
||||||
-- Execute command.
|
-- Execute command.
|
||||||
self:_ExecCommand(command)
|
self:_ExecCommand(command)
|
||||||
@@ -1238,7 +1397,7 @@ function MSRS:PlayTextExt(Text, Delay, Frequencies, Modulations, Gender, Culture
|
|||||||
self:T({Text, Delay, Frequencies, Modulations, Gender, Culture, Voice, Volume, Label, Coordinate} )
|
self:T({Text, Delay, Frequencies, Modulations, Gender, Culture, Voice, Volume, Label, Coordinate} )
|
||||||
|
|
||||||
if Delay and Delay>0 then
|
if Delay and Delay>0 then
|
||||||
self:ScheduleOnce(Delay, MSRS.PlayTextExt, self, Text, 0, Frequencies, Modulations, Gender, Culture, Voice, Volume, Label, Coordinate)
|
self:ScheduleOnce(Delay, self.PlayTextExt, self, Text, 0, Frequencies, Modulations, Gender, Culture, Voice, Volume, Label, Coordinate)
|
||||||
else
|
else
|
||||||
|
|
||||||
Frequencies = Frequencies or self:GetFrequencies()
|
Frequencies = Frequencies or self:GetFrequencies()
|
||||||
@@ -1376,20 +1535,25 @@ function MSRS:_GetCommand(freqs, modus, coal, gender, voice, culture, volume, sp
|
|||||||
modus=modus:gsub("1", "FM")
|
modus=modus:gsub("1", "FM")
|
||||||
|
|
||||||
-- Command.
|
-- Command.
|
||||||
|
local pwsh = string.format('Start-Process -WindowStyle Hidden -WorkingDirectory \"%s\" -FilePath \"%s\" -ArgumentList \'-f "%s" -m "%s" -c %s -p %s -n "%s" -v "%.1f"', path, exe, freqs, modus, coal, port, label,volume )
|
||||||
|
|
||||||
local command=string.format('"%s\\%s" -f "%s" -m "%s" -c %s -p %s -n "%s" -v "%.1f"', path, exe, freqs, modus, coal, port, label,volume)
|
local command=string.format('"%s\\%s" -f "%s" -m "%s" -c %s -p %s -n "%s" -v "%.1f"', path, exe, freqs, modus, coal, port, label,volume)
|
||||||
|
|
||||||
-- Set voice or gender/culture.
|
-- Set voice or gender/culture.
|
||||||
if voice then
|
if voice and self.UsePowerShell ~= true then
|
||||||
-- Use a specific voice (no need for gender and/or culture.
|
-- Use a specific voice (no need for gender and/or culture.
|
||||||
command=command..string.format(" --voice=\"%s\"", tostring(voice))
|
command=command..string.format(" --voice=\"%s\"", tostring(voice))
|
||||||
|
pwsh=pwsh..string.format(" --voice=\"%s\"", tostring(voice))
|
||||||
else
|
else
|
||||||
-- Add gender.
|
-- Add gender.
|
||||||
if gender and gender~="female" then
|
if gender and gender~="female" then
|
||||||
command=command..string.format(" -g %s", tostring(gender))
|
command=command..string.format(" -g %s", tostring(gender))
|
||||||
|
pwsh=pwsh..string.format(" -g %s", tostring(gender))
|
||||||
end
|
end
|
||||||
-- Add culture.
|
-- Add culture.
|
||||||
if culture and culture~="en-GB" then
|
if culture and culture~="en-GB" then
|
||||||
command=command..string.format(" -l %s", tostring(culture))
|
command=command..string.format(" -l %s", tostring(culture))
|
||||||
|
pwsh=pwsh..string.format(" -l %s", tostring(culture))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1397,16 +1561,18 @@ function MSRS:_GetCommand(freqs, modus, coal, gender, voice, culture, volume, sp
|
|||||||
if coordinate then
|
if coordinate then
|
||||||
local lat,lon,alt=self:_GetLatLongAlt(coordinate)
|
local lat,lon,alt=self:_GetLatLongAlt(coordinate)
|
||||||
command=command..string.format(" -L %.4f -O %.4f -A %d", lat, lon, alt)
|
command=command..string.format(" -L %.4f -O %.4f -A %d", lat, lon, alt)
|
||||||
|
pwsh=pwsh..string.format(" -L %.4f -O %.4f -A %d", lat, lon, alt)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set provider options
|
-- Set provider options
|
||||||
if self.provider==MSRS.Provider.GOOGLE then
|
if self.provider==MSRS.Provider.GOOGLE then
|
||||||
local pops=self:GetProviderOptions()
|
local pops=self:GetProviderOptions()
|
||||||
command=command..string.format(' --ssml -G "%s"', pops.credentials)
|
command=command..string.format(' --ssml -G "%s"', pops.credentials)
|
||||||
|
pwsh=pwsh..string.format(' --ssml -G "%s"', pops.credentials)
|
||||||
elseif self.provider==MSRS.Provider.WINDOWS then
|
elseif self.provider==MSRS.Provider.WINDOWS then
|
||||||
-- Nothing to do.
|
-- Nothing to do.
|
||||||
else
|
else
|
||||||
self:E("ERROR: SRS only supports WINWOWS and GOOGLE as TTS providers! Use DCS-gRPC backend for other providers such as ")
|
self:E("ERROR: SRS only supports WINDOWS and GOOGLE as TTS providers! Use DCS-gRPC backend for other providers such as AWS and Azure.")
|
||||||
end
|
end
|
||||||
|
|
||||||
if not UTILS.FileExists(fullPath) then
|
if not UTILS.FileExists(fullPath) then
|
||||||
@@ -1417,7 +1583,11 @@ function MSRS:_GetCommand(freqs, modus, coal, gender, voice, culture, volume, sp
|
|||||||
-- Debug output.
|
-- Debug output.
|
||||||
self:T("MSRS command from _GetCommand="..command)
|
self:T("MSRS command from _GetCommand="..command)
|
||||||
|
|
||||||
return command
|
if self.UsePowerShell == true then
|
||||||
|
return pwsh
|
||||||
|
else
|
||||||
|
return command
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Execute SRS command to play sound using the `DCS-SR-ExternalAudio.exe`.
|
--- Execute SRS command to play sound using the `DCS-SR-ExternalAudio.exe`.
|
||||||
@@ -1425,7 +1595,7 @@ end
|
|||||||
-- @param #string command Command to executer
|
-- @param #string command Command to executer
|
||||||
-- @return #number Return value of os.execute() command.
|
-- @return #number Return value of os.execute() command.
|
||||||
function MSRS:_ExecCommand(command)
|
function MSRS:_ExecCommand(command)
|
||||||
self:F( {command=command} )
|
self:T2( {command=command} )
|
||||||
|
|
||||||
-- Skip this function if _GetCommand was not able to find the executable
|
-- Skip this function if _GetCommand was not able to find the executable
|
||||||
if string.find(command, "CommandNotFound") then return 0 end
|
if string.find(command, "CommandNotFound") then return 0 end
|
||||||
@@ -1434,6 +1604,12 @@ function MSRS:_ExecCommand(command)
|
|||||||
-- Create a tmp file.
|
-- Create a tmp file.
|
||||||
local filename=os.getenv('TMP').."\\MSRS-"..MSRS.uuid()..".bat"
|
local filename=os.getenv('TMP').."\\MSRS-"..MSRS.uuid()..".bat"
|
||||||
|
|
||||||
|
if self.UsePowerShell == true then
|
||||||
|
filename=os.getenv('TMP').."\\MSRS-"..MSRS.uuid()..".ps1"
|
||||||
|
batContent = command .. "\'"
|
||||||
|
self:T({batContent=batContent})
|
||||||
|
end
|
||||||
|
|
||||||
local script=io.open(filename, "w+")
|
local script=io.open(filename, "w+")
|
||||||
script:write(batContent)
|
script:write(batContent)
|
||||||
script:close()
|
script:close()
|
||||||
@@ -1442,7 +1618,7 @@ function MSRS:_ExecCommand(command)
|
|||||||
self:T("MSRS batch content: "..batContent)
|
self:T("MSRS batch content: "..batContent)
|
||||||
|
|
||||||
local res=nil
|
local res=nil
|
||||||
if true then
|
if self.UsePowerShell ~= true then
|
||||||
|
|
||||||
-- Create a tmp file.
|
-- Create a tmp file.
|
||||||
local filenvbs = os.getenv('TMP') .. "\\MSRS-"..MSRS.uuid()..".vbs"
|
local filenvbs = os.getenv('TMP') .. "\\MSRS-"..MSRS.uuid()..".vbs"
|
||||||
@@ -1470,23 +1646,20 @@ function MSRS:_ExecCommand(command)
|
|||||||
timer.scheduleFunction(os.remove, filenvbs, timer.getTime()+1)
|
timer.scheduleFunction(os.remove, filenvbs, timer.getTime()+1)
|
||||||
self:T("MSRS vbs and batch file removed")
|
self:T("MSRS vbs and batch file removed")
|
||||||
|
|
||||||
elseif false then
|
elseif self.UsePowerShell == true then
|
||||||
|
|
||||||
-- Create a tmp file.
|
local pwsh = string.format('start /min "" powershell.exe -ExecutionPolicy Unrestricted -WindowStyle Hidden -Command "%s"',filename)
|
||||||
local filenvbs = os.getenv('TMP') .. "\\MSRS-"..MSRS.uuid()..".vbs"
|
--env.info("[MSRS] TextToSpeech Command :\n" .. pwsh.."\n")
|
||||||
|
|
||||||
-- VBS script
|
if string.len(pwsh) > 255 then
|
||||||
local script = io.open(filenvbs, "w+")
|
self:E("[MSRS] - pwsh string too long")
|
||||||
script:write(string.format('Set oShell = CreateObject ("Wscript.Shell")\n'))
|
end
|
||||||
script:write(string.format('Dim strArgs\n'))
|
|
||||||
script:write(string.format('strArgs = "cmd /c %s"\n', filename))
|
|
||||||
script:write(string.format('oShell.Run strArgs, 0, false'))
|
|
||||||
script:close()
|
|
||||||
|
|
||||||
local runvbs=string.format('cscript.exe //Nologo //B "%s"', filenvbs)
|
|
||||||
|
|
||||||
-- Play file in 0.01 seconds
|
-- Play file in 0.01 seconds
|
||||||
res=os.execute(runvbs)
|
res=os.execute(pwsh)
|
||||||
|
|
||||||
|
-- Remove file in 1 second.
|
||||||
|
timer.scheduleFunction(os.remove, filename, timer.getTime()+1)
|
||||||
|
|
||||||
else
|
else
|
||||||
-- Play command.
|
-- Play command.
|
||||||
@@ -1560,8 +1733,8 @@ end
|
|||||||
function MSRS:_DCSgRPCtts(Text, Frequencies, Gender, Culture, Voice, Volume, Label, Coordinate)
|
function MSRS:_DCSgRPCtts(Text, Frequencies, Gender, Culture, Voice, Volume, Label, Coordinate)
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:F("MSRS_BACKEND_DCSGRPC:_DCSgRPCtts()")
|
self:T("MSRS_BACKEND_DCSGRPC:_DCSgRPCtts()")
|
||||||
self:F({Text, Frequencies, Gender, Culture, Voice, Volume, Label, Coordinate})
|
self:T({Text, Frequencies, Gender, Culture, Voice, Volume, Label, Coordinate})
|
||||||
|
|
||||||
local options = {} -- #MSRS.GRPCOptions
|
local options = {} -- #MSRS.GRPCOptions
|
||||||
|
|
||||||
@@ -1587,7 +1760,6 @@ function MSRS:_DCSgRPCtts(Text, Frequencies, Gender, Culture, Voice, Volume, Lab
|
|||||||
|
|
||||||
-- Provider (win, gcloud, ...)
|
-- Provider (win, gcloud, ...)
|
||||||
local provider = self.provider or MSRS.Provider.WINDOWS
|
local provider = self.provider or MSRS.Provider.WINDOWS
|
||||||
self:F({provider=provider})
|
|
||||||
|
|
||||||
-- Provider options: voice, credentials
|
-- Provider options: voice, credentials
|
||||||
options.provider = {}
|
options.provider = {}
|
||||||
@@ -1620,9 +1792,9 @@ function MSRS:_DCSgRPCtts(Text, Frequencies, Gender, Culture, Voice, Volume, Lab
|
|||||||
end
|
end
|
||||||
|
|
||||||
for _,freq in pairs(Frequencies) do
|
for _,freq in pairs(Frequencies) do
|
||||||
self:F("Calling GRPC.tts with the following parameter:")
|
self:T("Calling GRPC.tts with the following parameter:")
|
||||||
self:F({ssml=ssml, freq=freq, options=options})
|
self:T({ssml=ssml, freq=freq, options=options})
|
||||||
self:F(options.provider[provider])
|
self:T(options.provider[provider])
|
||||||
GRPC.tts(ssml, freq*1e6, options)
|
GRPC.tts(ssml, freq*1e6, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1944,7 +2116,7 @@ end
|
|||||||
-- @param Core.Point#COORDINATE coordinate Coordinate to be used
|
-- @param Core.Point#COORDINATE coordinate Coordinate to be used
|
||||||
-- @return #MSRSQUEUE.Transmission Radio transmission table.
|
-- @return #MSRSQUEUE.Transmission Radio transmission table.
|
||||||
function MSRSQUEUE:NewTransmission(text, duration, msrs, tstart, interval, subgroups, subtitle, subduration, frequency, modulation, gender, culture, voice, volume, label,coordinate)
|
function MSRSQUEUE:NewTransmission(text, duration, msrs, tstart, interval, subgroups, subtitle, subduration, frequency, modulation, gender, culture, voice, volume, label,coordinate)
|
||||||
|
self:T({Text=text, Dur=duration, start=tstart, int=interval, sub=subgroups, subt=subtitle, sudb=subduration, F=frequency, M=modulation, G=gender, C=culture, V=voice, Vol=volume, L=label})
|
||||||
if self.TransmitOnlyWithPlayers then
|
if self.TransmitOnlyWithPlayers then
|
||||||
if self.PlayerSet and self.PlayerSet:CountAlive() == 0 then
|
if self.PlayerSet and self.PlayerSet:CountAlive() == 0 then
|
||||||
return self
|
return self
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
-- ## Features:
|
-- ## Features:
|
||||||
--
|
--
|
||||||
-- * Create a SOUNDFILE object (mp3 or ogg) to be played via DCS or SRS transmissions
|
-- * Create a SOUNDFILE object (mp3 or ogg) to be played via DCS or SRS transmissions
|
||||||
-- * Create a SOUNDTEXT object for text-to-speech output vis SRS Simple-Text-To-Speech (STTS)
|
-- * Create a SOUNDTEXT object for text-to-speech output vis SRS Simple-Text-To-Speech (MSRS)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
do -- Sound Base
|
do -- Sound Base
|
||||||
|
|
||||||
--- @type SOUNDBASE
|
-- @type SOUNDBASE
|
||||||
-- @field #string ClassName Name of the class.
|
-- @field #string ClassName Name of the class.
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ end
|
|||||||
|
|
||||||
do -- Sound File
|
do -- Sound File
|
||||||
|
|
||||||
--- @type SOUNDFILE
|
-- @type SOUNDFILE
|
||||||
-- @field #string ClassName Name of the class
|
-- @field #string ClassName Name of the class
|
||||||
-- @field #string filename Name of the flag.
|
-- @field #string filename Name of the flag.
|
||||||
-- @field #string path Directory path, where the sound file is located. This includes the final slash "/".
|
-- @field #string path Directory path, where the sound file is located. This includes the final slash "/".
|
||||||
@@ -160,7 +160,7 @@ do -- Sound File
|
|||||||
-- @param #string FileName The name of the sound file, e.g. "Hello World.ogg".
|
-- @param #string FileName The name of the sound file, e.g. "Hello World.ogg".
|
||||||
-- @param #string Path The path of the directory, where the sound file is located. Default is "l10n/DEFAULT/" within the miz file.
|
-- @param #string Path The path of the directory, where the sound file is located. Default is "l10n/DEFAULT/" within the miz file.
|
||||||
-- @param #number Duration Duration in seconds, how long it takes to play the sound file. Default is 3 seconds.
|
-- @param #number Duration Duration in seconds, how long it takes to play the sound file. Default is 3 seconds.
|
||||||
-- @param #bolean UseSrs Set if SRS should be used to play this file. Default is false.
|
-- @param #boolean UseSrs Set if SRS should be used to play this file. Default is false.
|
||||||
-- @return #SOUNDFILE self
|
-- @return #SOUNDFILE self
|
||||||
function SOUNDFILE:New(FileName, Path, Duration, UseSrs)
|
function SOUNDFILE:New(FileName, Path, Duration, UseSrs)
|
||||||
|
|
||||||
@@ -249,6 +249,9 @@ do -- Sound File
|
|||||||
-- @param #string Duration Duration in seconds. Default 3 seconds.
|
-- @param #string Duration Duration in seconds. Default 3 seconds.
|
||||||
-- @return #SOUNDFILE self
|
-- @return #SOUNDFILE self
|
||||||
function SOUNDFILE:SetDuration(Duration)
|
function SOUNDFILE:SetDuration(Duration)
|
||||||
|
if Duration and type(Duration)=="string" then
|
||||||
|
Duration=tonumber(Duration)
|
||||||
|
end
|
||||||
self.duration=Duration or 3
|
self.duration=Duration or 3
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -289,7 +292,7 @@ end
|
|||||||
|
|
||||||
do -- Text-To-Speech
|
do -- Text-To-Speech
|
||||||
|
|
||||||
--- @type SOUNDTEXT
|
-- @type SOUNDTEXT
|
||||||
-- @field #string ClassName Name of the class
|
-- @field #string ClassName Name of the class
|
||||||
-- @field #string text Text to speak.
|
-- @field #string text Text to speak.
|
||||||
-- @field #number duration Duration in seconds.
|
-- @field #number duration Duration in seconds.
|
||||||
@@ -356,7 +359,7 @@ do -- Text-To-Speech
|
|||||||
local self=BASE:Inherit(self, BASE:New()) -- #SOUNDTEXT
|
local self=BASE:Inherit(self, BASE:New()) -- #SOUNDTEXT
|
||||||
|
|
||||||
self:SetText(Text)
|
self:SetText(Text)
|
||||||
self:SetDuration(Duration or STTS.getSpeechTime(Text))
|
self:SetDuration(Duration or MSRS.getSpeechTime(Text))
|
||||||
--self:SetGender()
|
--self:SetGender()
|
||||||
--self:SetCulture()
|
--self:SetCulture()
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
do -- UserSound
|
do -- UserSound
|
||||||
|
|
||||||
--- @type USERSOUND
|
-- @type USERSOUND
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|||||||
@@ -27,6 +27,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.
|
||||||
|
|||||||
@@ -17,6 +17,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.
|
||||||
--
|
--
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user