mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Compare commits
604 Commits
2.7.15
...
kk/usergui
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c66fd7cab | ||
|
|
80f76b26c2 | ||
|
|
4e956c3203 | ||
|
|
08f2c29014 | ||
|
|
dcd4d0ab62 | ||
|
|
bb07e1935e | ||
|
|
088436c5ce | ||
|
|
797bf0047b | ||
|
|
f29d055ca3 | ||
|
|
1468641563 | ||
|
|
8b08942c4d | ||
|
|
eb84ad3cee | ||
|
|
91a34ac4d8 | ||
|
|
28c8d99878 | ||
|
|
4fda8cc5fb | ||
|
|
4ac583e434 | ||
|
|
fa762fe0fc | ||
|
|
aca5846209 | ||
|
|
4fd7d7cba9 | ||
|
|
9280a1224d | ||
|
|
fce7b07014 | ||
|
|
4696569f83 | ||
|
|
84230e2360 | ||
|
|
ca9913e38b | ||
|
|
ff951c69d9 | ||
|
|
f2f7c88299 | ||
|
|
f5d6d31b10 | ||
|
|
9b95e71d75 | ||
|
|
db6dc7b77e | ||
|
|
4c81333a0a | ||
|
|
79b1f1615f | ||
|
|
47f010cb28 | ||
|
|
d14b7e8f4c | ||
|
|
d9748ef147 | ||
|
|
64d7946c06 | ||
|
|
b052fc6243 | ||
|
|
8385b1d21a | ||
|
|
d4f4465b0a | ||
|
|
5fe77956cb | ||
|
|
d640acc7cc | ||
|
|
8dcd22f18c | ||
|
|
2d086a62f0 | ||
|
|
47ad2499d4 | ||
|
|
5d510807c9 | ||
|
|
5ba8f9e0e8 | ||
|
|
0338fd5d33 | ||
|
|
ea2175bba8 | ||
|
|
0835022c5c | ||
|
|
f306361317 | ||
|
|
0347e42fc7 | ||
|
|
9cc32ff8dc | ||
|
|
b052d99349 | ||
|
|
4fe1318e7c | ||
|
|
6ffe69484c | ||
|
|
501ab70992 | ||
|
|
6ac46addf0 | ||
|
|
3bdf4b4c76 | ||
|
|
46f70dd8a6 | ||
|
|
aeac2eb3d7 | ||
|
|
e83c8c3ee0 | ||
|
|
d65042c640 | ||
|
|
c72cdd8f0b | ||
|
|
7e2f8771b5 | ||
|
|
3ccfcdbd0f | ||
|
|
16f3dcbbb4 | ||
|
|
f6f3189504 | ||
|
|
071554bfc5 | ||
|
|
1527b53c76 | ||
|
|
bbc7f7e14c | ||
|
|
b9830a8437 | ||
|
|
caaee4f551 | ||
|
|
5f7115f4fe | ||
|
|
9ec92a8fca | ||
|
|
7cc040c234 | ||
|
|
9227ba9ecd | ||
|
|
e7fb073bab | ||
|
|
f86b3505b2 | ||
|
|
e89b921f3e | ||
|
|
0d18ce086c | ||
|
|
8fb126682f | ||
|
|
ebe486c69a | ||
|
|
702ec75935 | ||
|
|
465ec216ea | ||
|
|
d803b51e84 | ||
|
|
53f89fd42c | ||
|
|
c72f109553 | ||
|
|
92e03522db | ||
|
|
9716162739 | ||
|
|
4eea8fcadd | ||
|
|
0ae9be49da | ||
|
|
bda4efc634 | ||
|
|
e84e16f58b | ||
|
|
55ffe37a79 | ||
|
|
68548f4581 | ||
|
|
8382eb9cd8 | ||
|
|
f837e9dec7 | ||
|
|
230d9d82bf | ||
|
|
c089e56060 | ||
|
|
87f1a5ed0d | ||
|
|
d2d6fac7df | ||
|
|
bc3f9ed7c0 | ||
|
|
0f4162a9a9 | ||
|
|
6b270916c4 | ||
|
|
b3a006096c | ||
|
|
6903e252d2 | ||
|
|
ff6704f123 | ||
|
|
c770f4cb68 | ||
|
|
9ce1d360d6 | ||
|
|
6f473faa92 | ||
|
|
dd37a42470 | ||
|
|
88e1bbd60d | ||
|
|
e078e48853 | ||
|
|
fac7a5fdc6 | ||
|
|
49191fb144 | ||
|
|
f739062463 | ||
|
|
c22304f2b0 | ||
|
|
c97d2ecaba | ||
|
|
89a9d1d0a4 | ||
|
|
cf7d41cd7f | ||
|
|
afe542cc63 | ||
|
|
89a902fd57 | ||
|
|
ae604fd847 | ||
|
|
4b8d120f20 | ||
|
|
c489a88106 | ||
|
|
641707f37b | ||
|
|
67924c894d | ||
|
|
7c8f212b03 | ||
|
|
85c73cb0a5 | ||
|
|
1b1f8e0d2c | ||
|
|
f87126f22c | ||
|
|
b635490e47 | ||
|
|
cac7b39823 | ||
|
|
af3c579a03 | ||
|
|
a508c63279 | ||
|
|
427a11bd0f | ||
|
|
6f3133d48c | ||
|
|
aa7f26ac79 | ||
|
|
084caad5d7 | ||
|
|
343bf05c2c | ||
|
|
3e40d72e25 | ||
|
|
1c1daa4ebe | ||
|
|
fdcda6e5f3 | ||
|
|
a50dde7f2b | ||
|
|
1fb4cb1c4f | ||
|
|
cd0f854f41 | ||
|
|
52c2401d93 | ||
|
|
02a87d9fe0 | ||
|
|
12d68a41ca | ||
|
|
6c4a64601f | ||
|
|
434f985e77 | ||
|
|
ba1dcfcdba | ||
|
|
b346dabdf8 | ||
|
|
1376a16812 | ||
|
|
4267314260 | ||
|
|
b5110c8554 | ||
|
|
1f1d1e4f2f | ||
|
|
522eb8b256 | ||
|
|
b662ecc76b | ||
|
|
6dd69eb6db | ||
|
|
1b6aeff005 | ||
|
|
4287774d9f | ||
|
|
6bba2fec0b | ||
|
|
5d2656d679 | ||
|
|
65a729a2d6 | ||
|
|
7868930fcb | ||
|
|
67248a290c | ||
|
|
0bc52eb331 | ||
|
|
5353be482e | ||
|
|
826ae86cb7 | ||
|
|
475153be4c | ||
|
|
5f734a0d17 | ||
|
|
1b8c9367a3 | ||
|
|
19047843cc | ||
|
|
174454b8c5 | ||
|
|
d30a53333c | ||
|
|
30b89328f1 | ||
|
|
b38dc62be7 | ||
|
|
6d9333aa94 | ||
|
|
6947bcfcf2 | ||
|
|
db06154ad7 | ||
|
|
fa43a6c40b | ||
|
|
5056187fb9 | ||
|
|
72c5c2ee4d | ||
|
|
25936a526d | ||
|
|
8bc735288f | ||
|
|
f8afa1cb78 | ||
|
|
e95eb2768d | ||
|
|
f6091cd117 | ||
|
|
9fafdea0bb | ||
|
|
fbf2c4c721 | ||
|
|
9d3cb4cc1b | ||
|
|
9d500186d1 | ||
|
|
f80265786d | ||
|
|
7b9d8d375d | ||
|
|
7393cb2cbe | ||
|
|
bcbe872c7d | ||
|
|
bf60c535bc | ||
|
|
feb99e9405 | ||
|
|
9fde88d61a | ||
|
|
430b4a274c | ||
|
|
5996426119 | ||
|
|
36d9460cdf | ||
|
|
1561f49c9c | ||
|
|
e032781a92 | ||
|
|
aa7d0b1e25 | ||
|
|
13a8babe75 | ||
|
|
87dda49113 | ||
|
|
018830b539 | ||
|
|
d92d2d07c5 | ||
|
|
046e49ac6b | ||
|
|
52e66ae969 | ||
|
|
ca15d7cb00 | ||
|
|
1086c61ccf | ||
|
|
77f9721102 | ||
|
|
b05683d384 | ||
|
|
d7df08d754 | ||
|
|
92b21aa5c1 | ||
|
|
0e2dff4e6b | ||
|
|
5c9e3570e2 | ||
|
|
51102e47ae | ||
|
|
7643568706 | ||
|
|
3684a023da | ||
|
|
b0c8f05f38 | ||
|
|
d8c2b8b719 | ||
|
|
31075f7c04 | ||
|
|
6bf6b933cc | ||
|
|
5681244941 | ||
|
|
788108c5b8 | ||
|
|
3fbc76e37f | ||
|
|
4e5b483cc0 | ||
|
|
ab068670cc | ||
|
|
456c002c3c | ||
|
|
038b89776d | ||
|
|
df6d968ebe | ||
|
|
4d9197b3cc | ||
|
|
10dffb0689 | ||
|
|
722c33df62 | ||
|
|
dc54cc82af | ||
|
|
d4a46606fd | ||
|
|
015af9774c | ||
|
|
f0a37172b9 | ||
|
|
2dd2e593e8 | ||
|
|
49fd78abe7 | ||
|
|
7c8cca7f56 | ||
|
|
0658f6dc2b | ||
|
|
75558078ee | ||
|
|
f6b5c69d4e | ||
|
|
a7f01eb04a | ||
|
|
65f9db8efa | ||
|
|
2ebad9ce96 | ||
|
|
b9cc66004d | ||
|
|
17838e7fe7 | ||
|
|
b0d0dbfe72 | ||
|
|
2d081dfc03 | ||
|
|
4a594f41b0 | ||
|
|
04b4af58f7 | ||
|
|
f44ba39ec5 | ||
|
|
05df765c5c | ||
|
|
04a7c912ea | ||
|
|
55fb8f2064 | ||
|
|
912c162eee | ||
|
|
2efb6a624f | ||
|
|
ca84fa11cd | ||
|
|
ed614767e6 | ||
|
|
6d94a0c776 | ||
|
|
81fd5cb605 | ||
|
|
b70bf3b9af | ||
|
|
250d640e76 | ||
|
|
6a05789db5 | ||
|
|
5e20874dca | ||
|
|
bc16970d96 | ||
|
|
f8f4bac77e | ||
|
|
5aa8338c59 | ||
|
|
1362fe9019 | ||
|
|
ba361e7eff | ||
|
|
31fb9bc169 | ||
|
|
e95a9525c6 | ||
|
|
326d4b3135 | ||
|
|
c4fad08d58 | ||
|
|
5a57d05fd6 | ||
|
|
8a7fa326cd | ||
|
|
18afe9ad7a | ||
|
|
253cf0f5a5 | ||
|
|
c5a85456c0 | ||
|
|
9a383826e7 | ||
|
|
1e6731830e | ||
|
|
d9aff32a36 | ||
|
|
38cb8fb88e | ||
|
|
ad5488784f | ||
|
|
a4cdd62aff | ||
|
|
9a9de9306e | ||
|
|
cf824b912d | ||
|
|
8d2e291deb | ||
|
|
3a432782b2 | ||
|
|
bda1fac923 | ||
|
|
ef40b1c524 | ||
|
|
a4c81736aa | ||
|
|
045c49679d | ||
|
|
f40442d309 | ||
|
|
fe7acecdd3 | ||
|
|
4471ec9b96 | ||
|
|
32e1d4f8fa | ||
|
|
747e5d801a | ||
|
|
29ed630536 | ||
|
|
c5757ffd22 | ||
|
|
9cc08cb088 | ||
|
|
2771e7f856 | ||
|
|
7c4dd8160d | ||
|
|
1fdc50b0da | ||
|
|
f87a676e4b | ||
|
|
8bf56b8b1a | ||
|
|
f31741f934 | ||
|
|
46258492bd | ||
|
|
6481f66e27 | ||
|
|
5954b8692f | ||
|
|
f6fdecf892 | ||
|
|
53fb77b50d | ||
|
|
04a9dc3a8c | ||
|
|
10b9a32f29 | ||
|
|
40fa929eb0 | ||
|
|
8c8ef19f01 | ||
|
|
1eaa3d309d | ||
|
|
a52cd5612a | ||
|
|
e82ed762be | ||
|
|
0bb16ec827 | ||
|
|
a978420a67 | ||
|
|
f59326bf10 | ||
|
|
d937ab2679 | ||
|
|
7164e211f2 | ||
|
|
dae78d7ac1 | ||
|
|
254468c723 | ||
|
|
71be4d99d6 | ||
|
|
f86fc845e7 | ||
|
|
cc907b9c14 | ||
|
|
241b2beee1 | ||
|
|
12f260e857 | ||
|
|
096d145cf9 | ||
|
|
b3883301a2 | ||
|
|
3a7521c492 | ||
|
|
caa5a96235 | ||
|
|
cee1c592ba | ||
|
|
f1fc9f0b27 | ||
|
|
e9adcb0dd5 | ||
|
|
afe2b675e5 | ||
|
|
2c14ee74b0 | ||
|
|
f351d2a37e | ||
|
|
4cb0e70184 | ||
|
|
41bb2551d3 | ||
|
|
55ed394782 | ||
|
|
dd7a883a33 | ||
|
|
f7acbc3928 | ||
|
|
2318578126 | ||
|
|
3e6f25f17c | ||
|
|
0cd6a59ce4 | ||
|
|
91a445961b | ||
|
|
749e9b7e08 | ||
|
|
905d29b279 | ||
|
|
5f97299cb2 | ||
|
|
60b75a4c8f | ||
|
|
0868286f27 | ||
|
|
ffcc46cb2d | ||
|
|
21bcd64c9d | ||
|
|
943b68f38f | ||
|
|
256b93087f | ||
|
|
7ed0d7eec3 | ||
|
|
9b8154246f | ||
|
|
c360759e49 | ||
|
|
d8b80aab1a | ||
|
|
b96ebc1872 | ||
|
|
6896dc155a | ||
|
|
1060d63808 | ||
|
|
88b6540f5b | ||
|
|
302e785f32 | ||
|
|
1507cc0b42 | ||
|
|
240307ef94 | ||
|
|
90c74bd82c | ||
|
|
9414096de7 | ||
|
|
07c3be9d6a | ||
|
|
9869dbd95a | ||
|
|
49b702106a | ||
|
|
8eb09beb96 | ||
|
|
b402a99a25 | ||
|
|
ad8938cd74 | ||
|
|
ee409c45a0 | ||
|
|
9d5da3388d | ||
|
|
9e138aa149 | ||
|
|
cf94c4d043 | ||
|
|
63b3807cf6 | ||
|
|
f3b6b27521 | ||
|
|
ff656182e8 | ||
|
|
a85ef6e769 | ||
|
|
0bb8c56ea9 | ||
|
|
5f108aec23 | ||
|
|
bf6683f993 | ||
|
|
b7a5e8dd85 | ||
|
|
57294aeaf5 | ||
|
|
20bfb8b08f | ||
|
|
5585a8992c | ||
|
|
d92a20050c | ||
|
|
c9a91d0683 | ||
|
|
ae6716ac01 | ||
|
|
34285b26ae | ||
|
|
5341e5faee | ||
|
|
a6224b484e | ||
|
|
e95c1ad3aa | ||
|
|
9cfed56847 | ||
|
|
6c1abddb1e | ||
|
|
7dc239f506 | ||
|
|
3e8413c6b7 | ||
|
|
ff86bfb91d | ||
|
|
66494b7b5a | ||
|
|
973127aa8c | ||
|
|
83866c3dd3 | ||
|
|
4797abc287 | ||
|
|
50f73f1be2 | ||
|
|
2ebbc8f466 | ||
|
|
1a96b30a45 | ||
|
|
3b1b57a33e | ||
|
|
f85c0320ec | ||
|
|
bae7edb914 | ||
|
|
35322399e9 | ||
|
|
5d4c0f3c87 | ||
|
|
92c5c32e8c | ||
|
|
c8780b2d5f | ||
|
|
f11dbfa367 | ||
|
|
54fb9deb3e | ||
|
|
d3c34ef04d | ||
|
|
3d5470eb22 | ||
|
|
2a3d69d0d5 | ||
|
|
9862c32378 | ||
|
|
9f02232589 | ||
|
|
ffc86bf046 | ||
|
|
e4c8ca34ed | ||
|
|
f02b7036a9 | ||
|
|
6adef47340 | ||
|
|
5b044cc036 | ||
|
|
03ba7524b2 | ||
|
|
772921c6b8 | ||
|
|
d4d305d53b | ||
|
|
c58918e002 | ||
|
|
dec7854476 | ||
|
|
8ca102f584 | ||
|
|
4748c66d9c | ||
|
|
bf486b9f44 | ||
|
|
6ff433ed7a | ||
|
|
f9aa392c6d | ||
|
|
48721859fa | ||
|
|
ee59d999f5 | ||
|
|
2f4f98cfe0 | ||
|
|
ac1f202c19 | ||
|
|
3f97ba3bd7 | ||
|
|
819912cfd3 | ||
|
|
50ee1ae922 | ||
|
|
c0442fca68 | ||
|
|
c20927b6d7 | ||
|
|
0d5b6d4c3e | ||
|
|
bdc08a530d | ||
|
|
6ab1632b4b | ||
|
|
cec865b9fb | ||
|
|
d763e924a9 | ||
|
|
57a30621e1 | ||
|
|
f344084791 | ||
|
|
be68314c3a | ||
|
|
53cff8229b | ||
|
|
1d52e27668 | ||
|
|
6ec867196c | ||
|
|
80798f278c | ||
|
|
4e61bbb92e | ||
|
|
fabab9bfbb | ||
|
|
4ae0089e4f | ||
|
|
d82bce79c9 | ||
|
|
55fcaf1c05 | ||
|
|
e83df502ed | ||
|
|
6501e89fa2 | ||
|
|
91801d441f | ||
|
|
dd2a4ee7ff | ||
|
|
8cedd88ce2 | ||
|
|
c3fde2b698 | ||
|
|
59e8aed445 | ||
|
|
e47b8f377c | ||
|
|
793c0d988e | ||
|
|
b0eef34146 | ||
|
|
3fbfb8b528 | ||
|
|
cdd240abb7 | ||
|
|
5d802f0e16 | ||
|
|
8661d07e1e | ||
|
|
41eec658e0 | ||
|
|
9facf07955 | ||
|
|
cd4844d26c | ||
|
|
9619b11c58 | ||
|
|
535060153a | ||
|
|
f26ff52712 | ||
|
|
4a299ea53f | ||
|
|
6f0ba337c4 | ||
|
|
8df6e2dd57 | ||
|
|
5010cdff71 | ||
|
|
fea1839c06 | ||
|
|
80e3b157ca | ||
|
|
d5028d86df | ||
|
|
1fac6b7c93 | ||
|
|
089467c15a | ||
|
|
77e7f767d8 | ||
|
|
324739aeb9 | ||
|
|
84d301c676 | ||
|
|
dcfce8b619 | ||
|
|
813d4edc97 | ||
|
|
9ea4a5dbd4 | ||
|
|
508e36d327 | ||
|
|
37b1e7366c | ||
|
|
b29b9f1b2c | ||
|
|
7865be43bb | ||
|
|
f17f688a20 | ||
|
|
df2a6a6902 | ||
|
|
df0c0ec21e | ||
|
|
53d71d9766 | ||
|
|
eb5a72fc27 | ||
|
|
cec045045e | ||
|
|
33f30101d9 | ||
|
|
1e139a6005 | ||
|
|
eacfbad729 | ||
|
|
6834a2e083 | ||
|
|
2538d583ad | ||
|
|
c9ccc28251 | ||
|
|
0f1ad9d811 | ||
|
|
93c986f00a | ||
|
|
239e2ef86d | ||
|
|
5a7a23552d | ||
|
|
4fb98cf72b | ||
|
|
a125497fe7 | ||
|
|
ae2196585e | ||
|
|
fbad50973f | ||
|
|
782cfd1fd0 | ||
|
|
d4a06089c9 | ||
|
|
5c6efed995 | ||
|
|
68a31b1eb7 | ||
|
|
f46f755327 | ||
|
|
5d4f870a1d | ||
|
|
08c5c38c7b | ||
|
|
0c9238651a | ||
|
|
10a9b062b6 | ||
|
|
53c6a17ccb | ||
|
|
c10617e1b0 | ||
|
|
be01567a1b | ||
|
|
88fc501c24 | ||
|
|
e93bb5ceba | ||
|
|
7983621f8e | ||
|
|
6c79d6b01f | ||
|
|
b2a351e67d | ||
|
|
574fa8abf4 | ||
|
|
c4f4af5e5a | ||
|
|
1da0792ed7 | ||
|
|
7d37acb1cd | ||
|
|
fd230701e9 | ||
|
|
91d492c579 | ||
|
|
5eabe7e644 | ||
|
|
368e720cab | ||
|
|
cba156b3dc | ||
|
|
676bc0fef0 | ||
|
|
7455c63716 | ||
|
|
81818705df | ||
|
|
61ea484614 | ||
|
|
d5e8de4d74 | ||
|
|
b7d5144c91 | ||
|
|
7bba5ec69e | ||
|
|
0441acf101 | ||
|
|
89f0909a8f | ||
|
|
ff0f1c4c24 | ||
|
|
3a6c52ae73 | ||
|
|
7ec18ebf00 | ||
|
|
66f52d41eb | ||
|
|
1172cf0ae7 | ||
|
|
1d296d1cf4 | ||
|
|
a6bddc5aca | ||
|
|
bdd40fdf7d | ||
|
|
c84e153ff2 | ||
|
|
ab4c83d284 | ||
|
|
cd99c053df | ||
|
|
3434ef47d9 | ||
|
|
c5145a38e2 | ||
|
|
38b9778e9a | ||
|
|
2ca6168f47 | ||
|
|
0da2299472 | ||
|
|
bf2ce3c4af | ||
|
|
c0f82eabb2 | ||
|
|
30aba1258d | ||
|
|
f2ed920214 | ||
|
|
2fc7139f6b | ||
|
|
e8ace49e8b | ||
|
|
dddb9ff713 | ||
|
|
f582f7df7c | ||
|
|
14c6d1be9b | ||
|
|
2157f8e8cd | ||
|
|
0731e15385 | ||
|
|
9eb82060a5 | ||
|
|
9f232ab5ec | ||
|
|
ec0d164619 | ||
|
|
e804ab9254 | ||
|
|
25cb12a81a | ||
|
|
231acc7363 | ||
|
|
d8bdf6a8d3 | ||
|
|
d506067c72 | ||
|
|
4483d3231a | ||
|
|
481ee186aa | ||
|
|
8820b8a41c |
@@ -1,87 +0,0 @@
|
|||||||
version: 2.4.a.{build}
|
|
||||||
shallow_clone: true
|
|
||||||
skip_branch_with_pr: false
|
|
||||||
skip_commits:
|
|
||||||
message: /!nobuild/
|
|
||||||
skip_tags: false
|
|
||||||
|
|
||||||
environment:
|
|
||||||
access_token_documentation:
|
|
||||||
secure: JVBVVL8uJUcLXN+48eRdELEeCGOGCCaMzCqutsUqNuaZ/KblG5ZTt7+LV4UKv/0f
|
|
||||||
LUAROCKS_VER: 2.4.1
|
|
||||||
LUA_VER: 5.1.5
|
|
||||||
LUA: lua5.3
|
|
||||||
matrix:
|
|
||||||
- LUA_VER: 5.1.5
|
|
||||||
|
|
||||||
platform:
|
|
||||||
- x64
|
|
||||||
|
|
||||||
|
|
||||||
init:
|
|
||||||
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
|
|
||||||
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
|
|
||||||
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
|
|
||||||
throw "There are newer queued builds for this pull request, failing early." }
|
|
||||||
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
|
||||||
|
|
||||||
install:
|
|
||||||
- cmd:
|
|
||||||
# Outcomment if lua environment invalidates and needs to be reinstalled, otherwise all will run from the cache.
|
|
||||||
call choco install 7zip.commandline
|
|
||||||
call choco install lua51
|
|
||||||
call choco install luarocks
|
|
||||||
call refreshenv
|
|
||||||
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
|
|
||||||
cmd: PATH = %PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\bin
|
|
||||||
cmd: set LUA_PATH = %LUA_PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\share\lua\5.1\?.lua;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\share\lua\5.1\?\init.lua
|
|
||||||
cmd: set LUA_CPATH = %LUA_CPATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\lib\lua\5.1\?.dll
|
|
||||||
call luarocks install luasrcdiet
|
|
||||||
call luarocks install checks
|
|
||||||
call luarocks install luadocumentor
|
|
||||||
call luarocks install luacheck
|
|
||||||
|
|
||||||
|
|
||||||
cache:
|
|
||||||
C:\ProgramData\chocolatey\lib
|
|
||||||
C:\ProgramData\chocolatey\bin
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
build_script:
|
|
||||||
- ps: |
|
|
||||||
if( $env:appveyor_repo_branch -eq 'master' -or $env:appveyor_repo_branch -eq 'develop' )
|
|
||||||
{
|
|
||||||
echo "Hello World!"
|
|
||||||
$apiUrl = 'https://ci.appveyor.com/api'
|
|
||||||
$token = 'v2.6hcv3ige78kg3yvg4ge8'
|
|
||||||
$headers = @{
|
|
||||||
"Authorization" = "Bearer $token"
|
|
||||||
"Content-type" = "application/json"
|
|
||||||
}
|
|
||||||
$RequestBody = @{ accountName = 'FlightControl-Master'; projectSlug = 'moose-include'; branch = "$env:appveyor_repo_branch"; environmentVariables = @{} } | ConvertTo-Json
|
|
||||||
# Generate the new version ...
|
|
||||||
$project = Invoke-RestMethod -method Post -Uri "$apiUrl/builds" -Headers $headers -Body $RequestBody
|
|
||||||
}
|
|
||||||
- ps: |
|
|
||||||
if( $env:appveyor_repo_branch -eq 'master' -or $env:appveyor_repo_branch -eq 'develop' )
|
|
||||||
{
|
|
||||||
$apiUrl = 'https://ci.appveyor.com/api'
|
|
||||||
$token = 'v2.6hcv3ige78kg3yvg4ge8'
|
|
||||||
$headers = @{
|
|
||||||
"Authorization" = "Bearer $token"
|
|
||||||
"Content-type" = "application/json"
|
|
||||||
}
|
|
||||||
$RequestBody = @{ accountName = 'FlightControl-Master'; projectSlug = 'moose-docs'; branch = "$env:appveyor_repo_branch"; environmentVariables = @{} } | ConvertTo-Json
|
|
||||||
# get project with last build details
|
|
||||||
$project = Invoke-RestMethod -method Post -Uri "$apiUrl/builds" -Headers $headers -Body $RequestBody
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
test: off
|
|
||||||
# test_script:
|
|
||||||
# - cmd: luacheck "Moose Development\Moose\moose.lua" "Moose Mission Setup\moose.lua"
|
|
||||||
|
|
||||||
|
|
||||||
on_finish:
|
|
||||||
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
|
||||||
4
.gitattributes
vendored
4
.gitattributes
vendored
@@ -15,3 +15,7 @@
|
|||||||
*.PDF diff=astextplain
|
*.PDF diff=astextplain
|
||||||
*.rtf diff=astextplain
|
*.rtf diff=astextplain
|
||||||
*.RTF diff=astextplain
|
*.RTF diff=astextplain
|
||||||
|
|
||||||
|
# Avoid Windows line endings on shell scripts
|
||||||
|
# Needed for dockerfile builds
|
||||||
|
*.sh text eol=lf
|
||||||
|
|||||||
168
.github/workflows/build-docs.yml
vendored
Normal file
168
.github/workflows/build-docs.yml
vendored
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
name: Moose-Docs
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- develop
|
||||||
|
paths:
|
||||||
|
- 'Moose Setup/**/*.lua'
|
||||||
|
- 'Moose Development/**/*.lua'
|
||||||
|
- 'Moose Development/**/*.py'
|
||||||
|
- 'Moose Development/**/*.html'
|
||||||
|
- '.github/workflows/build-docs.yml'
|
||||||
|
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Extract branch name
|
||||||
|
shell: bash
|
||||||
|
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
|
||||||
|
id: extract_branch
|
||||||
|
|
||||||
|
- name: Build informations
|
||||||
|
run: |
|
||||||
|
echo "Triggered by: ${{ github.event_name }}"
|
||||||
|
echo "Running on: ${{ runner.os }}"
|
||||||
|
echo "Ref: ${{ github.ref }}"
|
||||||
|
echo "Branch name: ${{ steps.extract_branch.outputs.branch }}"
|
||||||
|
echo "Repository: ${{ github.repository }}"
|
||||||
|
echo "Commit-Id: ${{ github.sha }}"
|
||||||
|
echo "Owner: ${{ github.repository_owner }}"
|
||||||
|
echo "FORCE_PUSH: ${{ vars.FORCE_PUSH }}"
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
# Prepare build environment
|
||||||
|
#########################################################################
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Prepare build output folders
|
||||||
|
run: |
|
||||||
|
mkdir -p build/tools
|
||||||
|
mkdir -p build/doc
|
||||||
|
|
||||||
|
- name: Checkout FlightControls modified luadocumentor
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: Applevangelist/luadocumentor
|
||||||
|
path: './build/tools/luadocumentor'
|
||||||
|
ref: 'patch-1'
|
||||||
|
token: ${{ secrets.BOT_TOKEN }}
|
||||||
|
|
||||||
|
- name: Update apt-get (needed for act docker image)
|
||||||
|
run: |
|
||||||
|
sudo apt-get -qq update
|
||||||
|
|
||||||
|
- name: Install tree
|
||||||
|
run: |
|
||||||
|
sudo apt-get -qq install tree
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
# Install all prerequisites for LuaDocumentor
|
||||||
|
#########################################################################
|
||||||
|
- name: Install Lua
|
||||||
|
run: |
|
||||||
|
sudo apt-get -qq install lua5.1
|
||||||
|
|
||||||
|
- name: Install LuaRocks
|
||||||
|
run: |
|
||||||
|
sudo apt-get -qq install luarocks -y
|
||||||
|
|
||||||
|
- name: Install markdown (prereq for LuaDocumentor)
|
||||||
|
run: |
|
||||||
|
sudo luarocks install markdown 0.32-2
|
||||||
|
|
||||||
|
- name: Install penlight (prereq for LuaDocumentor)
|
||||||
|
run: |
|
||||||
|
sudo luarocks install penlight 1.11.0-1
|
||||||
|
|
||||||
|
- name: Install metalua-compiler (prereq for LuaDocumentor)
|
||||||
|
run: |
|
||||||
|
sudo luarocks install metalua-compiler 0.7.3-1
|
||||||
|
|
||||||
|
- name: Install metalua-parser (prereq for LuaDocumentor)
|
||||||
|
run: |
|
||||||
|
sudo luarocks install metalua-parser 0.7.3-2
|
||||||
|
|
||||||
|
- name: Install checks (prereq for LuaDocumentor)
|
||||||
|
run: |
|
||||||
|
sudo luarocks install checks
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
# Run LuaDocumentor
|
||||||
|
#########################################################################
|
||||||
|
- name: Run LuaDocumentor
|
||||||
|
run: |
|
||||||
|
lua luadocumentor.lua -d ${{ github.workspace }}/build/doc "${{ github.workspace }}/Moose Development/Moose"
|
||||||
|
working-directory: ${{ github.workspace }}/build/tools/luadocumentor
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
# Replace <head> tag
|
||||||
|
#########################################################################
|
||||||
|
- name: Replace head tag
|
||||||
|
run: |
|
||||||
|
python3 "${{ github.workspace }}/Moose Development/docs-header.py"
|
||||||
|
working-directory: ${{ github.workspace }}/build/doc
|
||||||
|
|
||||||
|
- name: Check replacement of head tag
|
||||||
|
run: |
|
||||||
|
head -10 ${{ github.workspace }}/build/doc/AI.AI_A2A_Cap.html
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
# Push to MOOSE_DOCS
|
||||||
|
#########################################################################
|
||||||
|
- name: Set docs repo for branch
|
||||||
|
shell: bash
|
||||||
|
id: set_doc_repo
|
||||||
|
run: |
|
||||||
|
if [[ $GITHUB_REF == 'refs/heads/master' ]]; then
|
||||||
|
echo "docrepo=MOOSE_DOCS" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "docrepo=MOOSE_DOCS_DEVELOP" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Checkout ${{ steps.set_doc_repo.outputs.docrepo }} to folder MOOSE_DOCS
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: ${{ github.repository_owner }}/${{ steps.set_doc_repo.outputs.docrepo }}
|
||||||
|
path: './build/MOOSE_DOCS'
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: 'master'
|
||||||
|
token: ${{ secrets.BOT_TOKEN }}
|
||||||
|
|
||||||
|
- name: Delete folder to remove deleted files
|
||||||
|
run: |
|
||||||
|
rm -rf ./build/MOOSE_DOCS/Documentation/
|
||||||
|
|
||||||
|
- name: Create target folder
|
||||||
|
run: mkdir -p build/MOOSE_DOCS/Documentation
|
||||||
|
|
||||||
|
- name: Copy build result to MOOSE_DOCS
|
||||||
|
run: |
|
||||||
|
cp ./build/doc/*.* ./build/MOOSE_DOCS/Documentation/
|
||||||
|
|
||||||
|
- name: Push result to docs repository
|
||||||
|
if: ${{ vars.FORCE_PUSH == 'true' }}
|
||||||
|
run: |
|
||||||
|
git config user.name "MooseBotter"
|
||||||
|
git config user.email "MooseBotter@users.noreply.github.com"
|
||||||
|
git add .
|
||||||
|
git commit --allow-empty -m "Auto commit by GitHub Actions Workflow"
|
||||||
|
git push --set-upstream origin master
|
||||||
|
|
||||||
|
working-directory: ${{ github.workspace }}/build/MOOSE_DOCS
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
# Show the results
|
||||||
|
#########################################################################
|
||||||
|
- name: List files in the repository
|
||||||
|
run: |
|
||||||
|
tree ${{ github.workspace }}/build
|
||||||
|
|
||||||
|
- run: echo "This job's status is ${{ job.status }}."
|
||||||
148
.github/workflows/build-includes.yml
vendored
Normal file
148
.github/workflows/build-includes.yml
vendored
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
name: Moose-Includes
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- develop
|
||||||
|
paths:
|
||||||
|
- 'Moose Setup/**/*.lua'
|
||||||
|
- 'Moose Development/**/*.lua'
|
||||||
|
- '.github/workflows/build-includes.yml'
|
||||||
|
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Extract branch name
|
||||||
|
shell: bash
|
||||||
|
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
|
||||||
|
id: extract_branch
|
||||||
|
|
||||||
|
- name: Build informations
|
||||||
|
run: |
|
||||||
|
echo "Triggered by: ${{ github.event_name }}"
|
||||||
|
echo "Running on: ${{ runner.os }}"
|
||||||
|
echo "Ref: ${{ github.ref }}"
|
||||||
|
echo "Branch name: ${{ steps.extract_branch.outputs.branch }}"
|
||||||
|
echo "Repository: ${{ github.repository }}"
|
||||||
|
echo "Commit-Id: ${{ github.sha }}"
|
||||||
|
echo "Owner: ${{ github.repository_owner }}"
|
||||||
|
echo "FORCE_PUSH: ${{ vars.FORCE_PUSH }}"
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
# Prepare build environment
|
||||||
|
#########################################################################
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Prepare build output folders
|
||||||
|
run: |
|
||||||
|
mkdir -p build/result/Moose_Include_Dynamic
|
||||||
|
mkdir -p build/result/Moose_Include_Static
|
||||||
|
|
||||||
|
- name: Update apt-get (needed for act docker image)
|
||||||
|
run: |
|
||||||
|
sudo apt-get -qq update
|
||||||
|
|
||||||
|
- name: Install tree
|
||||||
|
run: |
|
||||||
|
sudo apt-get -qq install tree
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
# Install all prerequisites
|
||||||
|
#########################################################################
|
||||||
|
- name: Install Lua 5.3
|
||||||
|
run: |
|
||||||
|
sudo apt-get -qq install lua5.3 -y
|
||||||
|
- name: Check Lua version
|
||||||
|
run: |
|
||||||
|
lua -v
|
||||||
|
|
||||||
|
- name: Install LuaRocks
|
||||||
|
run: |
|
||||||
|
sudo apt-get -qq install luarocks -y
|
||||||
|
- name: Check LuaRocks version
|
||||||
|
run: |
|
||||||
|
luarocks --version
|
||||||
|
|
||||||
|
- name: Install Lua 5.3 Dev for prerequisites for LuaSrcDiet
|
||||||
|
run: |
|
||||||
|
sudo apt-get -qq install liblua5.3-dev -y
|
||||||
|
|
||||||
|
- name: Install LuaSrcDiet
|
||||||
|
run: |
|
||||||
|
sudo luarocks install luasrcdiet
|
||||||
|
|
||||||
|
- name: Install LuaCheck
|
||||||
|
run: |
|
||||||
|
sudo luarocks install luacheck
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
# Build Include files
|
||||||
|
#########################################################################
|
||||||
|
- name: Build Include Static
|
||||||
|
run: |
|
||||||
|
export COMMIT_TIME=$(git show -s --format=%cd ${{ github.sha }} --date=iso-strict)
|
||||||
|
lua5.3 "./Moose Setup/Moose_Create.lua" S "$COMMIT_TIME-${{ github.sha }}" "./Moose Development/Moose" "./Moose Setup" "./build/result/Moose_Include_Static"
|
||||||
|
|
||||||
|
- name: Build Includes Dynamic
|
||||||
|
run: |
|
||||||
|
export COMMIT_TIME=$(git show -s --format=%cd ${{ github.sha }} --date=iso-strict)
|
||||||
|
lua5.3 "./Moose Setup/Moose_Create.lua" D "$COMMIT_TIME-${{ github.sha }}" "./Moose Development/Moose" "./Moose Setup" "./build/result/Moose_Include_Dynamic"
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
# Run LuaCheck
|
||||||
|
#########################################################################
|
||||||
|
- name: Run LuaCheck
|
||||||
|
if: ${{ vars.SKIP_LUACHECK != true }}
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
luacheck --std=lua51c --config=.luacheckrc -gurasqq "Moose Development/Moose"
|
||||||
|
|
||||||
|
- name: Run LuaSrcDiet
|
||||||
|
run: |
|
||||||
|
luasrcdiet --basic --opt-emptylines ./build/result/Moose_Include_Static/Moose.lua -o ./build/result/Moose_Include_Static/Moose_.lua
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
# Push to MOOSE_INCLUDE
|
||||||
|
#########################################################################
|
||||||
|
- name: Checkout MOOSE_INCLUDE
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: ${{ github.repository_owner }}/MOOSE_INCLUDE
|
||||||
|
path: './build/MOOSE_INCLUDE'
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: ${{ steps.extract_branch.outputs.branch }}
|
||||||
|
token: ${{ secrets.BOT_TOKEN }}
|
||||||
|
|
||||||
|
- name: Create target folder (needed if checkout is deactivated)
|
||||||
|
run: mkdir -p build/MOOSE_INCLUDE
|
||||||
|
|
||||||
|
- name: Copy build reseult to MOOSE_INCLUDE
|
||||||
|
run: |
|
||||||
|
cp -r ./build/result/* ./build/MOOSE_INCLUDE/
|
||||||
|
|
||||||
|
- name: Push result to MOOSE_INCLUDE repository
|
||||||
|
if: ${{ vars.FORCE_PUSH == 'true' }}
|
||||||
|
run: |
|
||||||
|
git config user.name "MooseBotter"
|
||||||
|
git config user.email "MooseBotter@users.noreply.github.com"
|
||||||
|
git add .
|
||||||
|
git commit --allow-empty -m "Auto commit by GitHub Actions Workflow"
|
||||||
|
git push --set-upstream origin ${{ steps.extract_branch.outputs.branch }}
|
||||||
|
|
||||||
|
working-directory: ${{ github.workspace }}/build/MOOSE_INCLUDE
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
# Show the results
|
||||||
|
#########################################################################
|
||||||
|
- name: List files in the repository
|
||||||
|
run: |
|
||||||
|
tree ${{ github.workspace }}/build
|
||||||
|
|
||||||
|
- run: echo "This job's status is ${{ job.status }}."
|
||||||
78
.github/workflows/gh-pages.yml
vendored
Normal file
78
.github/workflows/gh-pages.yml
vendored
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
# This workflow uses actions that are not certified by GitHub.
|
||||||
|
# They are provided by a third-party and are governed by
|
||||||
|
# separate terms of service, privacy policy, and support
|
||||||
|
# documentation.
|
||||||
|
|
||||||
|
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
|
||||||
|
name: Deploy Jekyll site to Pages
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["master"]
|
||||||
|
paths:
|
||||||
|
- 'docs/**'
|
||||||
|
- '.github/workflows/gh-pages.yml'
|
||||||
|
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pages: write
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
# Allow one concurrent deployment
|
||||||
|
concurrency:
|
||||||
|
group: "pages"
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# Build job
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Setup Ruby
|
||||||
|
uses: ruby/setup-ruby@v1
|
||||||
|
with:
|
||||||
|
ruby-version: '3.1' # Not needed with a .ruby-version file
|
||||||
|
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
||||||
|
cache-version: 0 # Increment this number if you need to re-download cached gems
|
||||||
|
working-directory: docs/
|
||||||
|
- name: Setup Pages
|
||||||
|
id: pages
|
||||||
|
uses: actions/configure-pages@v3
|
||||||
|
- name: Build with Jekyll
|
||||||
|
# Outputs to the './_site' directory by default
|
||||||
|
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
|
||||||
|
env:
|
||||||
|
JEKYLL_ENV: production
|
||||||
|
working-directory: docs/
|
||||||
|
- name: Upload artifact
|
||||||
|
# Automatically uploads an artifact from the './_site' directory by default
|
||||||
|
uses: actions/upload-pages-artifact@v1
|
||||||
|
with:
|
||||||
|
path: docs/_site/
|
||||||
|
|
||||||
|
# Deployment job
|
||||||
|
deploy:
|
||||||
|
environment:
|
||||||
|
name: github-pages
|
||||||
|
url: ${{ steps.deployment.outputs.page_url }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
steps:
|
||||||
|
- name: Deploy to GitHub Pages
|
||||||
|
id: deployment
|
||||||
|
uses: actions/deploy-pages@v1
|
||||||
|
|
||||||
|
check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: deploy
|
||||||
|
steps:
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
- run: npm install linkinator
|
||||||
|
- run: npx linkinator https://flightcontrol-master.github.io/MOOSE/ --verbosity error --timeout 5000 --recurse --skip "(java.com)" --retry-errors --retry-errors-count 3 --retry-errors-jitter
|
||||||
16
.gitignore
vendored
16
.gitignore
vendored
@@ -35,6 +35,8 @@ local.properties
|
|||||||
## Ignore Visual Studio temporary files, build results, and
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
## files generated by popular Visual Studio add-ons.
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
|
||||||
|
.vscode
|
||||||
|
|
||||||
# User-specific files
|
# User-specific files
|
||||||
*.suo
|
*.suo
|
||||||
*.user
|
*.user
|
||||||
@@ -219,12 +221,16 @@ pip-log.txt
|
|||||||
#Goodsync
|
#Goodsync
|
||||||
_gsdata_/
|
_gsdata_/
|
||||||
|
|
||||||
|
# PyCharm
|
||||||
|
.idea
|
||||||
|
|
||||||
#GITHUB
|
#GITHUB
|
||||||
.gitattributes
|
|
||||||
.gitignore
|
|
||||||
Moose Test Missions/MOOSE_Test_Template.miz
|
Moose Test Missions/MOOSE_Test_Template.miz
|
||||||
Moose Development/Moose/.vscode/launch.json
|
Moose Development/Moose/.vscode/launch.json
|
||||||
MooseCodeWS.code-workspace
|
MooseCodeWS.code-workspace
|
||||||
.gitignore
|
|
||||||
.gitignore
|
# Excludes for act (https://github.com/nektos/act)
|
||||||
/.gitignore
|
.secrets
|
||||||
|
.env
|
||||||
|
.actrc
|
||||||
|
.vars
|
||||||
|
|||||||
166
Moose Development/Moose/.editorconfig
Normal file
166
Moose Development/Moose/.editorconfig
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
# Repository: https://github.com/CppCXY/EmmyLuaCodeStyle
|
||||||
|
# English documentation: https://github.com/CppCXY/EmmyLuaCodeStyle/blob/master/README_EN.md
|
||||||
|
[*.lua]
|
||||||
|
# [basic]
|
||||||
|
|
||||||
|
# optional space/tab
|
||||||
|
indent_style = space
|
||||||
|
# if indent_style is space, this is valid
|
||||||
|
indent_size = 4
|
||||||
|
# if indent_style is tab, this is valid
|
||||||
|
tab_width = 4
|
||||||
|
# none/single/double
|
||||||
|
quote_style = none
|
||||||
|
|
||||||
|
# only support number
|
||||||
|
continuation_indent_size = 0
|
||||||
|
|
||||||
|
# optional crlf/lf/cr/auto, if it is 'auto', in windows it is crlf other platforms are lf
|
||||||
|
end_of_line = auto
|
||||||
|
|
||||||
|
detect_end_of_line = false
|
||||||
|
|
||||||
|
# this mean utf8 length , if this is 'unset' then the line width is no longer checked
|
||||||
|
# this option decides when to chopdown the code
|
||||||
|
max_line_length = 9999
|
||||||
|
|
||||||
|
# this will check text end with new line
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
# [function]
|
||||||
|
|
||||||
|
# function call expression's args will align to first arg
|
||||||
|
# optional true/false/only_after_more_indention_statement/only_not_exist_cross_row_expression
|
||||||
|
align_call_args = false
|
||||||
|
|
||||||
|
# if true, all function define params will align to first param
|
||||||
|
align_function_define_params = true
|
||||||
|
|
||||||
|
remove_expression_list_finish_comma = true
|
||||||
|
|
||||||
|
# keep/remove/remove_table_only/remove_string_only/unambiguous_remove_string_only
|
||||||
|
call_arg_parentheses = keep
|
||||||
|
|
||||||
|
# [table]
|
||||||
|
|
||||||
|
#optional none/comma/semicolon
|
||||||
|
table_separator_style = none
|
||||||
|
|
||||||
|
#optional keep/never/always/smart
|
||||||
|
trailing_table_separator = keep
|
||||||
|
|
||||||
|
# see document for detail
|
||||||
|
continuous_assign_table_field_align_to_equal_sign = true
|
||||||
|
|
||||||
|
# if true, format like this "local t = { 1, 2, 3 }"
|
||||||
|
keep_one_space_between_table_and_bracket = true
|
||||||
|
|
||||||
|
# if indent_style is tab, this option is invalid
|
||||||
|
align_table_field_to_first_field = true
|
||||||
|
|
||||||
|
# [statement]
|
||||||
|
|
||||||
|
align_chained_expression_statement = false
|
||||||
|
|
||||||
|
# continous line distance
|
||||||
|
max_continuous_line_distance = 1
|
||||||
|
|
||||||
|
# see document for detail
|
||||||
|
continuous_assign_statement_align_to_equal_sign = true
|
||||||
|
|
||||||
|
# if statement will align like switch case
|
||||||
|
if_condition_align_with_each_other = false
|
||||||
|
|
||||||
|
# if true, continuation_indent_size for local or assign statement is invalid
|
||||||
|
# however, if the expression list has cross row expression, it will not be aligned to the first expression
|
||||||
|
local_assign_continuation_align_to_first_expression = false
|
||||||
|
|
||||||
|
statement_inline_comment_space = 1
|
||||||
|
|
||||||
|
# [indentation]
|
||||||
|
|
||||||
|
# if true, the label loses its current indentation
|
||||||
|
label_no_indent = false
|
||||||
|
# if true, there will be no indentation in the do statement
|
||||||
|
do_statement_no_indent = false
|
||||||
|
# if true, the conditional expression of the if statement will not be a continuation line indent
|
||||||
|
if_condition_no_continuation_indent = false
|
||||||
|
|
||||||
|
if_branch_comments_after_block_no_indent = false
|
||||||
|
|
||||||
|
# [space]
|
||||||
|
|
||||||
|
# if true, t[#t+1] will not space wrapper '+'
|
||||||
|
table_append_expression_no_space = false
|
||||||
|
|
||||||
|
long_chain_expression_allow_one_space_after_colon = false
|
||||||
|
|
||||||
|
remove_empty_header_and_footer_lines_in_function = true
|
||||||
|
|
||||||
|
space_before_function_open_parenthesis = false
|
||||||
|
|
||||||
|
space_inside_function_call_parentheses = false
|
||||||
|
|
||||||
|
space_inside_function_param_list_parentheses = false
|
||||||
|
|
||||||
|
space_before_open_square_bracket = false
|
||||||
|
|
||||||
|
space_inside_square_brackets = false
|
||||||
|
|
||||||
|
# if true, ormat like this "local t <const> = 1"
|
||||||
|
keep_one_space_between_namedef_and_attribute = true
|
||||||
|
|
||||||
|
# [row_layout]
|
||||||
|
# The following configuration supports four expressions
|
||||||
|
# minLine:${n}
|
||||||
|
# keepLine
|
||||||
|
# keepLine:${n}
|
||||||
|
# maxLine:${n}
|
||||||
|
|
||||||
|
keep_line_after_if_statement = minLine:0
|
||||||
|
|
||||||
|
keep_line_after_do_statement = minLine:0
|
||||||
|
|
||||||
|
keep_line_after_while_statement = minLine:0
|
||||||
|
|
||||||
|
keep_line_after_repeat_statement = minLine:0
|
||||||
|
|
||||||
|
keep_line_after_for_statement = minLine:0
|
||||||
|
|
||||||
|
keep_line_after_local_or_assign_statement = keepLine
|
||||||
|
|
||||||
|
keep_line_after_function_define_statement = keepLine:1
|
||||||
|
|
||||||
|
keep_line_after_expression_statement = keepLine
|
||||||
|
|
||||||
|
# [diagnostic]
|
||||||
|
|
||||||
|
# the following is code diagnostic options
|
||||||
|
enable_check_codestyle = true
|
||||||
|
|
||||||
|
# [diagnostic.name_style]
|
||||||
|
enable_name_style_check = false
|
||||||
|
# the following is name style check rule
|
||||||
|
# base option off/camel_case/snake_case/upper_snake_case/pascal_case/same(filename/first_param/'<const string>', snake_case/pascal_case/camel_case)
|
||||||
|
# all option can use '|' represent or
|
||||||
|
# for example:
|
||||||
|
# snake_case | upper_snake_case
|
||||||
|
# same(first_param, snake_case)
|
||||||
|
# same('m')
|
||||||
|
local_name_define_style = snake_case
|
||||||
|
|
||||||
|
function_param_name_style = snake_case
|
||||||
|
|
||||||
|
function_name_define_style = snake_case
|
||||||
|
|
||||||
|
local_function_name_define_style = snake_case
|
||||||
|
|
||||||
|
table_field_name_define_style = snake_case
|
||||||
|
|
||||||
|
global_variable_name_define_style = snake_case|upper_snake_case
|
||||||
|
|
||||||
|
module_name_define_style = same('m')|same(filename, snake_case)
|
||||||
|
|
||||||
|
require_module_name_style = same(first_param, snake_case)
|
||||||
|
|
||||||
|
class_name_define_style = same(filename, snake_case)
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
# See https://github.com/Koihik/LuaFormatter
|
|
||||||
# Use '-- LuaFormatter off' and '-- LuaFormatter on' around code blocks to inhibit formatting
|
|
||||||
|
|
||||||
column_limit: 500
|
|
||||||
indent_width: 2
|
|
||||||
use_tab: false
|
|
||||||
continuation_indent_width: 2
|
|
||||||
keep_simple_control_block_one_line: false
|
|
||||||
keep_simple_function_one_line: false
|
|
||||||
align_args: true
|
|
||||||
break_after_functioncall_lp: false
|
|
||||||
break_before_functioncall_rp: false
|
|
||||||
align_parameter: true
|
|
||||||
chop_down_parameter: true
|
|
||||||
break_after_functiondef_lp: false
|
|
||||||
break_before_functiondef_rp: false
|
|
||||||
align_table_field: true
|
|
||||||
break_after_table_lb: true
|
|
||||||
break_before_table_rb: true
|
|
||||||
chop_down_table: true
|
|
||||||
chop_down_kv_table: true
|
|
||||||
column_table_limit: 500
|
|
||||||
table_sep: ','
|
|
||||||
extra_sep_at_table_end: true
|
|
||||||
break_after_operator: true
|
|
||||||
single_quote_to_double_quote: false
|
|
||||||
double_quote_to_single_quote: false
|
|
||||||
spaces_before_call: 1
|
|
||||||
spaces_inside_functiondef_parens: true
|
|
||||||
spaces_inside_functioncall_parens: true
|
|
||||||
spaces_inside_table_braces: true
|
|
||||||
spaces_around_equals_in_field: true
|
|
||||||
line_breaks_after_function_body: 1
|
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
--- **AI** -- (R2.2) - Models the process of Combat Air Patrol (CAP) for airplanes.
|
--- **AI** - Models the process of Combat Air Patrol (CAP) for airplanes.
|
||||||
|
--
|
||||||
|
-- This is a class used in the @{AI.AI_A2A_Dispatcher}.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -13,8 +15,7 @@
|
|||||||
-- @extends AI.AI_Air_Patrol#AI_AIR_PATROL
|
-- @extends AI.AI_Air_Patrol#AI_AIR_PATROL
|
||||||
-- @extends AI.AI_Air_Engage#AI_AIR_ENGAGE
|
-- @extends AI.AI_Air_Engage#AI_AIR_ENGAGE
|
||||||
|
|
||||||
|
--- The AI_A2A_CAP class implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Group} or @{Wrapper.Group}
|
||||||
--- The AI_A2A_CAP class implements the core functions to patrol a @{Zone} by an AI @{Wrapper.Group} or @{Wrapper.Group}
|
|
||||||
-- and automatically engage any airborne enemies that are within a certain range or within a certain zone.
|
-- and automatically engage any airborne enemies that are within a certain range or within a certain zone.
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
@@ -81,15 +82,20 @@
|
|||||||
-- that will define when the AI will engage with the detected airborne enemy targets.
|
-- that will define when the AI will engage with the detected airborne enemy targets.
|
||||||
-- The range can be beyond or smaller than the range of the Patrol Zone.
|
-- The range can be beyond or smaller than the range of the Patrol Zone.
|
||||||
-- The range is applied at the position of the AI.
|
-- The range is applied at the position of the AI.
|
||||||
-- Use the method @{AI.AI_CAP#AI_A2A_CAP.SetEngageRange}() to define that range.
|
-- Use the method @{#AI_A2A_CAP.SetEngageRange}() to define that range.
|
||||||
--
|
--
|
||||||
-- ## 4. Set the Zone of Engagement
|
-- ## 4. Set the Zone of Engagement
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
-- An optional @{Zone} can be set,
|
-- An optional @{Core.Zone} can be set,
|
||||||
-- that will define when the AI will engage with the detected airborne enemy targets.
|
-- that will define when the AI will engage with the detected airborne enemy targets.
|
||||||
-- Use the method @{AI.AI_Cap#AI_A2A_CAP.SetEngageZone}() to define that Zone.
|
-- Use the method @{#AI_A2A_CAP.SetEngageZone}() to define that Zone.
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
|
--
|
||||||
|
-- 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
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -106,7 +112,7 @@ AI_A2A_CAP = {
|
|||||||
-- @param DCS#Altitude EngageFloorAltitude The lowest altitude in meters where to execute the engagement.
|
-- @param DCS#Altitude EngageFloorAltitude The lowest altitude in meters where to execute the engagement.
|
||||||
-- @param DCS#Altitude EngageCeilingAltitude The highest altitude in meters where to execute the engagement.
|
-- @param DCS#Altitude EngageCeilingAltitude The highest altitude in meters where to execute the engagement.
|
||||||
-- @param DCS#AltitudeType EngageAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to "RADIO".
|
-- @param DCS#AltitudeType EngageAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to "RADIO".
|
||||||
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
|
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
|
||||||
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
|
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
|
||||||
-- @param DCS#Speed PatrolMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h.
|
-- @param DCS#Speed PatrolMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h.
|
||||||
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
||||||
@@ -117,7 +123,7 @@ function AI_A2A_CAP:New2( AICap, EngageMinSpeed, EngageMaxSpeed, EngageFloorAlti
|
|||||||
|
|
||||||
-- Multiple inheritance ... :-)
|
-- Multiple inheritance ... :-)
|
||||||
local AI_Air = AI_AIR:New( AICap )
|
local AI_Air = AI_AIR:New( AICap )
|
||||||
local AI_Air_Patrol = AI_AIR_PATROL:New( AI_Air, AICap, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType ) -- #AI_AIR_PATROL
|
local AI_Air_Patrol = AI_AIR_PATROL:New( AI_Air, AICap, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
||||||
local AI_Air_Engage = AI_AIR_ENGAGE:New( AI_Air_Patrol, AICap, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType )
|
local AI_Air_Engage = AI_AIR_ENGAGE:New( AI_Air_Patrol, AICap, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType )
|
||||||
local self = BASE:Inherit( self, AI_Air_Engage ) --#AI_A2A_CAP
|
local self = BASE:Inherit( self, AI_Air_Engage ) --#AI_A2A_CAP
|
||||||
|
|
||||||
@@ -132,7 +138,7 @@ end
|
|||||||
--- Creates a new AI_A2A_CAP object
|
--- Creates a new AI_A2A_CAP object
|
||||||
-- @param #AI_A2A_CAP self
|
-- @param #AI_A2A_CAP self
|
||||||
-- @param Wrapper.Group#GROUP AICap
|
-- @param Wrapper.Group#GROUP AICap
|
||||||
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
|
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
|
||||||
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
|
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
|
||||||
@@ -191,7 +197,7 @@ end
|
|||||||
--- Evaluate the attack and create an AttackUnitTask list.
|
--- Evaluate the attack and create an AttackUnitTask list.
|
||||||
-- @param #AI_A2A_CAP self
|
-- @param #AI_A2A_CAP self
|
||||||
-- @param Core.Set#SET_UNIT AttackSetUnit The set of units to attack.
|
-- @param Core.Set#SET_UNIT AttackSetUnit The set of units to attack.
|
||||||
-- @param Wrappper.Group#GROUP DefenderGroup The group of defenders.
|
-- @param Wrapper.Group#GROUP DefenderGroup The group of defenders.
|
||||||
-- @param #number EngageAltitude The altitude to engage the targets.
|
-- @param #number EngageAltitude The altitude to engage the targets.
|
||||||
-- @return #AI_A2A_CAP self
|
-- @return #AI_A2A_CAP self
|
||||||
function AI_A2A_CAP:CreateAttackUnitTasks( AttackSetUnit, DefenderGroup, EngageAltitude )
|
function AI_A2A_CAP:CreateAttackUnitTasks( AttackSetUnit, DefenderGroup, EngageAltitude )
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **AI** - (R2.2) - Manages the process of an automatic A2A defense system based on an EWR network targets and coordinating CAP and GCI.
|
--- **AI** - Manages the process of an automatic A2A defense system based on an EWR network targets and coordinating CAP and GCI.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [AID-A2A - AI A2A Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-A2A%20-%20AI%20A2A%20Dispatching)
|
-- [AID-A2A - AI A2A Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -57,8 +57,8 @@
|
|||||||
--
|
--
|
||||||
-- ## 2. Which type of EWR will I setup? Grouping based per AREA, per TYPE or per UNIT? (Later others will follow).
|
-- ## 2. Which type of EWR will I setup? Grouping based per AREA, per TYPE or per UNIT? (Later others will follow).
|
||||||
--
|
--
|
||||||
-- The MOOSE framework leverages the @{Detection} classes to perform the EWR detection.
|
-- The MOOSE framework leverages the @{Functional.Detection} classes to perform the EWR detection.
|
||||||
-- Several types of @{Detection} classes exist, and the most common characteristics of these classes is that they:
|
-- Several types of @{Functional.Detection} classes exist, and the most common characteristics of these classes is that they:
|
||||||
--
|
--
|
||||||
-- * Perform detections from multiple FACs as one co-operating entity.
|
-- * Perform detections from multiple FACs as one co-operating entity.
|
||||||
-- * Communicate with a Head Quarters, which consolidates each detection.
|
-- * Communicate with a Head Quarters, which consolidates each detection.
|
||||||
@@ -126,7 +126,7 @@
|
|||||||
-- * polygon zones
|
-- * polygon zones
|
||||||
-- * moving zones
|
-- * moving zones
|
||||||
--
|
--
|
||||||
-- Depending on the type of zone selected, a different @{Zone} object needs to be created from a ZONE_ class.
|
-- Depending on the type of zone selected, a different @{Core.Zone} object needs to be created from a ZONE_ class.
|
||||||
--
|
--
|
||||||
-- ## 14. For each Squadron doing CAP, what are the time intervals and CAP amounts to be performed?
|
-- ## 14. For each Squadron doing CAP, what are the time intervals and CAP amounts to be performed?
|
||||||
--
|
--
|
||||||
@@ -177,6 +177,11 @@
|
|||||||
--
|
--
|
||||||
-- **The default grouping is 1. That means, that each spawned defender will act individually.**
|
-- **The default grouping is 1. That means, that each spawned defender will act individually.**
|
||||||
--
|
--
|
||||||
|
-- # Developer Note
|
||||||
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Authors: **FlightControl** rework of GCICAP + introduction of new concepts (squadrons).
|
-- ### Authors: **FlightControl** rework of GCICAP + introduction of new concepts (squadrons).
|
||||||
@@ -305,7 +310,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
-- Use the method @{#AI_A2A_DISPATCHER.SetEngageRadius}() to set a specific Engage Radius.
|
-- Use the method @{#AI_A2A_DISPATCHER.SetEngageRadius}() to set a specific Engage Radius.
|
||||||
-- **The Engage Radius is defined for ALL squadrons which are operational.**
|
-- **The Engage Radius is defined for ALL squadrons which are operational.**
|
||||||
--
|
--
|
||||||
-- Demonstration Mission: [AID-019 - AI_A2A - Engage Range Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/release-2-2-pre/AID%20-%20AI%20Dispatching/AID-019%20-%20AI_A2A%20-%20Engage%20Range%20Test)
|
-- Demonstration Mission: [AID-019 - AI_A2A - Engage Range Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher/AID-A2A-019%20-%20Engage%20Range%20Test)
|
||||||
--
|
--
|
||||||
-- In this example an Engage Radius is set to various values.
|
-- In this example an Engage Radius is set to various values.
|
||||||
--
|
--
|
||||||
@@ -328,7 +333,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
-- Use the method @{#AI_A2A_DISPATCHER.SetGciRadius}() to set a specific controlled ground intercept radius.
|
-- Use the method @{#AI_A2A_DISPATCHER.SetGciRadius}() to set a specific controlled ground intercept radius.
|
||||||
-- **The Ground Controlled Intercept radius is defined for ALL squadrons which are operational.**
|
-- **The Ground Controlled Intercept radius is defined for ALL squadrons which are operational.**
|
||||||
--
|
--
|
||||||
-- Demonstration Mission: [AID-013 - AI_A2A - Intercept Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/release-2-2-pre/AID%20-%20AI%20Dispatching/AID-013%20-%20AI_A2A%20-%20Intercept%20Test)
|
-- Demonstration Mission: [AID-013 - AI_A2A - Intercept Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher/AID-A2A-013%20-%20Intercept%20Test)
|
||||||
--
|
--
|
||||||
-- In these examples, the Gci Radius is set to various values:
|
-- In these examples, the Gci Radius is set to various values:
|
||||||
--
|
--
|
||||||
@@ -356,12 +361,12 @@ do -- AI_A2A_DISPATCHER
|
|||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
-- If it's a cold war then the **borders of red and blue territory** need to be defined using a @{zone} object derived from @{Core.Zone#ZONE_BASE}.
|
-- If it's a cold war then the **borders of red and blue territory** need to be defined using a @{Core.Zone} object derived from @{Core.Zone#ZONE_BASE}.
|
||||||
-- If a hot war is chosen then **no borders** actually need to be defined using the helicopter units other than
|
-- If a hot war is chosen then **no borders** actually need to be defined using the helicopter units other than
|
||||||
-- it makes it easier sometimes for the mission maker to envisage where the red and blue territories roughly are.
|
-- it makes it easier sometimes for the mission maker to envisage where the red and blue territories roughly are.
|
||||||
-- In a hot war the borders are effectively defined by the ground based radar coverage of a coalition.
|
-- In a hot war the borders are effectively defined by the ground based radar coverage of a coalition.
|
||||||
--
|
--
|
||||||
-- Demonstration Mission: [AID-009 - AI_A2A - Border Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/release-2-2-pre/AID%20-%20AI%20Dispatching/AID-009 - AI_A2A - Border Test)
|
-- Demonstration Mission: [AID-009 - AI_A2A - Border Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher/AID-A2A-009%20-%20Border%20Test)
|
||||||
--
|
--
|
||||||
-- In this example a border is set for the CCCP A2A dispatcher:
|
-- In this example a border is set for the CCCP A2A dispatcher:
|
||||||
--
|
--
|
||||||
@@ -592,7 +597,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
-- A2ADispatcher:SetSquadronCap( "Maykop", CAPZoneMiddle, 4000, 8000, 600, 800, 800, 1200, "RADIO" )
|
-- A2ADispatcher:SetSquadronCap( "Maykop", CAPZoneMiddle, 4000, 8000, 600, 800, 800, 1200, "RADIO" )
|
||||||
-- A2ADispatcher:SetSquadronCapInterval( "Sochi", 2, 30, 120, 1 )
|
-- A2ADispatcher:SetSquadronCapInterval( "Sochi", 2, 30, 120, 1 )
|
||||||
--
|
--
|
||||||
-- Note the different @{Zone} MOOSE classes being used to create zones of different types. Please click the @{Zone} link for more information about the different zone types.
|
-- Note the different @{Core.Zone} MOOSE classes being used to create zones of different types. Please click the @{Core.Zone} link for more information about the different zone types.
|
||||||
-- Zones can be circles, can be setup in the mission editor using trigger zones, but can also be setup in the mission editor as polygons and in this case GROUP objects are being used!
|
-- Zones can be circles, can be setup in the mission editor using trigger zones, but can also be setup in the mission editor as polygons and in this case GROUP objects are being used!
|
||||||
--
|
--
|
||||||
-- ## 7.2. Set the squadron to execute CAP:
|
-- ## 7.2. Set the squadron to execute CAP:
|
||||||
@@ -1148,7 +1153,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
|
|
||||||
self:I( "Captured " .. AirbaseName )
|
self:I( "Captured " .. AirbaseName )
|
||||||
|
|
||||||
-- Now search for all squadrons located at the airbase, and sanatize them.
|
-- Now search for all squadrons located at the airbase, and sanitize them.
|
||||||
for SquadronName, Squadron in pairs( self.DefenderSquadrons ) do
|
for SquadronName, Squadron in pairs( self.DefenderSquadrons ) do
|
||||||
if Squadron.AirbaseName == AirbaseName then
|
if Squadron.AirbaseName == AirbaseName then
|
||||||
Squadron.ResourceCount = -999 -- The base has been captured, and the resources are eliminated. No more spawning.
|
Squadron.ResourceCount = -999 -- The base has been captured, and the resources are eliminated. No more spawning.
|
||||||
@@ -1228,7 +1233,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
--
|
--
|
||||||
-- **Use the method @{#AI_A2A_DISPATCHER.SetEngageRadius}() to modify the default Engage Radius for ALL squadrons.**
|
-- **Use the method @{#AI_A2A_DISPATCHER.SetEngageRadius}() to modify the default Engage Radius for ALL squadrons.**
|
||||||
--
|
--
|
||||||
-- Demonstration Mission: [AID-019 - AI_A2A - Engage Range Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/release-2-2-pre/AID%20-%20AI%20Dispatching/AID-019%20-%20AI_A2A%20-%20Engage%20Range%20Test)
|
-- Demonstration Mission: [AID-019 - AI_A2A - Engage Range Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher/AID-A2A-019%20-%20Engage%20Range%20Test)
|
||||||
--
|
--
|
||||||
-- @param #AI_A2A_DISPATCHER self
|
-- @param #AI_A2A_DISPATCHER self
|
||||||
-- @param #number EngageRadius (Optional, Default = 100000) The radius to report friendlies near the target.
|
-- @param #number EngageRadius (Optional, Default = 100000) The radius to report friendlies near the target.
|
||||||
@@ -1278,7 +1283,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
-- Use the method @{#AI_A2A_DISPATCHER.SetGciRadius}() to set a specific controlled ground intercept radius.
|
-- Use the method @{#AI_A2A_DISPATCHER.SetGciRadius}() to set a specific controlled ground intercept radius.
|
||||||
-- **The Ground Controlled Intercept radius is defined for ALL squadrons which are operational.**
|
-- **The Ground Controlled Intercept radius is defined for ALL squadrons which are operational.**
|
||||||
--
|
--
|
||||||
-- Demonstration Mission: [AID-013 - AI_A2A - Intercept Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/release-2-2-pre/AID%20-%20AI%20Dispatching/AID-013%20-%20AI_A2A%20-%20Intercept%20Test)
|
-- Demonstration Mission: [AID-013 - AI_A2A - Intercept Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher/AID-A2A-013%20-%20Intercept%20Test)
|
||||||
--
|
--
|
||||||
-- @param #AI_A2A_DISPATCHER self
|
-- @param #AI_A2A_DISPATCHER self
|
||||||
-- @param #number GciRadius (Optional, Default = 200000) The radius to ground control intercept detected targets from the nearest airbase.
|
-- @param #number GciRadius (Optional, Default = 200000) The radius to ground control intercept detected targets from the nearest airbase.
|
||||||
@@ -1304,7 +1309,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
--- Define a border area to simulate a **cold war** scenario.
|
--- Define a border area to simulate a **cold war** scenario.
|
||||||
-- A **cold war** is one where CAP aircraft patrol their territory but will not attack enemy aircraft or launch GCI aircraft unless enemy aircraft enter their territory. In other words the EWR may detect an enemy aircraft but will only send aircraft to attack it if it crosses the border.
|
-- A **cold war** is one where CAP aircraft patrol their territory but will not attack enemy aircraft or launch GCI aircraft unless enemy aircraft enter their territory. In other words the EWR may detect an enemy aircraft but will only send aircraft to attack it if it crosses the border.
|
||||||
-- A **hot war** is one where CAP aircraft will intercept any detected enemy aircraft and GCI aircraft will launch against detected enemy aircraft without regard for territory. In other words if the ground radar can detect the enemy aircraft then it will send CAP and GCI aircraft to attack it.
|
-- A **hot war** is one where CAP aircraft will intercept any detected enemy aircraft and GCI aircraft will launch against detected enemy aircraft without regard for territory. In other words if the ground radar can detect the enemy aircraft then it will send CAP and GCI aircraft to attack it.
|
||||||
-- If it's a cold war then the **borders of red and blue territory** need to be defined using a @{zone} object derived from @{Core.Zone#ZONE_BASE}. This method needs to be used for this.
|
-- If it's a cold war then the **borders of red and blue territory** need to be defined using a @{Core.Zone} object derived from @{Core.Zone#ZONE_BASE}. This method needs to be used for this.
|
||||||
-- If a hot war is chosen then **no borders** actually need to be defined using the helicopter units other than it makes it easier sometimes for the mission maker to envisage where the red and blue territories roughly are. In a hot war the borders are effectively defined by the ground based radar coverage of a coalition. Set the noborders parameter to 1
|
-- If a hot war is chosen then **no borders** actually need to be defined using the helicopter units other than it makes it easier sometimes for the mission maker to envisage where the red and blue territories roughly are. In a hot war the borders are effectively defined by the ground based radar coverage of a coalition. Set the noborders parameter to 1
|
||||||
-- @param #AI_A2A_DISPATCHER self
|
-- @param #AI_A2A_DISPATCHER self
|
||||||
-- @param Core.Zone#ZONE_BASE BorderZone An object derived from ZONE_BASE, or a list of objects derived from ZONE_BASE.
|
-- @param Core.Zone#ZONE_BASE BorderZone An object derived from ZONE_BASE, or a list of objects derived from ZONE_BASE.
|
||||||
@@ -1687,6 +1692,20 @@ do -- AI_A2A_DISPATCHER
|
|||||||
|
|
||||||
return DefenderSquadron
|
return DefenderSquadron
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Get a resource count from a specific squadron
|
||||||
|
-- @param #AI_A2A_DISPATCHER self
|
||||||
|
-- @param #string Squadron Name of the squadron.
|
||||||
|
-- @return #number Number of airframes available or nil if the squadron does not exist
|
||||||
|
function AI_A2A_DISPATCHER:QuerySquadron(Squadron)
|
||||||
|
local Squadron = self:GetSquadron(Squadron)
|
||||||
|
if Squadron.ResourceCount then
|
||||||
|
self:T2(string.format("%s = %s",Squadron.Name,Squadron.ResourceCount))
|
||||||
|
return Squadron.ResourceCount
|
||||||
|
end
|
||||||
|
self:F({Squadron = Squadron.Name,SquadronResourceCount = Squadron.ResourceCount})
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
--- [DEPRECATED - Might create problems launching planes] Set the Squadron visible before startup of the dispatcher.
|
--- [DEPRECATED - Might create problems launching planes] Set the Squadron visible before startup of the dispatcher.
|
||||||
-- All planes will be spawned as uncontrolled on the parking spot.
|
-- All planes will be spawned as uncontrolled on the parking spot.
|
||||||
@@ -1713,7 +1732,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
-- Get free parking for fighter aircraft.
|
-- Get free parking for fighter aircraft.
|
||||||
local nfreeparking = DefenderSquadron.Airbase:GetFreeParkingSpotsNumber( AIRBASE.TerminalType.FighterAircraft, true )
|
local nfreeparking = DefenderSquadron.Airbase:GetFreeParkingSpotsNumber( AIRBASE.TerminalType.FighterAircraft, true )
|
||||||
|
|
||||||
-- Take number of free parking spots if no resource count was specifed.
|
-- Take number of free parking spots if no resource count was specified.
|
||||||
DefenderSquadron.ResourceCount = DefenderSquadron.ResourceCount or nfreeparking
|
DefenderSquadron.ResourceCount = DefenderSquadron.ResourceCount or nfreeparking
|
||||||
|
|
||||||
-- Check that resource count is not larger than free parking spots.
|
-- Check that resource count is not larger than free parking spots.
|
||||||
@@ -1758,7 +1777,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
-- @param DCS#Altitude EngageFloorAltitude The lowest altitude in meters where to execute the engagement.
|
-- @param DCS#Altitude EngageFloorAltitude The lowest altitude in meters where to execute the engagement.
|
||||||
-- @param DCS#Altitude EngageCeilingAltitude The highest altitude in meters where to execute the engagement.
|
-- @param DCS#Altitude EngageCeilingAltitude The highest altitude in meters where to execute the engagement.
|
||||||
-- @param #number EngageAltType The altitude type to engage, which is a string "BARO" defining Barometric or "RADIO" defining radio controlled altitude.
|
-- @param #number EngageAltType The altitude type to engage, which is a string "BARO" defining Barometric or "RADIO" defining radio controlled altitude.
|
||||||
-- @param Core.Zone#ZONE_BASE Zone The @{Zone} object derived from @{Core.Zone#ZONE_BASE} that defines the zone wherein the CAP will be executed.
|
-- @param Core.Zone#ZONE_BASE Zone The @{Core.Zone} object derived from @{Core.Zone#ZONE_BASE} that defines the zone wherein the CAP will be executed.
|
||||||
-- @param #number PatrolMinSpeed The minimum speed at which the cap can be executed.
|
-- @param #number PatrolMinSpeed The minimum speed at which the cap can be executed.
|
||||||
-- @param #number PatrolMaxSpeed The maximum speed at which the cap can be executed.
|
-- @param #number PatrolMaxSpeed The maximum speed at which the cap can be executed.
|
||||||
-- @param #number PatrolFloorAltitude The minimum altitude at which the cap can be executed.
|
-- @param #number PatrolFloorAltitude The minimum altitude at which the cap can be executed.
|
||||||
@@ -1825,7 +1844,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
--- Set a CAP for a Squadron.
|
--- Set a CAP for a Squadron.
|
||||||
-- @param #AI_A2A_DISPATCHER self
|
-- @param #AI_A2A_DISPATCHER self
|
||||||
-- @param #string SquadronName The squadron name.
|
-- @param #string SquadronName The squadron name.
|
||||||
-- @param Core.Zone#ZONE_BASE Zone The @{Zone} object derived from @{Core.Zone#ZONE_BASE} that defines the zone wherein the CAP will be executed.
|
-- @param Core.Zone#ZONE_BASE Zone The @{Core.Zone} object derived from @{Core.Zone#ZONE_BASE} that defines the zone wherein the CAP will be executed.
|
||||||
-- @param #number PatrolFloorAltitude The minimum altitude at which the cap can be executed.
|
-- @param #number PatrolFloorAltitude The minimum altitude at which the cap can be executed.
|
||||||
-- @param #number PatrolCeilingAltitude the maximum altitude at which the cap can be executed.
|
-- @param #number PatrolCeilingAltitude the maximum altitude at which the cap can be executed.
|
||||||
-- @param #number PatrolMinSpeed The minimum speed at which the cap can be executed.
|
-- @param #number PatrolMinSpeed The minimum speed at which the cap can be executed.
|
||||||
@@ -3238,7 +3257,8 @@ do -- AI_A2A_DISPATCHER
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_A2A_DISPATCHER self
|
--- AI_A2A_Fsm:onafterHome
|
||||||
|
-- @param #AI_A2A_DISPATCHER self
|
||||||
function AI_A2A_Fsm:onafterHome( Defender, From, Event, To, Action )
|
function AI_A2A_Fsm:onafterHome( Defender, From, Event, To, Action )
|
||||||
if Defender and Defender:IsAlive() then
|
if Defender and Defender:IsAlive() then
|
||||||
self:F( { "CAP Home", Defender:GetName() } )
|
self:F( { "CAP Home", Defender:GetName() } )
|
||||||
@@ -3486,7 +3506,8 @@ do -- AI_A2A_DISPATCHER
|
|||||||
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_A2A_DISPATCHER self
|
--- function Fsm:onafterLostControl
|
||||||
|
-- @param #AI_A2A_DISPATCHER self
|
||||||
function Fsm:onafterLostControl( Defender, From, Event, To )
|
function Fsm:onafterLostControl( Defender, From, Event, To )
|
||||||
self:F( { "GCI LostControl", Defender:GetName() } )
|
self:F( { "GCI LostControl", Defender:GetName() } )
|
||||||
self:GetParent( self ).onafterHome( self, Defender, From, Event, To )
|
self:GetParent( self ).onafterHome( self, Defender, From, Event, To )
|
||||||
@@ -3499,7 +3520,8 @@ do -- AI_A2A_DISPATCHER
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_A2A_DISPATCHER self
|
--- function Fsm:onafterHome
|
||||||
|
-- @param #AI_A2A_DISPATCHER self
|
||||||
function Fsm:onafterHome( DefenderGroup, From, Event, To, Action )
|
function Fsm:onafterHome( DefenderGroup, From, Event, To, Action )
|
||||||
self:F( { "GCI Home", DefenderGroup:GetName() } )
|
self:F( { "GCI Home", DefenderGroup:GetName() } )
|
||||||
self:GetParent( self ).onafterHome( self, DefenderGroup, From, Event, To )
|
self:GetParent( self ).onafterHome( self, DefenderGroup, From, Event, To )
|
||||||
@@ -3940,11 +3962,7 @@ do
|
|||||||
--
|
--
|
||||||
-- # Demo Missions
|
-- # Demo Missions
|
||||||
--
|
--
|
||||||
-- ### [AI\_A2A\_GCICAP for Caucasus](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/release-2-2-pre/AID%20-%20AI%20Dispatching/AID-200%20-%20AI_A2A%20-%20GCICAP%20Demonstration)
|
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher)
|
||||||
-- ### [AI\_A2A\_GCICAP for NTTR](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/release-2-2-pre/AID%20-%20AI%20Dispatching/AID-210%20-%20NTTR%20AI_A2A_GCICAP%20Demonstration)
|
|
||||||
-- ### [AI\_A2A\_GCICAP for Normandy](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/release-2-2-pre/AID%20-%20AI%20Dispatching/AID-220%20-%20NORMANDY%20AI_A2A_GCICAP%20Demonstration)
|
|
||||||
--
|
|
||||||
-- ### [AI\_A2A\_GCICAP for beta testers](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching)
|
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- **AI** -- (R2.2) - Models the process of Ground Controlled Interception (GCI) for airplanes.
|
--- **AI** - Models the process of Ground Controlled Interception (GCI) for airplanes.
|
||||||
--
|
--
|
||||||
-- This is a class used in the @{AI_A2A_Dispatcher}.
|
-- This is a class used in the @{AI.AI_A2A_Dispatcher}.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -8,53 +8,37 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @module AI.AI_A2A_GCI
|
-- @module AI.AI_A2A_Gci
|
||||||
-- @image AI_Ground_Control_Intercept.JPG
|
-- @image AI_Ground_Control_Intercept.JPG
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- @type AI_A2A_GCI
|
--- @type AI_A2A_GCI
|
||||||
-- @extends AI.AI_A2A#AI_A2A
|
-- @extends AI.AI_Air_Engage#AI_AIR_ENGAGE
|
||||||
|
|
||||||
|
|
||||||
--- 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.
|
||||||
-- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits.
|
-- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- This cycle will continue.
|
-- This cycle will continue.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- During the patrol, the AI will detect enemy targets, which are reported through the **Detected** event.
|
-- During the patrol, the AI will detect enemy targets, which are reported through the **Detected** event.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- When enemies are detected, the AI will automatically engage the enemy.
|
-- When enemies are detected, the AI will automatically engage the enemy.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- Until a fuel or damage threshold has been reached by the AI, or when the AI is commanded to RTB.
|
-- Until a fuel or damage threshold has been reached by the AI, or when the AI is commanded to RTB.
|
||||||
-- When the fuel threshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
|
-- When the fuel threshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- ## 1. AI_A2A_GCI constructor
|
-- ## 1. AI_A2A_GCI constructor
|
||||||
--
|
--
|
||||||
-- * @{#AI_A2A_GCI.New}(): Creates a new AI_A2A_GCI object.
|
-- * @{#AI_A2A_GCI.New}(): Creates a new AI_A2A_GCI object.
|
||||||
--
|
--
|
||||||
-- ## 2. AI_A2A_GCI is a FSM
|
-- ## 2. AI_A2A_GCI is a FSM
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- ### 2.1 AI_A2A_GCI States
|
-- ### 2.1 AI_A2A_GCI States
|
||||||
--
|
--
|
||||||
-- * **None** ( Group ): The process is not started yet.
|
-- * **None** ( Group ): The process is not started yet.
|
||||||
@@ -75,23 +59,10 @@
|
|||||||
-- * **@{#AI_A2A_GCI.Destroyed}**: The AI has destroyed all bogeys @{Wrapper.Unit}s assigned in the CAS task.
|
-- * **@{#AI_A2A_GCI.Destroyed}**: The AI has destroyed all bogeys @{Wrapper.Unit}s assigned in the CAS task.
|
||||||
-- * **Status** ( Group ): The AI is checking status (fuel and damage). When the thresholds have been reached, the AI will RTB.
|
-- * **Status** ( Group ): The AI is checking status (fuel and damage). When the thresholds have been reached, the AI will RTB.
|
||||||
--
|
--
|
||||||
-- ## 3. Set the Range of Engagement
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
-- 
|
-- 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
|
||||||
-- An optional range can be set in meters,
|
|
||||||
-- that will define when the AI will engage with the detected airborne enemy targets.
|
|
||||||
-- The range can be beyond or smaller than the range of the Patrol Zone.
|
|
||||||
-- The range is applied at the position of the AI.
|
|
||||||
-- Use the method @{AI.AI_GCI#AI_A2A_GCI.SetEngageRange}() to define that range.
|
|
||||||
--
|
|
||||||
-- ## 4. Set the Zone of Engagement
|
|
||||||
--
|
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- An optional @{Zone} can be set,
|
|
||||||
-- that will define when the AI will engage with the detected airborne enemy targets.
|
|
||||||
-- Use the method @{AI.AI_Cap#AI_A2A_GCI.SetEngageZone}() to define that Zone.
|
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -153,7 +124,7 @@ end
|
|||||||
--- Evaluate the attack and create an AttackUnitTask list.
|
--- Evaluate the attack and create an AttackUnitTask list.
|
||||||
-- @param #AI_A2A_GCI self
|
-- @param #AI_A2A_GCI self
|
||||||
-- @param Core.Set#SET_UNIT AttackSetUnit The set of units to attack.
|
-- @param Core.Set#SET_UNIT AttackSetUnit The set of units to attack.
|
||||||
-- @param Wrappper.Group#GROUP DefenderGroup The group of defenders.
|
-- @param Wrapper.Group#GROUP DefenderGroup The group of defenders.
|
||||||
-- @param #number EngageAltitude The altitude to engage the targets.
|
-- @param #number EngageAltitude The altitude to engage the targets.
|
||||||
-- @return #AI_A2A_GCI self
|
-- @return #AI_A2A_GCI self
|
||||||
function AI_A2A_GCI:CreateAttackUnitTasks( AttackSetUnit, DefenderGroup, EngageAltitude )
|
function AI_A2A_GCI:CreateAttackUnitTasks( AttackSetUnit, DefenderGroup, EngageAltitude )
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **AI** -- (R2.2) - Models the process of air patrol of airplanes.
|
--- **AI** - Models the process of air patrol of airplanes.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -11,9 +11,9 @@
|
|||||||
|
|
||||||
|
|
||||||
--- @type AI_A2A_PATROL
|
--- @type AI_A2A_PATROL
|
||||||
-- @extends AI.AI_A2A#AI_A2A
|
-- @extends AI.AI_Air_Patrol#AI_AIR_PATROL
|
||||||
|
|
||||||
--- Implements the core functions to patrol a @{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}.
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
@@ -102,7 +102,7 @@
|
|||||||
-- When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base.
|
-- When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base.
|
||||||
-- Therefore, with a parameter and a calculation of the distance to the home base, the fuel threshold is calculated.
|
-- Therefore, with a parameter and a calculation of the distance to the home base, the fuel threshold is calculated.
|
||||||
-- When the fuel threshold is reached, the AI will continue for a given time its patrol task in orbit,
|
-- When the fuel threshold is reached, the AI will continue for a given time its patrol task in orbit,
|
||||||
-- while a new AI is targetted to the AI_A2A_PATROL.
|
-- while a new AI is targeted to the AI_A2A_PATROL.
|
||||||
-- Once the time is finished, the old AI will return to the base.
|
-- Once the time is finished, the old AI will return to the base.
|
||||||
-- Use the method @{#AI_A2A_PATROL.ManageFuel}() to have this proces in place.
|
-- Use the method @{#AI_A2A_PATROL.ManageFuel}() to have this proces in place.
|
||||||
--
|
--
|
||||||
@@ -111,7 +111,12 @@
|
|||||||
-- When the AI is damaged, it is required that a new Patrol is started. However, damage cannon be foreseen early on.
|
-- When the AI is damaged, it is required that a new Patrol is started. However, damage cannon be foreseen early on.
|
||||||
-- Therefore, when the damage threshold is reached, the AI will return immediately to the home base (RTB).
|
-- Therefore, when the damage threshold is reached, the AI will return immediately to the home base (RTB).
|
||||||
-- Use the method @{#AI_A2A_PATROL.ManageDamage}() to have this proces in place.
|
-- Use the method @{#AI_A2A_PATROL.ManageDamage}() to have this proces in place.
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_A2A_PATROL
|
-- @field #AI_A2A_PATROL
|
||||||
@@ -122,7 +127,7 @@ AI_A2A_PATROL = {
|
|||||||
--- Creates a new AI_A2A_PATROL object
|
--- Creates a new AI_A2A_PATROL object
|
||||||
-- @param #AI_A2A_PATROL self
|
-- @param #AI_A2A_PATROL self
|
||||||
-- @param Wrapper.Group#GROUP AIPatrol The patrol group object.
|
-- @param Wrapper.Group#GROUP AIPatrol The patrol group object.
|
||||||
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
|
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
|
||||||
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
|
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
|
||||||
@@ -264,7 +269,7 @@ function AI_A2A_PATROL:SetAltitude( PatrolFloorAltitude, PatrolCeilingAltitude )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Defines a new patrol route using the @{Process_PatrolZone} parameters and settings.
|
--- Defines a new patrol route using the @{AI.AI_Patrol#AI_PATROL_ZONE} parameters and settings.
|
||||||
-- @param #AI_A2A_PATROL self
|
-- @param #AI_A2A_PATROL self
|
||||||
-- @return #AI_A2A_PATROL self
|
-- @return #AI_A2A_PATROL self
|
||||||
-- @param Wrapper.Group#GROUP AIPatrol The Group Object managed by the FSM.
|
-- @param Wrapper.Group#GROUP AIPatrol The Group Object managed by the FSM.
|
||||||
@@ -287,7 +292,7 @@ function AI_A2A_PATROL:onafterPatrol( AIPatrol, From, Event, To )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- This statis method is called from the route path within the last task at the last waaypoint of the AIPatrol.
|
--- This static method is called from the route path within the last task at the last waypoint of the AIPatrol.
|
||||||
-- Note that this method is required, as triggers the next route when patrolling for the AIPatrol.
|
-- Note that this method is required, as triggers the next route when patrolling for the AIPatrol.
|
||||||
-- @param Wrapper.Group#GROUP AIPatrol The AI group.
|
-- @param Wrapper.Group#GROUP AIPatrol The AI group.
|
||||||
-- @param #AI_A2A_PATROL Fsm The FSM.
|
-- @param #AI_A2A_PATROL Fsm The FSM.
|
||||||
@@ -302,7 +307,7 @@ function AI_A2A_PATROL.PatrolRoute( AIPatrol, Fsm )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Defines a new patrol route using the @{Process_PatrolZone} parameters and settings.
|
--- Defines a new patrol route using the @{AI.AI_Patrol#AI_PATROL_ZONE} parameters and settings.
|
||||||
-- @param #AI_A2A_PATROL self
|
-- @param #AI_A2A_PATROL self
|
||||||
-- @param Wrapper.Group#GROUP AIPatrol The Group managed by the FSM.
|
-- @param Wrapper.Group#GROUP AIPatrol The Group managed by the FSM.
|
||||||
-- @param #string From The From State string.
|
-- @param #string From The From State string.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- **AI** -- Models the process of air to ground BAI engagement for airplanes and helicopters.
|
--- **AI** - Models the process of air to ground BAI engagement for airplanes and helicopters.
|
||||||
--
|
--
|
||||||
-- This is a class used in the @{AI_A2G_Dispatcher}.
|
-- This is a class used in the @{AI.AI_A2G_Dispatcher}.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -11,14 +11,17 @@
|
|||||||
-- @module AI.AI_A2G_BAI
|
-- @module AI.AI_A2G_BAI
|
||||||
-- @image AI_Air_To_Ground_Engage.JPG
|
-- @image AI_Air_To_Ground_Engage.JPG
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- @type AI_A2G_BAI
|
--- @type AI_A2G_BAI
|
||||||
-- @extends AI.AI_A2A_Engage#AI_A2A_Engage
|
-- @extends AI.AI_Air_Patrol#AI_AIR_PATROL
|
||||||
|
-- @extends AI.AI_Air_Engage#AI_AIR_ENGAGE
|
||||||
|
|
||||||
--- 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
|
||||||
--
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_A2G_BAI
|
-- @field #AI_A2G_BAI
|
||||||
@@ -26,8 +29,6 @@ AI_A2G_BAI = {
|
|||||||
ClassName = "AI_A2G_BAI",
|
ClassName = "AI_A2G_BAI",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- Creates a new AI_A2G_BAI object
|
--- Creates a new AI_A2G_BAI object
|
||||||
-- @param #AI_A2G_BAI self
|
-- @param #AI_A2G_BAI self
|
||||||
-- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
@@ -36,7 +37,7 @@ AI_A2G_BAI = {
|
|||||||
-- @param DCS#Altitude EngageFloorAltitude The lowest altitude in meters where to execute the engagement.
|
-- @param DCS#Altitude EngageFloorAltitude The lowest altitude in meters where to execute the engagement.
|
||||||
-- @param DCS#Altitude EngageCeilingAltitude The highest altitude in meters where to execute the engagement.
|
-- @param DCS#Altitude EngageCeilingAltitude The highest altitude in meters where to execute the engagement.
|
||||||
-- @param DCS#AltitudeType EngageAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to "RADIO".
|
-- @param DCS#AltitudeType EngageAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to "RADIO".
|
||||||
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
|
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
|
||||||
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
|
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
|
||||||
@@ -46,14 +47,13 @@ AI_A2G_BAI = {
|
|||||||
function AI_A2G_BAI:New2( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
function AI_A2G_BAI:New2( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
||||||
|
|
||||||
local AI_Air = AI_AIR:New( AIGroup )
|
local AI_Air = AI_AIR:New( AIGroup )
|
||||||
local AI_Air_Patrol = AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType ) -- #AI_AIR_PATROL
|
local AI_Air_Patrol = AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
||||||
local AI_Air_Engage = AI_AIR_ENGAGE:New( AI_Air_Patrol, AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType )
|
local AI_Air_Engage = AI_AIR_ENGAGE:New( AI_Air_Patrol, AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType )
|
||||||
local self = BASE:Inherit( self, AI_Air_Engage )
|
local self = BASE:Inherit( self, AI_Air_Engage )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Creates a new AI_A2G_BAI object
|
--- Creates a new AI_A2G_BAI object
|
||||||
-- @param #AI_A2G_BAI self
|
-- @param #AI_A2G_BAI self
|
||||||
-- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
@@ -61,7 +61,7 @@ end
|
|||||||
-- @param DCS#Speed EngageMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h when engaging a target.
|
-- @param DCS#Speed EngageMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h when engaging a target.
|
||||||
-- @param DCS#Altitude EngageFloorAltitude The lowest altitude in meters where to execute the engagement.
|
-- @param DCS#Altitude EngageFloorAltitude The lowest altitude in meters where to execute the engagement.
|
||||||
-- @param DCS#Altitude EngageCeilingAltitude The highest altitude in meters where to execute the engagement.
|
-- @param DCS#Altitude EngageCeilingAltitude The highest altitude in meters where to execute the engagement.
|
||||||
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
|
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
|
||||||
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
|
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
|
||||||
@@ -76,7 +76,7 @@ end
|
|||||||
--- Evaluate the attack and create an AttackUnitTask list.
|
--- Evaluate the attack and create an AttackUnitTask list.
|
||||||
-- @param #AI_A2G_BAI self
|
-- @param #AI_A2G_BAI self
|
||||||
-- @param Core.Set#SET_UNIT AttackSetUnit The set of units to attack.
|
-- @param Core.Set#SET_UNIT AttackSetUnit The set of units to attack.
|
||||||
-- @param Wrappper.Group#GROUP DefenderGroup The group of defenders.
|
-- @param Wrapper.Group#GROUP DefenderGroup The group of defenders.
|
||||||
-- @param #number EngageAltitude The altitude to engage the targets.
|
-- @param #number EngageAltitude The altitude to engage the targets.
|
||||||
-- @return #AI_A2G_BAI self
|
-- @return #AI_A2G_BAI self
|
||||||
function AI_A2G_BAI:CreateAttackUnitTasks( AttackSetUnit, DefenderGroup, EngageAltitude )
|
function AI_A2G_BAI:CreateAttackUnitTasks( AttackSetUnit, DefenderGroup, EngageAltitude )
|
||||||
@@ -92,8 +92,6 @@ function AI_A2G_BAI:CreateAttackUnitTasks( AttackSetUnit, DefenderGroup, EngageA
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return AttackUnitTasks
|
return AttackUnitTasks
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- **AI** -- Models the process of air to ground engagement for airplanes and helicopters.
|
--- **AI** - Models the process of air to ground engagement for airplanes and helicopters.
|
||||||
--
|
--
|
||||||
-- This is a class used in the @{AI_A2G_Dispatcher}.
|
-- This is a class used in the @{AI.AI_A2G_Dispatcher}.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -11,14 +11,17 @@
|
|||||||
-- @module AI.AI_A2G_CAS
|
-- @module AI.AI_A2G_CAS
|
||||||
-- @image AI_Air_To_Ground_Engage.JPG
|
-- @image AI_Air_To_Ground_Engage.JPG
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- @type AI_A2G_CAS
|
--- @type AI_A2G_CAS
|
||||||
-- @extends AI.AI_A2G_Patrol#AI_AIR_PATROL
|
-- @extends AI.AI_Air_Patrol#AI_AIR_PATROL
|
||||||
|
-- @extends AI.AI_Air_Engage#AI_AIR_ENGAGE
|
||||||
|
|
||||||
--- 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
|
||||||
--
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_A2G_CAS
|
-- @field #AI_A2G_CAS
|
||||||
@@ -26,8 +29,6 @@ AI_A2G_CAS = {
|
|||||||
ClassName = "AI_A2G_CAS",
|
ClassName = "AI_A2G_CAS",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- Creates a new AI_A2G_CAS object
|
--- Creates a new AI_A2G_CAS object
|
||||||
-- @param #AI_A2G_CAS self
|
-- @param #AI_A2G_CAS self
|
||||||
-- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
@@ -36,7 +37,7 @@ AI_A2G_CAS = {
|
|||||||
-- @param DCS#Altitude EngageFloorAltitude The lowest altitude in meters where to execute the engagement.
|
-- @param DCS#Altitude EngageFloorAltitude The lowest altitude in meters where to execute the engagement.
|
||||||
-- @param DCS#Altitude EngageCeilingAltitude The highest altitude in meters where to execute the engagement.
|
-- @param DCS#Altitude EngageCeilingAltitude The highest altitude in meters where to execute the engagement.
|
||||||
-- @param DCS#AltitudeType EngageAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to "RADIO".
|
-- @param DCS#AltitudeType EngageAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to "RADIO".
|
||||||
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
|
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
|
||||||
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
|
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
|
||||||
@@ -46,14 +47,13 @@ AI_A2G_CAS = {
|
|||||||
function AI_A2G_CAS:New2( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
function AI_A2G_CAS:New2( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
||||||
|
|
||||||
local AI_Air = AI_AIR:New( AIGroup )
|
local AI_Air = AI_AIR:New( AIGroup )
|
||||||
local AI_Air_Patrol = AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType ) -- #AI_AIR_PATROL
|
local AI_Air_Patrol = AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
||||||
local AI_Air_Engage = AI_AIR_ENGAGE:New( AI_Air_Patrol, AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType )
|
local AI_Air_Engage = AI_AIR_ENGAGE:New( AI_Air_Patrol, AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType )
|
||||||
local self = BASE:Inherit( self, AI_Air_Engage )
|
local self = BASE:Inherit( self, AI_Air_Engage )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Creates a new AI_A2G_CAS object
|
--- Creates a new AI_A2G_CAS object
|
||||||
-- @param #AI_A2G_CAS self
|
-- @param #AI_A2G_CAS self
|
||||||
-- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
@@ -61,7 +61,7 @@ end
|
|||||||
-- @param DCS#Speed EngageMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h when engaging a target.
|
-- @param DCS#Speed EngageMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h when engaging a target.
|
||||||
-- @param DCS#Altitude EngageFloorAltitude The lowest altitude in meters where to execute the engagement.
|
-- @param DCS#Altitude EngageFloorAltitude The lowest altitude in meters where to execute the engagement.
|
||||||
-- @param DCS#Altitude EngageCeilingAltitude The highest altitude in meters where to execute the engagement.
|
-- @param DCS#Altitude EngageCeilingAltitude The highest altitude in meters where to execute the engagement.
|
||||||
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
|
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
|
||||||
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
|
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
|
||||||
@@ -76,7 +76,7 @@ end
|
|||||||
--- Evaluate the attack and create an AttackUnitTask list.
|
--- Evaluate the attack and create an AttackUnitTask list.
|
||||||
-- @param #AI_A2G_CAS self
|
-- @param #AI_A2G_CAS self
|
||||||
-- @param Core.Set#SET_UNIT AttackSetUnit The set of units to attack.
|
-- @param Core.Set#SET_UNIT AttackSetUnit The set of units to attack.
|
||||||
-- @param Wrappper.Group#GROUP DefenderGroup The group of defenders.
|
-- @param Wrapper.Group#GROUP DefenderGroup The group of defenders.
|
||||||
-- @param #number EngageAltitude The altitude to engage the targets.
|
-- @param #number EngageAltitude The altitude to engage the targets.
|
||||||
-- @return #AI_A2G_CAS self
|
-- @return #AI_A2G_CAS self
|
||||||
function AI_A2G_CAS:CreateAttackUnitTasks( AttackSetUnit, DefenderGroup, EngageAltitude )
|
function AI_A2G_CAS:CreateAttackUnitTasks( AttackSetUnit, DefenderGroup, EngageAltitude )
|
||||||
@@ -92,9 +92,6 @@ function AI_A2G_CAS:CreateAttackUnitTasks( AttackSetUnit, DefenderGroup, EngageA
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return AttackUnitTasks
|
return AttackUnitTasks
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **AI** - Create an automated A2G defense system based on a detection network of reconnaissance vehicles and air units, coordinating SEAD, BAI and CAS operations.
|
--- **AI** - Create an automated A2G defense system with reconnaissance units, coordinating SEAD, BAI and CAS operations.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [AID-A2G - AI A2G Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-A2G%20-%20AI%20A2G%20Dispatching)
|
-- [AID-A2G - AI A2G Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2G_Dispatcher)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -175,7 +175,7 @@
|
|||||||
-- * polygon zones
|
-- * polygon zones
|
||||||
-- * moving zones
|
-- * moving zones
|
||||||
--
|
--
|
||||||
-- Depending on the type of zone selected, a different @{Zone} object needs to be created from a ZONE_ class.
|
-- Depending on the type of zone selected, a different @{Core.Zone} object needs to be created from a ZONE_ class.
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
-- ## 12. Are moving defense coordinates possible?
|
-- ## 12. Are moving defense coordinates possible?
|
||||||
@@ -253,7 +253,12 @@
|
|||||||
--
|
--
|
||||||
-- **The default grouping is 1. That means, that each spawned defender will act individually.**
|
-- **The default grouping is 1. That means, that each spawned defender will act individually.**
|
||||||
-- But you can specify a number between 1 and 4, so that the defenders will act as a group.
|
-- But you can specify a number between 1 and 4, so that the defenders will act as a group.
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **FlightControl** rework of GCICAP + introduction of new concepts (squadrons).
|
-- ### Author: **FlightControl** rework of GCICAP + introduction of new concepts (squadrons).
|
||||||
@@ -291,8 +296,6 @@ do -- AI_A2G_DISPATCHER
|
|||||||
--
|
--
|
||||||
-- ## 1. AI\_A2G\_DISPATCHER constructor:
|
-- ## 1. AI\_A2G\_DISPATCHER constructor:
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
--
|
--
|
||||||
-- The @{#AI_A2G_DISPATCHER.New}() method creates a new AI_A2G_DISPATCHER instance.
|
-- The @{#AI_A2G_DISPATCHER.New}() method creates a new AI_A2G_DISPATCHER instance.
|
||||||
--
|
--
|
||||||
@@ -306,8 +309,6 @@ do -- AI_A2G_DISPATCHER
|
|||||||
-- A reconnaissance network, is used to detect enemy ground targets,
|
-- A reconnaissance network, is used to detect enemy ground targets,
|
||||||
-- potentially group them into areas, and to understand the position, level of threat of the enemy.
|
-- potentially group them into areas, and to understand the position, level of threat of the enemy.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- As explained in the introduction, depending on the type of mission you want to achieve, different types of units can be applied to detect ground enemy targets.
|
-- As explained in the introduction, depending on the type of mission you want to achieve, different types of units can be applied to detect ground enemy targets.
|
||||||
-- Ground based units are very useful to act as a reconnaissance, but they lack sometimes the visibility to detect targets at greater range.
|
-- Ground based units are very useful to act as a reconnaissance, but they lack sometimes the visibility to detect targets at greater range.
|
||||||
-- Recce are very useful to acquire the position of enemy ground targets when spread out over the battlefield at strategic positions.
|
-- Recce are very useful to acquire the position of enemy ground targets when spread out over the battlefield at strategic positions.
|
||||||
@@ -681,8 +682,6 @@ do -- AI_A2G_DISPATCHER
|
|||||||
--
|
--
|
||||||
-- Use the method @{#AI_A2G_DISPATCHER.SetSquadronGrouping}() to set the grouping of aircraft when spawned in.
|
-- Use the method @{#AI_A2G_DISPATCHER.SetSquadronGrouping}() to set the grouping of aircraft when spawned in.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- In the case of **on call** engagement, the @{#AI_A2G_DISPATCHER.SetSquadronGrouping}() method has additional behaviour.
|
-- In the case of **on call** engagement, the @{#AI_A2G_DISPATCHER.SetSquadronGrouping}() method has additional behaviour.
|
||||||
-- When there aren't enough patrol flights airborne, a on call will be initiated for the remaining
|
-- When there aren't enough patrol flights airborne, a on call will be initiated for the remaining
|
||||||
-- targets to be engaged. Depending on the grouping parameter, the spawned flights for on call aircraft are grouped into this setting.
|
-- targets to be engaged. Depending on the grouping parameter, the spawned flights for on call aircraft are grouped into this setting.
|
||||||
@@ -696,8 +695,6 @@ do -- AI_A2G_DISPATCHER
|
|||||||
-- The effectiveness can be set with the **overhead parameter**. This is a number that is used to calculate the amount of Units that dispatching command will allocate to GCI in surplus of detected amount of units.
|
-- The effectiveness can be set with the **overhead parameter**. This is a number that is used to calculate the amount of Units that dispatching command will allocate to GCI in surplus of detected amount of units.
|
||||||
-- The **default value** of the overhead parameter is 1.0, which means **equal balance**.
|
-- The **default value** of the overhead parameter is 1.0, which means **equal balance**.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- However, depending on the (type of) aircraft (strength and payload) in the squadron and the amount of resources available, this parameter can be changed.
|
-- However, depending on the (type of) aircraft (strength and payload) in the squadron and the amount of resources available, this parameter can be changed.
|
||||||
--
|
--
|
||||||
-- The @{#AI_A2G_DISPATCHER.SetSquadronOverhead}() method can be used to tweak the defense strength,
|
-- The @{#AI_A2G_DISPATCHER.SetSquadronOverhead}() method can be used to tweak the defense strength,
|
||||||
@@ -843,8 +840,6 @@ do -- AI_A2G_DISPATCHER
|
|||||||
--
|
--
|
||||||
-- For example, the following setup will set the default refuel tanker to "Tanker":
|
-- For example, the following setup will set the default refuel tanker to "Tanker":
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- -- Set the default tanker for refuelling to "Tanker", when the default fuel threshold has reached 90% fuel left.
|
-- -- Set the default tanker for refuelling to "Tanker", when the default fuel threshold has reached 90% fuel left.
|
||||||
-- A2GDispatcher:SetDefaultFuelThreshold( 0.9 )
|
-- A2GDispatcher:SetDefaultFuelThreshold( 0.9 )
|
||||||
-- A2GDispatcher:SetDefaultTanker( "Tanker" )
|
-- A2GDispatcher:SetDefaultTanker( "Tanker" )
|
||||||
@@ -951,7 +946,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
AI_A2G_DISPATCHER.DefenseQueue = {}
|
AI_A2G_DISPATCHER.DefenseQueue = {}
|
||||||
|
|
||||||
--- Defense approach types.
|
--- Defense approach types.
|
||||||
-- @type #AI_A2G_DISPATCHER.DefenseApproach
|
-- @type AI_A2G_DISPATCHER.DefenseApproach
|
||||||
AI_A2G_DISPATCHER.DefenseApproach = {
|
AI_A2G_DISPATCHER.DefenseApproach = {
|
||||||
Random = 1,
|
Random = 1,
|
||||||
Distance = 2,
|
Distance = 2,
|
||||||
@@ -1389,7 +1384,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
--- Define a border area to simulate a **cold war** scenario.
|
--- Define a border area to simulate a **cold war** scenario.
|
||||||
-- A **cold war** is one where Patrol aircraft patrol their territory but will not attack enemy aircraft or launch GCI aircraft unless enemy aircraft enter their territory. In other words the EWR may detect an enemy aircraft but will only send aircraft to attack it if it crosses the border.
|
-- A **cold war** is one where Patrol aircraft patrol their territory but will not attack enemy aircraft or launch GCI aircraft unless enemy aircraft enter their territory. In other words the EWR may detect an enemy aircraft but will only send aircraft to attack it if it crosses the border.
|
||||||
-- A **hot war** is one where Patrol aircraft will intercept any detected enemy aircraft and GCI aircraft will launch against detected enemy aircraft without regard for territory. In other words if the ground radar can detect the enemy aircraft then it will send Patrol and GCI aircraft to attack it.
|
-- A **hot war** is one where Patrol aircraft will intercept any detected enemy aircraft and GCI aircraft will launch against detected enemy aircraft without regard for territory. In other words if the ground radar can detect the enemy aircraft then it will send Patrol and GCI aircraft to attack it.
|
||||||
-- If it's a cold war then the **borders of red and blue territory** need to be defined using a @{zone} object derived from @{Core.Zone#ZONE_BASE}. This method needs to be used for this.
|
-- If it's a cold war then the **borders of red and blue territory** need to be defined using a @{Core.Zone} object derived from @{Core.Zone#ZONE_BASE}. This method needs to be used for this.
|
||||||
-- If a hot war is chosen then **no borders** actually need to be defined using the helicopter units other than it makes it easier sometimes for the mission maker to envisage where the red and blue territories roughly are. In a hot war the borders are effectively defined by the ground based radar coverage of a coalition. Set the noborders parameter to 1
|
-- If a hot war is chosen then **no borders** actually need to be defined using the helicopter units other than it makes it easier sometimes for the mission maker to envisage where the red and blue territories roughly are. In a hot war the borders are effectively defined by the ground based radar coverage of a coalition. Set the noborders parameter to 1
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param Core.Zone#ZONE_BASE BorderZone An object derived from ZONE_BASE, or a list of objects derived from ZONE_BASE.
|
-- @param Core.Zone#ZONE_BASE BorderZone An object derived from ZONE_BASE, or a list of objects derived from ZONE_BASE.
|
||||||
@@ -1806,6 +1801,19 @@ do -- AI_A2G_DISPATCHER
|
|||||||
return DefenderSquadron
|
return DefenderSquadron
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Get a resource count from a specific squadron
|
||||||
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
|
-- @param #string Squadron Name of the squadron.
|
||||||
|
-- @return #number Number of airframes available or nil if the squadron does not exist
|
||||||
|
function AI_A2G_DISPATCHER:QuerySquadron(Squadron)
|
||||||
|
local Squadron = self:GetSquadron(Squadron)
|
||||||
|
if Squadron.ResourceCount then
|
||||||
|
self:T2(string.format("%s = %s",Squadron.Name,Squadron.ResourceCount))
|
||||||
|
return Squadron.ResourceCount
|
||||||
|
end
|
||||||
|
self:F({Squadron = Squadron.Name,SquadronResourceCount = Squadron.ResourceCount})
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
--- Set the Squadron visible before startup of the dispatcher.
|
--- Set the Squadron visible before startup of the dispatcher.
|
||||||
-- All planes will be spawned as uncontrolled on the parking spot.
|
-- All planes will be spawned as uncontrolled on the parking spot.
|
||||||
@@ -1839,7 +1847,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
--- Check if the Squadron is visible before startup of the dispatcher.
|
--- Check if the Squadron is visible before startup of the dispatcher.
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param #string SquadronName The squadron name.
|
-- @param #string SquadronName The squadron name.
|
||||||
-- @return #bool true if visible.
|
-- @return #boolean true if visible.
|
||||||
-- @usage
|
-- @usage
|
||||||
--
|
--
|
||||||
-- -- Set the Squadron visible before startup of dispatcher.
|
-- -- Set the Squadron visible before startup of dispatcher.
|
||||||
@@ -2185,7 +2193,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
-- The Sead patrol will start a patrol of the aircraft at a specified zone, and will engage when commanded.
|
-- The Sead patrol will start a patrol of the aircraft at a specified zone, and will engage when commanded.
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param #string SquadronName The squadron name.
|
-- @param #string SquadronName The squadron name.
|
||||||
-- @param Core.Zone#ZONE_BASE Zone The @{Zone} object derived from @{Core.Zone#ZONE_BASE} that defines the zone wherein the Patrol will be executed.
|
-- @param Core.Zone#ZONE_BASE Zone The @{Core.Zone} object derived from @{Core.Zone#ZONE_BASE} that defines the zone wherein the Patrol will be executed.
|
||||||
-- @param #number PatrolMinSpeed (optional, default = 50% of max speed) The minimum speed at which the cap can be executed.
|
-- @param #number PatrolMinSpeed (optional, default = 50% of max speed) The minimum speed at which the cap can be executed.
|
||||||
-- @param #number PatrolMaxSpeed (optional, default = 75% of max speed) The maximum speed at which the cap can be executed.
|
-- @param #number PatrolMaxSpeed (optional, default = 75% of max speed) The maximum speed at which the cap can be executed.
|
||||||
-- @param #number PatrolFloorAltitude (optional, default = 1000m ) The minimum altitude at which the cap can be executed.
|
-- @param #number PatrolFloorAltitude (optional, default = 1000m ) The minimum altitude at which the cap can be executed.
|
||||||
@@ -2234,7 +2242,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
-- The Sead patrol will start a patrol of the aircraft at a specified zone, and will engage when commanded.
|
-- The Sead patrol will start a patrol of the aircraft at a specified zone, and will engage when commanded.
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param #string SquadronName The squadron name.
|
-- @param #string SquadronName The squadron name.
|
||||||
-- @param Core.Zone#ZONE_BASE Zone The @{Zone} object derived from @{Core.Zone#ZONE_BASE} that defines the zone wherein the Patrol will be executed.
|
-- @param Core.Zone#ZONE_BASE Zone The @{Core.Zone} object derived from @{Core.Zone#ZONE_BASE} that defines the zone wherein the Patrol will be executed.
|
||||||
-- @param #number FloorAltitude (optional, default = 1000m ) The minimum altitude at which the cap can be executed.
|
-- @param #number FloorAltitude (optional, default = 1000m ) The minimum altitude at which the cap can be executed.
|
||||||
-- @param #number CeilingAltitude (optional, default = 1500m ) The maximum altitude at which the cap can be executed.
|
-- @param #number CeilingAltitude (optional, default = 1500m ) The maximum altitude at which the cap can be executed.
|
||||||
-- @param #number PatrolMinSpeed (optional, default = 50% of max speed) The minimum speed at which the cap can be executed.
|
-- @param #number PatrolMinSpeed (optional, default = 50% of max speed) The minimum speed at which the cap can be executed.
|
||||||
@@ -2336,7 +2344,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
-- The Cas patrol will start a patrol of the aircraft at a specified zone, and will engage when commanded.
|
-- The Cas patrol will start a patrol of the aircraft at a specified zone, and will engage when commanded.
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param #string SquadronName The squadron name.
|
-- @param #string SquadronName The squadron name.
|
||||||
-- @param Core.Zone#ZONE_BASE Zone The @{Zone} object derived from @{Core.Zone#ZONE_BASE} that defines the zone wherein the Patrol will be executed.
|
-- @param Core.Zone#ZONE_BASE Zone The @{Core.Zone} object derived from @{Core.Zone#ZONE_BASE} that defines the zone wherein the Patrol will be executed.
|
||||||
-- @param #number PatrolMinSpeed (optional, default = 50% of max speed) The minimum speed at which the cap can be executed.
|
-- @param #number PatrolMinSpeed (optional, default = 50% of max speed) The minimum speed at which the cap can be executed.
|
||||||
-- @param #number PatrolMaxSpeed (optional, default = 75% of max speed) The maximum speed at which the cap can be executed.
|
-- @param #number PatrolMaxSpeed (optional, default = 75% of max speed) The maximum speed at which the cap can be executed.
|
||||||
-- @param #number PatrolFloorAltitude (optional, default = 1000m ) The minimum altitude at which the cap can be executed.
|
-- @param #number PatrolFloorAltitude (optional, default = 1000m ) The minimum altitude at which the cap can be executed.
|
||||||
@@ -2385,7 +2393,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
-- The Cas patrol will start a patrol of the aircraft at a specified zone, and will engage when commanded.
|
-- The Cas patrol will start a patrol of the aircraft at a specified zone, and will engage when commanded.
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param #string SquadronName The squadron name.
|
-- @param #string SquadronName The squadron name.
|
||||||
-- @param Core.Zone#ZONE_BASE Zone The @{Zone} object derived from @{Core.Zone#ZONE_BASE} that defines the zone wherein the Patrol will be executed.
|
-- @param Core.Zone#ZONE_BASE Zone The @{Core.Zone} object derived from @{Core.Zone#ZONE_BASE} that defines the zone wherein the Patrol will be executed.
|
||||||
-- @param #number FloorAltitude (optional, default = 1000m ) The minimum altitude at which the cap can be executed.
|
-- @param #number FloorAltitude (optional, default = 1000m ) The minimum altitude at which the cap can be executed.
|
||||||
-- @param #number CeilingAltitude (optional, default = 1500m ) The maximum altitude at which the cap can be executed.
|
-- @param #number CeilingAltitude (optional, default = 1500m ) The maximum altitude at which the cap can be executed.
|
||||||
-- @param #number PatrolMinSpeed (optional, default = 50% of max speed) The minimum speed at which the cap can be executed.
|
-- @param #number PatrolMinSpeed (optional, default = 50% of max speed) The minimum speed at which the cap can be executed.
|
||||||
@@ -2487,7 +2495,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
-- The Bai patrol will start a patrol of the aircraft at a specified zone, and will engage when commanded.
|
-- The Bai patrol will start a patrol of the aircraft at a specified zone, and will engage when commanded.
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param #string SquadronName The squadron name.
|
-- @param #string SquadronName The squadron name.
|
||||||
-- @param Core.Zone#ZONE_BASE Zone The @{Zone} object derived from @{Core.Zone#ZONE_BASE} that defines the zone wherein the Patrol will be executed.
|
-- @param Core.Zone#ZONE_BASE Zone The @{Core.Zone} object derived from @{Core.Zone#ZONE_BASE} that defines the zone wherein the Patrol will be executed.
|
||||||
-- @param #number PatrolMinSpeed (optional, default = 50% of max speed) The minimum speed at which the cap can be executed.
|
-- @param #number PatrolMinSpeed (optional, default = 50% of max speed) The minimum speed at which the cap can be executed.
|
||||||
-- @param #number PatrolMaxSpeed (optional, default = 75% of max speed) The maximum speed at which the cap can be executed.
|
-- @param #number PatrolMaxSpeed (optional, default = 75% of max speed) The maximum speed at which the cap can be executed.
|
||||||
-- @param #number PatrolFloorAltitude (optional, default = 1000m ) The minimum altitude at which the cap can be executed.
|
-- @param #number PatrolFloorAltitude (optional, default = 1000m ) The minimum altitude at which the cap can be executed.
|
||||||
@@ -2536,7 +2544,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
-- The Bai patrol will start a patrol of the aircraft at a specified zone, and will engage when commanded.
|
-- The Bai patrol will start a patrol of the aircraft at a specified zone, and will engage when commanded.
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param #string SquadronName The squadron name.
|
-- @param #string SquadronName The squadron name.
|
||||||
-- @param Core.Zone#ZONE_BASE Zone The @{Zone} object derived from @{Core.Zone#ZONE_BASE} that defines the zone wherein the Patrol will be executed.
|
-- @param Core.Zone#ZONE_BASE Zone The @{Core.Zone} object derived from @{Core.Zone#ZONE_BASE} that defines the zone wherein the Patrol will be executed.
|
||||||
-- @param #number FloorAltitude (optional, default = 1000m ) The minimum altitude at which the cap can be executed.
|
-- @param #number FloorAltitude (optional, default = 1000m ) The minimum altitude at which the cap can be executed.
|
||||||
-- @param #number CeilingAltitude (optional, default = 1500m ) The maximum altitude at which the cap can be executed.
|
-- @param #number CeilingAltitude (optional, default = 1500m ) The maximum altitude at which the cap can be executed.
|
||||||
-- @param #number PatrolMinSpeed (optional, default = 50% of max speed) The minimum speed at which the cap can be executed.
|
-- @param #number PatrolMinSpeed (optional, default = 50% of max speed) The minimum speed at which the cap can be executed.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- **AI** -- Models the process of air to ground SEAD engagement for airplanes and helicopters.
|
--- **AI** - Models the process of air to ground SEAD engagement for airplanes and helicopters.
|
||||||
--
|
--
|
||||||
-- This is a class used in the @{AI_A2G_Dispatcher}.
|
-- This is a class used in the @{AI.AI_A2G_Dispatcher}.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -14,61 +14,43 @@
|
|||||||
|
|
||||||
|
|
||||||
--- @type AI_A2G_SEAD
|
--- @type AI_A2G_SEAD
|
||||||
-- @extends AI.AI_A2G_Patrol#AI_AIR_PATROL
|
-- @extends AI.AI_Air_Patrol#AI_AIR_PATROL
|
||||||
|
-- @extends AI.AI_Air_Engage#AI_AIR_ENGAGE
|
||||||
|
|
||||||
|
|
||||||
--- 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.
|
||||||
-- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits.
|
-- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- This cycle will continue.
|
-- This cycle will continue.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- During the patrol, the AI will detect enemy targets, which are reported through the **Detected** event.
|
-- During the patrol, the AI will detect enemy targets, which are reported through the **Detected** event.
|
||||||
--
|
|
||||||
-- 
|
|
||||||
--
|
--
|
||||||
-- When enemies are detected, the AI will automatically engage the enemy.
|
-- When enemies are detected, the AI will automatically engage the enemy.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- Until a fuel or damage threshold has been reached by the AI, or when the AI is commanded to RTB.
|
-- Until a fuel or damage threshold has been reached by the AI, or when the AI is commanded to RTB.
|
||||||
-- When the fuel threshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
|
-- When the fuel threshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- ## 1. AI_A2G_SEAD constructor
|
-- ## 1. AI_A2G_SEAD constructor
|
||||||
--
|
--
|
||||||
-- * @{#AI_A2G_SEAD.New}(): Creates a new AI_A2G_SEAD object.
|
-- * @{#AI_A2G_SEAD.New}(): Creates a new AI_A2G_SEAD object.
|
||||||
--
|
--
|
||||||
-- ## 3. Set the Range of Engagement
|
-- ## 3. Set the Range of Engagement
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- An optional range can be set in meters,
|
-- An optional range can be set in meters,
|
||||||
-- that will define when the AI will engage with the detected airborne enemy targets.
|
-- that will define when the AI will engage with the detected airborne enemy targets.
|
||||||
-- The range can be beyond or smaller than the range of the Patrol Zone.
|
-- The range can be beyond or smaller than the range of the Patrol Zone.
|
||||||
-- The range is applied at the position of the AI.
|
-- The range is applied at the position of the AI.
|
||||||
-- Use the method @{AI.AI_GCI#AI_A2G_SEAD.SetEngageRange}() to define that range.
|
-- Use the method @{#AI_AIR_PATROL.SetEngageRange}() to define that range.
|
||||||
--
|
--
|
||||||
-- ## 4. Set the Zone of Engagement
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
-- 
|
-- 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
|
||||||
-- An optional @{Zone} can be set,
|
--
|
||||||
-- that will define when the AI will engage with the detected airborne enemy targets.
|
|
||||||
-- Use the method @{AI.AI_Cap#AI_A2G_SEAD.SetEngageZone}() to define that Zone.
|
|
||||||
--
|
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_A2G_SEAD
|
-- @field #AI_A2G_SEAD
|
||||||
@@ -76,8 +58,6 @@ AI_A2G_SEAD = {
|
|||||||
ClassName = "AI_A2G_SEAD",
|
ClassName = "AI_A2G_SEAD",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- Creates a new AI_A2G_SEAD object
|
--- Creates a new AI_A2G_SEAD object
|
||||||
-- @param #AI_A2G_SEAD self
|
-- @param #AI_A2G_SEAD self
|
||||||
-- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
@@ -86,7 +66,7 @@ AI_A2G_SEAD = {
|
|||||||
-- @param DCS#Altitude EngageFloorAltitude The lowest altitude in meters where to execute the engagement.
|
-- @param DCS#Altitude EngageFloorAltitude The lowest altitude in meters where to execute the engagement.
|
||||||
-- @param DCS#Altitude EngageCeilingAltitude The highest altitude in meters where to execute the engagement.
|
-- @param DCS#Altitude EngageCeilingAltitude The highest altitude in meters where to execute the engagement.
|
||||||
-- @param DCS#AltitudeType EngageAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to "RADIO".
|
-- @param DCS#AltitudeType EngageAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to "RADIO".
|
||||||
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
|
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
|
||||||
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
|
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
|
||||||
@@ -96,7 +76,7 @@ AI_A2G_SEAD = {
|
|||||||
function AI_A2G_SEAD:New2( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
function AI_A2G_SEAD:New2( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
||||||
|
|
||||||
local AI_Air = AI_AIR:New( AIGroup )
|
local AI_Air = AI_AIR:New( AIGroup )
|
||||||
local AI_Air_Patrol = AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType ) -- #AI_AIR_PATROL
|
local AI_Air_Patrol = AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
||||||
local AI_Air_Engage = AI_AIR_ENGAGE:New( AI_Air_Patrol, AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType )
|
local AI_Air_Engage = AI_AIR_ENGAGE:New( AI_Air_Patrol, AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType )
|
||||||
local self = BASE:Inherit( self, AI_Air_Engage )
|
local self = BASE:Inherit( self, AI_Air_Engage )
|
||||||
|
|
||||||
@@ -111,7 +91,7 @@ end
|
|||||||
-- @param DCS#Speed EngageMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h when engaging a target.
|
-- @param DCS#Speed EngageMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h when engaging a target.
|
||||||
-- @param DCS#Altitude EngageFloorAltitude The lowest altitude in meters where to execute the engagement.
|
-- @param DCS#Altitude EngageFloorAltitude The lowest altitude in meters where to execute the engagement.
|
||||||
-- @param DCS#Altitude EngageCeilingAltitude The highest altitude in meters where to execute the engagement.
|
-- @param DCS#Altitude EngageCeilingAltitude The highest altitude in meters where to execute the engagement.
|
||||||
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
|
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
|
||||||
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
|
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
|
||||||
@@ -127,7 +107,7 @@ end
|
|||||||
--- Evaluate the attack and create an AttackUnitTask list.
|
--- Evaluate the attack and create an AttackUnitTask list.
|
||||||
-- @param #AI_A2G_SEAD self
|
-- @param #AI_A2G_SEAD self
|
||||||
-- @param Core.Set#SET_UNIT AttackSetUnit The set of units to attack.
|
-- @param Core.Set#SET_UNIT AttackSetUnit The set of units to attack.
|
||||||
-- @param Wrappper.Group#GROUP DefenderGroup The group of defenders.
|
-- @param Wrapper.Group#GROUP DefenderGroup The group of defenders.
|
||||||
-- @param #number EngageAltitude The altitude to engage the targets.
|
-- @param #number EngageAltitude The altitude to engage the targets.
|
||||||
-- @return #AI_A2G_SEAD self
|
-- @return #AI_A2G_SEAD self
|
||||||
function AI_A2G_SEAD:CreateAttackUnitTasks( AttackSetUnit, DefenderGroup, EngageAltitude )
|
function AI_A2G_SEAD:CreateAttackUnitTasks( AttackSetUnit, DefenderGroup, EngageAltitude )
|
||||||
|
|||||||
@@ -46,6 +46,11 @@
|
|||||||
-- * **Stop**: Stop the transport process.
|
-- * **Stop**: Stop the transport process.
|
||||||
-- * **Monitor**: Monitor and take action.
|
-- * **Monitor**: Monitor and take action.
|
||||||
--
|
--
|
||||||
|
-- # Developer Note
|
||||||
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- @field #AI_AIR
|
-- @field #AI_AIR
|
||||||
AI_AIR = {
|
AI_AIR = {
|
||||||
ClassName = "AI_AIR",
|
ClassName = "AI_AIR",
|
||||||
@@ -374,7 +379,7 @@ end
|
|||||||
|
|
||||||
--- When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base.
|
--- When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base.
|
||||||
-- Therefore, with a parameter and a calculation of the distance to the home base, the fuel threshold is calculated.
|
-- Therefore, with a parameter and a calculation of the distance to the home base, the fuel threshold is calculated.
|
||||||
-- When the fuel threshold is reached, the AI will continue for a given time its patrol task in orbit, while a new AIControllable is targetted to the AI_AIR.
|
-- When the fuel threshold is reached, the AI will continue for a given time its patrol task in orbit, while a new AIControllable is targeted to the AI_AIR.
|
||||||
-- Once the time is finished, the old AI will return to the base.
|
-- Once the time is finished, the old AI will return to the base.
|
||||||
-- @param #AI_AIR self
|
-- @param #AI_AIR self
|
||||||
-- @param #number FuelThresholdPercentage The threshold in percentage (between 0 and 1) when the AIControllable is considered to get out of fuel.
|
-- @param #number FuelThresholdPercentage The threshold in percentage (between 0 and 1) when the AIControllable is considered to get out of fuel.
|
||||||
@@ -409,7 +414,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- Defines a new patrol route using the @{Process_PatrolZone} parameters and settings.
|
--- Defines a new patrol route using the @{AI.AI_Patrol#AI_PATROL_ZONE} parameters and settings.
|
||||||
-- @param #AI_AIR self
|
-- @param #AI_AIR self
|
||||||
-- @return #AI_AIR self
|
-- @return #AI_AIR self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
|
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
|
||||||
@@ -473,27 +478,27 @@ function AI_AIR:onafterStatus()
|
|||||||
-- self:Home( "Destroy" )
|
-- self:Home( "Destroy" )
|
||||||
-- end
|
-- end
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
|
|
||||||
if not self:Is( "Fuel" ) and not self:Is( "Home" ) and not self:is( "Refuelling" )then
|
if not self:Is( "Fuel" ) and not self:Is( "Home" ) and not self:is( "Refuelling" )then
|
||||||
|
|
||||||
local Fuel = self.Controllable:GetFuelMin()
|
local Fuel = self.Controllable:GetFuelMin()
|
||||||
|
|
||||||
-- If the fuel in the controllable is below the threshold percentage,
|
-- If the fuel in the controllable is below the threshold percentage,
|
||||||
-- then send for refuel in case of a tanker, otherwise RTB.
|
-- then send for refuel in case of a tanker, otherwise RTB.
|
||||||
if Fuel < self.FuelThresholdPercentage then
|
if Fuel < self.FuelThresholdPercentage then
|
||||||
|
|
||||||
if self.TankerName then
|
if self.TankerName then
|
||||||
self:I( self.Controllable:GetName() .. " is out of fuel: " .. Fuel .. " ... Refuelling at Tanker!" )
|
self:I( self.Controllable:GetName() .. " is out of fuel: " .. Fuel .. " ... Refuelling at Tanker!" )
|
||||||
self:Refuel()
|
self:Refuel()
|
||||||
else
|
else
|
||||||
self:I( self.Controllable:GetName() .. " is out of fuel: " .. Fuel .. " ... RTB!" )
|
self:I( self.Controllable:GetName() .. " is out of fuel: " .. Fuel .. " ... RTB!" )
|
||||||
local OldAIControllable = self.Controllable
|
local OldAIControllable = self.Controllable
|
||||||
|
|
||||||
local OrbitTask = OldAIControllable:TaskOrbitCircle( math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude ), self.PatrolMinSpeed )
|
local OrbitTask = OldAIControllable:TaskOrbitCircle( math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude ), self.PatrolMinSpeed )
|
||||||
local TimedOrbitTask = OldAIControllable:TaskControlled( OrbitTask, OldAIControllable:TaskCondition(nil,nil,nil,nil,self.OutOfFuelOrbitTime,nil ) )
|
local TimedOrbitTask = OldAIControllable:TaskControlled( OrbitTask, OldAIControllable:TaskCondition(nil,nil,nil,nil,self.OutOfFuelOrbitTime,nil ) )
|
||||||
OldAIControllable:SetTask( TimedOrbitTask, 10 )
|
OldAIControllable:SetTask( TimedOrbitTask, 10 )
|
||||||
|
|
||||||
self:Fuel()
|
self:Fuel()
|
||||||
RTB = true
|
RTB = true
|
||||||
end
|
end
|
||||||
@@ -504,11 +509,11 @@ function AI_AIR:onafterStatus()
|
|||||||
if self:Is( "Fuel" ) and not self:Is( "Home" ) and not self:is( "Refuelling" ) then
|
if self:Is( "Fuel" ) and not self:Is( "Home" ) and not self:is( "Refuelling" ) then
|
||||||
RTB = true
|
RTB = true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TODO: Check GROUP damage function.
|
-- TODO: Check GROUP damage function.
|
||||||
local Damage = self.Controllable:GetLife()
|
local Damage = self.Controllable:GetLife()
|
||||||
local InitialLife = self.Controllable:GetLife0()
|
local InitialLife = self.Controllable:GetLife0()
|
||||||
|
|
||||||
-- If the group is damaged, then RTB.
|
-- If the group is damaged, then RTB.
|
||||||
-- Note that a group can consist of more units, so if one unit is damaged of a group, the mission may continue.
|
-- Note that a group can consist of more units, so if one unit is damaged of a group, the mission may continue.
|
||||||
-- The damaged unit will RTB due to DCS logic, and the others will continue to engage.
|
-- The damaged unit will RTB due to DCS logic, and the others will continue to engage.
|
||||||
@@ -518,7 +523,7 @@ function AI_AIR:onafterStatus()
|
|||||||
RTB = true
|
RTB = true
|
||||||
self:SetStatusOff()
|
self:SetStatusOff()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check if planes went RTB and are out of control.
|
-- Check if planes went RTB and are out of control.
|
||||||
-- We only check if planes are out of control, when they are in duty.
|
-- We only check if planes are out of control, when they are in duty.
|
||||||
if self.Controllable:HasTask() == false then
|
if self.Controllable:HasTask() == false then
|
||||||
@@ -532,7 +537,7 @@ function AI_AIR:onafterStatus()
|
|||||||
self:Damaged()
|
self:Damaged()
|
||||||
else
|
else
|
||||||
self:I( self.Controllable:GetName() .. " control lost! " )
|
self:I( self.Controllable:GetName() .. " control lost! " )
|
||||||
|
|
||||||
self:LostControl()
|
self:LostControl()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -550,7 +555,7 @@ function AI_AIR:onafterStatus()
|
|||||||
if not self:Is("Home") then
|
if not self:Is("Home") then
|
||||||
self:__Status( 10 )
|
self:__Status( 10 )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -559,11 +564,11 @@ end
|
|||||||
function AI_AIR.RTBRoute( AIGroup, Fsm )
|
function AI_AIR.RTBRoute( AIGroup, Fsm )
|
||||||
|
|
||||||
AIGroup:F( { "AI_AIR.RTBRoute:", AIGroup:GetName() } )
|
AIGroup:F( { "AI_AIR.RTBRoute:", AIGroup:GetName() } )
|
||||||
|
|
||||||
if AIGroup:IsAlive() then
|
if AIGroup:IsAlive() then
|
||||||
Fsm:RTB()
|
Fsm:RTB()
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param Wrapper.Group#GROUP AIGroup
|
--- @param Wrapper.Group#GROUP AIGroup
|
||||||
@@ -576,7 +581,7 @@ function AI_AIR.RTBHold( AIGroup, Fsm )
|
|||||||
local Task = AIGroup:TaskOrbitCircle( 4000, 400 )
|
local Task = AIGroup:TaskOrbitCircle( 4000, 400 )
|
||||||
AIGroup:SetTask( Task )
|
AIGroup:SetTask( Task )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set the min and max factors on RTB speed. Use this, if your planes are heading back to base too fast. Default values are 0.5 and 0.6.
|
--- Set the min and max factors on RTB speed. Use this, if your planes are heading back to base too fast. Default values are 0.5 and 0.6.
|
||||||
@@ -598,54 +603,53 @@ end
|
|||||||
function AI_AIR:onafterRTB( AIGroup, From, Event, To )
|
function AI_AIR:onafterRTB( AIGroup, From, Event, To )
|
||||||
self:F( { AIGroup, From, Event, To } )
|
self:F( { AIGroup, From, Event, To } )
|
||||||
|
|
||||||
|
if AIGroup and AIGroup:IsAlive() then
|
||||||
if AIGroup and AIGroup:IsAlive() then
|
|
||||||
|
|
||||||
self:T( "Group " .. AIGroup:GetName() .. " ... RTB! ( " .. self:GetState() .. " )" )
|
self:T( "Group " .. AIGroup:GetName() .. " ... RTB! ( " .. self:GetState() .. " )" )
|
||||||
|
|
||||||
self:ClearTargetDistance()
|
self:ClearTargetDistance()
|
||||||
--AIGroup:ClearTasks()
|
--AIGroup:ClearTasks()
|
||||||
|
|
||||||
AIGroup:OptionProhibitAfterburner(true)
|
AIGroup:OptionProhibitAfterburner(true)
|
||||||
|
|
||||||
local EngageRoute = {}
|
local EngageRoute = {}
|
||||||
|
|
||||||
--- Calculate the target route point.
|
--- Calculate the target route point.
|
||||||
|
|
||||||
local FromCoord = AIGroup:GetCoordinate()
|
local FromCoord = AIGroup:GetCoordinate()
|
||||||
local ToTargetCoord = self.HomeAirbase:GetCoordinate() -- coordinate is on land height(!)
|
local ToTargetCoord = self.HomeAirbase:GetCoordinate() -- coordinate is on land height(!)
|
||||||
local ToTargetVec3 = ToTargetCoord:GetVec3()
|
local ToTargetVec3 = ToTargetCoord:GetVec3()
|
||||||
ToTargetVec3.y = ToTargetCoord:GetLandHeight()+3000 -- let's set this 1000m/3000 feet above ground
|
ToTargetVec3.y = ToTargetCoord:GetLandHeight()+3000 -- let's set this 1000m/3000 feet above ground
|
||||||
local ToTargetCoord2 = COORDINATE:NewFromVec3( ToTargetVec3 )
|
local ToTargetCoord2 = COORDINATE:NewFromVec3( ToTargetVec3 )
|
||||||
|
|
||||||
if not self.RTBMinSpeed or not self.RTBMaxSpeed then
|
if not self.RTBMinSpeed or not self.RTBMaxSpeed then
|
||||||
local RTBSpeedMax = AIGroup:GetSpeedMax()
|
local RTBSpeedMax = AIGroup:GetSpeedMax()
|
||||||
local RTBSpeedMaxFactor = self.RTBSpeedMaxFactor or 0.6
|
local RTBSpeedMaxFactor = self.RTBSpeedMaxFactor or 0.6
|
||||||
local RTBSpeedMinFactor = self.RTBSpeedMinFactor or 0.5
|
local RTBSpeedMinFactor = self.RTBSpeedMinFactor or 0.5
|
||||||
self:SetRTBSpeed( RTBSpeedMax * RTBSpeedMinFactor, RTBSpeedMax * RTBSpeedMaxFactor)
|
self:SetRTBSpeed( RTBSpeedMax * RTBSpeedMinFactor, RTBSpeedMax * RTBSpeedMaxFactor)
|
||||||
end
|
end
|
||||||
|
|
||||||
local RTBSpeed = math.random( self.RTBMinSpeed, self.RTBMaxSpeed )
|
local RTBSpeed = math.random( self.RTBMinSpeed, self.RTBMaxSpeed )
|
||||||
--local ToAirbaseAngle = FromCoord:GetAngleDegrees( FromCoord:GetDirectionVec3( ToTargetCoord2 ) )
|
--local ToAirbaseAngle = FromCoord:GetAngleDegrees( FromCoord:GetDirectionVec3( ToTargetCoord2 ) )
|
||||||
|
|
||||||
local Distance = FromCoord:Get2DDistance( ToTargetCoord2 )
|
local Distance = FromCoord:Get2DDistance( ToTargetCoord2 )
|
||||||
|
|
||||||
--local ToAirbaseCoord = FromCoord:Translate( 5000, ToAirbaseAngle )
|
--local ToAirbaseCoord = FromCoord:Translate( 5000, ToAirbaseAngle )
|
||||||
local ToAirbaseCoord = ToTargetCoord2
|
local ToAirbaseCoord = ToTargetCoord2
|
||||||
|
|
||||||
if Distance < 5000 then
|
if Distance < 5000 then
|
||||||
self:I( "RTB and near the airbase!" )
|
self:I( "RTB and near the airbase!" )
|
||||||
self:Home()
|
self:Home()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if not AIGroup:InAir() == true then
|
if not AIGroup:InAir() == true then
|
||||||
self:I( "Not anymore in the air, considered Home." )
|
self:I( "Not anymore in the air, considered Home." )
|
||||||
self:Home()
|
self:Home()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- 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,
|
||||||
@@ -666,10 +670,10 @@ function AI_AIR:onafterRTB( AIGroup, From, Event, To )
|
|||||||
|
|
||||||
EngageRoute[#EngageRoute+1] = FromRTBRoutePoint
|
EngageRoute[#EngageRoute+1] = FromRTBRoutePoint
|
||||||
EngageRoute[#EngageRoute+1] = ToRTBRoutePoint
|
EngageRoute[#EngageRoute+1] = ToRTBRoutePoint
|
||||||
|
|
||||||
local Tasks = {}
|
local Tasks = {}
|
||||||
Tasks[#Tasks+1] = AIGroup:TaskFunction( "AI_AIR.RTBRoute", self )
|
Tasks[#Tasks+1] = AIGroup:TaskFunction( "AI_AIR.RTBRoute", self )
|
||||||
|
|
||||||
EngageRoute[#EngageRoute].task = AIGroup:TaskCombo( Tasks )
|
EngageRoute[#EngageRoute].task = AIGroup:TaskCombo( Tasks )
|
||||||
|
|
||||||
AIGroup:OptionROEHoldFire()
|
AIGroup:OptionROEHoldFire()
|
||||||
@@ -677,9 +681,9 @@ function AI_AIR:onafterRTB( AIGroup, From, Event, To )
|
|||||||
|
|
||||||
--- NOW ROUTE THE GROUP!
|
--- NOW ROUTE THE GROUP!
|
||||||
AIGroup:Route( EngageRoute, self.TaskDelay )
|
AIGroup:Route( EngageRoute, self.TaskDelay )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_AIR self
|
--- @param #AI_AIR self
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **AI** - Create an automated AIR defense system based on a detection network of reconnaissance vehicles and air units, coordinating SEAD, BAI and CAP operations.
|
--- **AI** - Create an automated AIR defense system with reconnaissance units, coordinating SEAD, BAI and CAP operations.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
-- * Setup quickly an AIR defense system for a coalition.
|
-- * Setup quickly an AIR defense system for a coalition.
|
||||||
-- * Setup multiple defense zones to defend specific coordinates in your battlefield.
|
-- * Setup multiple defense zones to defend specific coordinates in your battlefield.
|
||||||
-- * Setup (SEAD) Suppression of Air Defense squadrons, to gain control in the air of enemy grounds.
|
-- * Setup (SEAD) Suppression of Air Defense squadrons, to gain control in the air of enemy grounds.
|
||||||
-- * Setup (CAS) Controlled Air Support squadrons, to attack closeby enemy ground units near friendly installations.
|
-- * Setup (CAS) Controlled Air Support squadrons, to attack close by enemy ground units near friendly installations.
|
||||||
-- * Setup (BAI) Battleground Air Interdiction squadrons to attack remote enemy ground units and targets.
|
-- * Setup (BAI) Battleground Air Interdiction squadrons to attack remote enemy ground units and targets.
|
||||||
-- * Define and use a detection network controlled by recce.
|
-- * Define and use a detection network controlled by recce.
|
||||||
-- * Define AIR defense squadrons at airbases, FARPs and carriers.
|
-- * Define AIR defense squadrons at airbases, FARPs and carriers.
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [AID-AIR - AI AIR Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-AIR%20-%20AI%20AIR%20Dispatching)
|
-- [AI_A2A_Dispatcher](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
--
|
--
|
||||||
-- ## 4. How do the defenses decide **when and where to engage** on approaching enemy units?
|
-- ## 4. How do the defenses decide **when and where to engage** on approaching enemy units?
|
||||||
--
|
--
|
||||||
-- The AIR dispacher needs you to setup (various) defense coordinates, which are strategic positions in the battle field to be defended.
|
-- The AIR dispatcher needs you to setup (various) defense coordinates, which are strategic positions in the battle field to be defended.
|
||||||
-- Any ground based enemy approaching within the proximity of such a defense point, may trigger for a defensive action by friendly air units.
|
-- Any ground based enemy approaching within the proximity of such a defense point, may trigger for a defensive action by friendly air units.
|
||||||
--
|
--
|
||||||
-- There are 2 important parameters that play a role in the defensive decision making: defensiveness and reactivity.
|
-- There are 2 important parameters that play a role in the defensive decision making: defensiveness and reactivity.
|
||||||
@@ -108,7 +108,7 @@
|
|||||||
-- ## 5. Are defense coordinates and defense reactivity the only parameters?
|
-- ## 5. Are defense coordinates and defense reactivity the only parameters?
|
||||||
--
|
--
|
||||||
-- No, depending on the target type, and the threat level of the target, the probability of defense will be higher.
|
-- No, depending on the target type, and the threat level of the target, the probability of defense will be higher.
|
||||||
-- In other words, when a SAM-10 radar emitter is detected, its probabilty for defense will be much higher than when a BMP-1 vehicle is
|
-- In other words, when a SAM-10 radar emitter is detected, its probability for defense will be much higher than when a BMP-1 vehicle is
|
||||||
-- detected, even when both enemies are at the same distance from a defense coordinate.
|
-- detected, even when both enemies are at the same distance from a defense coordinate.
|
||||||
-- This will ensure optimal defenses, SEAD tasks will be launched much more quicker against engaging radar emitters, to ensure air superiority.
|
-- This will ensure optimal defenses, SEAD tasks will be launched much more quicker against engaging radar emitters, to ensure air superiority.
|
||||||
-- Approaching main battle tanks will be engaged much faster, than a group of approaching trucks.
|
-- Approaching main battle tanks will be engaged much faster, than a group of approaching trucks.
|
||||||
@@ -117,12 +117,12 @@
|
|||||||
-- ## 6. Which Squadrons will I create and which name will I give each Squadron?
|
-- ## 6. Which Squadrons will I create and which name will I give each Squadron?
|
||||||
--
|
--
|
||||||
-- The AIR defense system works with **Squadrons**. Each Squadron must be given a unique name, that forms the **key** to the squadron.
|
-- The AIR defense system works with **Squadrons**. Each Squadron must be given a unique name, that forms the **key** to the squadron.
|
||||||
-- Several options and activities can be set per Squadron. A free format name can be given, but always ensure that the name is meaningfull
|
-- Several options and activities can be set per Squadron. A free format name can be given, but always ensure that the name is meaningful
|
||||||
-- for your mission, and remember that squadron names are used for communication to the players of your mission.
|
-- for your mission, and remember that squadron names are used for communication to the players of your mission.
|
||||||
--
|
--
|
||||||
-- There are mainly 3 types of defenses: **SEAD**, **CAS** and **BAI**.
|
-- There are mainly 3 types of defenses: **SEAD**, **CAS** and **BAI**.
|
||||||
--
|
--
|
||||||
-- Suppression of Air Defenses (SEAD) are effective agains radar emitters. Close Air Support (CAS) is launched when the enemy is close near friendly units.
|
-- Suppression of Air Defenses (SEAD) are effective against radar emitters. Close Air Support (CAS) is launched when the enemy is close near friendly units.
|
||||||
-- Battleground Air Interdiction (BAI) tasks are launched when there are no friendlies around.
|
-- Battleground Air Interdiction (BAI) tasks are launched when there are no friendlies around.
|
||||||
--
|
--
|
||||||
-- Depending on the defense type, different payloads will be needed. See further points on squadron definition.
|
-- Depending on the defense type, different payloads will be needed. See further points on squadron definition.
|
||||||
@@ -174,13 +174,13 @@
|
|||||||
-- * polygon zones
|
-- * polygon zones
|
||||||
-- * moving zones
|
-- * moving zones
|
||||||
--
|
--
|
||||||
-- Depending on the type of zone selected, a different @{Zone} object needs to be created from a ZONE_ class.
|
-- Depending on the type of zone selected, a different @{Core.Zone} object needs to be created from a ZONE_ class.
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
-- ## 12. Are moving defense coordinates possible?
|
-- ## 12. Are moving defense coordinates possible?
|
||||||
--
|
--
|
||||||
-- Yes, different COORDINATE types are possible to be used.
|
-- Yes, different COORDINATE types are possible to be used.
|
||||||
-- The COORDINATE_UNIT will help you to specify a defense coodinate that is attached to a moving unit.
|
-- The COORDINATE_UNIT will help you to specify a defense coordinate that is attached to a moving unit.
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
-- ## 13. How much defense coordinates do I need to create?
|
-- ## 13. How much defense coordinates do I need to create?
|
||||||
@@ -214,7 +214,7 @@
|
|||||||
-- * From a parking spot with running engines
|
-- * From a parking spot with running engines
|
||||||
-- * From a parking spot with cold engines
|
-- * From a parking spot with cold engines
|
||||||
--
|
--
|
||||||
-- **The default takeoff method is staight in the air.**
|
-- **The default takeoff method is straight in the air.**
|
||||||
-- This takeoff method is the most useful if you want to avoid airplane clutter at airbases!
|
-- This takeoff method is the most useful if you want to avoid airplane clutter at airbases!
|
||||||
-- But it is the least realistic one!
|
-- But it is the least realistic one!
|
||||||
--
|
--
|
||||||
@@ -236,10 +236,10 @@
|
|||||||
--
|
--
|
||||||
-- For each Squadron, depending on the helicopter or airplane type (modern, old) and payload, which overhead is required to provide any defense?
|
-- For each Squadron, depending on the helicopter or airplane type (modern, old) and payload, which overhead is required to provide any defense?
|
||||||
--
|
--
|
||||||
-- In other words, if **X** enemy ground units are detected, how many **Y** defense helicpters or airplanes need to engage (per squadron)?
|
-- In other words, if **X** enemy ground units are detected, how many **Y** defense helicopters or airplanes need to engage (per squadron)?
|
||||||
-- The **Y** is dependent on the type of airplane (era), payload, fuel levels, skills etc.
|
-- The **Y** is dependent on the type of airplane (era), payload, fuel levels, skills etc.
|
||||||
-- But the most important factor is the payload, which is the amount of AIR weapons the defense can carry to attack the enemy ground units.
|
-- But the most important factor is the payload, which is the amount of AIR weapons the defense can carry to attack the enemy ground units.
|
||||||
-- For example, a Ka-50 can carry 16 vikrs, that means, that it potentially can destroy at least 8 ground units without a reload of ammunication.
|
-- For example, a Ka-50 can carry 16 vikrs, that means, that it potentially can destroy at least 8 ground units without a reload of ammunition.
|
||||||
-- That means, that one defender can destroy more enemy ground units.
|
-- That means, that one defender can destroy more enemy ground units.
|
||||||
-- Thus, the overhead is a **factor** that will calculate dynamically how many **Y** defenses will be required based on **X** attackers detected.
|
-- Thus, the overhead is a **factor** that will calculate dynamically how many **Y** defenses will be required based on **X** attackers detected.
|
||||||
--
|
--
|
||||||
@@ -259,7 +259,7 @@
|
|||||||
--
|
--
|
||||||
-- ### Author: **FlightControl** rework of GCICAP + introduction of new concepts (squadrons).
|
-- ### Author: **FlightControl** rework of GCICAP + introduction of new concepts (squadrons).
|
||||||
--
|
--
|
||||||
-- @module AI.AI_AIR_Dispatcher
|
-- @module AI.AI_Air_Dispatcher
|
||||||
-- @image AI_Air_To_Ground_Dispatching.JPG
|
-- @image AI_Air_To_Ground_Dispatching.JPG
|
||||||
|
|
||||||
|
|
||||||
@@ -279,7 +279,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
-- Multiple defense coordinates can be setup. Defense coordinates can be strategic or tactical positions or references to strategic units or scenery.
|
-- Multiple defense coordinates can be setup. Defense coordinates can be strategic or tactical positions or references to strategic units or scenery.
|
||||||
-- The AIR dispatcher will evaluate every x seconds the tactical situation around each defense coordinate. When a defense coordinate
|
-- The AIR dispatcher will evaluate every x seconds the tactical situation around each defense coordinate. When a defense coordinate
|
||||||
-- is under threat, it will communicate through the command center that defensive actions need to be taken and will launch groups of air units for defense.
|
-- is under threat, it will communicate through the command center that defensive actions need to be taken and will launch groups of air units for defense.
|
||||||
-- The level of threat to the defense coordinate varyies upon the strength and types of the enemy units, the distance to the defense point, and the defensiveness parameters.
|
-- The level of threat to the defense coordinate varies upon the strength and types of the enemy units, the distance to the defense point, and the defensiveness parameters.
|
||||||
-- Defensive actions are taken through probability, but the closer and the more threat the enemy poses to the defense coordinate, the faster it will be attacked by friendly AIR units.
|
-- Defensive actions are taken through probability, but the closer and the more threat the enemy poses to the defense coordinate, the faster it will be attacked by friendly AIR units.
|
||||||
--
|
--
|
||||||
-- Please study carefully the underlying explanations how to setup and use this module, as it has many features.
|
-- Please study carefully the underlying explanations how to setup and use this module, as it has many features.
|
||||||
@@ -292,8 +292,6 @@ do -- AI_AIR_DISPATCHER
|
|||||||
--
|
--
|
||||||
-- ## 1. AI\_AIR\_DISPATCHER constructor:
|
-- ## 1. AI\_AIR\_DISPATCHER constructor:
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
--
|
--
|
||||||
-- The @{#AI_AIR_DISPATCHER.New}() method creates a new AI_AIR_DISPATCHER instance.
|
-- The @{#AI_AIR_DISPATCHER.New}() method creates a new AI_AIR_DISPATCHER instance.
|
||||||
--
|
--
|
||||||
@@ -306,8 +304,6 @@ do -- AI_AIR_DISPATCHER
|
|||||||
-- A reconnaissance network, is used to detect enemy ground targets,
|
-- A reconnaissance network, is used to detect enemy ground targets,
|
||||||
-- potentially group them into areas, and to understand the position, level of threat of the enemy.
|
-- potentially group them into areas, and to understand the position, level of threat of the enemy.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- As explained in the introduction, depending on the type of mission you want to achieve, different types of units can be applied to detect ground enemy targets.
|
-- As explained in the introduction, depending on the type of mission you want to achieve, different types of units can be applied to detect ground enemy targets.
|
||||||
-- Ground based units are very useful to act as a reconnaissance, but they lack sometimes the visibility to detect targets at greater range.
|
-- Ground based units are very useful to act as a reconnaissance, but they lack sometimes the visibility to detect targets at greater range.
|
||||||
-- Recce are very useful to acquire the position of enemy ground targets when spread out over the battlefield at strategic positions.
|
-- Recce are very useful to acquire the position of enemy ground targets when spread out over the battlefield at strategic positions.
|
||||||
@@ -328,7 +324,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
-- By spawning in dynamically additional recce, you can ensure that there is sufficient reconnaissance coverage so the defense mechanism is continuously
|
-- By spawning in dynamically additional recce, you can ensure that there is sufficient reconnaissance coverage so the defense mechanism is continuously
|
||||||
-- alerted of new enemy ground targets.
|
-- alerted of new enemy ground targets.
|
||||||
--
|
--
|
||||||
-- The following example defens a new reconnaissance network using a @{Functional.Detection#DETECTION_AREAS} object.
|
-- The following example defense a new reconnaissance network using a @{Functional.Detection#DETECTION_AREAS} object.
|
||||||
--
|
--
|
||||||
-- -- Define a SET_GROUP object that builds a collection of groups that define the recce network.
|
-- -- Define a SET_GROUP object that builds a collection of groups that define the recce network.
|
||||||
-- -- Here we build the network with all the groups that have a name starting with CCCP Recce.
|
-- -- Here we build the network with all the groups that have a name starting with CCCP Recce.
|
||||||
@@ -473,7 +469,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
-- the mission designer can choose to increase or reduce the amount of planes spawned.
|
-- the mission designer can choose to increase or reduce the amount of planes spawned.
|
||||||
--
|
--
|
||||||
-- The method @{#AI_AIR_DISPATCHER.SetSquadron}() defines for you a new squadron.
|
-- The method @{#AI_AIR_DISPATCHER.SetSquadron}() defines for you a new squadron.
|
||||||
-- The provided parameters are the squadron name, airbase name and a list of template prefixe, and a number that indicates the amount of resources.
|
-- The provided parameters are the squadron name, airbase name and a list of template prefixes, and a number that indicates the amount of resources.
|
||||||
--
|
--
|
||||||
-- For example, this defines 3 new squadrons:
|
-- For example, this defines 3 new squadrons:
|
||||||
--
|
--
|
||||||
@@ -619,7 +615,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
-- Depending on the demand of requested takeoffs by the AIR dispatcher, an airfield can become overloaded. Too many aircraft need to be taken
|
-- Depending on the demand of requested takeoffs by the AIR dispatcher, an airfield can become overloaded. Too many aircraft need to be taken
|
||||||
-- off at the same time, which will result in clutter as described above. In order to better control this behaviour, a takeoff scheduler is implemented,
|
-- off at the same time, which will result in clutter as described above. In order to better control this behaviour, a takeoff scheduler is implemented,
|
||||||
-- which can be used to control how many aircraft are ordered for takeoff between specific time intervals.
|
-- which can be used to control how many aircraft are ordered for takeoff between specific time intervals.
|
||||||
-- The takeff intervals can be specified per squadron, which make sense, as each squadron have a "home" airfield.
|
-- The takeoff intervals can be specified per squadron, which make sense, as each squadron have a "home" airfield.
|
||||||
--
|
--
|
||||||
-- For this purpose, the method @{#AI_AIR_DISPATCHER.SetSquadronTakeOffInterval}() can be used to specify the takeoff intervals of
|
-- For this purpose, the method @{#AI_AIR_DISPATCHER.SetSquadronTakeOffInterval}() can be used to specify the takeoff intervals of
|
||||||
-- aircraft groups per squadron to avoid cluttering of aircraft at airbases.
|
-- aircraft groups per squadron to avoid cluttering of aircraft at airbases.
|
||||||
@@ -673,8 +669,6 @@ do -- AI_AIR_DISPATCHER
|
|||||||
--
|
--
|
||||||
-- Use the method @{#AI_AIR_DISPATCHER.SetSquadronGrouping}() to set the grouping of aircraft when spawned in.
|
-- Use the method @{#AI_AIR_DISPATCHER.SetSquadronGrouping}() to set the grouping of aircraft when spawned in.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- In the case of **on call** engagement, the @{#AI_AIR_DISPATCHER.SetSquadronGrouping}() method has additional behaviour.
|
-- In the case of **on call** engagement, the @{#AI_AIR_DISPATCHER.SetSquadronGrouping}() method has additional behaviour.
|
||||||
-- When there aren't enough patrol flights airborne, a on call will be initiated for the remaining
|
-- When there aren't enough patrol flights airborne, a on call will be initiated for the remaining
|
||||||
-- targets to be engaged. Depending on the grouping parameter, the spawned flights for on call aircraft are grouped into this setting.
|
-- targets to be engaged. Depending on the grouping parameter, the spawned flights for on call aircraft are grouped into this setting.
|
||||||
@@ -688,8 +682,6 @@ do -- AI_AIR_DISPATCHER
|
|||||||
-- The effectiveness can be set with the **overhead parameter**. This is a number that is used to calculate the amount of Units that dispatching command will allocate to GCI in surplus of detected amount of units.
|
-- The effectiveness can be set with the **overhead parameter**. This is a number that is used to calculate the amount of Units that dispatching command will allocate to GCI in surplus of detected amount of units.
|
||||||
-- The **default value** of the overhead parameter is 1.0, which means **equal balance**.
|
-- The **default value** of the overhead parameter is 1.0, which means **equal balance**.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- However, depending on the (type of) aircraft (strength and payload) in the squadron and the amount of resources available, this parameter can be changed.
|
-- However, depending on the (type of) aircraft (strength and payload) in the squadron and the amount of resources available, this parameter can be changed.
|
||||||
--
|
--
|
||||||
-- The @{#AI_AIR_DISPATCHER.SetSquadronOverhead}() method can be used to tweak the defense strength,
|
-- The @{#AI_AIR_DISPATCHER.SetSquadronOverhead}() method can be used to tweak the defense strength,
|
||||||
@@ -835,8 +827,6 @@ do -- AI_AIR_DISPATCHER
|
|||||||
--
|
--
|
||||||
-- For example, the following setup will set the default refuel tanker to "Tanker":
|
-- For example, the following setup will set the default refuel tanker to "Tanker":
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- -- Define the CAP
|
-- -- Define the CAP
|
||||||
-- A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-34" }, 20 )
|
-- A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-34" }, 20 )
|
||||||
-- A2ADispatcher:SetSquadronCap( "Sochi", ZONE:New( "PatrolZone" ), 4000, 8000, 600, 800, 1000, 1300 )
|
-- A2ADispatcher:SetSquadronCap( "Sochi", ZONE:New( "PatrolZone" ), 4000, 8000, 600, 800, 1000, 1300 )
|
||||||
@@ -883,6 +873,11 @@ do -- AI_AIR_DISPATCHER
|
|||||||
-- However, the squadron will still stay alive. Any airplane that is airborne will continue its operations until all airborne airplanes
|
-- However, the squadron will still stay alive. Any airplane that is airborne will continue its operations until all airborne airplanes
|
||||||
-- of the squadron will be destroyed. This to keep consistency of air operations not to confuse the players.
|
-- of the squadron will be destroyed. This to keep consistency of air operations not to confuse the players.
|
||||||
--
|
--
|
||||||
|
-- # Developer Note
|
||||||
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- @field #AI_AIR_DISPATCHER
|
-- @field #AI_AIR_DISPATCHER
|
||||||
AI_AIR_DISPATCHER = {
|
AI_AIR_DISPATCHER = {
|
||||||
ClassName = "AI_AIR_DISPATCHER",
|
ClassName = "AI_AIR_DISPATCHER",
|
||||||
@@ -947,7 +942,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
AI_AIR_DISPATCHER.DefenseQueue = {}
|
AI_AIR_DISPATCHER.DefenseQueue = {}
|
||||||
|
|
||||||
--- Defense approach types
|
--- Defense approach types
|
||||||
-- @type #AI_AIR_DISPATCHER.DefenseApproach
|
-- @type AI_AIR_DISPATCHER.DefenseApproach
|
||||||
AI_AIR_DISPATCHER.DefenseApproach = {
|
AI_AIR_DISPATCHER.DefenseApproach = {
|
||||||
Random = 1,
|
Random = 1,
|
||||||
Distance = 2,
|
Distance = 2,
|
||||||
@@ -1021,7 +1016,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
-- @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.
|
||||||
-- @param Tasking.Task_AIR#AI_AIR Task
|
-- @param AI.AI_Air#AI_AIR Task
|
||||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||||
-- @param #string PlayerName
|
-- @param #string PlayerName
|
||||||
|
|
||||||
@@ -1224,7 +1219,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
|
|
||||||
self:I( "Captured " .. AirbaseName )
|
self:I( "Captured " .. AirbaseName )
|
||||||
|
|
||||||
-- Now search for all squadrons located at the airbase, and sanatize them.
|
-- Now search for all squadrons located at the airbase, and sanitize them.
|
||||||
for SquadronName, Squadron in pairs( self.DefenderSquadrons ) do
|
for SquadronName, Squadron in pairs( self.DefenderSquadrons ) do
|
||||||
if Squadron.AirbaseName == AirbaseName then
|
if Squadron.AirbaseName == AirbaseName then
|
||||||
Squadron.ResourceCount = -999 -- The base has been captured, and the resources are eliminated. No more spawning.
|
Squadron.ResourceCount = -999 -- The base has been captured, and the resources are eliminated. No more spawning.
|
||||||
@@ -1376,7 +1371,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
--- Define a border area to simulate a **cold war** scenario.
|
--- Define a border area to simulate a **cold war** scenario.
|
||||||
-- A **cold war** is one where Patrol aircraft patrol their territory but will not attack enemy aircraft or launch GCI aircraft unless enemy aircraft enter their territory. In other words the EWR may detect an enemy aircraft but will only send aircraft to attack it if it crosses the border.
|
-- A **cold war** is one where Patrol aircraft patrol their territory but will not attack enemy aircraft or launch GCI aircraft unless enemy aircraft enter their territory. In other words the EWR may detect an enemy aircraft but will only send aircraft to attack it if it crosses the border.
|
||||||
-- A **hot war** is one where Patrol aircraft will intercept any detected enemy aircraft and GCI aircraft will launch against detected enemy aircraft without regard for territory. In other words if the ground radar can detect the enemy aircraft then it will send Patrol and GCI aircraft to attack it.
|
-- A **hot war** is one where Patrol aircraft will intercept any detected enemy aircraft and GCI aircraft will launch against detected enemy aircraft without regard for territory. In other words if the ground radar can detect the enemy aircraft then it will send Patrol and GCI aircraft to attack it.
|
||||||
-- If it's a cold war then the **borders of red and blue territory** need to be defined using a @{zone} object derived from @{Core.Zone#ZONE_BASE}. This method needs to be used for this.
|
-- If it's a cold war then the **borders of red and blue territory** need to be defined using a @{Core.Zone} object derived from @{Core.Zone#ZONE_BASE}. This method needs to be used for this.
|
||||||
-- If a hot war is chosen then **no borders** actually need to be defined using the helicopter units other than it makes it easier sometimes for the mission maker to envisage where the red and blue territories roughly are. In a hot war the borders are effectively defined by the ground based radar coverage of a coalition. Set the noborders parameter to 1
|
-- If a hot war is chosen then **no borders** actually need to be defined using the helicopter units other than it makes it easier sometimes for the mission maker to envisage where the red and blue territories roughly are. In a hot war the borders are effectively defined by the ground based radar coverage of a coalition. Set the noborders parameter to 1
|
||||||
-- @param #AI_AIR_DISPATCHER self
|
-- @param #AI_AIR_DISPATCHER self
|
||||||
-- @param Core.Zone#ZONE_BASE BorderZone An object derived from ZONE_BASE, or a list of objects derived from ZONE_BASE.
|
-- @param Core.Zone#ZONE_BASE BorderZone An object derived from ZONE_BASE, or a list of objects derived from ZONE_BASE.
|
||||||
@@ -1796,12 +1791,12 @@ do -- AI_AIR_DISPATCHER
|
|||||||
--
|
--
|
||||||
-- @return #AI_AIR_DISPATCHER
|
-- @return #AI_AIR_DISPATCHER
|
||||||
function AI_AIR_DISPATCHER:SetSquadron2( Squadron )
|
function AI_AIR_DISPATCHER:SetSquadron2( Squadron )
|
||||||
|
|
||||||
local SquadronName = Squadron:GetName() -- Retrieves the Squadron Name.
|
local SquadronName = Squadron:GetName() -- Retrieves the Squadron Name.
|
||||||
self.DefenderSquadrons[SquadronName] = self.DefenderSquadrons[SquadronName] or {}
|
self.DefenderSquadrons[SquadronName] = self.DefenderSquadrons[SquadronName] or {}
|
||||||
|
|
||||||
local DefenderSquadron = self.DefenderSquadrons[SquadronName]
|
local DefenderSquadron = self.DefenderSquadrons[SquadronName]
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1812,15 +1807,15 @@ do -- AI_AIR_DISPATCHER
|
|||||||
function AI_AIR_DISPATCHER:GetSquadron( SquadronName )
|
function AI_AIR_DISPATCHER:GetSquadron( SquadronName )
|
||||||
|
|
||||||
local DefenderSquadron = self.DefenderSquadrons[SquadronName]
|
local DefenderSquadron = self.DefenderSquadrons[SquadronName]
|
||||||
|
|
||||||
if not DefenderSquadron then
|
if not DefenderSquadron then
|
||||||
error( "Unknown Squadron for Dispatcher:" .. SquadronName )
|
error( "Unknown Squadron for Dispatcher:" .. SquadronName )
|
||||||
end
|
end
|
||||||
|
|
||||||
return DefenderSquadron
|
return DefenderSquadron
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Set the Squadron visible before startup of the dispatcher.
|
--- Set the Squadron visible before startup of the dispatcher.
|
||||||
-- All planes will be spawned as uncontrolled on the parking spot.
|
-- All planes will be spawned as uncontrolled on the parking spot.
|
||||||
-- They will lock the parking spot.
|
-- They will lock the parking spot.
|
||||||
@@ -1852,7 +1847,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
--- Check if the Squadron is visible before startup of the dispatcher.
|
--- Check if the Squadron is visible before startup of the dispatcher.
|
||||||
-- @param #AI_AIR_DISPATCHER self
|
-- @param #AI_AIR_DISPATCHER self
|
||||||
-- @param #string SquadronName The squadron name.
|
-- @param #string SquadronName The squadron name.
|
||||||
-- @return #bool true if visible.
|
-- @return #boolean true if visible.
|
||||||
-- @usage
|
-- @usage
|
||||||
--
|
--
|
||||||
-- -- Set the Squadron visible before startup of dispatcher.
|
-- -- Set the Squadron visible before startup of dispatcher.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- **AI** -- Models the process of air to ground engagement for airplanes and helicopters.
|
--- **AI** - Models the process of air to ground engagement for airplanes and helicopters.
|
||||||
--
|
--
|
||||||
-- This is a class used in the @{AI_A2G_Dispatcher}.
|
-- This is a class used in the @{AI.AI_A2G_Dispatcher}.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -14,61 +14,45 @@
|
|||||||
|
|
||||||
|
|
||||||
--- @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.
|
||||||
-- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits.
|
-- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- This cycle will continue.
|
-- This cycle will continue.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- During the patrol, the AI will detect enemy targets, which are reported through the **Detected** event.
|
-- During the patrol, the AI will detect enemy targets, which are reported through the **Detected** event.
|
||||||
--
|
|
||||||
-- 
|
|
||||||
--
|
--
|
||||||
-- When enemies are detected, the AI will automatically engage the enemy.
|
-- When enemies are detected, the AI will automatically engage the enemy.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- Until a fuel or damage threshold has been reached by the AI, or when the AI is commanded to RTB.
|
-- Until a fuel or damage threshold has been reached by the AI, or when the AI is commanded to RTB.
|
||||||
-- When the fuel threshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
|
-- When the fuel threshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- ## 1. AI_AIR_ENGAGE constructor
|
-- ## 1. AI_AIR_ENGAGE constructor
|
||||||
--
|
--
|
||||||
-- * @{#AI_AIR_ENGAGE.New}(): Creates a new AI_AIR_ENGAGE object.
|
-- * @{#AI_AIR_ENGAGE.New}(): Creates a new AI_AIR_ENGAGE object.
|
||||||
--
|
--
|
||||||
-- ## 3. Set the Range of Engagement
|
-- ## 2. Set the Zone of Engagement
|
||||||
--
|
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- An optional range can be set in meters,
|
|
||||||
-- that will define when the AI will engage with the detected airborne enemy targets.
|
|
||||||
-- The range can be beyond or smaller than the range of the Patrol Zone.
|
|
||||||
-- The range is applied at the position of the AI.
|
|
||||||
-- Use the method @{AI.AI_GCI#AI_AIR_ENGAGE.SetEngageRange}() to define that range.
|
|
||||||
--
|
--
|
||||||
-- ## 4. Set the Zone of Engagement
|
-- An optional @{Core.Zone} can be set,
|
||||||
--
|
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- An optional @{Zone} can be set,
|
|
||||||
-- that will define when the AI will engage with the detected airborne enemy targets.
|
-- that will define when the AI will engage with the detected airborne enemy targets.
|
||||||
-- Use the method @{AI.AI_Cap#AI_AIR_ENGAGE.SetEngageZone}() to define that Zone.
|
-- Use the method @{AI.AI_CAP#AI_AIR_ENGAGE.SetEngageZone}() to define that Zone.
|
||||||
--
|
--
|
||||||
|
-- # Developer Note
|
||||||
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_AIR_ENGAGE
|
-- @field #AI_AIR_ENGAGE
|
||||||
@@ -451,12 +435,12 @@ function AI_AIR_ENGAGE:onafterEngageRoute( DefenderGroup, From, Event, To, Attac
|
|||||||
-- TODO: A factor of * 3 is way too close. This causes the AI not to engange until merged sometimes!
|
-- TODO: A factor of * 3 is way too close. This causes the AI not to engange until merged sometimes!
|
||||||
if TargetDistance <= EngageDistance * 9 then
|
if TargetDistance <= EngageDistance * 9 then
|
||||||
|
|
||||||
self:I(string.format("AI_AIR_ENGAGE onafterEngageRoute ==> __Engage - target distance = %.1f km", TargetDistance/1000))
|
--self:I(string.format("AI_AIR_ENGAGE onafterEngageRoute ==> __Engage - target distance = %.1f km", TargetDistance/1000))
|
||||||
self:__Engage( 0.1, AttackSetUnit )
|
self:__Engage( 0.1, AttackSetUnit )
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
self:I(string.format("FF AI_AIR_ENGAGE onafterEngageRoute ==> Routing - target distance = %.1f km", TargetDistance/1000))
|
--self:I(string.format("FF AI_AIR_ENGAGE onafterEngageRoute ==> Routing - target distance = %.1f km", TargetDistance/1000))
|
||||||
|
|
||||||
local EngageRoute = {}
|
local EngageRoute = {}
|
||||||
local AttackTasks = {}
|
local AttackTasks = {}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **AI** -- Models the process of A2G patrolling and engaging ground targets for airplanes and helicopters.
|
--- **AI** - Models the process of A2G patrolling and engaging ground targets for airplanes and helicopters.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -12,8 +12,7 @@
|
|||||||
--- @type AI_AIR_PATROL
|
--- @type AI_AIR_PATROL
|
||||||
-- @extends AI.AI_Air#AI_AIR
|
-- @extends AI.AI_Air#AI_AIR
|
||||||
|
|
||||||
|
--- The AI_AIR_PATROL class implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Group}
|
||||||
--- The AI_AIR_PATROL class implements the core functions to patrol a @{Zone} by an AI @{Wrapper.Group} or @{Wrapper.Group}
|
|
||||||
-- and automatically engage any airborne enemies that are within a certain range or within a certain zone.
|
-- and automatically engage any airborne enemies that are within a certain range or within a certain zone.
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
@@ -80,16 +79,13 @@
|
|||||||
-- that will define when the AI will engage with the detected airborne enemy targets.
|
-- that will define when the AI will engage with the detected airborne enemy targets.
|
||||||
-- The range can be beyond or smaller than the range of the Patrol Zone.
|
-- The range can be beyond or smaller than the range of the Patrol Zone.
|
||||||
-- The range is applied at the position of the AI.
|
-- The range is applied at the position of the AI.
|
||||||
-- Use the method @{AI.AI_CAP#AI_AIR_PATROL.SetEngageRange}() to define that range.
|
-- Use the method @{#AI_AIR_PATROL.SetEngageRange}() to define that range.
|
||||||
--
|
--
|
||||||
-- ## 4. Set the Zone of Engagement
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
-- 
|
-- 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
|
||||||
-- An optional @{Zone} can be set,
|
--
|
||||||
-- that will define when the AI will engage with the detected airborne enemy targets.
|
|
||||||
-- Use the method @{AI.AI_Cap#AI_AIR_PATROL.SetEngageZone}() to define that Zone.
|
|
||||||
--
|
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_AIR_PATROL
|
-- @field #AI_AIR_PATROL
|
||||||
@@ -101,7 +97,7 @@ AI_AIR_PATROL = {
|
|||||||
-- @param #AI_AIR_PATROL self
|
-- @param #AI_AIR_PATROL self
|
||||||
-- @param AI.AI_Air#AI_AIR AI_Air The AI_AIR FSM.
|
-- @param AI.AI_Air#AI_AIR AI_Air The AI_AIR FSM.
|
||||||
-- @param Wrapper.Group#GROUP AIGroup The AI group.
|
-- @param Wrapper.Group#GROUP AIGroup The AI group.
|
||||||
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
|
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
|
||||||
-- @param DCS#Altitude PatrolFloorAltitude (optional, default = 1000m ) The lowest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolFloorAltitude (optional, default = 1000m ) The lowest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Altitude PatrolCeilingAltitude (optional, default = 1500m ) The highest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolCeilingAltitude (optional, default = 1500m ) The highest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Speed PatrolMinSpeed (optional, default = 50% of max speed) The minimum speed of the @{Wrapper.Group} in km/h.
|
-- @param DCS#Speed PatrolMinSpeed (optional, default = 50% of max speed) The minimum speed of the @{Wrapper.Group} in km/h.
|
||||||
@@ -114,17 +110,17 @@ function AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, Pa
|
|||||||
local self = BASE:Inherit( self, AI_Air ) -- #AI_AIR_PATROL
|
local self = BASE:Inherit( self, AI_Air ) -- #AI_AIR_PATROL
|
||||||
|
|
||||||
local SpeedMax = AIGroup:GetSpeedMax()
|
local SpeedMax = AIGroup:GetSpeedMax()
|
||||||
|
|
||||||
self.PatrolZone = PatrolZone
|
self.PatrolZone = PatrolZone
|
||||||
|
|
||||||
self.PatrolFloorAltitude = PatrolFloorAltitude or 1000
|
self.PatrolFloorAltitude = PatrolFloorAltitude or 1000
|
||||||
self.PatrolCeilingAltitude = PatrolCeilingAltitude or 1500
|
self.PatrolCeilingAltitude = PatrolCeilingAltitude or 1500
|
||||||
self.PatrolMinSpeed = PatrolMinSpeed or SpeedMax * 0.5
|
self.PatrolMinSpeed = PatrolMinSpeed or SpeedMax * 0.5
|
||||||
self.PatrolMaxSpeed = PatrolMaxSpeed or SpeedMax * 0.75
|
self.PatrolMaxSpeed = PatrolMaxSpeed or SpeedMax * 0.75
|
||||||
|
|
||||||
-- defafult PatrolAltType to "RADIO" if not specified
|
-- defafult PatrolAltType to "RADIO" if not specified
|
||||||
self.PatrolAltType = PatrolAltType or "RADIO"
|
self.PatrolAltType = PatrolAltType or "RADIO"
|
||||||
|
|
||||||
self:AddTransition( { "Started", "Airborne", "Refuelling" }, "Patrol", "Patrolling" )
|
self:AddTransition( { "Started", "Airborne", "Refuelling" }, "Patrol", "Patrolling" )
|
||||||
|
|
||||||
--- OnBefore Transition Handler for Event Patrol.
|
--- OnBefore Transition Handler for Event Patrol.
|
||||||
@@ -135,7 +131,7 @@ function AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, Pa
|
|||||||
-- @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 Patrol.
|
--- OnAfter Transition Handler for Event Patrol.
|
||||||
-- @function [parent=#AI_AIR_PATROL] OnAfterPatrol
|
-- @function [parent=#AI_AIR_PATROL] OnAfterPatrol
|
||||||
-- @param #AI_AIR_PATROL self
|
-- @param #AI_AIR_PATROL self
|
||||||
@@ -143,16 +139,16 @@ function AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, Pa
|
|||||||
-- @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.
|
||||||
|
|
||||||
--- Synchronous Event Trigger for Event Patrol.
|
--- Synchronous Event Trigger for Event Patrol.
|
||||||
-- @function [parent=#AI_AIR_PATROL] Patrol
|
-- @function [parent=#AI_AIR_PATROL] Patrol
|
||||||
-- @param #AI_AIR_PATROL self
|
-- @param #AI_AIR_PATROL self
|
||||||
|
|
||||||
--- Asynchronous Event Trigger for Event Patrol.
|
--- Asynchronous Event Trigger for Event Patrol.
|
||||||
-- @function [parent=#AI_AIR_PATROL] __Patrol
|
-- @function [parent=#AI_AIR_PATROL] __Patrol
|
||||||
-- @param #AI_AIR_PATROL self
|
-- @param #AI_AIR_PATROL self
|
||||||
-- @param #number Delay The delay in seconds.
|
-- @param #number Delay The delay in seconds.
|
||||||
|
|
||||||
--- OnLeave Transition Handler for State Patrolling.
|
--- OnLeave Transition Handler for State Patrolling.
|
||||||
-- @function [parent=#AI_AIR_PATROL] OnLeavePatrolling
|
-- @function [parent=#AI_AIR_PATROL] OnLeavePatrolling
|
||||||
-- @param #AI_AIR_PATROL self
|
-- @param #AI_AIR_PATROL self
|
||||||
@@ -161,7 +157,7 @@ function AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, Pa
|
|||||||
-- @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.
|
||||||
|
|
||||||
--- OnEnter Transition Handler for State Patrolling.
|
--- OnEnter Transition Handler for State Patrolling.
|
||||||
-- @function [parent=#AI_AIR_PATROL] OnEnterPatrolling
|
-- @function [parent=#AI_AIR_PATROL] OnEnterPatrolling
|
||||||
-- @param #AI_AIR_PATROL self
|
-- @param #AI_AIR_PATROL self
|
||||||
@@ -169,9 +165,9 @@ function AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, Pa
|
|||||||
-- @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.
|
||||||
|
|
||||||
self:AddTransition( "Patrolling", "PatrolRoute", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_AIR_PATROL.
|
self:AddTransition( "Patrolling", "PatrolRoute", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_AIR_PATROL.
|
||||||
|
|
||||||
--- OnBefore Transition Handler for Event PatrolRoute.
|
--- OnBefore Transition Handler for Event PatrolRoute.
|
||||||
-- @function [parent=#AI_AIR_PATROL] OnBeforePatrolRoute
|
-- @function [parent=#AI_AIR_PATROL] OnBeforePatrolRoute
|
||||||
-- @param #AI_AIR_PATROL self
|
-- @param #AI_AIR_PATROL self
|
||||||
@@ -180,7 +176,7 @@ function AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, Pa
|
|||||||
-- @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 PatrolRoute.
|
--- OnAfter Transition Handler for Event PatrolRoute.
|
||||||
-- @function [parent=#AI_AIR_PATROL] OnAfterPatrolRoute
|
-- @function [parent=#AI_AIR_PATROL] OnAfterPatrolRoute
|
||||||
-- @param #AI_AIR_PATROL self
|
-- @param #AI_AIR_PATROL self
|
||||||
@@ -188,23 +184,21 @@ function AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, Pa
|
|||||||
-- @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.
|
||||||
|
|
||||||
--- Synchronous Event Trigger for Event PatrolRoute.
|
--- Synchronous Event Trigger for Event PatrolRoute.
|
||||||
-- @function [parent=#AI_AIR_PATROL] PatrolRoute
|
-- @function [parent=#AI_AIR_PATROL] PatrolRoute
|
||||||
-- @param #AI_AIR_PATROL self
|
-- @param #AI_AIR_PATROL self
|
||||||
|
|
||||||
--- Asynchronous Event Trigger for Event PatrolRoute.
|
--- Asynchronous Event Trigger for Event PatrolRoute.
|
||||||
-- @function [parent=#AI_AIR_PATROL] __PatrolRoute
|
-- @function [parent=#AI_AIR_PATROL] __PatrolRoute
|
||||||
-- @param #AI_AIR_PATROL self
|
-- @param #AI_AIR_PATROL self
|
||||||
-- @param #number Delay The delay in seconds.
|
-- @param #number Delay The delay in seconds.
|
||||||
|
|
||||||
|
|
||||||
self:AddTransition( "*", "Reset", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_AIR_PATROL.
|
self:AddTransition( "*", "Reset", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_AIR_PATROL.
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Set the Engage Range when the AI will engage with airborne enemies.
|
--- Set the Engage Range when the AI will engage with airborne enemies.
|
||||||
-- @param #AI_AIR_PATROL self
|
-- @param #AI_AIR_PATROL self
|
||||||
-- @param #number EngageRange The Engage Range.
|
-- @param #number EngageRange The Engage Range.
|
||||||
@@ -230,7 +224,7 @@ end
|
|||||||
-- @param #table CapCoordinates Table of coordinates of first race track point. Second point is determined by leg length and heading.
|
-- @param #table CapCoordinates Table of coordinates of first race track point. Second point is determined by leg length and heading.
|
||||||
-- @return #AI_AIR_PATROL self
|
-- @return #AI_AIR_PATROL self
|
||||||
function AI_AIR_PATROL:SetRaceTrackPattern(LegMin, LegMax, HeadingMin, HeadingMax, DurationMin, DurationMax, CapCoordinates)
|
function AI_AIR_PATROL:SetRaceTrackPattern(LegMin, LegMax, HeadingMin, HeadingMax, DurationMin, DurationMax, CapCoordinates)
|
||||||
|
|
||||||
self.racetrack=true
|
self.racetrack=true
|
||||||
self.racetracklegmin=LegMin or 10000
|
self.racetracklegmin=LegMin or 10000
|
||||||
self.racetracklegmax=LegMax or 15000
|
self.racetracklegmax=LegMax or 15000
|
||||||
@@ -238,18 +232,16 @@ function AI_AIR_PATROL:SetRaceTrackPattern(LegMin, LegMax, HeadingMin, HeadingMa
|
|||||||
self.racetrackheadingmax=HeadingMax or 180
|
self.racetrackheadingmax=HeadingMax or 180
|
||||||
self.racetrackdurationmin=DurationMin
|
self.racetrackdurationmin=DurationMin
|
||||||
self.racetrackdurationmax=DurationMax
|
self.racetrackdurationmax=DurationMax
|
||||||
|
|
||||||
if self.racetrackdurationmax and not self.racetrackdurationmin then
|
if self.racetrackdurationmax and not self.racetrackdurationmin then
|
||||||
self.racetrackdurationmin=self.racetrackdurationmax
|
self.racetrackdurationmin=self.racetrackdurationmax
|
||||||
end
|
end
|
||||||
|
|
||||||
self.racetrackcapcoordinates=CapCoordinates
|
self.racetrackcapcoordinates=CapCoordinates
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Defines a new patrol route using the @{AI.AI_Patrol#AI_PATROL_ZONE} parameters and settings.
|
||||||
|
|
||||||
--- Defines a new patrol route using the @{Process_PatrolZone} parameters and settings.
|
|
||||||
-- @param #AI_AIR_PATROL self
|
-- @param #AI_AIR_PATROL self
|
||||||
-- @return #AI_AIR_PATROL self
|
-- @return #AI_AIR_PATROL self
|
||||||
-- @param Wrapper.Group#GROUP AIPatrol The Group Object managed by the FSM.
|
-- @param Wrapper.Group#GROUP AIPatrol The Group Object managed by the FSM.
|
||||||
@@ -262,7 +254,7 @@ function AI_AIR_PATROL:onafterPatrol( AIPatrol, From, Event, To )
|
|||||||
self:ClearTargetDistance()
|
self:ClearTargetDistance()
|
||||||
|
|
||||||
self:__PatrolRoute( self.TaskDelay )
|
self:__PatrolRoute( self.TaskDelay )
|
||||||
|
|
||||||
AIPatrol:OnReSpawn(
|
AIPatrol:OnReSpawn(
|
||||||
function( PatrolGroup )
|
function( PatrolGroup )
|
||||||
self:__Reset( self.TaskDelay )
|
self:__Reset( self.TaskDelay )
|
||||||
@@ -271,7 +263,7 @@ function AI_AIR_PATROL:onafterPatrol( AIPatrol, From, Event, To )
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- This statis method is called from the route path within the last task at the last waaypoint of the AIPatrol.
|
--- This static method is called from the route path within the last task at the last waypoint of the AIPatrol.
|
||||||
-- Note that this method is required, as triggers the next route when patrolling for the AIPatrol.
|
-- Note that this method is required, as triggers the next route when patrolling for the AIPatrol.
|
||||||
-- @param Wrapper.Group#GROUP AIPatrol The AI group.
|
-- @param Wrapper.Group#GROUP AIPatrol The AI group.
|
||||||
-- @param #AI_AIR_PATROL Fsm The FSM.
|
-- @param #AI_AIR_PATROL Fsm The FSM.
|
||||||
@@ -282,10 +274,10 @@ function AI_AIR_PATROL.___PatrolRoute( AIPatrol, Fsm )
|
|||||||
if AIPatrol and AIPatrol:IsAlive() then
|
if AIPatrol and AIPatrol:IsAlive() then
|
||||||
Fsm:PatrolRoute()
|
Fsm:PatrolRoute()
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Defines a new patrol route using the @{Process_PatrolZone} parameters and settings.
|
--- Defines a new patrol route using the @{AI.AI_Patrol#AI_PATROL_ZONE} parameters and settings.
|
||||||
-- @param #AI_AIR_PATROL self
|
-- @param #AI_AIR_PATROL self
|
||||||
-- @param Wrapper.Group#GROUP AIPatrol The Group managed by the FSM.
|
-- @param Wrapper.Group#GROUP AIPatrol The Group managed by the FSM.
|
||||||
-- @param #string From The From State string.
|
-- @param #string From The From State string.
|
||||||
@@ -300,21 +292,20 @@ function AI_AIR_PATROL:onafterPatrolRoute( AIPatrol, From, Event, To )
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if AIPatrol and AIPatrol:IsAlive() then
|
if AIPatrol and AIPatrol:IsAlive() then
|
||||||
|
|
||||||
local PatrolRoute = {}
|
local PatrolRoute = {}
|
||||||
|
|
||||||
--- Calculate the target route point.
|
--- Calculate the target route point.
|
||||||
|
|
||||||
local CurrentCoord = AIPatrol:GetCoordinate()
|
local CurrentCoord = AIPatrol:GetCoordinate()
|
||||||
|
|
||||||
local altitude= math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude )
|
local altitude= math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude )
|
||||||
|
|
||||||
local ToTargetCoord = self.PatrolZone:GetRandomPointVec2()
|
local ToTargetCoord = self.PatrolZone:GetRandomPointVec2()
|
||||||
ToTargetCoord:SetAlt( altitude )
|
ToTargetCoord:SetAlt( altitude )
|
||||||
self:SetTargetDistance( ToTargetCoord ) -- For RTB status check
|
self:SetTargetDistance( ToTargetCoord ) -- For RTB status check
|
||||||
|
|
||||||
local ToTargetSpeed = math.random( self.PatrolMinSpeed, self.PatrolMaxSpeed )
|
local ToTargetSpeed = math.random( self.PatrolMinSpeed, self.PatrolMaxSpeed )
|
||||||
local speedkmh=ToTargetSpeed
|
local speedkmh=ToTargetSpeed
|
||||||
|
|
||||||
@@ -322,31 +313,31 @@ function AI_AIR_PATROL:onafterPatrolRoute( AIPatrol, From, Event, To )
|
|||||||
PatrolRoute[#PatrolRoute+1] = FromWP
|
PatrolRoute[#PatrolRoute+1] = FromWP
|
||||||
|
|
||||||
if self.racetrack then
|
if self.racetrack then
|
||||||
|
|
||||||
-- Random heading.
|
-- Random heading.
|
||||||
local heading = math.random(self.racetrackheadingmin, self.racetrackheadingmax)
|
local heading = math.random(self.racetrackheadingmin, self.racetrackheadingmax)
|
||||||
|
|
||||||
-- Random leg length.
|
-- Random leg length.
|
||||||
local leg=math.random(self.racetracklegmin, self.racetracklegmax)
|
local leg=math.random(self.racetracklegmin, self.racetracklegmax)
|
||||||
|
|
||||||
-- Random duration if any.
|
-- Random duration if any.
|
||||||
local duration = self.racetrackdurationmin
|
local duration = self.racetrackdurationmin
|
||||||
if self.racetrackdurationmax then
|
if self.racetrackdurationmax then
|
||||||
duration=math.random(self.racetrackdurationmin, self.racetrackdurationmax)
|
duration=math.random(self.racetrackdurationmin, self.racetrackdurationmax)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- CAP coordinate.
|
-- CAP coordinate.
|
||||||
local c0=self.PatrolZone:GetRandomCoordinate()
|
local c0=self.PatrolZone:GetRandomCoordinate()
|
||||||
if self.racetrackcapcoordinates and #self.racetrackcapcoordinates>0 then
|
if self.racetrackcapcoordinates and #self.racetrackcapcoordinates>0 then
|
||||||
c0=self.racetrackcapcoordinates[math.random(#self.racetrackcapcoordinates)]
|
c0=self.racetrackcapcoordinates[math.random(#self.racetrackcapcoordinates)]
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Race track points.
|
-- Race track points.
|
||||||
local c1=c0:SetAltitude(altitude) --Core.Point#COORDINATE
|
local c1=c0:SetAltitude(altitude) --Core.Point#COORDINATE
|
||||||
local c2=c1:Translate(leg, heading):SetAltitude(altitude)
|
local c2=c1:Translate(leg, heading):SetAltitude(altitude)
|
||||||
|
|
||||||
self:SetTargetDistance(c0) -- For RTB status check
|
self:SetTargetDistance(c0) -- For RTB status check
|
||||||
|
|
||||||
-- Debug:
|
-- Debug:
|
||||||
self:T(string.format("Patrol zone race track: v=%.1f knots, h=%.1f ft, heading=%03d, leg=%d m, t=%s sec", UTILS.KmphToKnots(speedkmh), UTILS.MetersToFeet(altitude), heading, leg, tostring(duration)))
|
self:T(string.format("Patrol zone race track: v=%.1f knots, h=%.1f ft, heading=%03d, leg=%d m, t=%s sec", UTILS.KmphToKnots(speedkmh), UTILS.MetersToFeet(altitude), heading, leg, tostring(duration)))
|
||||||
--c1:MarkToAll("Race track c1")
|
--c1:MarkToAll("Race track c1")
|
||||||
@@ -354,39 +345,41 @@ function AI_AIR_PATROL:onafterPatrolRoute( AIPatrol, From, Event, To )
|
|||||||
|
|
||||||
-- Task to orbit.
|
-- Task to orbit.
|
||||||
local taskOrbit=AIPatrol:TaskOrbit(c1, altitude, UTILS.KmphToMps(speedkmh), c2)
|
local taskOrbit=AIPatrol:TaskOrbit(c1, altitude, UTILS.KmphToMps(speedkmh), c2)
|
||||||
|
|
||||||
-- Task function to redo the patrol at other random position.
|
-- Task function to redo the patrol at other random position.
|
||||||
local taskPatrol=AIPatrol:TaskFunction("AI_AIR_PATROL.___PatrolRoute", self)
|
local taskPatrol=AIPatrol:TaskFunction("AI_AIR_PATROL.___PatrolRoute", self)
|
||||||
|
|
||||||
-- Controlled task with task condition.
|
-- Controlled task with task condition.
|
||||||
local taskCond=AIPatrol:TaskCondition(nil, nil, nil, nil, duration, nil)
|
local taskCond=AIPatrol:TaskCondition(nil, nil, nil, nil, duration, nil)
|
||||||
local taskCont=AIPatrol:TaskControlled(taskOrbit, taskCond)
|
local taskCont=AIPatrol:TaskControlled(taskOrbit, taskCond)
|
||||||
|
|
||||||
-- Second waypoint
|
-- Second waypoint
|
||||||
PatrolRoute[2]=c1:WaypointAirTurningPoint(self.PatrolAltType, speedkmh, {taskCont, taskPatrol}, "CAP Orbit")
|
PatrolRoute[2]=c1:WaypointAirTurningPoint(self.PatrolAltType, speedkmh, {taskCont, taskPatrol}, "CAP Orbit")
|
||||||
|
|
||||||
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, POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, ToTargetSpeed, true)
|
||||||
PatrolRoute[#PatrolRoute+1] = ToWP
|
PatrolRoute[#PatrolRoute+1] = ToWP
|
||||||
|
|
||||||
local Tasks = {}
|
local Tasks = {}
|
||||||
Tasks[#Tasks+1] = AIPatrol:TaskFunction("AI_AIR_PATROL.___PatrolRoute", self)
|
Tasks[#Tasks+1] = AIPatrol:TaskFunction("AI_AIR_PATROL.___PatrolRoute", self)
|
||||||
PatrolRoute[#PatrolRoute].task = AIPatrol:TaskCombo( Tasks )
|
PatrolRoute[#PatrolRoute].task = AIPatrol:TaskCombo( Tasks )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
AIPatrol:OptionROEReturnFire()
|
AIPatrol:OptionROEReturnFire()
|
||||||
AIPatrol:OptionROTEvadeFire()
|
AIPatrol:OptionROTEvadeFire()
|
||||||
|
|
||||||
AIPatrol:Route( PatrolRoute, self.TaskDelay )
|
AIPatrol:Route( PatrolRoute, self.TaskDelay )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param Wrapper.Group#GROUP AIPatrol
|
--- Resumes the AIPatrol
|
||||||
|
-- @param Wrapper.Group#GROUP AIPatrol
|
||||||
|
-- @param Core.Fsm#FSM Fsm
|
||||||
function AI_AIR_PATROL.Resume( AIPatrol, Fsm )
|
function AI_AIR_PATROL.Resume( AIPatrol, Fsm )
|
||||||
|
|
||||||
AIPatrol:F( { "AI_AIR_PATROL.Resume:", AIPatrol:GetName() } )
|
AIPatrol:F( { "AI_AIR_PATROL.Resume:", AIPatrol:GetName() } )
|
||||||
@@ -394,5 +387,5 @@ function AI_AIR_PATROL.Resume( AIPatrol, Fsm )
|
|||||||
Fsm:__Reset( Fsm.TaskDelay )
|
Fsm:__Reset( Fsm.TaskDelay )
|
||||||
Fsm:__PatrolRoute( Fsm.TaskDelay )
|
Fsm:__PatrolRoute( Fsm.TaskDelay )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- **AI** - Models squadrons for airplanes and helicopters.
|
--- **AI** - Models squadrons for airplanes and helicopters.
|
||||||
--
|
--
|
||||||
-- This is a class used in the @{AI_Air_Dispatcher} and derived dispatcher classes.
|
-- This is a class used in the @{AI.AI_Air_Dispatcher} and derived dispatcher classes.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -18,7 +18,12 @@
|
|||||||
|
|
||||||
|
|
||||||
--- Implements the core functions modeling squadrons for airplanes and helicopters.
|
--- Implements the core functions modeling squadrons for airplanes and helicopters.
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_AIR_SQUADRON
|
-- @field #AI_AIR_SQUADRON
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **AI** -- Peform Battlefield Area Interdiction (BAI) within an engagement zone.
|
--- **AI** - Peform Battlefield Area Interdiction (BAI) within an engagement zone.
|
||||||
--
|
--
|
||||||
-- **Features:**
|
-- **Features:**
|
||||||
--
|
--
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/BAI%20-%20Battlefield%20Air%20Interdiction)
|
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_BAI)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -22,21 +22,21 @@
|
|||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
-- ### Contributions:
|
-- ### Contributions:
|
||||||
--
|
--
|
||||||
-- * **[Gunterlund](http://forums.eagle.ru:8080/member.php?u=75036)**: Test case revision.
|
-- * **Gunterlund**: Test case revision.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @module AI.AI_Bai
|
-- @module AI.AI_BAI
|
||||||
-- @image AI_Battlefield_Air_Interdiction.JPG
|
-- @image AI_Battlefield_Air_Interdiction.JPG
|
||||||
|
|
||||||
|
|
||||||
--- AI_BAI_ZONE class
|
--- AI_BAI_ZONE class
|
||||||
-- @type AI_BAI_ZONE
|
-- @type AI_BAI_ZONE
|
||||||
-- @field Wrapper.Controllable#CONTROLLABLE AIControllable The @{Wrapper.Controllable} patrolling.
|
-- @field Wrapper.Controllable#CONTROLLABLE AIControllable The @{Wrapper.Controllable} patrolling.
|
||||||
-- @field Core.Zone#ZONE_BASE TargetZone The @{Zone} where the patrol needs to be executed.
|
-- @field Core.Zone#ZONE_BASE TargetZone The @{Core.Zone} where the patrol needs to be executed.
|
||||||
-- @extends AI.AI_Patrol#AI_PATROL_ZONE
|
-- @extends AI.AI_Patrol#AI_PATROL_ZONE
|
||||||
|
|
||||||
--- Implements the core functions to provide BattleGround Air Interdiction in an Engage @{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.
|
||||||
--
|
--
|
||||||
@@ -130,7 +130,12 @@
|
|||||||
-- AIBAIZone:SearchOff()
|
-- AIBAIZone:SearchOff()
|
||||||
--
|
--
|
||||||
-- Searching can be switched back on with the method @{#AI_BAI_ZONE.SearchOn}(). Use the method @{#AI_BAI_ZONE.SearchOnOff}() to flexibily switch searching on or off.
|
-- Searching can be switched back on with the method @{#AI_BAI_ZONE.SearchOn}(). Use the method @{#AI_BAI_ZONE.SearchOnOff}() to flexibily switch searching on or off.
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_BAI_ZONE
|
-- @field #AI_BAI_ZONE
|
||||||
@@ -142,7 +147,7 @@ AI_BAI_ZONE = {
|
|||||||
|
|
||||||
--- Creates a new AI_BAI_ZONE object
|
--- Creates a new AI_BAI_ZONE object
|
||||||
-- @param #AI_BAI_ZONE self
|
-- @param #AI_BAI_ZONE self
|
||||||
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
|
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
|
||||||
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Controllable} in km/h.
|
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Controllable} in km/h.
|
||||||
@@ -566,7 +571,7 @@ function AI_BAI_ZONE:onafterEngage( Controllable, From, Event, To,
|
|||||||
|
|
||||||
EngageRoute[#EngageRoute].task = Controllable:TaskCombo( AttackTasks )
|
EngageRoute[#EngageRoute].task = Controllable:TaskCombo( AttackTasks )
|
||||||
|
|
||||||
--- Define a random point in the @{Zone}. The AI will fly to that point within the zone.
|
--- Define a random point in the @{Core.Zone}. The AI will fly to that point within the zone.
|
||||||
|
|
||||||
--- Find a random 2D point in EngageZone.
|
--- Find a random 2D point in EngageZone.
|
||||||
local ToTargetVec2 = self.EngageZone:GetRandomVec2()
|
local ToTargetVec2 = self.EngageZone:GetRandomVec2()
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **AI** -- Balance player slots with AI to create an engaging simulation environment, independent of the amount of players.
|
--- **AI** - Balance player slots with AI to create an engaging simulation environment, independent of the amount of players.
|
||||||
--
|
--
|
||||||
-- **Features:**
|
-- **Features:**
|
||||||
--
|
--
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AIB%20-%20AI%20Balancing)
|
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Balancer)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
-- ### Contributions:
|
-- ### Contributions:
|
||||||
--
|
--
|
||||||
-- * **[Dutch_Baron](https://forums.eagle.ru/member.php?u=112075)**: Working together with James has resulted in the creation of the AI_BALANCER class. James has shared his ideas on balancing AI with air units, and together we made a first design which you can use now :-)
|
-- * **Dutch_Baron**: Working together with James has resulted in the creation of the AI_BALANCER class. James has shared his ideas on balancing AI with air units, and together we made a first design which you can use now :-)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
--
|
--
|
||||||
-- The parent class @{Core.Fsm#FSM_SET} manages the functionality to control the Finite State Machine (FSM).
|
-- The parent class @{Core.Fsm#FSM_SET} manages the functionality to control the Finite State Machine (FSM).
|
||||||
-- The mission designer can tailor the behaviour of the AI_BALANCER, by defining event and state transition methods.
|
-- The mission designer can tailor the behaviour of the AI_BALANCER, by defining event and state transition methods.
|
||||||
-- An explanation about state and event transition methods can be found in the @{FSM} module documentation.
|
-- An explanation about state and event transition methods can be found in the @{Core.Fsm} module documentation.
|
||||||
--
|
--
|
||||||
-- The mission designer can tailor the AI_BALANCER behaviour, by implementing a state or event handling method for the following:
|
-- The mission designer can tailor the AI_BALANCER behaviour, by implementing a state or event handling method for the following:
|
||||||
--
|
--
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
--
|
--
|
||||||
-- ## 2. AI_BALANCER is a FSM
|
-- ## 2. AI_BALANCER is a FSM
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
-- ### 2.1. AI_BALANCER States
|
-- ### 2.1. AI_BALANCER States
|
||||||
--
|
--
|
||||||
@@ -85,7 +85,12 @@
|
|||||||
--
|
--
|
||||||
-- Note that when AI returns to an airbase, the AI_BALANCER will trigger the **Return** event and the AI will return,
|
-- Note that when AI returns to an airbase, the AI_BALANCER will trigger the **Return** event and the AI will return,
|
||||||
-- otherwise the AI_BALANCER will trigger a **Destroy** event, and the AI will be destroyed.
|
-- otherwise the AI_BALANCER will trigger a **Destroy** event, and the AI will be destroyed.
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- @field #AI_BALANCER
|
-- @field #AI_BALANCER
|
||||||
AI_BALANCER = {
|
AI_BALANCER = {
|
||||||
ClassName = "AI_BALANCER",
|
ClassName = "AI_BALANCER",
|
||||||
@@ -163,7 +168,8 @@ function AI_BALANCER:ReturnToHomeAirbase( ReturnThresholdRange )
|
|||||||
self.ReturnThresholdRange = ReturnThresholdRange
|
self.ReturnThresholdRange = ReturnThresholdRange
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_BALANCER self
|
--- AI_BALANCER:onenterSpawning
|
||||||
|
-- @param #AI_BALANCER self
|
||||||
-- @param Core.Set#SET_GROUP SetGroup
|
-- @param Core.Set#SET_GROUP SetGroup
|
||||||
-- @param #string ClientName
|
-- @param #string ClientName
|
||||||
-- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
@@ -185,7 +191,8 @@ function AI_BALANCER:onenterSpawning( SetGroup, From, Event, To, ClientName )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_BALANCER self
|
--- AI_BALANCER:onenterDestroying
|
||||||
|
-- @param #AI_BALANCER self
|
||||||
-- @param Core.Set#SET_GROUP SetGroup
|
-- @param Core.Set#SET_GROUP SetGroup
|
||||||
-- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
function AI_BALANCER:onenterDestroying( SetGroup, From, Event, To, ClientName, AIGroup )
|
function AI_BALANCER:onenterDestroying( SetGroup, From, Event, To, ClientName, AIGroup )
|
||||||
@@ -228,15 +235,16 @@ function AI_BALANCER:onenterReturning( SetGroup, From, Event, To, AIGroup )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- AI_BALANCER:onenterMonitoring
|
||||||
--- @param #AI_BALANCER self
|
-- @param #AI_BALANCER self
|
||||||
function AI_BALANCER:onenterMonitoring( SetGroup )
|
function AI_BALANCER:onenterMonitoring( SetGroup )
|
||||||
|
|
||||||
self:T2( { self.SetClient:Count() } )
|
self:T2( { self.SetClient:Count() } )
|
||||||
--self.SetClient:Flush()
|
--self.SetClient:Flush()
|
||||||
|
|
||||||
self.SetClient:ForEachClient(
|
self.SetClient:ForEachClient(
|
||||||
--- @param Wrapper.Client#CLIENT Client
|
--- SetClient:ForEachClient
|
||||||
|
-- @param Wrapper.Client#CLIENT Client
|
||||||
function( Client )
|
function( Client )
|
||||||
self:T3(Client.ClientName)
|
self:T3(Client.ClientName)
|
||||||
|
|
||||||
@@ -259,7 +267,8 @@ function AI_BALANCER:onenterMonitoring( SetGroup )
|
|||||||
self:T2( RangeZone )
|
self:T2( RangeZone )
|
||||||
|
|
||||||
_DATABASE:ForEachPlayerUnit(
|
_DATABASE:ForEachPlayerUnit(
|
||||||
--- @param Wrapper.Unit#UNIT RangeTestUnit
|
--- Nameless function
|
||||||
|
-- @param Wrapper.Unit#UNIT RangeTestUnit
|
||||||
function( RangeTestUnit, RangeZone, AIGroup, PlayerInRange )
|
function( RangeTestUnit, RangeZone, AIGroup, PlayerInRange )
|
||||||
self:T2( { PlayerInRange, RangeTestUnit.UnitName, RangeZone.ZoneName } )
|
self:T2( { PlayerInRange, RangeTestUnit.UnitName, RangeZone.ZoneName } )
|
||||||
if RangeTestUnit:IsInZone( RangeZone ) == true then
|
if RangeTestUnit:IsInZone( RangeZone ) == true then
|
||||||
@@ -271,7 +280,8 @@ function AI_BALANCER:onenterMonitoring( SetGroup )
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
--- @param Core.Zone#ZONE_RADIUS RangeZone
|
--- Nameless function
|
||||||
|
-- @param Core.Zone#ZONE_RADIUS RangeZone
|
||||||
-- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
function( RangeZone, AIGroup, PlayerInRange )
|
function( RangeZone, AIGroup, PlayerInRange )
|
||||||
if PlayerInRange.Value == false then
|
if PlayerInRange.Value == false then
|
||||||
@@ -302,6 +312,3 @@ function AI_BALANCER:onenterMonitoring( SetGroup )
|
|||||||
|
|
||||||
self:__Monitor( 10 )
|
self:__Monitor( 10 )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **AI** -- Perform Combat Air Patrolling (CAP) for airplanes.
|
--- **AI** - Perform Combat Air Patrolling (CAP) for airplanes.
|
||||||
--
|
--
|
||||||
-- **Features:**
|
-- **Features:**
|
||||||
--
|
--
|
||||||
@@ -6,11 +6,10 @@
|
|||||||
-- * Trigger detected events when enemy airplanes are detected.
|
-- * Trigger detected events when enemy airplanes are detected.
|
||||||
-- * Manage a fuel threshold to RTB on time.
|
-- * Manage a fuel threshold to RTB on time.
|
||||||
-- * Engage the enemy when detected.
|
-- * Engage the enemy when detected.
|
||||||
--
|
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CAP%20-%20Combat%20Air%20Patrol)
|
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_CAP)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -19,27 +18,25 @@
|
|||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
-- ### Contributions:
|
-- ### Contributions:
|
||||||
--
|
--
|
||||||
-- * **[Quax](https://forums.eagle.ru/member.php?u=90530)**: Concept, Advice & Testing.
|
-- * **Quax**: Concept, Advice & Testing.
|
||||||
-- * **[Pikey](https://forums.eagle.ru/member.php?u=62835)**: Concept, Advice & Testing.
|
-- * **Pikey**: Concept, Advice & Testing.
|
||||||
-- * **[Gunterlund](http://forums.eagle.ru:8080/member.php?u=75036)**: Test case revision.
|
-- * **Gunterlund**: Test case revision.
|
||||||
-- * **[Whisper](http://forums.eagle.ru/member.php?u=3829): Testing.
|
-- * **Whisper**: Testing.
|
||||||
-- * **[Delta99](https://forums.eagle.ru/member.php?u=125166): Testing.
|
-- * **Delta99**: Testing.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @module AI.AI_Cap
|
-- @module AI.AI_CAP
|
||||||
-- @image AI_Combat_Air_Patrol.JPG
|
-- @image AI_Combat_Air_Patrol.JPG
|
||||||
|
|
||||||
|
|
||||||
--- @type AI_CAP_ZONE
|
--- @type AI_CAP_ZONE
|
||||||
-- @field Wrapper.Controllable#CONTROLLABLE AIControllable The @{Wrapper.Controllable} patrolling.
|
-- @field Wrapper.Controllable#CONTROLLABLE AIControllable The @{Wrapper.Controllable} patrolling.
|
||||||
-- @field Core.Zone#ZONE_BASE TargetZone The @{Zone} where the patrol needs to be executed.
|
-- @field Core.Zone#ZONE_BASE TargetZone The @{Core.Zone} where the patrol needs to be executed.
|
||||||
-- @extends AI.AI_Patrol#AI_PATROL_ZONE
|
-- @extends AI.AI_Patrol#AI_PATROL_ZONE
|
||||||
|
|
||||||
|
--- Implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Controllable} or @{Wrapper.Group}
|
||||||
--- Implements the core functions to patrol a @{Zone} by an AI @{Wrapper.Controllable} or @{Wrapper.Group}
|
|
||||||
-- and automatically engage any airborne enemies that are within a certain range or within a certain zone.
|
-- and automatically engage any airborne enemies that are within a certain range or within a certain zone.
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
@@ -106,16 +103,21 @@
|
|||||||
-- that will define when the AI will engage with the detected airborne enemy targets.
|
-- that will define when the AI will engage with the detected airborne enemy targets.
|
||||||
-- The range can be beyond or smaller than the range of the Patrol Zone.
|
-- The range can be beyond or smaller than the range of the Patrol Zone.
|
||||||
-- The range is applied at the position of the AI.
|
-- The range is applied at the position of the AI.
|
||||||
-- Use the method @{AI.AI_CAP#AI_CAP_ZONE.SetEngageRange}() to define that range.
|
-- Use the method @{#AI_CAP_ZONE.SetEngageRange}() to define that range.
|
||||||
--
|
--
|
||||||
-- ## 4. Set the Zone of Engagement
|
-- ## 4. Set the Zone of Engagement
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
-- An optional @{Zone} can be set,
|
-- An optional @{Core.Zone} can be set,
|
||||||
-- that will define when the AI will engage with the detected airborne enemy targets.
|
-- that will define when the AI will engage with the detected airborne enemy targets.
|
||||||
-- Use the method @{AI.AI_Cap#AI_CAP_ZONE.SetEngageZone}() to define that Zone.
|
-- Use the method @{#AI_CAP_ZONE.SetEngageZone}() to define that Zone.
|
||||||
--
|
--
|
||||||
|
-- # Developer Note
|
||||||
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_CAP_ZONE
|
-- @field #AI_CAP_ZONE
|
||||||
@@ -123,11 +125,9 @@ AI_CAP_ZONE = {
|
|||||||
ClassName = "AI_CAP_ZONE",
|
ClassName = "AI_CAP_ZONE",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- Creates a new AI_CAP_ZONE object
|
--- Creates a new AI_CAP_ZONE object
|
||||||
-- @param #AI_CAP_ZONE self
|
-- @param #AI_CAP_ZONE self
|
||||||
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
|
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
|
||||||
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Controllable} in km/h.
|
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Controllable} in km/h.
|
||||||
@@ -141,7 +141,7 @@ function AI_CAP_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
|
|||||||
|
|
||||||
self.Accomplished = false
|
self.Accomplished = false
|
||||||
self.Engaging = false
|
self.Engaging = false
|
||||||
|
|
||||||
self:AddTransition( { "Patrolling", "Engaging" }, "Engage", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAP_ZONE.
|
self:AddTransition( { "Patrolling", "Engaging" }, "Engage", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAP_ZONE.
|
||||||
|
|
||||||
--- OnBefore Transition Handler for Event Engage.
|
--- OnBefore Transition Handler for Event Engage.
|
||||||
@@ -152,7 +152,7 @@ function AI_CAP_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
|
|||||||
-- @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.
|
||||||
-- @function [parent=#AI_CAP_ZONE] OnAfterEngage
|
-- @function [parent=#AI_CAP_ZONE] OnAfterEngage
|
||||||
-- @param #AI_CAP_ZONE self
|
-- @param #AI_CAP_ZONE self
|
||||||
@@ -160,11 +160,11 @@ function AI_CAP_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.
|
||||||
|
|
||||||
--- Synchronous Event Trigger for Event Engage.
|
--- Synchronous Event Trigger for Event Engage.
|
||||||
-- @function [parent=#AI_CAP_ZONE] Engage
|
-- @function [parent=#AI_CAP_ZONE] Engage
|
||||||
-- @param #AI_CAP_ZONE self
|
-- @param #AI_CAP_ZONE self
|
||||||
|
|
||||||
--- Asynchronous Event Trigger for Event Engage.
|
--- Asynchronous Event Trigger for Event Engage.
|
||||||
-- @function [parent=#AI_CAP_ZONE] __Engage
|
-- @function [parent=#AI_CAP_ZONE] __Engage
|
||||||
-- @param #AI_CAP_ZONE self
|
-- @param #AI_CAP_ZONE self
|
||||||
@@ -188,7 +188,7 @@ function AI_CAP_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
|
|||||||
-- @param #string To The To State string.
|
-- @param #string To The To State string.
|
||||||
|
|
||||||
self:AddTransition( "Engaging", "Fired", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAP_ZONE.
|
self:AddTransition( "Engaging", "Fired", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAP_ZONE.
|
||||||
|
|
||||||
--- OnBefore Transition Handler for Event Fired.
|
--- OnBefore Transition Handler for Event Fired.
|
||||||
-- @function [parent=#AI_CAP_ZONE] OnBeforeFired
|
-- @function [parent=#AI_CAP_ZONE] OnBeforeFired
|
||||||
-- @param #AI_CAP_ZONE self
|
-- @param #AI_CAP_ZONE self
|
||||||
@@ -197,7 +197,7 @@ function AI_CAP_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
|
|||||||
-- @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 Fired.
|
--- OnAfter Transition Handler for Event Fired.
|
||||||
-- @function [parent=#AI_CAP_ZONE] OnAfterFired
|
-- @function [parent=#AI_CAP_ZONE] OnAfterFired
|
||||||
-- @param #AI_CAP_ZONE self
|
-- @param #AI_CAP_ZONE self
|
||||||
@@ -205,11 +205,11 @@ function AI_CAP_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.
|
||||||
|
|
||||||
--- Synchronous Event Trigger for Event Fired.
|
--- Synchronous Event Trigger for Event Fired.
|
||||||
-- @function [parent=#AI_CAP_ZONE] Fired
|
-- @function [parent=#AI_CAP_ZONE] Fired
|
||||||
-- @param #AI_CAP_ZONE self
|
-- @param #AI_CAP_ZONE self
|
||||||
|
|
||||||
--- Asynchronous Event Trigger for Event Fired.
|
--- Asynchronous Event Trigger for Event Fired.
|
||||||
-- @function [parent=#AI_CAP_ZONE] __Fired
|
-- @function [parent=#AI_CAP_ZONE] __Fired
|
||||||
-- @param #AI_CAP_ZONE self
|
-- @param #AI_CAP_ZONE self
|
||||||
@@ -225,7 +225,7 @@ function AI_CAP_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
|
|||||||
-- @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 Destroy.
|
--- OnAfter Transition Handler for Event Destroy.
|
||||||
-- @function [parent=#AI_CAP_ZONE] OnAfterDestroy
|
-- @function [parent=#AI_CAP_ZONE] OnAfterDestroy
|
||||||
-- @param #AI_CAP_ZONE self
|
-- @param #AI_CAP_ZONE self
|
||||||
@@ -233,17 +233,16 @@ function AI_CAP_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.
|
||||||
|
|
||||||
--- Synchronous Event Trigger for Event Destroy.
|
--- Synchronous Event Trigger for Event Destroy.
|
||||||
-- @function [parent=#AI_CAP_ZONE] Destroy
|
-- @function [parent=#AI_CAP_ZONE] Destroy
|
||||||
-- @param #AI_CAP_ZONE self
|
-- @param #AI_CAP_ZONE self
|
||||||
|
|
||||||
--- Asynchronous Event Trigger for Event Destroy.
|
--- Asynchronous Event Trigger for Event Destroy.
|
||||||
-- @function [parent=#AI_CAP_ZONE] __Destroy
|
-- @function [parent=#AI_CAP_ZONE] __Destroy
|
||||||
-- @param #AI_CAP_ZONE self
|
-- @param #AI_CAP_ZONE self
|
||||||
-- @param #number Delay The delay in seconds.
|
-- @param #number Delay The delay in seconds.
|
||||||
|
|
||||||
|
|
||||||
self:AddTransition( "Engaging", "Abort", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_CAP_ZONE.
|
self:AddTransition( "Engaging", "Abort", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_CAP_ZONE.
|
||||||
|
|
||||||
--- OnBefore Transition Handler for Event Abort.
|
--- OnBefore Transition Handler for Event Abort.
|
||||||
@@ -254,7 +253,7 @@ function AI_CAP_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
|
|||||||
-- @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 Abort.
|
--- OnAfter Transition Handler for Event Abort.
|
||||||
-- @function [parent=#AI_CAP_ZONE] OnAfterAbort
|
-- @function [parent=#AI_CAP_ZONE] OnAfterAbort
|
||||||
-- @param #AI_CAP_ZONE self
|
-- @param #AI_CAP_ZONE self
|
||||||
@@ -262,11 +261,11 @@ function AI_CAP_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.
|
||||||
|
|
||||||
--- Synchronous Event Trigger for Event Abort.
|
--- Synchronous Event Trigger for Event Abort.
|
||||||
-- @function [parent=#AI_CAP_ZONE] Abort
|
-- @function [parent=#AI_CAP_ZONE] Abort
|
||||||
-- @param #AI_CAP_ZONE self
|
-- @param #AI_CAP_ZONE self
|
||||||
|
|
||||||
--- Asynchronous Event Trigger for Event Abort.
|
--- Asynchronous Event Trigger for Event Abort.
|
||||||
-- @function [parent=#AI_CAP_ZONE] __Abort
|
-- @function [parent=#AI_CAP_ZONE] __Abort
|
||||||
-- @param #AI_CAP_ZONE self
|
-- @param #AI_CAP_ZONE self
|
||||||
@@ -282,7 +281,7 @@ function AI_CAP_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
|
|||||||
-- @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 Accomplish.
|
--- OnAfter Transition Handler for Event Accomplish.
|
||||||
-- @function [parent=#AI_CAP_ZONE] OnAfterAccomplish
|
-- @function [parent=#AI_CAP_ZONE] OnAfterAccomplish
|
||||||
-- @param #AI_CAP_ZONE self
|
-- @param #AI_CAP_ZONE self
|
||||||
@@ -290,11 +289,11 @@ function AI_CAP_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.
|
||||||
|
|
||||||
--- Synchronous Event Trigger for Event Accomplish.
|
--- Synchronous Event Trigger for Event Accomplish.
|
||||||
-- @function [parent=#AI_CAP_ZONE] Accomplish
|
-- @function [parent=#AI_CAP_ZONE] Accomplish
|
||||||
-- @param #AI_CAP_ZONE self
|
-- @param #AI_CAP_ZONE self
|
||||||
|
|
||||||
--- Asynchronous Event Trigger for Event Accomplish.
|
--- Asynchronous Event Trigger for Event Accomplish.
|
||||||
-- @function [parent=#AI_CAP_ZONE] __Accomplish
|
-- @function [parent=#AI_CAP_ZONE] __Accomplish
|
||||||
-- @param #AI_CAP_ZONE self
|
-- @param #AI_CAP_ZONE self
|
||||||
@@ -303,7 +302,6 @@ function AI_CAP_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Set the Engage Zone which defines where the AI will engage bogies.
|
--- Set the Engage Zone which defines where the AI will engage bogies.
|
||||||
-- @param #AI_CAP_ZONE self
|
-- @param #AI_CAP_ZONE self
|
||||||
-- @param Core.Zone#ZONE EngageZone The zone where the AI is performing CAP.
|
-- @param Core.Zone#ZONE EngageZone The zone where the AI is performing CAP.
|
||||||
@@ -311,7 +309,7 @@ end
|
|||||||
function AI_CAP_ZONE:SetEngageZone( EngageZone )
|
function AI_CAP_ZONE:SetEngageZone( EngageZone )
|
||||||
self:F2()
|
self:F2()
|
||||||
|
|
||||||
if EngageZone then
|
if EngageZone then
|
||||||
self.EngageZone = EngageZone
|
self.EngageZone = EngageZone
|
||||||
else
|
else
|
||||||
self.EngageZone = nil
|
self.EngageZone = nil
|
||||||
@@ -346,7 +344,6 @@ function AI_CAP_ZONE:onafterStart( Controllable, From, Event, To )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param AI.AI_CAP#AI_CAP_ZONE
|
--- @param AI.AI_CAP#AI_CAP_ZONE
|
||||||
-- @param Wrapper.Group#GROUP EngageGroup
|
-- @param Wrapper.Group#GROUP EngageGroup
|
||||||
function AI_CAP_ZONE.EngageRoute( EngageGroup, Fsm )
|
function AI_CAP_ZONE.EngageRoute( EngageGroup, Fsm )
|
||||||
@@ -358,8 +355,6 @@ function AI_CAP_ZONE.EngageRoute( EngageGroup, Fsm )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_CAP_ZONE self
|
--- @param #AI_CAP_ZONE self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
|
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
|
||||||
-- @param #string From The From State string.
|
-- @param #string From The From State string.
|
||||||
@@ -380,11 +375,11 @@ end
|
|||||||
function AI_CAP_ZONE:onafterDetected( Controllable, From, Event, To )
|
function AI_CAP_ZONE:onafterDetected( Controllable, From, Event, To )
|
||||||
|
|
||||||
if From ~= "Engaging" then
|
if From ~= "Engaging" then
|
||||||
|
|
||||||
local Engage = false
|
local Engage = false
|
||||||
|
|
||||||
for DetectedUnit, Detected in pairs( self.DetectedUnits ) do
|
for DetectedUnit, Detected in pairs( self.DetectedUnits ) do
|
||||||
|
|
||||||
local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT
|
local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT
|
||||||
self:T( DetectedUnit )
|
self:T( DetectedUnit )
|
||||||
if DetectedUnit:IsAlive() and DetectedUnit:IsAir() then
|
if DetectedUnit:IsAlive() and DetectedUnit:IsAir() then
|
||||||
@@ -392,7 +387,7 @@ function AI_CAP_ZONE:onafterDetected( Controllable, From, Event, To )
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if Engage == true then
|
if Engage == true then
|
||||||
self:F( 'Detected -> Engaging' )
|
self:F( 'Detected -> Engaging' )
|
||||||
self:__Engage( 1 )
|
self:__Engage( 1 )
|
||||||
@@ -400,7 +395,6 @@ function AI_CAP_ZONE:onafterDetected( Controllable, From, Event, To )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_CAP_ZONE self
|
--- @param #AI_CAP_ZONE self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
|
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
|
||||||
-- @param #string From The From State string.
|
-- @param #string From The From State string.
|
||||||
@@ -411,9 +405,6 @@ function AI_CAP_ZONE:onafterAbort( Controllable, From, Event, To )
|
|||||||
self:__Route( 1 )
|
self:__Route( 1 )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_CAP_ZONE self
|
--- @param #AI_CAP_ZONE self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
|
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
|
||||||
-- @param #string From The From State string.
|
-- @param #string From The From State string.
|
||||||
@@ -427,24 +418,23 @@ function AI_CAP_ZONE:onafterEngage( Controllable, From, Event, To )
|
|||||||
|
|
||||||
--- Calculate the current route point.
|
--- Calculate the current route point.
|
||||||
local CurrentVec2 = self.Controllable:GetVec2()
|
local CurrentVec2 = self.Controllable:GetVec2()
|
||||||
|
|
||||||
if not CurrentVec2 then return self end
|
if not CurrentVec2 then return self 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 = POINT_VEC3: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,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
ToEngageZoneSpeed,
|
ToEngageZoneSpeed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
EngageRoute[#EngageRoute+1] = CurrentRoutePoint
|
EngageRoute[#EngageRoute+1] = CurrentRoutePoint
|
||||||
|
|
||||||
|
|
||||||
--- Find a random 2D point in PatrolZone.
|
--- Find a random 2D point in PatrolZone.
|
||||||
local ToTargetVec2 = self.PatrolZone:GetRandomVec2()
|
local ToTargetVec2 = self.PatrolZone:GetRandomVec2()
|
||||||
self:T2( ToTargetVec2 )
|
self:T2( ToTargetVec2 )
|
||||||
@@ -453,17 +443,17 @@ function AI_CAP_ZONE:onafterEngage( Controllable, From, Event, To )
|
|||||||
local ToTargetAltitude = math.random( self.EngageFloorAltitude, self.EngageCeilingAltitude )
|
local ToTargetAltitude = math.random( self.EngageFloorAltitude, self.EngageCeilingAltitude )
|
||||||
local ToTargetSpeed = math.random( self.PatrolMinSpeed, self.PatrolMaxSpeed )
|
local ToTargetSpeed = math.random( self.PatrolMinSpeed, self.PatrolMaxSpeed )
|
||||||
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 = POINT_VEC3: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,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
ToTargetSpeed,
|
ToTargetSpeed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
EngageRoute[#EngageRoute+1] = ToPatrolRoutePoint
|
EngageRoute[#EngageRoute+1] = ToPatrolRoutePoint
|
||||||
@@ -482,7 +472,7 @@ function AI_CAP_ZONE:onafterEngage( Controllable, From, Event, To )
|
|||||||
self:F( {"Within Zone and Engaging ", DetectedUnit } )
|
self:F( {"Within Zone and Engaging ", DetectedUnit } )
|
||||||
AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit )
|
AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit )
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if self.EngageRange then
|
if self.EngageRange then
|
||||||
if DetectedUnit:GetPointVec3():Get2DDistance(Controllable:GetPointVec3() ) <= self.EngageRange then
|
if DetectedUnit:GetPointVec3():Get2DDistance(Controllable:GetPointVec3() ) <= self.EngageRange then
|
||||||
self:F( {"Within Range and Engaging", DetectedUnit } )
|
self:F( {"Within Range and Engaging", DetectedUnit } )
|
||||||
@@ -506,12 +496,12 @@ function AI_CAP_ZONE:onafterEngage( Controllable, From, Event, To )
|
|||||||
|
|
||||||
AttackTasks[#AttackTasks+1] = Controllable:TaskFunction( "AI_CAP_ZONE.EngageRoute", self )
|
AttackTasks[#AttackTasks+1] = Controllable:TaskFunction( "AI_CAP_ZONE.EngageRoute", self )
|
||||||
EngageRoute[1].task = Controllable:TaskCombo( AttackTasks )
|
EngageRoute[1].task = Controllable:TaskCombo( AttackTasks )
|
||||||
|
|
||||||
self:SetDetectionDeactivated()
|
self:SetDetectionDeactivated()
|
||||||
end
|
end
|
||||||
|
|
||||||
Controllable:Route( EngageRoute, 0.5 )
|
Controllable:Route( EngageRoute, 0.5 )
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **AI** -- Perform Close Air Support (CAS) near friendlies.
|
--- **AI** - Perform Close Air Support (CAS) near friendlies.
|
||||||
--
|
--
|
||||||
-- **Features:**
|
-- **Features:**
|
||||||
--
|
--
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CAS%20-%20Close%20Air%20Support)
|
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_CAS)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -22,22 +22,22 @@
|
|||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
-- ### Contributions:
|
-- ### Contributions:
|
||||||
--
|
--
|
||||||
-- * **[Quax](https://forums.eagle.ru/member.php?u=90530)**: Concept, Advice & Testing.
|
-- * **Quax**: Concept, Advice & Testing.
|
||||||
-- * **[Pikey](https://forums.eagle.ru/member.php?u=62835)**: Concept, Advice & Testing.
|
-- * **Pikey**: Concept, Advice & Testing.
|
||||||
-- * **[Gunterlund](http://forums.eagle.ru:8080/member.php?u=75036)**: Test case revision.
|
-- * **Gunterlund**: Test case revision.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @module AI.AI_Cas
|
-- @module AI.AI_CAS
|
||||||
-- @image AI_Close_Air_Support.JPG
|
-- @image AI_Close_Air_Support.JPG
|
||||||
|
|
||||||
--- AI_CAS_ZONE class
|
--- AI_CAS_ZONE class
|
||||||
-- @type AI_CAS_ZONE
|
-- @type AI_CAS_ZONE
|
||||||
-- @field Wrapper.Controllable#CONTROLLABLE AIControllable The @{Wrapper.Controllable} patrolling.
|
-- @field Wrapper.Controllable#CONTROLLABLE AIControllable The @{Wrapper.Controllable} patrolling.
|
||||||
-- @field Core.Zone#ZONE_BASE TargetZone The @{Zone} where the patrol needs to be executed.
|
-- @field Core.Zone#ZONE_BASE TargetZone The @{Core.Zone} where the patrol needs to be executed.
|
||||||
-- @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 @{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.
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
@@ -118,7 +118,12 @@
|
|||||||
-- * **@{#AI_CAS_ZONE.Destroy}**: The AI has destroyed a target @{Wrapper.Unit}.
|
-- * **@{#AI_CAS_ZONE.Destroy}**: The AI has destroyed a target @{Wrapper.Unit}.
|
||||||
-- * **@{#AI_CAS_ZONE.Destroyed}**: The AI has destroyed all target @{Wrapper.Unit}s assigned in the CAS task.
|
-- * **@{#AI_CAS_ZONE.Destroyed}**: The AI has destroyed all target @{Wrapper.Unit}s assigned in the CAS task.
|
||||||
-- * **Status**: The AI is checking status (fuel and damage). When the thresholds have been reached, the AI will RTB.
|
-- * **Status**: The AI is checking status (fuel and damage). When the thresholds have been reached, the AI will RTB.
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_CAS_ZONE
|
-- @field #AI_CAS_ZONE
|
||||||
@@ -130,7 +135,7 @@ AI_CAS_ZONE = {
|
|||||||
|
|
||||||
--- Creates a new AI_CAS_ZONE object
|
--- Creates a new AI_CAS_ZONE object
|
||||||
-- @param #AI_CAS_ZONE self
|
-- @param #AI_CAS_ZONE self
|
||||||
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
|
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
|
||||||
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Controllable} in km/h.
|
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Controllable} in km/h.
|
||||||
@@ -496,7 +501,7 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To,
|
|||||||
AttackTasks[#AttackTasks+1] = Controllable:TaskFunction( "AI_CAS_ZONE.EngageRoute", self )
|
AttackTasks[#AttackTasks+1] = Controllable:TaskFunction( "AI_CAS_ZONE.EngageRoute", self )
|
||||||
EngageRoute[#EngageRoute].task = Controllable:TaskCombo( AttackTasks )
|
EngageRoute[#EngageRoute].task = Controllable:TaskCombo( AttackTasks )
|
||||||
|
|
||||||
--- Define a random point in the @{Zone}. The AI will fly to that point within the zone.
|
--- Define a random point in the @{Core.Zone}. The AI will fly to that point within the zone.
|
||||||
|
|
||||||
--- Find a random 2D point in EngageZone.
|
--- Find a random 2D point in EngageZone.
|
||||||
local ToTargetVec2 = self.EngageZone:GetRandomVec2()
|
local ToTargetVec2 = self.EngageZone:GetRandomVec2()
|
||||||
|
|||||||
@@ -25,7 +25,12 @@
|
|||||||
-- * @{AI.AI_Cargo_APC} - Cargo transportation using APCs and other vehicles between zones.
|
-- * @{AI.AI_Cargo_APC} - Cargo transportation using APCs and other vehicles between zones.
|
||||||
-- * @{AI.AI_Cargo_Helicopter} - Cargo transportation using helicopters between zones.
|
-- * @{AI.AI_Cargo_Helicopter} - Cargo transportation using helicopters between zones.
|
||||||
-- * @{AI.AI_Cargo_Airplane} - Cargo transportation using airplanes to and from airbases.
|
-- * @{AI.AI_Cargo_Airplane} - Cargo transportation using airplanes to and from airbases.
|
||||||
--
|
--
|
||||||
|
-- # Developer Note
|
||||||
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- @field #AI_CARGO
|
-- @field #AI_CARGO
|
||||||
AI_CARGO = {
|
AI_CARGO = {
|
||||||
ClassName = "AI_CARGO",
|
ClassName = "AI_CARGO",
|
||||||
|
|||||||
@@ -75,7 +75,12 @@
|
|||||||
-- Using the @{#AI_CARGO_APC.Pickup}() method, you are able to direct the APCs towards a point on the battlefield to board/load the cargo at the specific coordinate.
|
-- Using the @{#AI_CARGO_APC.Pickup}() method, you are able to direct the APCs towards a point on the battlefield to board/load the cargo at the specific coordinate.
|
||||||
-- The APCs will follow nearby roads as much as possible, to ensure fast and clean cargo transportation between the objects and villages in the simulation environment.
|
-- The APCs will follow nearby roads as much as possible, to ensure fast and clean cargo transportation between the objects and villages in the simulation environment.
|
||||||
--
|
--
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
--
|
--
|
||||||
-- @field #AI_CARGO_APC
|
-- @field #AI_CARGO_APC
|
||||||
AI_CARGO_APC = {
|
AI_CARGO_APC = {
|
||||||
|
|||||||
@@ -41,7 +41,12 @@
|
|||||||
-- marginal impact on the overall battlefield simulation. Fortunately, the firing strength of infantry is limited, and thus, respacing healthy infantry every
|
-- marginal impact on the overall battlefield simulation. Fortunately, the firing strength of infantry is limited, and thus, respacing healthy infantry every
|
||||||
-- time is not so much of an issue ...
|
-- time is not so much of an issue ...
|
||||||
--
|
--
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- @field #AI_CARGO_AIRPLANE
|
-- @field #AI_CARGO_AIRPLANE
|
||||||
AI_CARGO_AIRPLANE = {
|
AI_CARGO_AIRPLANE = {
|
||||||
ClassName = "AI_CARGO_AIRPLANE",
|
ClassName = "AI_CARGO_AIRPLANE",
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
--
|
--
|
||||||
-- Test missions can be located on the main GITHUB site.
|
-- Test missions can be located on the main GITHUB site.
|
||||||
--
|
--
|
||||||
-- [FlightControl-Master/MOOSE_MISSIONS/AID - AI Dispatching/AID-CGO - AI Cargo Dispatching/](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/AID%20-%20AI%20Dispatching/AID-CGO%20-%20AI%20Cargo%20Dispatching)
|
-- [FlightControl-Master/MOOSE_MISSIONS/AID - AI Dispatching/AID-CGO - AI Cargo Dispatching/](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Cargo_Dispatcher)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -100,7 +100,12 @@
|
|||||||
--
|
--
|
||||||
-- Yes, please ensure that the zones are declared using the @{Core.Zone} classes.
|
-- Yes, please ensure that the zones are declared using the @{Core.Zone} classes.
|
||||||
-- Possible zones that function at the moment are ZONE, ZONE_GROUP, ZONE_UNIT, ZONE_POLYGON.
|
-- Possible zones that function at the moment are ZONE, ZONE_GROUP, ZONE_UNIT, ZONE_POLYGON.
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
@@ -567,7 +572,7 @@
|
|||||||
-- A home zone can be specified to where the Carriers will move when there isn't any cargo left for pickup.
|
-- A home zone can be specified to where the Carriers will move when there isn't any cargo left for pickup.
|
||||||
-- Use @{#AI_CARGO_DISPATCHER.SetHomeZone}() to specify the home zone.
|
-- Use @{#AI_CARGO_DISPATCHER.SetHomeZone}() to specify the home zone.
|
||||||
--
|
--
|
||||||
-- If no home zone is specified, the carriers will wait near the deploy zone for a new pickup command.
|
-- If no home zone is specified, the carriers will wait near the deploy zone for a new pickup command.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -578,10 +583,12 @@ AI_CARGO_DISPATCHER = {
|
|||||||
PickupCargo = {}
|
PickupCargo = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
--- @field #list
|
--- List of AI_Cargo
|
||||||
|
-- @field #list
|
||||||
AI_CARGO_DISPATCHER.AI_Cargo = {}
|
AI_CARGO_DISPATCHER.AI_Cargo = {}
|
||||||
|
|
||||||
--- @field #list
|
--- List of PickupCargo
|
||||||
|
-- @field #list
|
||||||
AI_CARGO_DISPATCHER.PickupCargo = {}
|
AI_CARGO_DISPATCHER.PickupCargo = {}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -137,7 +137,12 @@
|
|||||||
-- Use @{#AI_CARGO_DISPATCHER_APC.SetHomeZone}() to specify the home zone.
|
-- Use @{#AI_CARGO_DISPATCHER_APC.SetHomeZone}() to specify the home zone.
|
||||||
--
|
--
|
||||||
-- If no home zone is specified, the APCs will wait near the deploy zone for a new pickup command.
|
-- If no home zone is specified, the APCs will wait near the deploy zone for a new pickup command.
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_CARGO_DISPATCHER_APC
|
-- @field #AI_CARGO_DISPATCHER_APC
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **AI** -- (R2.4) - Models the intelligent transportation of infantry and other cargo using Planes.
|
--- **AI** - Models the intelligent transportation of infantry and other cargo using Planes.
|
||||||
--
|
--
|
||||||
-- ## Features:
|
-- ## Features:
|
||||||
--
|
--
|
||||||
@@ -108,7 +108,12 @@
|
|||||||
--
|
--
|
||||||
-- **There are a lot of templates available that allows you to quickly setup an event handler for a specific event type!**
|
-- **There are a lot of templates available that allows you to quickly setup an event handler for a specific event type!**
|
||||||
--
|
--
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
--
|
--
|
||||||
-- @field #AI_CARGO_DISPATCHER_AIRPLANE
|
-- @field #AI_CARGO_DISPATCHER_AIRPLANE
|
||||||
AI_CARGO_DISPATCHER_AIRPLANE = {
|
AI_CARGO_DISPATCHER_AIRPLANE = {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **AI** -- (2.4) - Models the intelligent transportation of infantry and other cargo using Helicopters.
|
--- **AI** - Models the intelligent transportation of infantry and other cargo using Helicopters.
|
||||||
--
|
--
|
||||||
-- ## Features:
|
-- ## Features:
|
||||||
--
|
--
|
||||||
@@ -140,7 +140,12 @@
|
|||||||
-- Use @{#AI_CARGO_DISPATCHER_HELICOPTER.SetHomeZone}() to specify the home zone.
|
-- Use @{#AI_CARGO_DISPATCHER_HELICOPTER.SetHomeZone}() to specify the home zone.
|
||||||
--
|
--
|
||||||
-- If no home zone is specified, the helicopters will wait near the deploy zone for a new pickup command.
|
-- If no home zone is specified, the helicopters will wait near the deploy zone for a new pickup command.
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_CARGO_DISPATCHER_HELICOPTER
|
-- @field #AI_CARGO_DISPATCHER_HELICOPTER
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **AI** -- (2.5.1) - Models the intelligent transportation of infantry and other cargo using Ships
|
--- **AI** - Models the intelligent transportation of infantry and other cargo using Ships.
|
||||||
--
|
--
|
||||||
-- ## Features:
|
-- ## Features:
|
||||||
--
|
--
|
||||||
@@ -37,14 +37,14 @@
|
|||||||
--
|
--
|
||||||
-- This will be particularly helpful in order to determine how to **Tailor the different cargo handling events**.
|
-- This will be particularly helpful in order to determine how to **Tailor the different cargo handling events**.
|
||||||
--
|
--
|
||||||
-- The AI_CARGO_DISPATCHER_SHIP class uses the @{Cargo.Cargo} capabilities within the MOOSE framwork.
|
-- The AI_CARGO_DISPATCHER_SHIP class uses the @{Cargo.Cargo} capabilities within the MOOSE framework.
|
||||||
-- Also ensure that you fully understand how to declare and setup Cargo objects within the MOOSE framework before using this class.
|
-- Also ensure that you fully understand how to declare and setup Cargo objects within the MOOSE framework before using this class.
|
||||||
-- CARGO derived objects must generally be declared within the mission to make the AI_CARGO_DISPATCHER_SHIP object recognize the cargo.
|
-- CARGO derived objects must generally be declared within the mission to make the AI_CARGO_DISPATCHER_SHIP object recognize the cargo.
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
-- # 1) AI_CARGO_DISPATCHER_SHIP constructor.
|
-- # 1) AI_CARGO_DISPATCHER_SHIP constructor.
|
||||||
--
|
--
|
||||||
-- * @{AI_CARGO_DISPATCHER_SHIP.New}(): Creates a new AI_CARGO_DISPATCHER_SHIP object.
|
-- * @{#AI_CARGO_DISPATCHER_SHIP.New}(): Creates a new AI_CARGO_DISPATCHER_SHIP object.
|
||||||
--
|
--
|
||||||
-- ---
|
-- ---
|
||||||
--
|
--
|
||||||
@@ -130,7 +130,12 @@
|
|||||||
-- Use @{#AI_CARGO_DISPATCHER_SHIP.SetHomeZone}() to specify the home zone.
|
-- Use @{#AI_CARGO_DISPATCHER_SHIP.SetHomeZone}() to specify the home zone.
|
||||||
--
|
--
|
||||||
-- If no home zone is specified, the Ship will wait near the deploy zone for a new pickup command.
|
-- If no home zone is specified, the Ship will wait near the deploy zone for a new pickup command.
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_CARGO_DISPATCHER_SHIP
|
-- @field #AI_CARGO_DISPATCHER_SHIP
|
||||||
|
|||||||
@@ -41,7 +41,12 @@
|
|||||||
-- marginal impact on the overall battlefield simulation. Fortunately, the firing strength of infantry is limited, and thus, respacing healthy infantry every
|
-- marginal impact on the overall battlefield simulation. Fortunately, the firing strength of infantry is limited, and thus, respacing healthy infantry every
|
||||||
-- time is not so much of an issue ...
|
-- time is not so much of an issue ...
|
||||||
--
|
--
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_CARGO_HELICOPTER
|
-- @field #AI_CARGO_HELICOPTER
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **AI** -- (R2.5.1) - Models the intelligent transportation of infantry and other cargo.
|
--- **AI** - Models the intelligent transportation of infantry and other cargo.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -46,15 +46,20 @@
|
|||||||
--
|
--
|
||||||
-- ## Cargo deployment.
|
-- ## Cargo deployment.
|
||||||
--
|
--
|
||||||
-- Using the @{AI_CARGO_SHIP.Deploy}() method, you are able to direct the Ship towards a Deploy zone to unboard/unload the cargo at the
|
-- Using the @{#AI_CARGO_SHIP.Deploy}() method, you are able to direct the Ship towards a Deploy zone to unboard/unload the cargo at the
|
||||||
-- specified coordinate. The Ship will follow the Shipping Lane to ensure consistent cargo transportation within the simulation environment.
|
-- specified coordinate. The Ship will follow the Shipping Lane to ensure consistent cargo transportation within the simulation environment.
|
||||||
--
|
--
|
||||||
-- ## Cargo pickup.
|
-- ## Cargo pickup.
|
||||||
--
|
--
|
||||||
-- Using the @{AI_CARGO_SHIP.Pickup}() method, you are able to direct the Ship towards a Pickup zone to board/load the cargo at the specified
|
-- Using the @{#AI_CARGO_SHIP.Pickup}() method, you are able to direct the Ship towards a Pickup zone to board/load the cargo at the specified
|
||||||
-- coordinate. The Ship will follow the Shipping Lane to ensure consistent cargo transportation within the simulation environment.
|
-- coordinate. The Ship will follow the Shipping Lane to ensure consistent cargo transportation within the simulation environment.
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
|
-- # Developer Note
|
||||||
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- @field #AI_CARGO_SHIP
|
-- @field #AI_CARGO_SHIP
|
||||||
AI_CARGO_SHIP = {
|
AI_CARGO_SHIP = {
|
||||||
ClassName = "AI_CARGO_SHIP",
|
ClassName = "AI_CARGO_SHIP",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **Functional** -- Taking the lead of AI escorting your flight or of other AI.
|
--- **AI** - Taking the lead of AI escorting your flight or of other AI.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/ESC%20-%20Escorting)
|
-- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Escort)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -147,8 +147,8 @@
|
|||||||
-- @image Escorting.JPG
|
-- @image Escorting.JPG
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
--- @type AI_ESCORT
|
-- @type AI_ESCORT
|
||||||
-- @extends AI.AI_Formation#AI_FORMATION
|
-- @extends AI.AI_Formation#AI_FORMATION
|
||||||
|
|
||||||
|
|
||||||
@@ -168,10 +168,17 @@
|
|||||||
--
|
--
|
||||||
-- -- First find the GROUP object and the CLIENT object.
|
-- -- First find the GROUP object and the CLIENT object.
|
||||||
-- local EscortUnit = CLIENT:FindByName( "Unit Name" ) -- The Unit Name is the name of the unit flagged with the skill Client in the mission editor.
|
-- local EscortUnit = CLIENT:FindByName( "Unit Name" ) -- The Unit Name is the name of the unit flagged with the skill Client in the mission editor.
|
||||||
-- local EscortGroup = GROUP:FindByName( "Group Name" ) -- The Group Name is the name of the group that will escort the Escort Client.
|
-- local EscortGroup = SET_GROUP:New():FilterPrefixes("Escort"):FilterOnce() -- The the group name of the escorts contains "Escort".
|
||||||
--
|
--
|
||||||
-- -- Now use these 2 objects to construct the new EscortPlanes object.
|
-- -- Now use these 2 objects to construct the new EscortPlanes object.
|
||||||
-- EscortPlanes = AI_ESCORT:New( EscortUnit, EscortGroup, "Desert", "Welcome to the mission. You are escorted by a plane with code name 'Desert', which can be instructed through the F10 radio menu." )
|
-- EscortPlanes = AI_ESCORT:New( EscortUnit, EscortGroup, "Desert", "Welcome to the mission. You are escorted by a plane with code name 'Desert', which can be instructed through the F10 radio menu." )
|
||||||
|
-- EscortPlanes:MenusAirplanes() -- create menus for airplanes
|
||||||
|
-- EscortPlanes:__Start(2)
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
|
--
|
||||||
|
-- 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
|
||||||
--
|
--
|
||||||
-- @field #AI_ESCORT
|
-- @field #AI_ESCORT
|
||||||
AI_ESCORT = {
|
AI_ESCORT = {
|
||||||
@@ -189,16 +196,9 @@ AI_ESCORT = {
|
|||||||
TaskPoints = {}
|
TaskPoints = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
--- @field Functional.Detection#DETECTION_AREAS
|
-- @field Functional.Detection#DETECTION_AREAS
|
||||||
AI_ESCORT.Detection = nil
|
AI_ESCORT.Detection = nil
|
||||||
|
|
||||||
--- MENUPARAM type
|
|
||||||
-- @type MENUPARAM
|
|
||||||
-- @field #AI_ESCORT ParamSelf
|
|
||||||
-- @field #Distance ParamDistance
|
|
||||||
-- @field #function ParamFunction
|
|
||||||
-- @field #string ParamMessage
|
|
||||||
|
|
||||||
--- AI_ESCORT class constructor for an AI group
|
--- AI_ESCORT class constructor for an AI group
|
||||||
-- @param #AI_ESCORT self
|
-- @param #AI_ESCORT self
|
||||||
-- @param Wrapper.Client#CLIENT EscortUnit The client escorted by the EscortGroup.
|
-- @param Wrapper.Client#CLIENT EscortUnit The client escorted by the EscortGroup.
|
||||||
@@ -211,10 +211,14 @@ AI_ESCORT.Detection = nil
|
|||||||
--
|
--
|
||||||
-- -- First find the GROUP object and the CLIENT object.
|
-- -- First find the GROUP object and the CLIENT object.
|
||||||
-- local EscortUnit = CLIENT:FindByName( "Unit Name" ) -- The Unit Name is the name of the unit flagged with the skill Client in the mission editor.
|
-- local EscortUnit = CLIENT:FindByName( "Unit Name" ) -- The Unit Name is the name of the unit flagged with the skill Client in the mission editor.
|
||||||
-- local EscortGroup = GROUP:FindByName( "Group Name" ) -- The Group Name is the name of the group that will escort the Escort Client.
|
-- local EscortGroup = SET_GROUP:New():FilterPrefixes("Escort"):FilterOnce() -- The the group name of the escorts contains "Escort".
|
||||||
--
|
--
|
||||||
-- -- Now use these 2 objects to construct the new EscortPlanes object.
|
-- -- Now use these 2 objects to construct the new EscortPlanes object.
|
||||||
-- EscortPlanes = AI_ESCORT:New( EscortUnit, EscortGroup, "Desert", "Welcome to the mission. You are escorted by a plane with code name 'Desert', which can be instructed through the F10 radio menu." )
|
-- EscortPlanes = AI_ESCORT:New( EscortUnit, EscortGroup, "Desert", "Welcome to the mission. You are escorted by a plane with code name 'Desert', which can be instructed through the F10 radio menu." )
|
||||||
|
-- EscortPlanes:MenusAirplanes() -- create menus for airplanes
|
||||||
|
-- EscortPlanes:__Start(2)
|
||||||
|
--
|
||||||
|
--
|
||||||
function AI_ESCORT:New( EscortUnit, EscortGroupSet, EscortName, EscortBriefing )
|
function AI_ESCORT:New( EscortUnit, EscortGroupSet, EscortName, EscortBriefing )
|
||||||
|
|
||||||
local self = BASE:Inherit( self, AI_FORMATION:New( EscortUnit, EscortGroupSet, EscortName, EscortBriefing ) ) -- #AI_ESCORT
|
local self = BASE:Inherit( self, AI_FORMATION:New( EscortUnit, EscortGroupSet, EscortName, EscortBriefing ) ) -- #AI_ESCORT
|
||||||
@@ -227,10 +231,17 @@ function AI_ESCORT:New( EscortUnit, EscortGroupSet, EscortName, EscortBriefing )
|
|||||||
self.EscortGroupSet = EscortGroupSet
|
self.EscortGroupSet = EscortGroupSet
|
||||||
|
|
||||||
self.EscortGroupSet:SetSomeIteratorLimit( 8 )
|
self.EscortGroupSet:SetSomeIteratorLimit( 8 )
|
||||||
|
|
||||||
self.EscortBriefing = EscortBriefing
|
self.EscortBriefing = EscortBriefing
|
||||||
|
|
||||||
self.Menu = {}
|
self.Menu = {}
|
||||||
|
self.Menu.HoldAtEscortPosition = self.Menu.HoldAtEscortPosition or {}
|
||||||
|
self.Menu.HoldAtLeaderPosition = self.Menu.HoldAtLeaderPosition or {}
|
||||||
|
self.Menu.Flare = self.Menu.Flare or {}
|
||||||
|
self.Menu.Smoke = self.Menu.Smoke or {}
|
||||||
|
self.Menu.Targets = self.Menu.Targets or {}
|
||||||
|
self.Menu.ROE = self.Menu.ROE or {}
|
||||||
|
self.Menu.ROT = self.Menu.ROT or {}
|
||||||
|
|
||||||
-- if not EscortBriefing then
|
-- if not EscortBriefing then
|
||||||
-- EscortGroup:MessageToClient( EscortGroup:GetCategoryName() .. " '" .. EscortName .. "' (" .. EscortGroup:GetCallsign() .. ") reporting! " ..
|
-- EscortGroup:MessageToClient( EscortGroup:GetCategoryName() .. " '" .. EscortName .. "' (" .. EscortGroup:GetCallsign() .. ") reporting! " ..
|
||||||
@@ -250,7 +261,7 @@ function AI_ESCORT:New( EscortUnit, EscortGroupSet, EscortName, EscortBriefing )
|
|||||||
|
|
||||||
|
|
||||||
EscortGroupSet:ForEachGroup(
|
EscortGroupSet:ForEachGroup(
|
||||||
--- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
-- Set EscortGroup known at EscortUnit.
|
-- Set EscortGroup known at EscortUnit.
|
||||||
if not self.PlayerUnit._EscortGroups then
|
if not self.PlayerUnit._EscortGroups then
|
||||||
@@ -325,14 +336,14 @@ function AI_ESCORT:_InitEscortRoute( EscortGroup )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_ESCORT self
|
-- @param #AI_ESCORT self
|
||||||
-- @param Core.Set#SET_GROUP EscortGroupSet
|
-- @param Core.Set#SET_GROUP EscortGroupSet
|
||||||
function AI_ESCORT:onafterStart( EscortGroupSet )
|
function AI_ESCORT:onafterStart( EscortGroupSet )
|
||||||
|
|
||||||
self:F()
|
self:F()
|
||||||
|
|
||||||
EscortGroupSet:ForEachGroup(
|
EscortGroupSet:ForEachGroup(
|
||||||
--- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
EscortGroup:WayPointInitialize()
|
EscortGroup:WayPointInitialize()
|
||||||
|
|
||||||
@@ -370,7 +381,7 @@ function AI_ESCORT:onafterStart( EscortGroupSet )
|
|||||||
self:_InitFlightMenus()
|
self:_InitFlightMenus()
|
||||||
|
|
||||||
self.EscortGroupSet:ForSomeGroupAlive(
|
self.EscortGroupSet:ForSomeGroupAlive(
|
||||||
--- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
|
|
||||||
self:_InitEscortMenus( EscortGroup )
|
self:_InitEscortMenus( EscortGroup )
|
||||||
@@ -378,7 +389,7 @@ function AI_ESCORT:onafterStart( EscortGroupSet )
|
|||||||
|
|
||||||
self:SetFlightModeFormation( EscortGroup )
|
self:SetFlightModeFormation( EscortGroup )
|
||||||
|
|
||||||
--- @param #AI_ESCORT self
|
-- @param #AI_ESCORT self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function EscortGroup:OnEventDeadOrCrash( EventData )
|
function EscortGroup:OnEventDeadOrCrash( EventData )
|
||||||
self:F( { "EventDead", EventData } )
|
self:F( { "EventDead", EventData } )
|
||||||
@@ -394,14 +405,14 @@ function AI_ESCORT:onafterStart( EscortGroupSet )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_ESCORT self
|
-- @param #AI_ESCORT self
|
||||||
-- @param Core.Set#SET_GROUP EscortGroupSet
|
-- @param Core.Set#SET_GROUP EscortGroupSet
|
||||||
function AI_ESCORT:onafterStop( EscortGroupSet )
|
function AI_ESCORT:onafterStop( EscortGroupSet )
|
||||||
|
|
||||||
self:F()
|
self:F()
|
||||||
|
|
||||||
EscortGroupSet:ForEachGroup(
|
EscortGroupSet:ForEachGroup(
|
||||||
--- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
EscortGroup:WayPointInitialize()
|
EscortGroup:WayPointInitialize()
|
||||||
|
|
||||||
@@ -443,9 +454,9 @@ end
|
|||||||
-- @param #AI_ESCORT self
|
-- @param #AI_ESCORT self
|
||||||
-- @param #number XStart The start position on the X-axis in meters for the first group.
|
-- @param #number XStart The start position on the X-axis in meters for the first group.
|
||||||
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
|
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
|
||||||
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
|
-- @param #number YStart The start position on the Y-axis in meters for the first group.
|
||||||
-- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group.
|
-- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group.
|
||||||
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group.
|
-- @param #number ZStart The start position on the Z-axis in meters for the first group.
|
||||||
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
|
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
|
||||||
-- @param #number ZLevels The amount of levels on the Z-axis.
|
-- @param #number ZLevels The amount of levels on the Z-axis.
|
||||||
-- @return #AI_ESCORT
|
-- @return #AI_ESCORT
|
||||||
@@ -493,9 +504,9 @@ end
|
|||||||
-- @param #AI_ESCORT self
|
-- @param #AI_ESCORT self
|
||||||
-- @param #number XStart The start position on the X-axis in meters for the first group.
|
-- @param #number XStart The start position on the X-axis in meters for the first group.
|
||||||
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
|
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
|
||||||
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
|
-- @param #number YStart The start position on the Y-axis in meters for the first group.
|
||||||
-- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group.
|
-- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group.
|
||||||
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group.
|
-- @param #number ZStart The start position on the Z-axis in meters for the first group.
|
||||||
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
|
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
|
||||||
-- @param #number ZLevels The amount of levels on the Z-axis.
|
-- @param #number ZLevels The amount of levels on the Z-axis.
|
||||||
-- @return #AI_ESCORT
|
-- @return #AI_ESCORT
|
||||||
@@ -550,7 +561,7 @@ function AI_ESCORT:SetFlightMenuFormation( Formation )
|
|||||||
local MenuFlightFormationID = MENU_GROUP_COMMAND:New( self.PlayerGroup, Formation, FlightMenuFormation,
|
local MenuFlightFormationID = MENU_GROUP_COMMAND:New( self.PlayerGroup, Formation, FlightMenuFormation,
|
||||||
function ( self, Formation, ... )
|
function ( self, Formation, ... )
|
||||||
self.EscortGroupSet:ForSomeGroupAlive(
|
self.EscortGroupSet:ForSomeGroupAlive(
|
||||||
--- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup, self, Formation, Arguments )
|
function( EscortGroup, self, Formation, Arguments )
|
||||||
if EscortGroup:IsAir() then
|
if EscortGroup:IsAir() then
|
||||||
self:E({FormationID=FormationID})
|
self:E({FormationID=FormationID})
|
||||||
@@ -580,7 +591,7 @@ end
|
|||||||
-- @param #AI_ESCORT self
|
-- @param #AI_ESCORT self
|
||||||
-- @param #number XStart The start position on the X-axis in meters for the first group.
|
-- @param #number XStart The start position on the X-axis in meters for the first group.
|
||||||
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
|
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
|
||||||
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
|
-- @param #number YStart The start position on the Y-axis in meters for the first group.
|
||||||
-- @return #AI_ESCORT
|
-- @return #AI_ESCORT
|
||||||
function AI_ESCORT:MenuFormationTrail( XStart, XSpace, YStart )
|
function AI_ESCORT:MenuFormationTrail( XStart, XSpace, YStart )
|
||||||
|
|
||||||
@@ -594,7 +605,7 @@ end
|
|||||||
-- @param #AI_ESCORT self
|
-- @param #AI_ESCORT self
|
||||||
-- @param #number XStart The start position on the X-axis in meters for the first group.
|
-- @param #number XStart The start position on the X-axis in meters for the first group.
|
||||||
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
|
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
|
||||||
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
|
-- @param #number YStart The start position on the Y-axis in meters for the first group.
|
||||||
-- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group.
|
-- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group.
|
||||||
-- @return #AI_ESCORT
|
-- @return #AI_ESCORT
|
||||||
function AI_ESCORT:MenuFormationStack( XStart, XSpace, YStart, YSpace )
|
function AI_ESCORT:MenuFormationStack( XStart, XSpace, YStart, YSpace )
|
||||||
@@ -609,8 +620,8 @@ end
|
|||||||
-- This menu will appear under **Formation**.
|
-- This menu will appear under **Formation**.
|
||||||
-- @param #AI_ESCORT self
|
-- @param #AI_ESCORT self
|
||||||
-- @param #number XStart The start position on the X-axis in meters for the first group.
|
-- @param #number XStart The start position on the X-axis in meters for the first group.
|
||||||
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
|
-- @param #number YStart The start position on the Y-axis in meters for the first group.
|
||||||
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group.
|
-- @param #number ZStart The start position on the Z-axis in meters for the first group.
|
||||||
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
|
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
|
||||||
-- @return #AI_ESCORT
|
-- @return #AI_ESCORT
|
||||||
function AI_ESCORT:MenuFormationLeftLine( XStart, YStart, ZStart, ZSpace )
|
function AI_ESCORT:MenuFormationLeftLine( XStart, YStart, ZStart, ZSpace )
|
||||||
@@ -625,8 +636,8 @@ end
|
|||||||
-- This menu will appear under **Formation**.
|
-- This menu will appear under **Formation**.
|
||||||
-- @param #AI_ESCORT self
|
-- @param #AI_ESCORT self
|
||||||
-- @param #number XStart The start position on the X-axis in meters for the first group.
|
-- @param #number XStart The start position on the X-axis in meters for the first group.
|
||||||
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
|
-- @param #number YStart The start position on the Y-axis in meters for the first group.
|
||||||
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group.
|
-- @param #number ZStart The start position on the Z-axis in meters for the first group.
|
||||||
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
|
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
|
||||||
-- @return #AI_ESCORT
|
-- @return #AI_ESCORT
|
||||||
function AI_ESCORT:MenuFormationRightLine( XStart, YStart, ZStart, ZSpace )
|
function AI_ESCORT:MenuFormationRightLine( XStart, YStart, ZStart, ZSpace )
|
||||||
@@ -642,8 +653,8 @@ end
|
|||||||
-- @param #AI_ESCORT self
|
-- @param #AI_ESCORT self
|
||||||
-- @param #number XStart The start position on the X-axis in meters for the first group.
|
-- @param #number XStart The start position on the X-axis in meters for the first group.
|
||||||
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
|
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
|
||||||
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
|
-- @param #number YStart The start position on the Y-axis in meters for the first group.
|
||||||
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group.
|
-- @param #number ZStart The start position on the Z-axis in meters for the first group.
|
||||||
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
|
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
|
||||||
-- @return #AI_ESCORT
|
-- @return #AI_ESCORT
|
||||||
function AI_ESCORT:MenuFormationLeftWing( XStart, XSpace, YStart, ZStart, ZSpace )
|
function AI_ESCORT:MenuFormationLeftWing( XStart, XSpace, YStart, ZStart, ZSpace )
|
||||||
@@ -659,8 +670,8 @@ end
|
|||||||
-- @param #AI_ESCORT self
|
-- @param #AI_ESCORT self
|
||||||
-- @param #number XStart The start position on the X-axis in meters for the first group.
|
-- @param #number XStart The start position on the X-axis in meters for the first group.
|
||||||
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
|
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
|
||||||
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
|
-- @param #number YStart The start position on the Y-axis in meters for the first group.
|
||||||
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group.
|
-- @param #number ZStart The start position on the Z-axis in meters for the first group.
|
||||||
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
|
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
|
||||||
-- @return #AI_ESCORT
|
-- @return #AI_ESCORT
|
||||||
function AI_ESCORT:MenuFormationRightWing( XStart, XSpace, YStart, ZStart, ZSpace )
|
function AI_ESCORT:MenuFormationRightWing( XStart, XSpace, YStart, ZStart, ZSpace )
|
||||||
@@ -676,9 +687,9 @@ end
|
|||||||
-- @param #AI_ESCORT self
|
-- @param #AI_ESCORT self
|
||||||
-- @param #number XStart The start position on the X-axis in meters for the first group.
|
-- @param #number XStart The start position on the X-axis in meters for the first group.
|
||||||
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
|
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
|
||||||
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
|
-- @param #number YStart The start position on the Y-axis in meters for the first group.
|
||||||
-- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group.
|
-- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group.
|
||||||
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group.
|
-- @param #number ZStart The start position on the Z-axis in meters for the first group.
|
||||||
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
|
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
|
||||||
-- @return #AI_ESCORT
|
-- @return #AI_ESCORT
|
||||||
function AI_ESCORT:MenuFormationCenterWing( XStart, XSpace, YStart, YSpace, ZStart, ZSpace )
|
function AI_ESCORT:MenuFormationCenterWing( XStart, XSpace, YStart, YSpace, ZStart, ZSpace )
|
||||||
@@ -694,9 +705,9 @@ end
|
|||||||
-- @param #AI_ESCORT self
|
-- @param #AI_ESCORT self
|
||||||
-- @param #number XStart The start position on the X-axis in meters for the first group.
|
-- @param #number XStart The start position on the X-axis in meters for the first group.
|
||||||
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
|
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
|
||||||
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
|
-- @param #number YStart The start position on the Y-axis in meters for the first group.
|
||||||
-- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group.
|
-- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group.
|
||||||
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group.
|
-- @param #number ZStart The start position on the Z-axis in meters for the first group.
|
||||||
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
|
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
|
||||||
-- @return #AI_ESCORT
|
-- @return #AI_ESCORT
|
||||||
function AI_ESCORT:MenuFormationVic( XStart, XSpace, YStart, YSpace, ZStart, ZSpace )
|
function AI_ESCORT:MenuFormationVic( XStart, XSpace, YStart, YSpace, ZStart, ZSpace )
|
||||||
@@ -712,9 +723,9 @@ end
|
|||||||
-- @param #AI_ESCORT self
|
-- @param #AI_ESCORT self
|
||||||
-- @param #number XStart The start position on the X-axis in meters for the first group.
|
-- @param #number XStart The start position on the X-axis in meters for the first group.
|
||||||
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
|
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
|
||||||
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
|
-- @param #number YStart The start position on the Y-axis in meters for the first group.
|
||||||
-- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group.
|
-- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group.
|
||||||
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group.
|
-- @param #number ZStart The start position on the Z-axis in meters for the first group.
|
||||||
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
|
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
|
||||||
-- @param #number ZLevels The amount of levels on the Z-axis.
|
-- @param #number ZLevels The amount of levels on the Z-axis.
|
||||||
-- @return #AI_ESCORT
|
-- @return #AI_ESCORT
|
||||||
@@ -764,7 +775,7 @@ end
|
|||||||
|
|
||||||
function AI_ESCORT:SetFlightMenuHoldAtEscortPosition()
|
function AI_ESCORT:SetFlightMenuHoldAtEscortPosition()
|
||||||
|
|
||||||
for _, MenuHoldAtEscortPosition in pairs( self.Menu.HoldAtEscortPosition ) do
|
for _, MenuHoldAtEscortPosition in pairs( self.Menu.HoldAtEscortPosition or {} ) do
|
||||||
local FlightMenuReportNavigation = MENU_GROUP:New( self.PlayerGroup, "Navigation", self.FlightMenu )
|
local FlightMenuReportNavigation = MENU_GROUP:New( self.PlayerGroup, "Navigation", self.FlightMenu )
|
||||||
|
|
||||||
local FlightMenuHoldPosition = MENU_GROUP_COMMAND
|
local FlightMenuHoldPosition = MENU_GROUP_COMMAND
|
||||||
@@ -785,7 +796,7 @@ end
|
|||||||
|
|
||||||
function AI_ESCORT:SetEscortMenuHoldAtEscortPosition( EscortGroup )
|
function AI_ESCORT:SetEscortMenuHoldAtEscortPosition( EscortGroup )
|
||||||
|
|
||||||
for _, HoldAtEscortPosition in pairs( self.Menu.HoldAtEscortPosition ) do
|
for _, HoldAtEscortPosition in pairs( self.Menu.HoldAtEscortPosition or {}) do
|
||||||
if EscortGroup:IsAir() then
|
if EscortGroup:IsAir() then
|
||||||
local EscortGroupName = EscortGroup:GetName()
|
local EscortGroupName = EscortGroup:GetName()
|
||||||
local EscortMenuReportNavigation = MENU_GROUP:New( self.PlayerGroup, "Navigation", EscortGroup.EscortMenu )
|
local EscortMenuReportNavigation = MENU_GROUP:New( self.PlayerGroup, "Navigation", EscortGroup.EscortMenu )
|
||||||
@@ -853,7 +864,7 @@ end
|
|||||||
|
|
||||||
function AI_ESCORT:SetFlightMenuHoldAtLeaderPosition()
|
function AI_ESCORT:SetFlightMenuHoldAtLeaderPosition()
|
||||||
|
|
||||||
for _, MenuHoldAtLeaderPosition in pairs( self.Menu.HoldAtLeaderPosition ) do
|
for _, MenuHoldAtLeaderPosition in pairs( self.Menu.HoldAtLeaderPosition or {}) do
|
||||||
local FlightMenuReportNavigation = MENU_GROUP:New( self.PlayerGroup, "Navigation", self.FlightMenu )
|
local FlightMenuReportNavigation = MENU_GROUP:New( self.PlayerGroup, "Navigation", self.FlightMenu )
|
||||||
|
|
||||||
local FlightMenuHoldAtLeaderPosition = MENU_GROUP_COMMAND
|
local FlightMenuHoldAtLeaderPosition = MENU_GROUP_COMMAND
|
||||||
@@ -874,7 +885,7 @@ end
|
|||||||
|
|
||||||
function AI_ESCORT:SetEscortMenuHoldAtLeaderPosition( EscortGroup )
|
function AI_ESCORT:SetEscortMenuHoldAtLeaderPosition( EscortGroup )
|
||||||
|
|
||||||
for _, HoldAtLeaderPosition in pairs( self.Menu.HoldAtLeaderPosition ) do
|
for _, HoldAtLeaderPosition in pairs( self.Menu.HoldAtLeaderPosition or {}) do
|
||||||
if EscortGroup:IsAir() then
|
if EscortGroup:IsAir() then
|
||||||
|
|
||||||
local EscortGroupName = EscortGroup:GetName()
|
local EscortGroupName = EscortGroup:GetName()
|
||||||
@@ -999,7 +1010,7 @@ end
|
|||||||
|
|
||||||
function AI_ESCORT:SetFlightMenuFlare()
|
function AI_ESCORT:SetFlightMenuFlare()
|
||||||
|
|
||||||
for _, MenuFlare in pairs( self.Menu.Flare) do
|
for _, MenuFlare in pairs( self.Menu.Flare or {}) do
|
||||||
local FlightMenuReportNavigation = MENU_GROUP:New( self.PlayerGroup, "Navigation", self.FlightMenu )
|
local FlightMenuReportNavigation = MENU_GROUP:New( self.PlayerGroup, "Navigation", self.FlightMenu )
|
||||||
local FlightMenuFlare = MENU_GROUP:New( self.PlayerGroup, MenuFlare.MenuText, FlightMenuReportNavigation )
|
local FlightMenuFlare = MENU_GROUP:New( self.PlayerGroup, MenuFlare.MenuText, FlightMenuReportNavigation )
|
||||||
|
|
||||||
@@ -1014,7 +1025,7 @@ end
|
|||||||
|
|
||||||
function AI_ESCORT:SetEscortMenuFlare( EscortGroup )
|
function AI_ESCORT:SetEscortMenuFlare( EscortGroup )
|
||||||
|
|
||||||
for _, MenuFlare in pairs( self.Menu.Flare) do
|
for _, MenuFlare in pairs( self.Menu.Flare or {}) do
|
||||||
if EscortGroup:IsAir() then
|
if EscortGroup:IsAir() then
|
||||||
|
|
||||||
local EscortGroupName = EscortGroup:GetName()
|
local EscortGroupName = EscortGroup:GetName()
|
||||||
@@ -1059,7 +1070,7 @@ end
|
|||||||
|
|
||||||
function AI_ESCORT:SetFlightMenuSmoke()
|
function AI_ESCORT:SetFlightMenuSmoke()
|
||||||
|
|
||||||
for _, MenuSmoke in pairs( self.Menu.Smoke) do
|
for _, MenuSmoke in pairs( self.Menu.Smoke or {}) do
|
||||||
local FlightMenuReportNavigation = MENU_GROUP:New( self.PlayerGroup, "Navigation", self.FlightMenu )
|
local FlightMenuReportNavigation = MENU_GROUP:New( self.PlayerGroup, "Navigation", self.FlightMenu )
|
||||||
local FlightMenuSmoke = MENU_GROUP:New( self.PlayerGroup, MenuSmoke.MenuText, FlightMenuReportNavigation )
|
local FlightMenuSmoke = MENU_GROUP:New( self.PlayerGroup, MenuSmoke.MenuText, FlightMenuReportNavigation )
|
||||||
|
|
||||||
@@ -1076,7 +1087,7 @@ end
|
|||||||
|
|
||||||
function AI_ESCORT:SetEscortMenuSmoke( EscortGroup )
|
function AI_ESCORT:SetEscortMenuSmoke( EscortGroup )
|
||||||
|
|
||||||
for _, MenuSmoke in pairs( self.Menu.Smoke) do
|
for _, MenuSmoke in pairs( self.Menu.Smoke or {}) do
|
||||||
if EscortGroup:IsAir() then
|
if EscortGroup:IsAir() then
|
||||||
|
|
||||||
local EscortGroupName = EscortGroup:GetName()
|
local EscortGroupName = EscortGroup:GetName()
|
||||||
@@ -1169,7 +1180,7 @@ function AI_ESCORT:SetFlightMenuTargets()
|
|||||||
local FlightMenuAttackNearbyAir = MENU_GROUP_COMMAND:New( self.PlayerGroup, "Attack nearest airborne targets", self.FlightMenuAttack, AI_ESCORT._FlightAttackNearestTarget, self, self.__Enum.ReportType.Air ):SetTag( "Attack" )
|
local FlightMenuAttackNearbyAir = MENU_GROUP_COMMAND:New( self.PlayerGroup, "Attack nearest airborne targets", self.FlightMenuAttack, AI_ESCORT._FlightAttackNearestTarget, self, self.__Enum.ReportType.Air ):SetTag( "Attack" )
|
||||||
local FlightMenuAttackNearbyGround = MENU_GROUP_COMMAND:New( self.PlayerGroup, "Attack nearest ground targets", self.FlightMenuAttack, AI_ESCORT._FlightAttackNearestTarget, self, self.__Enum.ReportType.Ground ):SetTag( "Attack" )
|
local FlightMenuAttackNearbyGround = MENU_GROUP_COMMAND:New( self.PlayerGroup, "Attack nearest ground targets", self.FlightMenuAttack, AI_ESCORT._FlightAttackNearestTarget, self, self.__Enum.ReportType.Ground ):SetTag( "Attack" )
|
||||||
|
|
||||||
for _, MenuTargets in pairs( self.Menu.Targets) do
|
for _, MenuTargets in pairs( self.Menu.Targets or {}) do
|
||||||
MenuTargets.FlightReportTargetsScheduler = SCHEDULER:New( self, self._FlightReportTargetsScheduler, {}, MenuTargets.Interval, MenuTargets.Interval )
|
MenuTargets.FlightReportTargetsScheduler = SCHEDULER:New( self, self._FlightReportTargetsScheduler, {}, MenuTargets.Interval, MenuTargets.Interval )
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1179,7 +1190,7 @@ end
|
|||||||
|
|
||||||
function AI_ESCORT:SetEscortMenuTargets( EscortGroup )
|
function AI_ESCORT:SetEscortMenuTargets( EscortGroup )
|
||||||
|
|
||||||
for _, MenuTargets in pairs( self.Menu.Targets) do
|
for _, MenuTargets in pairs( self.Menu.Targets or {} or {}) do
|
||||||
if EscortGroup:IsAir() then
|
if EscortGroup:IsAir() then
|
||||||
local EscortGroupName = EscortGroup:GetName()
|
local EscortGroupName = EscortGroup:GetName()
|
||||||
--local EscortMenuReportTargets = MENU_GROUP:New( self.PlayerGroup, "Report targets", EscortGroup.EscortMenu )
|
--local EscortMenuReportTargets = MENU_GROUP:New( self.PlayerGroup, "Report targets", EscortGroup.EscortMenu )
|
||||||
@@ -1231,7 +1242,7 @@ function AI_ESCORT:MenuAssistedAttack()
|
|||||||
self:F()
|
self:F()
|
||||||
|
|
||||||
self.EscortGroupSet:ForSomeGroupAlive(
|
self.EscortGroupSet:ForSomeGroupAlive(
|
||||||
--- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
if not EscortGroup:IsAir() then
|
if not EscortGroup:IsAir() then
|
||||||
-- Request assistance from other escorts.
|
-- Request assistance from other escorts.
|
||||||
@@ -1246,7 +1257,7 @@ end
|
|||||||
|
|
||||||
function AI_ESCORT:SetFlightMenuROE()
|
function AI_ESCORT:SetFlightMenuROE()
|
||||||
|
|
||||||
for _, MenuROE in pairs( self.Menu.ROE) do
|
for _, MenuROE in pairs( self.Menu.ROE or {}) do
|
||||||
local FlightMenuROE = MENU_GROUP:New( self.PlayerGroup, "Rule Of Engagement", self.FlightMenu )
|
local FlightMenuROE = MENU_GROUP:New( self.PlayerGroup, "Rule Of Engagement", self.FlightMenu )
|
||||||
|
|
||||||
local FlightMenuROEHoldFire = MENU_GROUP_COMMAND:New( self.PlayerGroup, "Hold fire", FlightMenuROE, AI_ESCORT._FlightROEHoldFire, self, "Holding weapons!" )
|
local FlightMenuROEHoldFire = MENU_GROUP_COMMAND:New( self.PlayerGroup, "Hold fire", FlightMenuROE, AI_ESCORT._FlightROEHoldFire, self, "Holding weapons!" )
|
||||||
@@ -1261,7 +1272,7 @@ end
|
|||||||
|
|
||||||
function AI_ESCORT:SetEscortMenuROE( EscortGroup )
|
function AI_ESCORT:SetEscortMenuROE( EscortGroup )
|
||||||
|
|
||||||
for _, MenuROE in pairs( self.Menu.ROE) do
|
for _, MenuROE in pairs( self.Menu.ROE or {}) do
|
||||||
if EscortGroup:IsAir() then
|
if EscortGroup:IsAir() then
|
||||||
|
|
||||||
local EscortGroupName = EscortGroup:GetName()
|
local EscortGroupName = EscortGroup:GetName()
|
||||||
@@ -1302,7 +1313,7 @@ end
|
|||||||
|
|
||||||
function AI_ESCORT:SetFlightMenuROT()
|
function AI_ESCORT:SetFlightMenuROT()
|
||||||
|
|
||||||
for _, MenuROT in pairs( self.Menu.ROT) do
|
for _, MenuROT in pairs( self.Menu.ROT or {}) do
|
||||||
local FlightMenuROT = MENU_GROUP:New( self.PlayerGroup, "Reaction On Threat", self.FlightMenu )
|
local FlightMenuROT = MENU_GROUP:New( self.PlayerGroup, "Reaction On Threat", self.FlightMenu )
|
||||||
|
|
||||||
local FlightMenuROTNoReaction = MENU_GROUP_COMMAND:New( self.PlayerGroup, "Fight until death", FlightMenuROT, AI_ESCORT._FlightROTNoReaction, self, "Fighting until death!" )
|
local FlightMenuROTNoReaction = MENU_GROUP_COMMAND:New( self.PlayerGroup, "Fight until death", FlightMenuROT, AI_ESCORT._FlightROTNoReaction, self, "Fighting until death!" )
|
||||||
@@ -1317,7 +1328,7 @@ end
|
|||||||
|
|
||||||
function AI_ESCORT:SetEscortMenuROT( EscortGroup )
|
function AI_ESCORT:SetEscortMenuROT( EscortGroup )
|
||||||
|
|
||||||
for _, MenuROT in pairs( self.Menu.ROT) do
|
for _, MenuROT in pairs( self.Menu.ROT or {}) do
|
||||||
if EscortGroup:IsAir() then
|
if EscortGroup:IsAir() then
|
||||||
|
|
||||||
local EscortGroupName = EscortGroup:GetName()
|
local EscortGroupName = EscortGroup:GetName()
|
||||||
@@ -1375,7 +1386,7 @@ function AI_ESCORT:SetEscortMenuResumeMission( EscortGroup )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_ESCORT self
|
-- @param #AI_ESCORT self
|
||||||
-- @param Wrapper.Group#GROUP OrbitGroup
|
-- @param Wrapper.Group#GROUP OrbitGroup
|
||||||
-- @param Wrapper.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
-- @param #number OrbitHeight
|
-- @param #number OrbitHeight
|
||||||
@@ -1419,7 +1430,7 @@ function AI_ESCORT:_HoldPosition( OrbitGroup, EscortGroup, OrbitHeight, OrbitSec
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_ESCORT self
|
-- @param #AI_ESCORT self
|
||||||
-- @param Wrapper.Group#GROUP OrbitGroup
|
-- @param Wrapper.Group#GROUP OrbitGroup
|
||||||
-- @param #number OrbitHeight
|
-- @param #number OrbitHeight
|
||||||
-- @param #number OrbitSeconds
|
-- @param #number OrbitSeconds
|
||||||
@@ -1428,7 +1439,7 @@ function AI_ESCORT:_FlightHoldPosition( OrbitGroup, OrbitHeight, OrbitSeconds )
|
|||||||
local EscortUnit = self.PlayerUnit
|
local EscortUnit = self.PlayerUnit
|
||||||
|
|
||||||
self.EscortGroupSet:ForEachGroupAlive(
|
self.EscortGroupSet:ForEachGroupAlive(
|
||||||
--- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup, OrbitGroup )
|
function( EscortGroup, OrbitGroup )
|
||||||
if EscortGroup:IsAir() then
|
if EscortGroup:IsAir() then
|
||||||
if OrbitGroup == nil then
|
if OrbitGroup == nil then
|
||||||
@@ -1456,7 +1467,7 @@ end
|
|||||||
function AI_ESCORT:_FlightJoinUp()
|
function AI_ESCORT:_FlightJoinUp()
|
||||||
|
|
||||||
self.EscortGroupSet:ForEachGroupAlive(
|
self.EscortGroupSet:ForEachGroupAlive(
|
||||||
--- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
if EscortGroup:IsAir() then
|
if EscortGroup:IsAir() then
|
||||||
self:_JoinUp( EscortGroup )
|
self:_JoinUp( EscortGroup )
|
||||||
@@ -1471,7 +1482,7 @@ end
|
|||||||
-- @param #AI_ESCORT self
|
-- @param #AI_ESCORT self
|
||||||
-- @param #number XStart The start position on the X-axis in meters for the first group.
|
-- @param #number XStart The start position on the X-axis in meters for the first group.
|
||||||
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
|
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
|
||||||
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
|
-- @param #number YStart The start position on the Y-axis in meters for the first group.
|
||||||
-- @return #AI_ESCORT
|
-- @return #AI_ESCORT
|
||||||
function AI_ESCORT:_EscortFormationTrail( EscortGroup, XStart, XSpace, YStart )
|
function AI_ESCORT:_EscortFormationTrail( EscortGroup, XStart, XSpace, YStart )
|
||||||
|
|
||||||
@@ -1483,7 +1494,7 @@ end
|
|||||||
function AI_ESCORT:_FlightFormationTrail( XStart, XSpace, YStart )
|
function AI_ESCORT:_FlightFormationTrail( XStart, XSpace, YStart )
|
||||||
|
|
||||||
self.EscortGroupSet:ForEachGroupAlive(
|
self.EscortGroupSet:ForEachGroupAlive(
|
||||||
--- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
if EscortGroup:IsAir() then
|
if EscortGroup:IsAir() then
|
||||||
self:_EscortFormationTrail( EscortGroup, XStart, XSpace, YStart )
|
self:_EscortFormationTrail( EscortGroup, XStart, XSpace, YStart )
|
||||||
@@ -1510,7 +1521,7 @@ end
|
|||||||
function AI_ESCORT:_FlightFormationStack( XStart, XSpace, YStart, YSpace )
|
function AI_ESCORT:_FlightFormationStack( XStart, XSpace, YStart, YSpace )
|
||||||
|
|
||||||
self.EscortGroupSet:ForEachGroupAlive(
|
self.EscortGroupSet:ForEachGroupAlive(
|
||||||
--- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
if EscortGroup:IsAir() then
|
if EscortGroup:IsAir() then
|
||||||
self:_EscortFormationStack( EscortGroup, XStart, XSpace, YStart, YSpace )
|
self:_EscortFormationStack( EscortGroup, XStart, XSpace, YStart, YSpace )
|
||||||
@@ -1533,7 +1544,7 @@ end
|
|||||||
function AI_ESCORT:_FlightFlare( Color, Message )
|
function AI_ESCORT:_FlightFlare( Color, Message )
|
||||||
|
|
||||||
self.EscortGroupSet:ForEachGroupAlive(
|
self.EscortGroupSet:ForEachGroupAlive(
|
||||||
--- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
if EscortGroup:IsAir() then
|
if EscortGroup:IsAir() then
|
||||||
self:_Flare( EscortGroup, Color, Message )
|
self:_Flare( EscortGroup, Color, Message )
|
||||||
@@ -1556,7 +1567,7 @@ end
|
|||||||
function AI_ESCORT:_FlightSmoke( Color, Message )
|
function AI_ESCORT:_FlightSmoke( Color, Message )
|
||||||
|
|
||||||
self.EscortGroupSet:ForEachGroupAlive(
|
self.EscortGroupSet:ForEachGroupAlive(
|
||||||
--- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
if EscortGroup:IsAir() then
|
if EscortGroup:IsAir() then
|
||||||
self:_Smoke( EscortGroup, Color, Message )
|
self:_Smoke( EscortGroup, Color, Message )
|
||||||
@@ -1587,7 +1598,7 @@ end
|
|||||||
function AI_ESCORT:_FlightSwitchReportNearbyTargets( ReportTargets )
|
function AI_ESCORT:_FlightSwitchReportNearbyTargets( ReportTargets )
|
||||||
|
|
||||||
self.EscortGroupSet:ForEachGroupAlive(
|
self.EscortGroupSet:ForEachGroupAlive(
|
||||||
--- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
if EscortGroup:IsAir() then
|
if EscortGroup:IsAir() then
|
||||||
self:_EscortSwitchReportNearbyTargets( EscortGroup, ReportTargets )
|
self:_EscortSwitchReportNearbyTargets( EscortGroup, ReportTargets )
|
||||||
@@ -1679,7 +1690,7 @@ function AI_ESCORT:_ScanTargets( ScanDuration )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param Wrapper.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
-- @param #AI_ESCORT self
|
-- @param #AI_ESCORT self
|
||||||
function AI_ESCORT.___Resume( EscortGroup, self )
|
function AI_ESCORT.___Resume( EscortGroup, self )
|
||||||
|
|
||||||
@@ -1701,7 +1712,7 @@ function AI_ESCORT.___Resume( EscortGroup, self )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_ESCORT self
|
-- @param #AI_ESCORT self
|
||||||
-- @param Wrapper.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
-- @param #number WayPoint
|
-- @param #number WayPoint
|
||||||
function AI_ESCORT:_ResumeMission( EscortGroup, WayPoint )
|
function AI_ESCORT:_ResumeMission( EscortGroup, WayPoint )
|
||||||
@@ -1723,7 +1734,7 @@ function AI_ESCORT:_ResumeMission( EscortGroup, WayPoint )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_ESCORT self
|
-- @param #AI_ESCORT self
|
||||||
-- @param Wrapper.Group#GROUP EscortGroup The escort group that will attack the detected item.
|
-- @param Wrapper.Group#GROUP EscortGroup The escort group that will attack the detected item.
|
||||||
-- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem
|
-- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem
|
||||||
function AI_ESCORT:_AttackTarget( EscortGroup, DetectedItem )
|
function AI_ESCORT:_AttackTarget( EscortGroup, DetectedItem )
|
||||||
@@ -1743,7 +1754,7 @@ function AI_ESCORT:_AttackTarget( EscortGroup, DetectedItem )
|
|||||||
local AttackUnitTasks = {}
|
local AttackUnitTasks = {}
|
||||||
|
|
||||||
DetectedSet:ForEachUnit(
|
DetectedSet:ForEachUnit(
|
||||||
--- @param Wrapper.Unit#UNIT DetectedUnit
|
-- @param Wrapper.Unit#UNIT DetectedUnit
|
||||||
function( DetectedUnit, Tasks )
|
function( DetectedUnit, Tasks )
|
||||||
if DetectedUnit:IsAlive() then
|
if DetectedUnit:IsAlive() then
|
||||||
AttackUnitTasks[#AttackUnitTasks+1] = EscortGroup:TaskAttackUnit( DetectedUnit )
|
AttackUnitTasks[#AttackUnitTasks+1] = EscortGroup:TaskAttackUnit( DetectedUnit )
|
||||||
@@ -1767,7 +1778,7 @@ function AI_ESCORT:_AttackTarget( EscortGroup, DetectedItem )
|
|||||||
local Tasks = {}
|
local Tasks = {}
|
||||||
|
|
||||||
DetectedSet:ForEachUnit(
|
DetectedSet:ForEachUnit(
|
||||||
--- @param Wrapper.Unit#UNIT DetectedUnit
|
-- @param Wrapper.Unit#UNIT DetectedUnit
|
||||||
function( DetectedUnit, Tasks )
|
function( DetectedUnit, Tasks )
|
||||||
if DetectedUnit:IsAlive() then
|
if DetectedUnit:IsAlive() then
|
||||||
Tasks[#Tasks+1] = EscortGroup:TaskFireAtPoint( DetectedUnit:GetVec2(), 50 )
|
Tasks[#Tasks+1] = EscortGroup:TaskFireAtPoint( DetectedUnit:GetVec2(), 50 )
|
||||||
@@ -1795,7 +1806,7 @@ end
|
|||||||
function AI_ESCORT:_FlightAttackTarget( DetectedItem )
|
function AI_ESCORT:_FlightAttackTarget( DetectedItem )
|
||||||
|
|
||||||
self.EscortGroupSet:ForEachGroupAlive(
|
self.EscortGroupSet:ForEachGroupAlive(
|
||||||
--- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup, DetectedItem )
|
function( EscortGroup, DetectedItem )
|
||||||
if EscortGroup:IsAir() then
|
if EscortGroup:IsAir() then
|
||||||
self:_AttackTarget( EscortGroup, DetectedItem )
|
self:_AttackTarget( EscortGroup, DetectedItem )
|
||||||
@@ -1842,7 +1853,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
--- @param #AI_ESCORT self
|
-- @param #AI_ESCORT self
|
||||||
-- @param Wrapper.Group#GROUP EscortGroup The escort group that will attack the detected item.
|
-- @param Wrapper.Group#GROUP EscortGroup The escort group that will attack the detected item.
|
||||||
-- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem
|
-- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem
|
||||||
function AI_ESCORT:_AssistTarget( EscortGroup, DetectedItem )
|
function AI_ESCORT:_AssistTarget( EscortGroup, DetectedItem )
|
||||||
@@ -1854,7 +1865,7 @@ function AI_ESCORT:_AssistTarget( EscortGroup, DetectedItem )
|
|||||||
local Tasks = {}
|
local Tasks = {}
|
||||||
|
|
||||||
DetectedSet:ForEachUnit(
|
DetectedSet:ForEachUnit(
|
||||||
--- @param Wrapper.Unit#UNIT DetectedUnit
|
-- @param Wrapper.Unit#UNIT DetectedUnit
|
||||||
function( DetectedUnit, Tasks )
|
function( DetectedUnit, Tasks )
|
||||||
if DetectedUnit:IsAlive() then
|
if DetectedUnit:IsAlive() then
|
||||||
Tasks[#Tasks+1] = EscortGroup:TaskFireAtPoint( DetectedUnit:GetVec2(), 50 )
|
Tasks[#Tasks+1] = EscortGroup:TaskFireAtPoint( DetectedUnit:GetVec2(), 50 )
|
||||||
@@ -1881,7 +1892,7 @@ end
|
|||||||
|
|
||||||
function AI_ESCORT:_FlightROEHoldFire( EscortROEMessage )
|
function AI_ESCORT:_FlightROEHoldFire( EscortROEMessage )
|
||||||
self.EscortGroupSet:ForEachGroupAlive(
|
self.EscortGroupSet:ForEachGroupAlive(
|
||||||
--- @param Wrapper.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
self:_ROE( EscortGroup, EscortGroup.OptionROEHoldFire, EscortROEMessage )
|
self:_ROE( EscortGroup, EscortGroup.OptionROEHoldFire, EscortROEMessage )
|
||||||
end
|
end
|
||||||
@@ -1890,7 +1901,7 @@ end
|
|||||||
|
|
||||||
function AI_ESCORT:_FlightROEOpenFire( EscortROEMessage )
|
function AI_ESCORT:_FlightROEOpenFire( EscortROEMessage )
|
||||||
self.EscortGroupSet:ForEachGroupAlive(
|
self.EscortGroupSet:ForEachGroupAlive(
|
||||||
--- @param Wrapper.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
self:_ROE( EscortGroup, EscortGroup.OptionROEOpenFire, EscortROEMessage )
|
self:_ROE( EscortGroup, EscortGroup.OptionROEOpenFire, EscortROEMessage )
|
||||||
end
|
end
|
||||||
@@ -1899,7 +1910,7 @@ end
|
|||||||
|
|
||||||
function AI_ESCORT:_FlightROEReturnFire( EscortROEMessage )
|
function AI_ESCORT:_FlightROEReturnFire( EscortROEMessage )
|
||||||
self.EscortGroupSet:ForEachGroupAlive(
|
self.EscortGroupSet:ForEachGroupAlive(
|
||||||
--- @param Wrapper.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
self:_ROE( EscortGroup, EscortGroup.OptionROEReturnFire, EscortROEMessage )
|
self:_ROE( EscortGroup, EscortGroup.OptionROEReturnFire, EscortROEMessage )
|
||||||
end
|
end
|
||||||
@@ -1908,7 +1919,7 @@ end
|
|||||||
|
|
||||||
function AI_ESCORT:_FlightROEWeaponFree( EscortROEMessage )
|
function AI_ESCORT:_FlightROEWeaponFree( EscortROEMessage )
|
||||||
self.EscortGroupSet:ForEachGroupAlive(
|
self.EscortGroupSet:ForEachGroupAlive(
|
||||||
--- @param Wrapper.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
self:_ROE( EscortGroup, EscortGroup.OptionROEWeaponFree, EscortROEMessage )
|
self:_ROE( EscortGroup, EscortGroup.OptionROEWeaponFree, EscortROEMessage )
|
||||||
end
|
end
|
||||||
@@ -1924,7 +1935,7 @@ end
|
|||||||
|
|
||||||
function AI_ESCORT:_FlightROTNoReaction( EscortROTMessage )
|
function AI_ESCORT:_FlightROTNoReaction( EscortROTMessage )
|
||||||
self.EscortGroupSet:ForEachGroupAlive(
|
self.EscortGroupSet:ForEachGroupAlive(
|
||||||
--- @param Wrapper.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
self:_ROT( EscortGroup, EscortGroup.OptionROTNoReaction, EscortROTMessage )
|
self:_ROT( EscortGroup, EscortGroup.OptionROTNoReaction, EscortROTMessage )
|
||||||
end
|
end
|
||||||
@@ -1933,7 +1944,7 @@ end
|
|||||||
|
|
||||||
function AI_ESCORT:_FlightROTPassiveDefense( EscortROTMessage )
|
function AI_ESCORT:_FlightROTPassiveDefense( EscortROTMessage )
|
||||||
self.EscortGroupSet:ForEachGroupAlive(
|
self.EscortGroupSet:ForEachGroupAlive(
|
||||||
--- @param Wrapper.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
self:_ROT( EscortGroup, EscortGroup.OptionROTPassiveDefense, EscortROTMessage )
|
self:_ROT( EscortGroup, EscortGroup.OptionROTPassiveDefense, EscortROTMessage )
|
||||||
end
|
end
|
||||||
@@ -1942,7 +1953,7 @@ end
|
|||||||
|
|
||||||
function AI_ESCORT:_FlightROTEvadeFire( EscortROTMessage )
|
function AI_ESCORT:_FlightROTEvadeFire( EscortROTMessage )
|
||||||
self.EscortGroupSet:ForEachGroupAlive(
|
self.EscortGroupSet:ForEachGroupAlive(
|
||||||
--- @param Wrapper.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
self:_ROT( EscortGroup, EscortGroup.OptionROTEvadeFire, EscortROTMessage )
|
self:_ROT( EscortGroup, EscortGroup.OptionROTEvadeFire, EscortROTMessage )
|
||||||
end
|
end
|
||||||
@@ -1951,7 +1962,7 @@ end
|
|||||||
|
|
||||||
function AI_ESCORT:_FlightROTVertical( EscortROTMessage )
|
function AI_ESCORT:_FlightROTVertical( EscortROTMessage )
|
||||||
self.EscortGroupSet:ForEachGroupAlive(
|
self.EscortGroupSet:ForEachGroupAlive(
|
||||||
--- @param Wrapper.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
self:_ROT( EscortGroup, EscortGroup.OptionROTVertical, EscortROTMessage )
|
self:_ROT( EscortGroup, EscortGroup.OptionROTVertical, EscortROTMessage )
|
||||||
end
|
end
|
||||||
@@ -2178,5 +2189,3 @@ function AI_ESCORT:_FlightReportTargetsScheduler()
|
|||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,12 @@
|
|||||||
|
|
||||||
|
|
||||||
--- Models the automatic assignment of AI escorts to player flights.
|
--- Models the automatic assignment of AI escorts to player flights.
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_ESCORT_DISPATCHER
|
-- @field #AI_ESCORT_DISPATCHER
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @module AI.AI_ESCORT_DISPATCHER_REQUEST
|
-- @module AI.AI_Escort_Dispatcher_Request
|
||||||
-- @image MOOSE.JPG
|
-- @image MOOSE.JPG
|
||||||
|
|
||||||
|
|
||||||
@@ -20,7 +20,12 @@
|
|||||||
|
|
||||||
|
|
||||||
--- 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
|
||||||
--
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_ESCORT_DISPATCHER_REQUEST
|
-- @field #AI_ESCORT_DISPATCHER_REQUEST
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **Functional** -- Taking the lead of AI escorting your flight or of other AI, upon request using the menu.
|
--- **AI** - Taking the lead of AI escorting your flight or of other AI, upon request using the menu.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/ESC%20-%20Escorting)
|
-- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Escort)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -137,13 +137,18 @@
|
|||||||
-- Escort groups can have their own mission. This menu item will allow the escort group to resume their Mission from a given waypoint.
|
-- Escort groups can have their own mission. This menu item will allow the escort group to resume their Mission from a given waypoint.
|
||||||
-- Note that this is really fantastic, as you now have the dynamic of taking control of the escort groups, and allowing them to resume their path or mission.
|
-- Note that this is really fantastic, as you now have the dynamic of taking control of the escort groups, and allowing them to resume their path or mission.
|
||||||
--
|
--
|
||||||
|
-- # Developer Note
|
||||||
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Authors: **FlightControl**
|
-- ### Authors: **FlightControl**
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @module AI.AI_Escort
|
-- @module AI.AI_Escort_Request
|
||||||
-- @image Escorting.JPG
|
-- @image Escorting.JPG
|
||||||
|
|
||||||
|
|
||||||
@@ -292,7 +297,7 @@ function AI_ESCORT_REQUEST:onafterStop( EscortGroupSet )
|
|||||||
self:F()
|
self:F()
|
||||||
|
|
||||||
EscortGroupSet:ForEachGroup(
|
EscortGroupSet:ForEachGroup(
|
||||||
--- @param Core.Group#GROUP EscortGroup
|
--- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
EscortGroup:WayPointInitialize()
|
EscortGroup:WayPointInitialize()
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **AI** -- Build large airborne formations of aircraft.
|
--- **AI** - Build large airborne formations of aircraft.
|
||||||
--
|
--
|
||||||
-- **Features:**
|
-- **Features:**
|
||||||
--
|
--
|
||||||
@@ -7,13 +7,13 @@
|
|||||||
-- * Assign a group leader that will guide the large formation path.
|
-- * Assign a group leader that will guide the large formation path.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/FOR%20-%20Formation)
|
-- ## Additional Material:
|
||||||
--
|
--
|
||||||
-- ===
|
-- * **Demo Missions:** [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Formation)
|
||||||
--
|
-- * **YouTube videos:** [Playlist](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl0bFIJ9jIdYM22uaWmIN4oz)
|
||||||
-- ### [YouTube Playlist](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl0bFIJ9jIdYM22uaWmIN4oz)
|
-- * **Guides:** None
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
@@ -31,17 +31,17 @@
|
|||||||
-- @field Core.Set#SET_GROUP FollowGroupSet
|
-- @field Core.Set#SET_GROUP FollowGroupSet
|
||||||
-- @field #string FollowName
|
-- @field #string FollowName
|
||||||
-- @field #AI_FORMATION.MODE FollowMode The mode the escort is in.
|
-- @field #AI_FORMATION.MODE FollowMode The mode the escort is in.
|
||||||
-- @field Scheduler#SCHEDULER FollowScheduler The instance of the SCHEDULER class.
|
-- @field Core.Scheduler#SCHEDULER FollowScheduler The instance of the SCHEDULER class.
|
||||||
-- @field #number FollowDistance The current follow distance.
|
-- @field #number FollowDistance The current follow distance.
|
||||||
-- @field #boolean ReportTargets If true, nearby targets are reported.
|
-- @field #boolean ReportTargets If true, nearby targets are reported.
|
||||||
-- @Field DCSTypes#AI.Option.Air.val.ROE OptionROE Which ROE is set to the FollowGroup.
|
-- @field DCS#AI.Option.Air.val.ROE OptionROE Which ROE is set to the FollowGroup.
|
||||||
-- @field DCSTypes#AI.Option.Air.val.REACTION_ON_THREAT OptionReactionOnThreat Which REACTION_ON_THREAT is set to the FollowGroup.
|
-- @field DCS#AI.Option.Air.val.REACTION_ON_THREAT OptionReactionOnThreat Which REACTION_ON_THREAT is set to the FollowGroup.
|
||||||
-- @field #number dtFollow Time step between position updates.
|
-- @field #number dtFollow Time step between position updates.
|
||||||
|
|
||||||
|
|
||||||
--- 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 @{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:
|
||||||
--
|
--
|
||||||
@@ -92,7 +92,12 @@
|
|||||||
-- local LargeFormation = AI_FORMATION:New( LeaderUnit, FollowGroupSet, "Center Wing Formation", "Briefing" )
|
-- local LargeFormation = AI_FORMATION:New( LeaderUnit, FollowGroupSet, "Center Wing Formation", "Briefing" )
|
||||||
-- LargeFormation:FormationCenterWing( 500, 50, 0, 250, 250 )
|
-- LargeFormation:FormationCenterWing( 500, 50, 0, 250, 250 )
|
||||||
-- LargeFormation:__Start( 1 )
|
-- LargeFormation:__Start( 1 )
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- @field #AI_FORMATION
|
-- @field #AI_FORMATION
|
||||||
AI_FORMATION = {
|
AI_FORMATION = {
|
||||||
ClassName = "AI_FORMATION",
|
ClassName = "AI_FORMATION",
|
||||||
@@ -159,15 +164,6 @@ AI_FORMATION.__Enum.ReportType = {
|
|||||||
Ground = "G",
|
Ground = "G",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- MENUPARAM type
|
|
||||||
-- @type MENUPARAM
|
|
||||||
-- @field #AI_FORMATION ParamSelf
|
|
||||||
-- @field #number ParamDistance
|
|
||||||
-- @field #function ParamFunction
|
|
||||||
-- @field #string ParamMessage
|
|
||||||
|
|
||||||
--- AI_FORMATION class constructor for an AI group
|
--- AI_FORMATION class constructor for an AI group
|
||||||
-- @param #AI_FORMATION self
|
-- @param #AI_FORMATION self
|
||||||
-- @param Wrapper.Unit#UNIT FollowUnit The UNIT leading the FolllowGroupSet.
|
-- @param Wrapper.Unit#UNIT FollowUnit The UNIT leading the FolllowGroupSet.
|
||||||
@@ -1000,7 +996,7 @@ function AI_FORMATION:SetFlightModeMission( FollowGroup )
|
|||||||
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Mission )
|
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Mission )
|
||||||
else
|
else
|
||||||
self.FollowGroupSet:ForSomeGroupAlive(
|
self.FollowGroupSet:ForSomeGroupAlive(
|
||||||
--- @param Core.Group#GROUP EscortGroup
|
--- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( FollowGroup )
|
function( FollowGroup )
|
||||||
FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) )
|
FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) )
|
||||||
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Mission )
|
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Mission )
|
||||||
@@ -1024,7 +1020,7 @@ function AI_FORMATION:SetFlightModeAttack( FollowGroup )
|
|||||||
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Attack )
|
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Attack )
|
||||||
else
|
else
|
||||||
self.FollowGroupSet:ForSomeGroupAlive(
|
self.FollowGroupSet:ForSomeGroupAlive(
|
||||||
--- @param Core.Group#GROUP EscortGroup
|
--- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( FollowGroup )
|
function( FollowGroup )
|
||||||
FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) )
|
FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) )
|
||||||
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Attack )
|
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Attack )
|
||||||
@@ -1048,7 +1044,7 @@ function AI_FORMATION:SetFlightModeFormation( FollowGroup )
|
|||||||
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Formation )
|
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Formation )
|
||||||
else
|
else
|
||||||
self.FollowGroupSet:ForSomeGroupAlive(
|
self.FollowGroupSet:ForSomeGroupAlive(
|
||||||
--- @param Core.Group#GROUP EscortGroup
|
--- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( FollowGroup )
|
function( FollowGroup )
|
||||||
FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) )
|
FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) )
|
||||||
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Formation )
|
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Formation )
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **AI** -- Perform Air Patrolling for airplanes.
|
--- **AI** - Perform Air Patrolling for airplanes.
|
||||||
--
|
--
|
||||||
-- **Features:**
|
-- **Features:**
|
||||||
--
|
--
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/PAT%20-%20Patrolling)
|
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Patrol)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -27,8 +27,8 @@
|
|||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
-- ### Contributions:
|
-- ### Contributions:
|
||||||
--
|
--
|
||||||
-- * **[Dutch_Baron](https://forums.eagle.ru/member.php?u=112075)**: Working together with James has resulted in the creation of the AI_BALANCER class. James has shared his ideas on balancing AI with air units, and together we made a first design which you can use now :-)
|
-- * **Dutch_Baron**: Working together with James has resulted in the creation of the AI_BALANCER class. James has shared his ideas on balancing AI with air units, and together we made a first design which you can use now :-)
|
||||||
-- * **[Pikey](https://forums.eagle.ru/member.php?u=62835)**: Testing and API concept review.
|
-- * **Pikey**: Testing and API concept review.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
--- AI_PATROL_ZONE class
|
--- AI_PATROL_ZONE class
|
||||||
-- @type AI_PATROL_ZONE
|
-- @type AI_PATROL_ZONE
|
||||||
-- @field Wrapper.Controllable#CONTROLLABLE AIControllable The @{Wrapper.Controllable} patrolling.
|
-- @field Wrapper.Controllable#CONTROLLABLE AIControllable The @{Wrapper.Controllable} patrolling.
|
||||||
-- @field Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
|
-- @field Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
|
||||||
-- @field DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
-- @field DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
||||||
-- @field DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
-- @field DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
||||||
-- @field DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Controllable} in km/h.
|
-- @field DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Controllable} in km/h.
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
-- @field Core.Spawn#SPAWN CoordTest
|
-- @field Core.Spawn#SPAWN CoordTest
|
||||||
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
||||||
|
|
||||||
--- Implements the core functions to patrol a @{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}.
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
@@ -135,16 +135,21 @@
|
|||||||
-- When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base.
|
-- When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base.
|
||||||
-- Therefore, with a parameter and a calculation of the distance to the home base, the fuel threshold is calculated.
|
-- Therefore, with a parameter and a calculation of the distance to the home base, the fuel threshold is calculated.
|
||||||
-- When the fuel threshold is reached, the AI will continue for a given time its patrol task in orbit,
|
-- When the fuel threshold is reached, the AI will continue for a given time its patrol task in orbit,
|
||||||
-- while a new AI is targetted to the AI_PATROL_ZONE.
|
-- while a new AI is targeted to the AI_PATROL_ZONE.
|
||||||
-- Once the time is finished, the old AI will return to the base.
|
-- Once the time is finished, the old AI will return to the base.
|
||||||
-- Use the method @{#AI_PATROL_ZONE.ManageFuel}() to have this proces in place.
|
-- Use the method @{#AI_PATROL_ZONE.ManageFuel}() to have this process in place.
|
||||||
--
|
--
|
||||||
-- ## 7. Manage "damage" behaviour of the AI in the AI_PATROL_ZONE
|
-- ## 7. Manage "damage" behaviour of the AI in the AI_PATROL_ZONE
|
||||||
--
|
--
|
||||||
-- When the AI is damaged, it is required that a new AIControllable is started. However, damage cannon be foreseen early on.
|
-- When the AI is damaged, it is required that a new AIControllable is started. However, damage cannon be foreseen early on.
|
||||||
-- Therefore, when the damage threshold is reached, the AI will return immediately to the home base (RTB).
|
-- Therefore, when the damage threshold is reached, the AI will return immediately to the home base (RTB).
|
||||||
-- Use the method @{#AI_PATROL_ZONE.ManageDamage}() to have this proces in place.
|
-- Use the method @{#AI_PATROL_ZONE.ManageDamage}() to have this process in place.
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_PATROL_ZONE
|
-- @field #AI_PATROL_ZONE
|
||||||
@@ -154,7 +159,7 @@ AI_PATROL_ZONE = {
|
|||||||
|
|
||||||
--- Creates a new AI_PATROL_ZONE object
|
--- Creates a new AI_PATROL_ZONE object
|
||||||
-- @param #AI_PATROL_ZONE self
|
-- @param #AI_PATROL_ZONE self
|
||||||
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
|
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
|
||||||
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Controllable} in km/h.
|
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Controllable} in km/h.
|
||||||
@@ -170,27 +175,27 @@ function AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltit
|
|||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, FSM_CONTROLLABLE:New() ) -- #AI_PATROL_ZONE
|
local self = BASE:Inherit( self, FSM_CONTROLLABLE:New() ) -- #AI_PATROL_ZONE
|
||||||
|
|
||||||
|
|
||||||
self.PatrolZone = PatrolZone
|
self.PatrolZone = PatrolZone
|
||||||
self.PatrolFloorAltitude = PatrolFloorAltitude
|
self.PatrolFloorAltitude = PatrolFloorAltitude
|
||||||
self.PatrolCeilingAltitude = PatrolCeilingAltitude
|
self.PatrolCeilingAltitude = PatrolCeilingAltitude
|
||||||
self.PatrolMinSpeed = PatrolMinSpeed
|
self.PatrolMinSpeed = PatrolMinSpeed
|
||||||
self.PatrolMaxSpeed = PatrolMaxSpeed
|
self.PatrolMaxSpeed = PatrolMaxSpeed
|
||||||
|
|
||||||
-- defafult PatrolAltType to "BARO" if not specified
|
-- defafult PatrolAltType to "BARO" if not specified
|
||||||
self.PatrolAltType = PatrolAltType or "BARO"
|
self.PatrolAltType = PatrolAltType or "BARO"
|
||||||
|
|
||||||
self:SetRefreshTimeInterval( 30 )
|
self:SetRefreshTimeInterval( 30 )
|
||||||
|
|
||||||
self.CheckStatus = true
|
self.CheckStatus = true
|
||||||
|
|
||||||
self:ManageFuel( .2, 60 )
|
self:ManageFuel( .2, 60 )
|
||||||
self:ManageDamage( 1 )
|
self:ManageDamage( 1 )
|
||||||
|
|
||||||
|
|
||||||
self.DetectedUnits = {} -- This table contains the targets detected during patrol.
|
self.DetectedUnits = {} -- This table contains the targets detected during patrol.
|
||||||
|
|
||||||
self:SetStartState( "None" )
|
self:SetStartState( "None" )
|
||||||
|
|
||||||
self:AddTransition( "*", "Stop", "Stopped" )
|
self:AddTransition( "*", "Stop", "Stopped" )
|
||||||
@@ -228,7 +233,7 @@ function AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltit
|
|||||||
-- @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.
|
||||||
|
|
||||||
--- Synchronous Event Trigger for Event Stop.
|
--- Synchronous Event Trigger for Event Stop.
|
||||||
-- @function [parent=#AI_PATROL_ZONE] Stop
|
-- @function [parent=#AI_PATROL_ZONE] Stop
|
||||||
-- @param #AI_PATROL_ZONE self
|
-- @param #AI_PATROL_ZONE self
|
||||||
@@ -256,7 +261,7 @@ function AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltit
|
|||||||
-- @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.
|
||||||
|
|
||||||
--- Synchronous Event Trigger for Event Start.
|
--- Synchronous Event Trigger for Event Start.
|
||||||
-- @function [parent=#AI_PATROL_ZONE] Start
|
-- @function [parent=#AI_PATROL_ZONE] Start
|
||||||
-- @param #AI_PATROL_ZONE self
|
-- @param #AI_PATROL_ZONE self
|
||||||
@@ -329,7 +334,7 @@ function AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltit
|
|||||||
-- @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.
|
||||||
|
|
||||||
--- Synchronous Event Trigger for Event Status.
|
--- Synchronous Event Trigger for Event Status.
|
||||||
-- @function [parent=#AI_PATROL_ZONE] Status
|
-- @function [parent=#AI_PATROL_ZONE] Status
|
||||||
-- @param #AI_PATROL_ZONE self
|
-- @param #AI_PATROL_ZONE self
|
||||||
@@ -413,7 +418,7 @@ function AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltit
|
|||||||
-- @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.
|
||||||
|
|
||||||
--- Synchronous Event Trigger for Event RTB.
|
--- Synchronous Event Trigger for Event RTB.
|
||||||
-- @function [parent=#AI_PATROL_ZONE] RTB
|
-- @function [parent=#AI_PATROL_ZONE] RTB
|
||||||
-- @param #AI_PATROL_ZONE self
|
-- @param #AI_PATROL_ZONE self
|
||||||
@@ -441,11 +446,11 @@ function AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltit
|
|||||||
-- @param #string To The To State string.
|
-- @param #string To The To State string.
|
||||||
|
|
||||||
self:AddTransition( "*", "Reset", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_PATROL_ZONE.
|
self:AddTransition( "*", "Reset", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_PATROL_ZONE.
|
||||||
|
|
||||||
self:AddTransition( "*", "Eject", "*" )
|
self:AddTransition( "*", "Eject", "*" )
|
||||||
self:AddTransition( "*", "Crash", "Crashed" )
|
self:AddTransition( "*", "Crash", "Crashed" )
|
||||||
self:AddTransition( "*", "PilotDead", "*" )
|
self:AddTransition( "*", "PilotDead", "*" )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -459,7 +464,7 @@ end
|
|||||||
-- @return #AI_PATROL_ZONE self
|
-- @return #AI_PATROL_ZONE self
|
||||||
function AI_PATROL_ZONE:SetSpeed( PatrolMinSpeed, PatrolMaxSpeed )
|
function AI_PATROL_ZONE:SetSpeed( PatrolMinSpeed, PatrolMaxSpeed )
|
||||||
self:F2( { PatrolMinSpeed, PatrolMaxSpeed } )
|
self:F2( { PatrolMinSpeed, PatrolMaxSpeed } )
|
||||||
|
|
||||||
self.PatrolMinSpeed = PatrolMinSpeed
|
self.PatrolMinSpeed = PatrolMinSpeed
|
||||||
self.PatrolMaxSpeed = PatrolMaxSpeed
|
self.PatrolMaxSpeed = PatrolMaxSpeed
|
||||||
end
|
end
|
||||||
@@ -473,7 +478,7 @@ end
|
|||||||
-- @return #AI_PATROL_ZONE self
|
-- @return #AI_PATROL_ZONE self
|
||||||
function AI_PATROL_ZONE:SetAltitude( PatrolFloorAltitude, PatrolCeilingAltitude )
|
function AI_PATROL_ZONE:SetAltitude( PatrolFloorAltitude, PatrolCeilingAltitude )
|
||||||
self:F2( { PatrolFloorAltitude, PatrolCeilingAltitude } )
|
self:F2( { PatrolFloorAltitude, PatrolCeilingAltitude } )
|
||||||
|
|
||||||
self.PatrolFloorAltitude = PatrolFloorAltitude
|
self.PatrolFloorAltitude = PatrolFloorAltitude
|
||||||
self.PatrolCeilingAltitude = PatrolCeilingAltitude
|
self.PatrolCeilingAltitude = PatrolCeilingAltitude
|
||||||
end
|
end
|
||||||
@@ -582,7 +587,7 @@ end
|
|||||||
|
|
||||||
--- When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base.
|
--- When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base.
|
||||||
-- Therefore, with a parameter and a calculation of the distance to the home base, the fuel threshold is calculated.
|
-- Therefore, with a parameter and a calculation of the distance to the home base, the fuel threshold is calculated.
|
||||||
-- When the fuel threshold is reached, the AI will continue for a given time its patrol task in orbit, while a new AIControllable is targetted to the AI_PATROL_ZONE.
|
-- When the fuel threshold is reached, the AI will continue for a given time its patrol task in orbit, while a new AIControllable is targeted to the AI_PATROL_ZONE.
|
||||||
-- Once the time is finished, the old AI will return to the base.
|
-- Once the time is finished, the old AI will return to the base.
|
||||||
-- @param #AI_PATROL_ZONE self
|
-- @param #AI_PATROL_ZONE self
|
||||||
-- @param #number PatrolFuelThresholdPercentage The threshold in percentage (between 0 and 1) when the AIControllable is considered to get out of fuel.
|
-- @param #number PatrolFuelThresholdPercentage The threshold in percentage (between 0 and 1) when the AIControllable is considered to get out of fuel.
|
||||||
@@ -592,7 +597,7 @@ function AI_PATROL_ZONE:ManageFuel( PatrolFuelThresholdPercentage, PatrolOutOfFu
|
|||||||
|
|
||||||
self.PatrolFuelThresholdPercentage = PatrolFuelThresholdPercentage
|
self.PatrolFuelThresholdPercentage = PatrolFuelThresholdPercentage
|
||||||
self.PatrolOutOfFuelOrbitTime = PatrolOutOfFuelOrbitTime
|
self.PatrolOutOfFuelOrbitTime = PatrolOutOfFuelOrbitTime
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -609,28 +614,28 @@ function AI_PATROL_ZONE:ManageDamage( PatrolDamageThreshold )
|
|||||||
|
|
||||||
self.PatrolManageDamage = true
|
self.PatrolManageDamage = true
|
||||||
self.PatrolDamageThreshold = PatrolDamageThreshold
|
self.PatrolDamageThreshold = PatrolDamageThreshold
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Defines a new patrol route using the @{Process_PatrolZone} parameters and settings.
|
--- Defines a new patrol route using the @{#AI_PATROL_ZONE} parameters and settings.
|
||||||
-- @param #AI_PATROL_ZONE self
|
-- @param #AI_PATROL_ZONE self
|
||||||
-- @return #AI_PATROL_ZONE self
|
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
|
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
|
||||||
-- @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 #AI_PATROL_ZONE self
|
||||||
function AI_PATROL_ZONE:onafterStart( Controllable, From, Event, To )
|
function AI_PATROL_ZONE:onafterStart( Controllable, From, Event, To )
|
||||||
self:F2()
|
self:F2()
|
||||||
|
|
||||||
self:__Route( 1 ) -- Route to the patrol point. The asynchronous trigger is important, because a spawned group and units takes at least one second to come live.
|
self:__Route( 1 ) -- Route to the patrol point. The asynchronous trigger is important, because a spawned group and units takes at least one second to come live.
|
||||||
self:__Status( 60 ) -- Check status status every 30 seconds.
|
self:__Status( 60 ) -- Check status status every 30 seconds.
|
||||||
self:SetDetectionActivated()
|
self:SetDetectionActivated()
|
||||||
|
|
||||||
self:HandleEvent( EVENTS.PilotDead, self.OnPilotDead )
|
self:HandleEvent( EVENTS.PilotDead, self.OnPilotDead )
|
||||||
self:HandleEvent( EVENTS.Crash, self.OnCrash )
|
self:HandleEvent( EVENTS.Crash, self.OnCrash )
|
||||||
self:HandleEvent( EVENTS.Ejection, self.OnEjection )
|
self:HandleEvent( EVENTS.Ejection, self.OnEjection )
|
||||||
|
|
||||||
Controllable:OptionROEHoldFire()
|
Controllable:OptionROEHoldFire()
|
||||||
Controllable:OptionROTVertical()
|
Controllable:OptionROTVertical()
|
||||||
|
|
||||||
@@ -667,12 +672,12 @@ function AI_PATROL_ZONE:onafterDetect( Controllable, From, Event, To )
|
|||||||
if TargetObject and TargetObject:isExist() and TargetObject.id_ < 50000000 then
|
if TargetObject and TargetObject:isExist() and TargetObject.id_ < 50000000 then
|
||||||
|
|
||||||
local TargetUnit = UNIT:Find( TargetObject )
|
local TargetUnit = UNIT:Find( TargetObject )
|
||||||
|
|
||||||
-- Check that target is alive due to issue https://github.com/FlightControl-Master/MOOSE/issues/1234
|
-- Check that target is alive due to issue https://github.com/FlightControl-Master/MOOSE/issues/1234
|
||||||
if TargetUnit and TargetUnit:IsAlive() then
|
if TargetUnit and TargetUnit:IsAlive() then
|
||||||
|
|
||||||
local TargetUnitName = TargetUnit:GetName()
|
local TargetUnitName = TargetUnit:GetName()
|
||||||
|
|
||||||
if self.DetectionZone then
|
if self.DetectionZone then
|
||||||
if TargetUnit:IsInZone( self.DetectionZone ) then
|
if TargetUnit:IsInZone( self.DetectionZone ) then
|
||||||
self:T( {"Detected ", TargetUnit } )
|
self:T( {"Detected ", TargetUnit } )
|
||||||
@@ -687,13 +692,13 @@ function AI_PATROL_ZONE:onafterDetect( Controllable, From, Event, To )
|
|||||||
end
|
end
|
||||||
Detected = true
|
Detected = true
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self:__Detect( -self.DetectInterval )
|
self:__Detect( -self.DetectInterval )
|
||||||
|
|
||||||
if Detected == true then
|
if Detected == true then
|
||||||
self:__Detected( 1.5 )
|
self:__Detected( 1.5 )
|
||||||
end
|
end
|
||||||
@@ -701,7 +706,7 @@ function AI_PATROL_ZONE:onafterDetect( Controllable, From, Event, To )
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- @param Wrapper.Controllable#CONTROLLABLE AIControllable
|
--- @param Wrapper.Controllable#CONTROLLABLE AIControllable
|
||||||
-- This statis method is called from the route path within the last task at the last waaypoint of the Controllable.
|
-- This static method is called from the route path within the last task at the last waypoint of the Controllable.
|
||||||
-- Note that this method is required, as triggers the next route when patrolling for the Controllable.
|
-- Note that this method is required, as triggers the next route when patrolling for the Controllable.
|
||||||
function AI_PATROL_ZONE:_NewPatrolRoute( AIControllable )
|
function AI_PATROL_ZONE:_NewPatrolRoute( AIControllable )
|
||||||
|
|
||||||
@@ -710,7 +715,7 @@ function AI_PATROL_ZONE:_NewPatrolRoute( AIControllable )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Defines a new patrol route using the @{Process_PatrolZone} parameters and settings.
|
--- Defines a new patrol route using the @{#AI_PATROL_ZONE} parameters and settings.
|
||||||
-- @param #AI_PATROL_ZONE self
|
-- @param #AI_PATROL_ZONE self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
|
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
|
||||||
-- @param #string From The From State string.
|
-- @param #string From The From State string.
|
||||||
@@ -729,7 +734,7 @@ function AI_PATROL_ZONE:onafterRoute( Controllable, From, Event, To )
|
|||||||
if self.Controllable:IsAlive() and life > 1 then
|
if self.Controllable:IsAlive() and life > 1 then
|
||||||
-- Determine if the AIControllable is within the PatrolZone.
|
-- Determine if the AIControllable is within the PatrolZone.
|
||||||
-- If not, make a waypoint within the to that the AIControllable will fly at maximum speed to that point.
|
-- If not, make a waypoint within the to that the AIControllable will fly at maximum speed to that point.
|
||||||
|
|
||||||
local PatrolRoute = {}
|
local PatrolRoute = {}
|
||||||
|
|
||||||
-- Calculate the current route point of the controllable as the start point of the route.
|
-- Calculate the current route point of the controllable as the start point of the route.
|
||||||
@@ -775,7 +780,7 @@ function AI_PATROL_ZONE:onafterRoute( Controllable, From, Event, To )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Define a random point in the @{Zone}. The AI will fly to that point within the zone.
|
--- Define a random point in the @{Core.Zone}. The AI will fly to that point within the zone.
|
||||||
|
|
||||||
--- Find a random 2D point in PatrolZone.
|
--- Find a random 2D point in PatrolZone.
|
||||||
local ToTargetVec2 = self.PatrolZone:GetRandomVec2()
|
local ToTargetVec2 = self.PatrolZone:GetRandomVec2()
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
--- **Actions** - ACT_ACCOUNT_ classes **account for** (detect, count & report) various DCS events occuring on @{Wrapper.Unit}s.
|
--- **Actions** - ACT_ACCOUNT_ classes **account for** (detect, count & report) various DCS events occurring on UNITs.
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @module Actions.Account
|
-- @module Actions.Act_Account
|
||||||
-- @image MOOSE.JPG
|
-- @image MOOSE.JPG
|
||||||
|
|
||||||
do -- ACT_ACCOUNT
|
do -- ACT_ACCOUNT
|
||||||
@@ -20,7 +20,7 @@ do -- ACT_ACCOUNT
|
|||||||
--
|
--
|
||||||
-- ### ACT_ACCOUNT States
|
-- ### ACT_ACCOUNT States
|
||||||
--
|
--
|
||||||
-- * **Asigned**: The player is assigned.
|
-- * **Assigned**: The player is assigned.
|
||||||
-- * **Waiting**: Waiting for an event.
|
-- * **Waiting**: Waiting for an event.
|
||||||
-- * **Report**: Reporting.
|
-- * **Report**: Reporting.
|
||||||
-- * **Account**: Account for an event.
|
-- * **Account**: Account for an event.
|
||||||
@@ -54,6 +54,11 @@ do -- ACT_ACCOUNT
|
|||||||
-- The state transition method needs to start with the name **OnAfter + the name of the state**.
|
-- The state transition method needs to start with the name **OnAfter + the name of the state**.
|
||||||
-- These state transition methods need to provide a return value, which is specified at the function description.
|
-- These state transition methods need to provide a return value, which is specified at the function description.
|
||||||
--
|
--
|
||||||
|
-- # Developer Note
|
||||||
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- @type ACT_ACCOUNT
|
-- @type ACT_ACCOUNT
|
||||||
-- @field Core.Set#SET_UNIT TargetSetUnit
|
-- @field Core.Set#SET_UNIT TargetSetUnit
|
||||||
-- @extends Core.Fsm#FSM_PROCESS
|
-- @extends Core.Fsm#FSM_PROCESS
|
||||||
@@ -104,7 +109,6 @@ do -- ACT_ACCOUNT
|
|||||||
self:__Wait( 1 )
|
self:__Wait( 1 )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #ACT_ACCOUNT self
|
-- @param #ACT_ACCOUNT self
|
||||||
-- @param Wrapper.Unit#UNIT ProcessUnit
|
-- @param Wrapper.Unit#UNIT ProcessUnit
|
||||||
@@ -138,10 +142,10 @@ end -- ACT_ACCOUNT
|
|||||||
|
|
||||||
do -- ACT_ACCOUNT_DEADS
|
do -- ACT_ACCOUNT_DEADS
|
||||||
|
|
||||||
--- # @{#ACT_ACCOUNT_DEADS} FSM class, extends @{Core.Fsm.Account#ACT_ACCOUNT}
|
--- # @{#ACT_ACCOUNT_DEADS} FSM class, extends @{#ACT_ACCOUNT}
|
||||||
--
|
--
|
||||||
-- The ACT_ACCOUNT_DEADS class accounts (detects, counts and reports) successful kills of DCS units.
|
-- The ACT_ACCOUNT_DEADS class accounts (detects, counts and reports) successful kills of DCS units.
|
||||||
-- The process is given a @{Set} of units that will be tracked upon successful destruction.
|
-- The process is given a @{Core.Set} of units that will be tracked upon successful destruction.
|
||||||
-- The process will end after each target has been successfully destroyed.
|
-- The process will end after each target has been successfully destroyed.
|
||||||
-- Each successful dead will trigger an Account state transition that can be scored, modified or administered.
|
-- Each successful dead will trigger an Account state transition that can be scored, modified or administered.
|
||||||
--
|
--
|
||||||
@@ -157,7 +161,6 @@ do -- ACT_ACCOUNT_DEADS
|
|||||||
ClassName = "ACT_ACCOUNT_DEADS",
|
ClassName = "ACT_ACCOUNT_DEADS",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
--- Creates a new DESTROY process.
|
--- Creates a new DESTROY process.
|
||||||
-- @param #ACT_ACCOUNT_DEADS self
|
-- @param #ACT_ACCOUNT_DEADS self
|
||||||
-- @param Core.Set#SET_UNIT TargetSetUnit
|
-- @param Core.Set#SET_UNIT TargetSetUnit
|
||||||
@@ -195,7 +198,6 @@ do -- ACT_ACCOUNT_DEADS
|
|||||||
self:GetCommandCenter():MessageTypeToGroup( MessageText, ProcessUnit:GetGroup(), MESSAGE.Type.Information )
|
self:GetCommandCenter():MessageTypeToGroup( MessageText, ProcessUnit:GetGroup(), MESSAGE.Type.Information )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #ACT_ACCOUNT_DEADS self
|
-- @param #ACT_ACCOUNT_DEADS self
|
||||||
-- @param Wrapper.Unit#UNIT ProcessUnit
|
-- @param Wrapper.Unit#UNIT ProcessUnit
|
||||||
@@ -270,7 +272,6 @@ do -- ACT_ACCOUNT_DEADS
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- DCS Events
|
--- DCS Events
|
||||||
|
|
||||||
--- @param #ACT_ACCOUNT_DEADS self
|
--- @param #ACT_ACCOUNT_DEADS self
|
||||||
|
|||||||
@@ -52,9 +52,14 @@
|
|||||||
-- The state transition method needs to start with the name **OnAfter + the name of the state**.
|
-- The state transition method needs to start with the name **OnAfter + the name of the state**.
|
||||||
-- These state transition methods need to provide a return value, which is specified at the function description.
|
-- These state transition methods need to provide a return value, which is specified at the function description.
|
||||||
--
|
--
|
||||||
|
-- # Developer Note
|
||||||
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # 1) @{#ACT_ASSIGN_ACCEPT} class, extends @{Core.Fsm.Assign#ACT_ASSIGN}
|
-- # 1) @{#ACT_ASSIGN_ACCEPT} class, extends @{Core.Fsm#ACT_ASSIGN}
|
||||||
--
|
--
|
||||||
-- The ACT_ASSIGN_ACCEPT class accepts by default a task for a player. No player intervention is allowed to reject the task.
|
-- The ACT_ASSIGN_ACCEPT class accepts by default a task for a player. No player intervention is allowed to reject the task.
|
||||||
--
|
--
|
||||||
@@ -64,7 +69,7 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # 2) @{#ACT_ASSIGN_MENU_ACCEPT} class, extends @{Core.Fsm.Assign#ACT_ASSIGN}
|
-- # 2) @{#ACT_ASSIGN_MENU_ACCEPT} class, extends @{Core.Fsm#ACT_ASSIGN}
|
||||||
--
|
--
|
||||||
-- The ACT_ASSIGN_MENU_ACCEPT class accepts a task when the player accepts the task through an added menu option.
|
-- The ACT_ASSIGN_MENU_ACCEPT class accepts a task when the player accepts the task through an added menu option.
|
||||||
-- This assignment type is useful to conditionally allow the player to choose whether or not he would accept the task.
|
-- This assignment type is useful to conditionally allow the player to choose whether or not he would accept the task.
|
||||||
@@ -77,7 +82,7 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @module Actions.Assign
|
-- @module Actions.Act_Assign
|
||||||
-- @image MOOSE.JPG
|
-- @image MOOSE.JPG
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -48,9 +48,9 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # 1) @{#ACT_ASSIST_SMOKE_TARGETS_ZONE} class, extends @{Core.Fsm.Route#ACT_ASSIST}
|
-- # 1) @{#ACT_ASSIST_SMOKE_TARGETS_ZONE} class, extends @{#ACT_ASSIST}
|
||||||
--
|
--
|
||||||
-- The ACT_ASSIST_SMOKE_TARGETS_ZONE class implements the core functions to smoke targets in a @{Zone}.
|
-- The ACT_ASSIST_SMOKE_TARGETS_ZONE class implements the core functions to smoke targets in a @{Core.Zone}.
|
||||||
-- The targets are smoked within a certain range around each target, simulating a realistic smoking behaviour.
|
-- The targets are smoked within a certain range around each target, simulating a realistic smoking behaviour.
|
||||||
-- At random intervals, a new target is smoked.
|
-- At random intervals, a new target is smoked.
|
||||||
--
|
--
|
||||||
@@ -58,9 +58,14 @@
|
|||||||
--
|
--
|
||||||
-- * @{#ACT_ASSIST_SMOKE_TARGETS_ZONE.New}(): Creates a new ACT_ASSIST_SMOKE_TARGETS_ZONE object.
|
-- * @{#ACT_ASSIST_SMOKE_TARGETS_ZONE.New}(): Creates a new ACT_ASSIST_SMOKE_TARGETS_ZONE object.
|
||||||
--
|
--
|
||||||
|
-- # Developer Note
|
||||||
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @module Actions.Assist
|
-- @module Actions.Act_Assist
|
||||||
-- @image MOOSE.JPG
|
-- @image MOOSE.JPG
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -60,9 +60,9 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # 1) @{#ACT_ROUTE_ZONE} class, extends @{Core.Fsm.Route#ACT_ROUTE}
|
-- # 1) @{#ACT_ROUTE_ZONE} class, extends @{#ACT_ROUTE}
|
||||||
--
|
--
|
||||||
-- The ACT_ROUTE_ZONE class implements the core functions to route an AIR @{Wrapper.Controllable} player @{Wrapper.Unit} to a @{Zone}.
|
-- The ACT_ROUTE_ZONE class implements the core functions to route an AIR @{Wrapper.Controllable} player @{Wrapper.Unit} to a @{Core.Zone}.
|
||||||
-- The player receives on perioding times messages with the coordinates of the route to follow.
|
-- The player receives on perioding times messages with the coordinates of the route to follow.
|
||||||
-- Upon arrival at the zone, a confirmation of arrival is sent, and the process will be ended.
|
-- Upon arrival at the zone, a confirmation of arrival is sent, and the process will be ended.
|
||||||
--
|
--
|
||||||
@@ -70,9 +70,14 @@
|
|||||||
--
|
--
|
||||||
-- * @{#ACT_ROUTE_ZONE.New}(): Creates a new ACT_ROUTE_ZONE object.
|
-- * @{#ACT_ROUTE_ZONE.New}(): Creates a new ACT_ROUTE_ZONE object.
|
||||||
--
|
--
|
||||||
|
-- # Developer Note
|
||||||
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @module Actions.Route
|
-- @module Actions.Act_Route
|
||||||
-- @image MOOSE.JPG
|
-- @image MOOSE.JPG
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
-- you can board the cargo into the carrier `CargoCarrier`.
|
-- you can board the cargo into the carrier `CargoCarrier`.
|
||||||
-- Simple, isn't it? Told you, and this is only the beginning.
|
-- Simple, isn't it? Told you, and this is only the beginning.
|
||||||
--
|
--
|
||||||
-- The boarding, unboarding, loading, unloading of cargo is however something that is not meant to be coded manualy by mission designers.
|
-- The boarding, unboarding, loading, unloading of cargo is however something that is not meant to be coded manually by mission designers.
|
||||||
-- It would be too low-level and not end-user friendly to deal with cargo handling complexity.
|
-- It would be too low-level and not end-user friendly to deal with cargo handling complexity.
|
||||||
-- Things can become really complex if you want to make cargo being handled and behave in multiple scenarios.
|
-- Things can become really complex if you want to make cargo being handled and behave in multiple scenarios.
|
||||||
--
|
--
|
||||||
@@ -77,8 +77,8 @@
|
|||||||
--
|
--
|
||||||
-- ## 3.1) AI Cargo handlers.
|
-- ## 3.1) AI Cargo handlers.
|
||||||
--
|
--
|
||||||
-- - @{AI.AI_Cargo_APC} will create for you the capatility to make an APC group handle cargo.
|
-- - @{AI.AI_Cargo_APC} will create for you the capability to make an APC group handle cargo.
|
||||||
-- - @{AI.AI_Cargo_Helicopter} will create for you the capatility to make a Helicopter group handle cargo.
|
-- - @{AI.AI_Cargo_Helicopter} will create for you the capability to make a Helicopter group handle cargo.
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
-- ## 3.2) AI Cargo transportation dispatchers.
|
-- ## 3.2) AI Cargo transportation dispatchers.
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
-- There are also dispatchers that make AI work together to transport cargo automatically!!!
|
-- There are also dispatchers that make AI work together to transport cargo automatically!!!
|
||||||
--
|
--
|
||||||
-- - @{AI.AI_Cargo_Dispatcher_APC} derived classes will create for your dynamic cargo handlers controlled by AI ground vehicle groups (APCs) to transport cargo between sites.
|
-- - @{AI.AI_Cargo_Dispatcher_APC} derived classes will create for your dynamic cargo handlers controlled by AI ground vehicle groups (APCs) to transport cargo between sites.
|
||||||
-- - @{AI.AI_Cargo_Dispatcher_Helicopters} derived classes will create for your dynamic cargo handlers controlled by AI helicpter groups to transport cargo between sites.
|
-- - @{AI.AI_Cargo_Dispatcher_Helicopter} derived classes will create for your dynamic cargo handlers controlled by AI helicopter groups to transport cargo between sites.
|
||||||
--
|
--
|
||||||
-- ## 3.3) Cargo transportation tasking.
|
-- ## 3.3) Cargo transportation tasking.
|
||||||
--
|
--
|
||||||
@@ -94,7 +94,7 @@
|
|||||||
--
|
--
|
||||||
-- - @{Tasking.Task_CARGO} derived classes will create for you cargo transportation tasks, that allow human players to interact with MOOSE cargo objects to complete tasks.
|
-- - @{Tasking.Task_CARGO} derived classes will create for you cargo transportation tasks, that allow human players to interact with MOOSE cargo objects to complete tasks.
|
||||||
--
|
--
|
||||||
-- Please refer to the documentation reflected within these modules to understand the detailed capabilties.
|
-- Please refer to the documentation reflected within these modules to understand the detailed capabilities.
|
||||||
--
|
--
|
||||||
-- # 4) Cargo SETs.
|
-- # 4) Cargo SETs.
|
||||||
--
|
--
|
||||||
@@ -228,12 +228,17 @@
|
|||||||
-- `StaticName #CARGO(T=CargoTypeName,C=Category,RR=Range,NR=Range)`
|
-- `StaticName #CARGO(T=CargoTypeName,C=Category,RR=Range,NR=Range)`
|
||||||
--
|
--
|
||||||
-- * **T=** Provide a text that contains the type name of the cargo object. This type name can be used to filter cargo within a SET_CARGO object.
|
-- * **T=** Provide a text that contains the type name of the cargo object. This type name can be used to filter cargo within a SET_CARGO object.
|
||||||
-- * **C=** Provide either `CRATE` or `SLING` to have this static created as a CARGO_CRATE or CARGO_SLINGLOAD respectivly.
|
-- * **C=** Provide either `CRATE` or `SLING` to have this static created as a CARGO_CRATE or CARGO_SLINGLOAD respectively.
|
||||||
-- * **RR=** Provide the minimal range in meters when the report to the carrier, and board to the carrier.
|
-- * **RR=** Provide the minimal range in meters when the report to the carrier, and board to the carrier.
|
||||||
-- Note that this option is optional, so can be omitted. The default value of the RR is 250 meters.
|
-- Note that this option is optional, so can be omitted. The default value of the RR is 250 meters.
|
||||||
-- * **NR=** Provide the maximum range in meters when the cargo units will be boarded within the carrier during boarding.
|
-- * **NR=** Provide the maximum range in meters when the cargo units will be boarded within the carrier during boarding.
|
||||||
-- Note that this option is optional, so can be omitted. The default value of the RR is 10 meters.
|
-- Note that this option is optional, so can be omitted. The default value of the RR is 10 meters.
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
@@ -365,7 +370,7 @@ CARGOS = {}
|
|||||||
|
|
||||||
do -- CARGO
|
do -- CARGO
|
||||||
|
|
||||||
--- @type CARGO
|
-- @type CARGO
|
||||||
-- @extends Core.Fsm#FSM_PROCESS
|
-- @extends Core.Fsm#FSM_PROCESS
|
||||||
-- @field #string Type A string defining the type of the cargo. eg. Engineers, Equipment, Screwdrivers.
|
-- @field #string Type A string defining the type of the cargo. eg. Engineers, Equipment, Screwdrivers.
|
||||||
-- @field #string Name A string defining the name of the cargo. The name is the unique identifier of the cargo.
|
-- @field #string Name A string defining the name of the cargo. The name is the unique identifier of the cargo.
|
||||||
@@ -377,7 +382,7 @@ do -- CARGO
|
|||||||
-- @field #boolean Moveable This flag defines if the cargo is moveable.
|
-- @field #boolean Moveable This flag defines if the cargo is moveable.
|
||||||
-- @field #boolean Representable This flag defines if the cargo can be represented by a DCS Unit.
|
-- @field #boolean Representable This flag defines if the cargo can be represented by a DCS Unit.
|
||||||
-- @field #boolean Containable This flag defines if the cargo can be contained within a DCS Unit.
|
-- @field #boolean Containable This flag defines if the cargo can be contained within a DCS Unit.
|
||||||
|
|
||||||
--- Defines the core functions that defines a cargo object within MOOSE.
|
--- Defines the core functions that defines a cargo object within MOOSE.
|
||||||
--
|
--
|
||||||
-- A cargo is a **logical object** defined that is available for transport, and has a life status within a simulation.
|
-- A cargo is a **logical object** defined that is available for transport, and has a life status within a simulation.
|
||||||
@@ -393,7 +398,7 @@ do -- CARGO
|
|||||||
--
|
--
|
||||||
-- * AI Armoured Personnel Carriers to transport cargo and engage in battles, using the @{AI.AI_Cargo_APC#AI_CARGO_APC} class.
|
-- * AI Armoured Personnel Carriers to transport cargo and engage in battles, using the @{AI.AI_Cargo_APC#AI_CARGO_APC} class.
|
||||||
-- * AI Helicopters to transport cargo, using the @{AI.AI_Cargo_Helicopter#AI_CARGO_HELICOPTER} class.
|
-- * AI Helicopters to transport cargo, using the @{AI.AI_Cargo_Helicopter#AI_CARGO_HELICOPTER} class.
|
||||||
-- * AI Planes to transport cargo, using the @{AI.AI_Cargo_Plane#AI_CARGO_PLANE} class.
|
-- * AI Planes to transport cargo, using the @{AI.AI_Cargo_Airplane#AI_CARGO_AIRPLANE} class.
|
||||||
-- * AI Ships is planned.
|
-- * AI Ships is planned.
|
||||||
--
|
--
|
||||||
-- The above cargo classes are also used by the TASK\_CARGO\_ classes to allow human players to transport cargo as part of a tasking:
|
-- The above cargo classes are also used by the TASK\_CARGO\_ classes to allow human players to transport cargo as part of a tasking:
|
||||||
@@ -428,10 +433,9 @@ do -- CARGO
|
|||||||
Reported = {},
|
Reported = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
--- @type CARGO.CargoObjects
|
-- @type CARGO.CargoObjects
|
||||||
-- @map < #string, Wrapper.Positionable#POSITIONABLE > The alive POSITIONABLE objects representing the the cargo.
|
-- @map < #string, Wrapper.Positionable#POSITIONABLE > The alive POSITIONABLE objects representing the the cargo.
|
||||||
|
|
||||||
|
|
||||||
--- CARGO Constructor. This class is an abstract class and should not be instantiated.
|
--- CARGO Constructor. This class is an abstract class and should not be instantiated.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param #string Type
|
-- @param #string Type
|
||||||
@@ -441,10 +445,10 @@ do -- CARGO
|
|||||||
-- @param #number NearRadius (optional)
|
-- @param #number NearRadius (optional)
|
||||||
-- @return #CARGO
|
-- @return #CARGO
|
||||||
function CARGO:New( Type, Name, Weight, LoadRadius, NearRadius ) --R2.1
|
function CARGO:New( Type, Name, Weight, LoadRadius, NearRadius ) --R2.1
|
||||||
|
|
||||||
local self = BASE:Inherit( self, FSM:New() ) -- #CARGO
|
local self = BASE:Inherit( self, FSM:New() ) -- #CARGO
|
||||||
self:F( { Type, Name, Weight, LoadRadius, NearRadius } )
|
self:T( { Type, Name, Weight, LoadRadius, NearRadius } )
|
||||||
|
|
||||||
self:SetStartState( "UnLoaded" )
|
self:SetStartState( "UnLoaded" )
|
||||||
self:AddTransition( { "UnLoaded", "Boarding" }, "Board", "Boarding" )
|
self:AddTransition( { "UnLoaded", "Boarding" }, "Board", "Boarding" )
|
||||||
self:AddTransition( "Boarding" , "Boarding", "Boarding" )
|
self:AddTransition( "Boarding" , "Boarding", "Boarding" )
|
||||||
@@ -459,7 +463,7 @@ do -- CARGO
|
|||||||
self:AddTransition( "*", "Destroyed", "Destroyed" )
|
self:AddTransition( "*", "Destroyed", "Destroyed" )
|
||||||
self:AddTransition( "*", "Respawn", "UnLoaded" )
|
self:AddTransition( "*", "Respawn", "UnLoaded" )
|
||||||
self:AddTransition( "*", "Reset", "UnLoaded" )
|
self:AddTransition( "*", "Reset", "UnLoaded" )
|
||||||
|
|
||||||
self.Type = Type
|
self.Type = Type
|
||||||
self.Name = Name
|
self.Name = Name
|
||||||
self.Weight = Weight or 0
|
self.Weight = Weight or 0
|
||||||
@@ -471,31 +475,29 @@ do -- CARGO
|
|||||||
self.Containable = false
|
self.Containable = false
|
||||||
|
|
||||||
self.CargoLimit = 0
|
self.CargoLimit = 0
|
||||||
|
|
||||||
self.LoadRadius = LoadRadius or 500
|
self.LoadRadius = LoadRadius or 500
|
||||||
--self.NearRadius = NearRadius or 25
|
--self.NearRadius = NearRadius or 25
|
||||||
|
|
||||||
self:SetDeployed( false )
|
self:SetDeployed( false )
|
||||||
|
|
||||||
self.CargoScheduler = SCHEDULER:New()
|
self.CargoScheduler = SCHEDULER:New()
|
||||||
|
|
||||||
CARGOS[self.Name] = self
|
CARGOS[self.Name] = self
|
||||||
|
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Find a CARGO in the _DATABASE.
|
--- Find a CARGO in the _DATABASE.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param #string CargoName The Cargo Name.
|
-- @param #string CargoName The Cargo Name.
|
||||||
-- @return #CARGO self
|
-- @return #CARGO self
|
||||||
function CARGO:FindByName( CargoName )
|
function CARGO:FindByName( CargoName )
|
||||||
|
|
||||||
local CargoFound = _DATABASE:FindCargo( CargoName )
|
local CargoFound = _DATABASE:FindCargo( CargoName )
|
||||||
return CargoFound
|
return CargoFound
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the x position of the cargo.
|
--- Get the x position of the cargo.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return #number
|
-- @return #number
|
||||||
@@ -504,9 +506,9 @@ do -- CARGO
|
|||||||
return self.CargoCarrier:GetCoordinate().x
|
return self.CargoCarrier:GetCoordinate().x
|
||||||
else
|
else
|
||||||
return self.CargoObject:GetCoordinate().x
|
return self.CargoObject:GetCoordinate().x
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the y position of the cargo.
|
--- Get the y position of the cargo.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return #number
|
-- @return #number
|
||||||
@@ -515,9 +517,9 @@ do -- CARGO
|
|||||||
return self.CargoCarrier:GetCoordinate().z
|
return self.CargoCarrier:GetCoordinate().z
|
||||||
else
|
else
|
||||||
return self.CargoObject:GetCoordinate().z
|
return self.CargoObject:GetCoordinate().z
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the heading of the cargo.
|
--- Get the heading of the cargo.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return #number
|
-- @return #number
|
||||||
@@ -526,22 +528,21 @@ do -- CARGO
|
|||||||
return self.CargoCarrier:GetHeading()
|
return self.CargoCarrier:GetHeading()
|
||||||
else
|
else
|
||||||
return self.CargoObject:GetHeading()
|
return self.CargoObject:GetHeading()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Check if the cargo can be Slingloaded.
|
--- Check if the cargo can be Slingloaded.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
function CARGO:CanSlingload()
|
function CARGO:CanSlingload()
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Check if the cargo can be Boarded.
|
--- Check if the cargo can be Boarded.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
function CARGO:CanBoard()
|
function CARGO:CanBoard()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Check if the cargo can be Unboarded.
|
--- Check if the cargo can be Unboarded.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
function CARGO:CanUnboard()
|
function CARGO:CanUnboard()
|
||||||
@@ -553,14 +554,13 @@ do -- CARGO
|
|||||||
function CARGO:CanLoad()
|
function CARGO:CanLoad()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Check if the cargo can be Unloaded.
|
--- Check if the cargo can be Unloaded.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
function CARGO:CanUnload()
|
function CARGO:CanUnload()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Destroy the cargo.
|
--- Destroy the cargo.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
function CARGO:Destroy()
|
function CARGO:Destroy()
|
||||||
@@ -569,14 +569,14 @@ do -- CARGO
|
|||||||
end
|
end
|
||||||
self:Destroyed()
|
self:Destroyed()
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the name of the Cargo.
|
--- Get the name of the Cargo.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return #string The name of the Cargo.
|
-- @return #string The name of the Cargo.
|
||||||
function CARGO:GetName() --R2.1
|
function CARGO:GetName() --R2.1
|
||||||
return self.Name
|
return self.Name
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the current active object representing or being the Cargo.
|
--- Get the current active object representing or being the Cargo.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return Wrapper.Positionable#POSITIONABLE The object representing or being the Cargo.
|
-- @return Wrapper.Positionable#POSITIONABLE The object representing or being the Cargo.
|
||||||
@@ -585,9 +585,9 @@ do -- CARGO
|
|||||||
return self.CargoCarrier
|
return self.CargoCarrier
|
||||||
else
|
else
|
||||||
return self.CargoObject
|
return self.CargoObject
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the object name of the Cargo.
|
--- Get the object name of the Cargo.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return #string The object name of the Cargo.
|
-- @return #string The object name of the Cargo.
|
||||||
@@ -596,9 +596,9 @@ do -- CARGO
|
|||||||
return self.CargoCarrier:GetName()
|
return self.CargoCarrier:GetName()
|
||||||
else
|
else
|
||||||
return self.CargoObject:GetName()
|
return self.CargoObject:GetName()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the amount of Cargo.
|
--- Get the amount of Cargo.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return #number The amount of Cargo.
|
-- @return #number The amount of Cargo.
|
||||||
@@ -613,7 +613,6 @@ do -- CARGO
|
|||||||
return self.Type
|
return self.Type
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Get the transportation method of the Cargo.
|
--- Get the transportation method of the Cargo.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return #string The transportation method of the Cargo.
|
-- @return #string The transportation method of the Cargo.
|
||||||
@@ -621,7 +620,6 @@ do -- CARGO
|
|||||||
return self.TransportationMethod
|
return self.TransportationMethod
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Get the coalition of the Cargo.
|
--- Get the coalition of the Cargo.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return Coalition
|
-- @return Coalition
|
||||||
@@ -630,32 +628,30 @@ do -- CARGO
|
|||||||
return self.CargoCarrier:GetCoalition()
|
return self.CargoCarrier:GetCoalition()
|
||||||
else
|
else
|
||||||
return self.CargoObject:GetCoalition()
|
return self.CargoObject:GetCoalition()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Get the current coordinates of the Cargo.
|
--- Get the current coordinates of the Cargo.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return Core.Point#COORDINATE The coordinates of the Cargo.
|
-- @return Core.Point#COORDINATE The coordinates of the Cargo.
|
||||||
function CARGO:GetCoordinate()
|
function CARGO:GetCoordinate()
|
||||||
return self.CargoObject:GetCoordinate()
|
return self.CargoObject:GetCoordinate()
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Check if cargo is destroyed.
|
--- Check if cargo is destroyed.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return #boolean true if destroyed
|
-- @return #boolean true if destroyed
|
||||||
function CARGO:IsDestroyed()
|
function CARGO:IsDestroyed()
|
||||||
return self:Is( "Destroyed" )
|
return self:Is( "Destroyed" )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Check if cargo is loaded.
|
--- Check if cargo is loaded.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return #boolean true if loaded
|
-- @return #boolean true if loaded
|
||||||
function CARGO:IsLoaded()
|
function CARGO:IsLoaded()
|
||||||
return self:Is( "Loaded" )
|
return self:Is( "Loaded" )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Check if cargo is loaded.
|
--- Check if cargo is loaded.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param Wrapper.Unit#UNIT Carrier
|
-- @param Wrapper.Unit#UNIT Carrier
|
||||||
@@ -663,14 +659,14 @@ do -- CARGO
|
|||||||
function CARGO:IsLoadedInCarrier( Carrier )
|
function CARGO:IsLoadedInCarrier( Carrier )
|
||||||
return self.CargoCarrier and self.CargoCarrier:GetName() == Carrier:GetName()
|
return self.CargoCarrier and self.CargoCarrier:GetName() == Carrier:GetName()
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Check if cargo is unloaded.
|
--- Check if cargo is unloaded.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return #boolean true if unloaded
|
-- @return #boolean true if unloaded
|
||||||
function CARGO:IsUnLoaded()
|
function CARGO:IsUnLoaded()
|
||||||
return self:Is( "UnLoaded" )
|
return self:Is( "UnLoaded" )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Check if cargo is boarding.
|
--- Check if cargo is boarding.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return #boolean true if boarding
|
-- @return #boolean true if boarding
|
||||||
@@ -678,52 +674,47 @@ do -- CARGO
|
|||||||
return self:Is( "Boarding" )
|
return self:Is( "Boarding" )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Check if cargo is unboarding.
|
--- Check if cargo is unboarding.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return #boolean true if unboarding
|
-- @return #boolean true if unboarding
|
||||||
function CARGO:IsUnboarding()
|
function CARGO:IsUnboarding()
|
||||||
return self:Is( "UnBoarding" )
|
return self:Is( "UnBoarding" )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Check if cargo is alive.
|
--- Check if cargo is alive.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return #boolean true if unloaded
|
-- @return #boolean true if unloaded
|
||||||
function CARGO:IsAlive()
|
function CARGO:IsAlive()
|
||||||
|
|
||||||
if self:IsLoaded() then
|
if self:IsLoaded() then
|
||||||
return self.CargoCarrier:IsAlive()
|
return self.CargoCarrier:IsAlive()
|
||||||
else
|
else
|
||||||
return self.CargoObject:IsAlive()
|
return self.CargoObject:IsAlive()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set the cargo as deployed.
|
--- Set the cargo as deployed.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param #boolean Deployed true if the cargo is to be deployed. false or nil otherwise.
|
-- @param #boolean Deployed true if the cargo is to be deployed. false or nil otherwise.
|
||||||
function CARGO:SetDeployed( Deployed )
|
function CARGO:SetDeployed( Deployed )
|
||||||
self.Deployed = Deployed
|
self.Deployed = Deployed
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Is the cargo deployed
|
--- Is the cargo deployed
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
function CARGO:IsDeployed()
|
function CARGO:IsDeployed()
|
||||||
return self.Deployed
|
return self.Deployed
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- Template method to spawn a new representation of the CARGO in the simulator.
|
--- Template method to spawn a new representation of the CARGO in the simulator.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return #CARGO
|
-- @return #CARGO
|
||||||
function CARGO:Spawn( PointVec2 )
|
function CARGO:Spawn( PointVec2 )
|
||||||
self:F()
|
self:T()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Signal a flare at the position of the CARGO.
|
--- Signal a flare at the position of the CARGO.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param Utilities.Utils#FLARECOLOR FlareColor
|
-- @param Utilities.Utils#FLARECOLOR FlareColor
|
||||||
@@ -732,31 +723,31 @@ do -- CARGO
|
|||||||
trigger.action.signalFlare( self.CargoObject:GetVec3(), FlareColor , 0 )
|
trigger.action.signalFlare( self.CargoObject:GetVec3(), FlareColor , 0 )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Signal a white flare at the position of the CARGO.
|
--- Signal a white flare at the position of the CARGO.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
function CARGO:FlareWhite()
|
function CARGO:FlareWhite()
|
||||||
self:Flare( trigger.flareColor.White )
|
self:Flare( trigger.flareColor.White )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Signal a yellow flare at the position of the CARGO.
|
--- Signal a yellow flare at the position of the CARGO.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
function CARGO:FlareYellow()
|
function CARGO:FlareYellow()
|
||||||
self:Flare( trigger.flareColor.Yellow )
|
self:Flare( trigger.flareColor.Yellow )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Signal a green flare at the position of the CARGO.
|
--- Signal a green flare at the position of the CARGO.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
function CARGO:FlareGreen()
|
function CARGO:FlareGreen()
|
||||||
self:Flare( trigger.flareColor.Green )
|
self:Flare( trigger.flareColor.Green )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Signal a red flare at the position of the CARGO.
|
--- Signal a red flare at the position of the CARGO.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
function CARGO:FlareRed()
|
function CARGO:FlareRed()
|
||||||
self:Flare( trigger.flareColor.Red )
|
self:Flare( trigger.flareColor.Red )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Smoke the CARGO.
|
--- Smoke the CARGO.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param Utilities.Utils#SMOKECOLOR SmokeColor The color of the smoke.
|
-- @param Utilities.Utils#SMOKECOLOR SmokeColor The color of the smoke.
|
||||||
@@ -770,38 +761,37 @@ do -- CARGO
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Smoke the CARGO Green.
|
--- Smoke the CARGO Green.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
function CARGO:SmokeGreen()
|
function CARGO:SmokeGreen()
|
||||||
self:Smoke( trigger.smokeColor.Green, Range )
|
self:Smoke( trigger.smokeColor.Green, Range )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Smoke the CARGO Red.
|
--- Smoke the CARGO Red.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
function CARGO:SmokeRed()
|
function CARGO:SmokeRed()
|
||||||
self:Smoke( trigger.smokeColor.Red, Range )
|
self:Smoke( trigger.smokeColor.Red, Range )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Smoke the CARGO White.
|
--- Smoke the CARGO White.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
function CARGO:SmokeWhite()
|
function CARGO:SmokeWhite()
|
||||||
self:Smoke( trigger.smokeColor.White, Range )
|
self:Smoke( trigger.smokeColor.White, Range )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Smoke the CARGO Orange.
|
--- Smoke the CARGO Orange.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
function CARGO:SmokeOrange()
|
function CARGO:SmokeOrange()
|
||||||
self:Smoke( trigger.smokeColor.Orange, Range )
|
self:Smoke( trigger.smokeColor.Orange, Range )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Smoke the CARGO Blue.
|
--- Smoke the CARGO Blue.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
function CARGO:SmokeBlue()
|
function CARGO:SmokeBlue()
|
||||||
self:Smoke( trigger.smokeColor.Blue, Range )
|
self:Smoke( trigger.smokeColor.Blue, Range )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Set the Load radius, which is the radius till when the Cargo can be loaded.
|
--- Set the Load radius, which is the radius till when the Cargo can be loaded.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param #number LoadRadius The radius till Cargo can be loaded.
|
-- @param #number LoadRadius The radius till Cargo can be loaded.
|
||||||
@@ -809,23 +799,21 @@ do -- CARGO
|
|||||||
function CARGO:SetLoadRadius( LoadRadius )
|
function CARGO:SetLoadRadius( LoadRadius )
|
||||||
self.LoadRadius = LoadRadius or 150
|
self.LoadRadius = LoadRadius or 150
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the Load radius, which is the radius till when the Cargo can be loaded.
|
--- Get the Load radius, which is the radius till when the Cargo can be loaded.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return #number The radius till Cargo can be loaded.
|
-- @return #number The radius till Cargo can be loaded.
|
||||||
function CARGO:GetLoadRadius()
|
function CARGO:GetLoadRadius()
|
||||||
return self.LoadRadius
|
return self.LoadRadius
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- Check if Cargo is in the LoadRadius for the Cargo to be Boarded or Loaded.
|
--- Check if Cargo is in the LoadRadius for the Cargo to be Boarded or Loaded.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
-- @return #boolean true if the CargoGroup is within the loading radius.
|
-- @return #boolean true if the CargoGroup is within the loading radius.
|
||||||
function CARGO:IsInLoadRadius( Coordinate )
|
function CARGO:IsInLoadRadius( Coordinate )
|
||||||
self:F( { Coordinate, LoadRadius = self.LoadRadius } )
|
self:T( { Coordinate, LoadRadius = self.LoadRadius } )
|
||||||
|
|
||||||
local Distance = 0
|
local Distance = 0
|
||||||
if self:IsUnLoaded() then
|
if self:IsUnLoaded() then
|
||||||
local CargoCoordinate = self.CargoObject:GetCoordinate()
|
local CargoCoordinate = self.CargoObject:GetCoordinate()
|
||||||
@@ -835,18 +823,17 @@ do -- CARGO
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Check if the Cargo can report itself to be Boarded or Loaded.
|
--- Check if the Cargo can report itself to be Boarded or Loaded.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
-- @return #boolean true if the Cargo can report itself.
|
-- @return #boolean true if the Cargo can report itself.
|
||||||
function CARGO:IsInReportRadius( Coordinate )
|
function CARGO:IsInReportRadius( Coordinate )
|
||||||
self:F( { Coordinate } )
|
self:T( { Coordinate } )
|
||||||
|
|
||||||
local Distance = 0
|
local Distance = 0
|
||||||
if self:IsUnLoaded() then
|
if self:IsUnLoaded() then
|
||||||
Distance = Coordinate:Get2DDistance( self.CargoObject:GetCoordinate() )
|
Distance = Coordinate:Get2DDistance( self.CargoObject:GetCoordinate() )
|
||||||
@@ -855,7 +842,7 @@ do -- CARGO
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -866,72 +853,69 @@ do -- CARGO
|
|||||||
-- @param #number NearRadius The radius when the cargo will board the Carrier (to avoid collision).
|
-- @param #number NearRadius The radius when the cargo will board the Carrier (to avoid collision).
|
||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
function CARGO:IsNear( Coordinate, NearRadius )
|
function CARGO:IsNear( Coordinate, NearRadius )
|
||||||
--self:F( { PointVec2 = PointVec2, NearRadius = NearRadius } )
|
--self:T( { PointVec2 = PointVec2, NearRadius = NearRadius } )
|
||||||
|
|
||||||
if self.CargoObject:IsAlive() then
|
if self.CargoObject:IsAlive() then
|
||||||
--local Distance = PointVec2:Get2DDistance( self.CargoObject:GetPointVec2() )
|
--local Distance = PointVec2:Get2DDistance( self.CargoObject:GetPointVec2() )
|
||||||
--self:F( { CargoObjectName = self.CargoObject:GetName() } )
|
--self:T( { CargoObjectName = self.CargoObject:GetName() } )
|
||||||
--self:F( { CargoObjectVec2 = self.CargoObject:GetVec2() } )
|
--self:T( { CargoObjectVec2 = self.CargoObject:GetVec2() } )
|
||||||
--self:F( { PointVec2 = PointVec2:GetVec2() } )
|
--self:T( { PointVec2 = PointVec2:GetVec2() } )
|
||||||
local Distance = Coordinate:Get2DDistance( self.CargoObject:GetCoordinate() )
|
local Distance = Coordinate:Get2DDistance( self.CargoObject:GetCoordinate() )
|
||||||
--self:F( { Distance = Distance, NearRadius = NearRadius or "nil" } )
|
--self:T( { Distance = Distance, NearRadius = NearRadius or "nil" } )
|
||||||
|
|
||||||
if Distance <= NearRadius then
|
if Distance <= NearRadius then
|
||||||
--self:F( { PointVec2 = PointVec2, NearRadius = NearRadius, IsNear = true } )
|
--self:T( { PointVec2 = PointVec2, NearRadius = NearRadius, IsNear = true } )
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--self:F( { PointVec2 = PointVec2, NearRadius = NearRadius, IsNear = false } )
|
--self:T( { PointVec2 = PointVec2, NearRadius = NearRadius, IsNear = false } )
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Check if Cargo is the given @{Core.Zone}.
|
||||||
|
|
||||||
--- Check if Cargo is the given @{Zone}.
|
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param Core.Zone#ZONE_BASE Zone
|
-- @param Core.Zone#ZONE_BASE Zone
|
||||||
-- @return #boolean **true** if cargo is in the Zone, **false** if cargo is not in the Zone.
|
-- @return #boolean **true** if cargo is in the Zone, **false** if cargo is not in the Zone.
|
||||||
function CARGO:IsInZone( Zone )
|
function CARGO:IsInZone( Zone )
|
||||||
--self:F( { Zone } )
|
--self:T( { Zone } )
|
||||||
|
|
||||||
if self:IsLoaded() then
|
if self:IsLoaded() then
|
||||||
return Zone:IsPointVec2InZone( self.CargoCarrier:GetPointVec2() )
|
return Zone:IsPointVec2InZone( self.CargoCarrier:GetPointVec2() )
|
||||||
else
|
else
|
||||||
--self:F( { Size = self.CargoObject:GetSize(), Units = self.CargoObject:GetUnits() } )
|
--self:T( { Size = self.CargoObject:GetSize(), Units = self.CargoObject:GetUnits() } )
|
||||||
if self.CargoObject:GetSize() ~= 0 then
|
if self.CargoObject:GetSize() ~= 0 then
|
||||||
return Zone:IsPointVec2InZone( self.CargoObject:GetPointVec2() )
|
return Zone:IsPointVec2InZone( self.CargoObject:GetPointVec2() )
|
||||||
else
|
else
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- 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#POINT_VEC2
|
||||||
function CARGO:GetPointVec2()
|
function CARGO:GetPointVec2()
|
||||||
return self.CargoObject:GetPointVec2()
|
return self.CargoObject:GetPointVec2()
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the current Coordinate of the cargo.
|
--- Get the current Coordinate of the cargo.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return Core.Point#COORDINATE
|
-- @return Core.Point#COORDINATE
|
||||||
function CARGO:GetCoordinate()
|
function CARGO:GetCoordinate()
|
||||||
return self.CargoObject:GetCoordinate()
|
return self.CargoObject:GetCoordinate()
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the weight of the cargo.
|
--- Get the weight of the cargo.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return #number Weight The weight in kg.
|
-- @return #number Weight The weight in kg.
|
||||||
function CARGO:GetWeight()
|
function CARGO:GetWeight()
|
||||||
return self.Weight
|
return self.Weight
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set the weight of the cargo.
|
--- Set the weight of the cargo.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param #number Weight The weight in kg.
|
-- @param #number Weight The weight in kg.
|
||||||
@@ -940,14 +924,14 @@ do -- CARGO
|
|||||||
self.Weight = Weight
|
self.Weight = Weight
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the volume of the cargo.
|
--- Get the volume of the cargo.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return #number Volume The volume in kg.
|
-- @return #number Volume The volume in kg.
|
||||||
function CARGO:GetVolume()
|
function CARGO:GetVolume()
|
||||||
return self.Volume
|
return self.Volume
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set the volume of the cargo.
|
--- Set the volume of the cargo.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param #number Volume The volume in kg.
|
-- @param #number Volume The volume in kg.
|
||||||
@@ -956,18 +940,18 @@ do -- CARGO
|
|||||||
self.Volume = Volume
|
self.Volume = Volume
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Send a CC message to a @{Wrapper.Group}.
|
--- Send a CC message to a @{Wrapper.Group}.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param #string Message
|
-- @param #string Message
|
||||||
-- @param Wrapper.Group#GROUP CarrierGroup The Carrier Group.
|
-- @param Wrapper.Group#GROUP CarrierGroup The Carrier Group.
|
||||||
-- @param #string Name (optional) The name of the Group used as a prefix for the message to the Group. If not provided, there will be nothing shown.
|
-- @param #string Name (optional) The name of the Group used as a prefix for the message to the Group. If not provided, there will be nothing shown.
|
||||||
function CARGO:MessageToGroup( Message, CarrierGroup, Name )
|
function CARGO:MessageToGroup( Message, CarrierGroup, Name )
|
||||||
|
|
||||||
MESSAGE:New( Message, 20, "Cargo " .. self:GetName() ):ToGroup( CarrierGroup )
|
MESSAGE:New( Message, 20, "Cargo " .. self:GetName() ):ToGroup( CarrierGroup )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Report to a Carrier Group.
|
--- Report to a Carrier Group.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param #string Action The string describing the action for the cargo.
|
-- @param #string Action The string describing the action for the cargo.
|
||||||
@@ -993,28 +977,25 @@ do -- CARGO
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Report to a Carrier Group with a Flaring signal.
|
--- Report to a Carrier Group with a Flaring signal.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param Utils#UTILS.FlareColor FlareColor the color of the flare.
|
-- @param Utilities.Utils#UTILS.FlareColor FlareColor the color of the flare.
|
||||||
-- @return #CARGO
|
-- @return #CARGO
|
||||||
function CARGO:ReportFlare( FlareColor )
|
function CARGO:ReportFlare( FlareColor )
|
||||||
|
|
||||||
self.ReportFlareColor = FlareColor
|
self.ReportFlareColor = FlareColor
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Report to a Carrier Group with a Smoking signal.
|
--- Report to a Carrier Group with a Smoking signal.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param Utils#UTILS.SmokeColor SmokeColor the color of the smoke.
|
-- @param Utilities.Utils#UTILS.SmokeColor SmokeColor the color of the smoke.
|
||||||
-- @return #CARGO
|
-- @return #CARGO
|
||||||
function CARGO:ReportSmoke( SmokeColor )
|
function CARGO:ReportSmoke( SmokeColor )
|
||||||
|
|
||||||
self.ReportSmokeColor = SmokeColor
|
self.ReportSmokeColor = SmokeColor
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Reset the reporting for a Carrier Group.
|
--- Reset the reporting for a Carrier Group.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param #string Action The string describing the action for the cargo.
|
-- @param #string Action The string describing the action for the cargo.
|
||||||
@@ -1024,7 +1005,7 @@ do -- CARGO
|
|||||||
|
|
||||||
self.Reported[CarrierGroup][Action] = nil
|
self.Reported[CarrierGroup][Action] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Reset all the reporting for a Carrier Group.
|
--- Reset all the reporting for a Carrier Group.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param Wrapper.Group#GROUP CarrierGroup The Carrier Group to send the report to.
|
-- @param Wrapper.Group#GROUP CarrierGroup The Carrier Group to send the report to.
|
||||||
@@ -1033,7 +1014,7 @@ do -- CARGO
|
|||||||
|
|
||||||
self.Reported[CarrierGroup] = nil
|
self.Reported[CarrierGroup] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Respawn the cargo when destroyed
|
--- Respawn the cargo when destroyed
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param #boolean RespawnDestroyed
|
-- @param #boolean RespawnDestroyed
|
||||||
@@ -1046,17 +1027,14 @@ do -- CARGO
|
|||||||
else
|
else
|
||||||
self.onenterDestroyed = nil
|
self.onenterDestroyed = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end -- CARGO
|
end -- CARGO
|
||||||
|
|
||||||
do -- CARGO_REPRESENTABLE
|
do -- CARGO_REPRESENTABLE
|
||||||
|
|
||||||
--- @type CARGO_REPRESENTABLE
|
-- @type CARGO_REPRESENTABLE
|
||||||
-- @extends #CARGO
|
-- @extends #CARGO
|
||||||
-- @field test
|
-- @field test
|
||||||
|
|
||||||
@@ -1075,18 +1053,18 @@ do -- CARGO_REPRESENTABLE
|
|||||||
-- @param #number NearRadius (optional) Radius in meters when the cargo is loaded into the carrier.
|
-- @param #number NearRadius (optional) Radius in meters when the cargo is loaded into the carrier.
|
||||||
-- @return #CARGO_REPRESENTABLE
|
-- @return #CARGO_REPRESENTABLE
|
||||||
function CARGO_REPRESENTABLE:New( CargoObject, Type, Name, LoadRadius, NearRadius )
|
function CARGO_REPRESENTABLE:New( CargoObject, Type, Name, LoadRadius, NearRadius )
|
||||||
|
|
||||||
-- Inherit CARGO.
|
-- Inherit CARGO.
|
||||||
local self = BASE:Inherit( self, CARGO:New( Type, Name, 0, LoadRadius, NearRadius ) ) -- #CARGO_REPRESENTABLE
|
local self = BASE:Inherit( self, CARGO:New( Type, Name, 0, LoadRadius, NearRadius ) ) -- #CARGO_REPRESENTABLE
|
||||||
self:F( { Type, Name, LoadRadius, NearRadius } )
|
self:T( { Type, Name, LoadRadius, NearRadius } )
|
||||||
|
|
||||||
-- Descriptors.
|
-- Descriptors.
|
||||||
local Desc=CargoObject:GetDesc()
|
local Desc=CargoObject:GetDesc()
|
||||||
self:T({Desc=Desc})
|
self:T({Desc=Desc})
|
||||||
|
|
||||||
-- Weight.
|
-- Weight.
|
||||||
local Weight = math.random( 80, 120 )
|
local Weight = math.random( 80, 120 )
|
||||||
|
|
||||||
-- Adjust weight..
|
-- Adjust weight..
|
||||||
if Desc then
|
if Desc then
|
||||||
if Desc.typeName == "2B11 mortar" then
|
if Desc.typeName == "2B11 mortar" then
|
||||||
@@ -1097,8 +1075,8 @@ do -- CARGO_REPRESENTABLE
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Set weight.
|
-- Set weight.
|
||||||
self:SetWeight( Weight )
|
self:SetWeight( Weight )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1106,14 +1084,14 @@ do -- CARGO_REPRESENTABLE
|
|||||||
-- @param #CARGO_REPRESENTABLE self
|
-- @param #CARGO_REPRESENTABLE self
|
||||||
-- @return #CARGO_REPRESENTABLE
|
-- @return #CARGO_REPRESENTABLE
|
||||||
function CARGO_REPRESENTABLE:Destroy()
|
function CARGO_REPRESENTABLE:Destroy()
|
||||||
|
|
||||||
-- Cargo objects are deleted from the _DATABASE and SET_CARGO objects.
|
-- Cargo objects are deleted from the _DATABASE and SET_CARGO objects.
|
||||||
self:F( { CargoName = self:GetName() } )
|
self:T( { CargoName = self:GetName() } )
|
||||||
--_EVENTDISPATCHER:CreateEventDeleteCargo( self )
|
--_EVENTDISPATCHER:CreateEventDeleteCargo( self )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- 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#POINT_VEC2 ToPointVec2
|
||||||
@@ -1121,19 +1099,19 @@ do -- CARGO_REPRESENTABLE
|
|||||||
-- @return #CARGO_REPRESENTABLE
|
-- @return #CARGO_REPRESENTABLE
|
||||||
function CARGO_REPRESENTABLE:RouteTo( ToPointVec2, Speed )
|
function CARGO_REPRESENTABLE:RouteTo( ToPointVec2, Speed )
|
||||||
self:F2( ToPointVec2 )
|
self:F2( ToPointVec2 )
|
||||||
|
|
||||||
local Points = {}
|
local Points = {}
|
||||||
|
|
||||||
local PointStartVec2 = self.CargoObject:GetPointVec2()
|
local PointStartVec2 = self.CargoObject:GetPointVec2()
|
||||||
|
|
||||||
Points[#Points+1] = PointStartVec2:WaypointGround( Speed )
|
Points[#Points+1] = PointStartVec2:WaypointGround( Speed )
|
||||||
Points[#Points+1] = ToPointVec2:WaypointGround( Speed )
|
Points[#Points+1] = ToPointVec2:WaypointGround( Speed )
|
||||||
|
|
||||||
local TaskRoute = self.CargoObject:TaskRoute( Points )
|
local TaskRoute = self.CargoObject:TaskRoute( Points )
|
||||||
self.CargoObject:SetTask( TaskRoute, 2 )
|
self.CargoObject:SetTask( TaskRoute, 2 )
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Send a message to a @{Wrapper.Group} through a communication channel near the cargo.
|
--- Send a message to a @{Wrapper.Group} through a communication channel near the cargo.
|
||||||
-- @param #CARGO_REPRESENTABLE self
|
-- @param #CARGO_REPRESENTABLE self
|
||||||
-- @param #string Message
|
-- @param #string Message
|
||||||
@@ -1145,32 +1123,31 @@ do -- CARGO_REPRESENTABLE
|
|||||||
CoordinateZone:Scan( { Object.Category.UNIT } )
|
CoordinateZone:Scan( { Object.Category.UNIT } )
|
||||||
for _, DCSUnit in pairs( CoordinateZone:GetScannedUnits() ) do
|
for _, DCSUnit in pairs( CoordinateZone:GetScannedUnits() ) do
|
||||||
local NearUnit = UNIT:Find( DCSUnit )
|
local NearUnit = UNIT:Find( DCSUnit )
|
||||||
self:F({NearUnit=NearUnit})
|
self:T({NearUnit=NearUnit})
|
||||||
local NearUnitCoalition = NearUnit:GetCoalition()
|
local NearUnitCoalition = NearUnit:GetCoalition()
|
||||||
local CargoCoalition = self:GetCoalition()
|
local CargoCoalition = self:GetCoalition()
|
||||||
if NearUnitCoalition == CargoCoalition then
|
if NearUnitCoalition == CargoCoalition then
|
||||||
local Attributes = NearUnit:GetDesc()
|
local Attributes = NearUnit:GetDesc()
|
||||||
self:F({Desc=Attributes})
|
self:T({Desc=Attributes})
|
||||||
if NearUnit:HasAttribute( "Trucks" ) then
|
if NearUnit:HasAttribute( "Trucks" ) then
|
||||||
MESSAGE:New( Message, 20, NearUnit:GetCallsign() .. " reporting - Cargo " .. self:GetName() ):ToGroup( TaskGroup )
|
MESSAGE:New( Message, 20, NearUnit:GetCallsign() .. " reporting - Cargo " .. self:GetName() ):ToGroup( TaskGroup )
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end -- CARGO_REPRESENTABLE
|
end -- CARGO_REPRESENTABLE
|
||||||
|
|
||||||
do -- CARGO_REPORTABLE
|
do -- CARGO_REPORTABLE
|
||||||
|
|
||||||
--- @type CARGO_REPORTABLE
|
-- @type CARGO_REPORTABLE
|
||||||
-- @extends #CARGO
|
-- @extends #CARGO
|
||||||
CARGO_REPORTABLE = {
|
CARGO_REPORTABLE = {
|
||||||
ClassName = "CARGO_REPORTABLE"
|
ClassName = "CARGO_REPORTABLE"
|
||||||
}
|
}
|
||||||
|
|
||||||
--- CARGO_REPORTABLE Constructor.
|
--- CARGO_REPORTABLE Constructor.
|
||||||
-- @param #CARGO_REPORTABLE self
|
-- @param #CARGO_REPORTABLE self
|
||||||
-- @param #string Type
|
-- @param #string Type
|
||||||
@@ -1181,35 +1158,27 @@ do -- CARGO_REPORTABLE
|
|||||||
-- @return #CARGO_REPORTABLE
|
-- @return #CARGO_REPORTABLE
|
||||||
function CARGO_REPORTABLE:New( Type, Name, Weight, LoadRadius, NearRadius )
|
function CARGO_REPORTABLE:New( Type, Name, Weight, LoadRadius, NearRadius )
|
||||||
local self = BASE:Inherit( self, CARGO:New( Type, Name, Weight, LoadRadius, NearRadius ) ) -- #CARGO_REPORTABLE
|
local self = BASE:Inherit( self, CARGO:New( Type, Name, Weight, LoadRadius, NearRadius ) ) -- #CARGO_REPORTABLE
|
||||||
self:F( { Type, Name, Weight, LoadRadius, NearRadius } )
|
self:T( { Type, Name, Weight, LoadRadius, NearRadius } )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Send a CC message to a @{Wrapper.Group}.
|
--- Send a CC message to a @{Wrapper.Group}.
|
||||||
-- @param #CARGO_REPORTABLE self
|
-- @param #CARGO_REPORTABLE self
|
||||||
-- @param #string Message
|
-- @param #string Message
|
||||||
-- @param Wrapper.Group#GROUP TaskGroup
|
-- @param Wrapper.Group#GROUP TaskGroup
|
||||||
-- @param #string Name (optional) The name of the Group used as a prefix for the message to the Group. If not provided, there will be nothing shown.
|
-- @param #string Name (optional) The name of the Group used as a prefix for the message to the Group. If not provided, there will be nothing shown.
|
||||||
function CARGO_REPORTABLE:MessageToGroup( Message, TaskGroup, Name )
|
function CARGO_REPORTABLE:MessageToGroup( Message, TaskGroup, Name )
|
||||||
|
|
||||||
MESSAGE:New( Message, 20, "Cargo " .. self:GetName() .. " reporting" ):ToGroup( TaskGroup )
|
MESSAGE:New( Message, 20, "Cargo " .. self:GetName() .. " reporting" ):ToGroup( TaskGroup )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
do -- CARGO_PACKAGE
|
do -- CARGO_PACKAGE
|
||||||
|
|
||||||
--- @type CARGO_PACKAGE
|
-- @type CARGO_PACKAGE
|
||||||
-- @extends #CARGO_REPRESENTABLE
|
-- @extends #CARGO_REPRESENTABLE
|
||||||
CARGO_PACKAGE = {
|
CARGO_PACKAGE = {
|
||||||
ClassName = "CARGO_PACKAGE"
|
ClassName = "CARGO_PACKAGE"
|
||||||
@@ -1226,7 +1195,7 @@ do -- CARGO_PACKAGE
|
|||||||
-- @return #CARGO_PACKAGE
|
-- @return #CARGO_PACKAGE
|
||||||
function CARGO_PACKAGE:New( CargoCarrier, Type, Name, Weight, LoadRadius, NearRadius )
|
function CARGO_PACKAGE:New( CargoCarrier, Type, Name, Weight, LoadRadius, NearRadius )
|
||||||
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoCarrier, Type, Name, Weight, LoadRadius, NearRadius ) ) -- #CARGO_PACKAGE
|
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoCarrier, Type, Name, Weight, LoadRadius, NearRadius ) ) -- #CARGO_PACKAGE
|
||||||
self:F( { Type, Name, Weight, LoadRadius, NearRadius } )
|
self:T( { Type, Name, Weight, LoadRadius, NearRadius } )
|
||||||
|
|
||||||
self:T( CargoCarrier )
|
self:T( CargoCarrier )
|
||||||
self.CargoCarrier = CargoCarrier
|
self.CargoCarrier = CargoCarrier
|
||||||
@@ -1244,7 +1213,7 @@ end
|
|||||||
-- @param #number BoardDistance
|
-- @param #number BoardDistance
|
||||||
-- @param #number Angle
|
-- @param #number Angle
|
||||||
function CARGO_PACKAGE:onafterOnBoard( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
|
function CARGO_PACKAGE:onafterOnBoard( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
|
||||||
self:F()
|
self:T()
|
||||||
|
|
||||||
self.CargoInAir = self.CargoCarrier:InAir()
|
self.CargoInAir = self.CargoCarrier:InAir()
|
||||||
|
|
||||||
@@ -1277,13 +1246,13 @@ end
|
|||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
function CARGO_PACKAGE:IsNear( CargoCarrier )
|
function CARGO_PACKAGE:IsNear( CargoCarrier )
|
||||||
self:F()
|
self:T()
|
||||||
|
|
||||||
local CargoCarrierPoint = CargoCarrier:GetCoordinate()
|
local CargoCarrierPoint = CargoCarrier:GetCoordinate()
|
||||||
|
|
||||||
local Distance = CargoCarrierPoint:Get2DDistance( self.CargoCarrier:GetCoordinate() )
|
local Distance = CargoCarrierPoint:Get2DDistance( self.CargoCarrier:GetCoordinate() )
|
||||||
self:T( Distance )
|
self:T( Distance )
|
||||||
|
|
||||||
if Distance <= self.NearRadius then
|
if Distance <= self.NearRadius then
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
@@ -1302,7 +1271,7 @@ end
|
|||||||
-- @param #number LoadDistance
|
-- @param #number LoadDistance
|
||||||
-- @param #number Angle
|
-- @param #number Angle
|
||||||
function CARGO_PACKAGE:onafterOnBoarded( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
|
function CARGO_PACKAGE:onafterOnBoarded( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
|
||||||
self:F()
|
self:T()
|
||||||
|
|
||||||
if self:IsNear( CargoCarrier ) then
|
if self:IsNear( CargoCarrier ) then
|
||||||
self:__Load( 1, CargoCarrier, Speed, LoadDistance, Angle )
|
self:__Load( 1, CargoCarrier, Speed, LoadDistance, Angle )
|
||||||
@@ -1323,7 +1292,7 @@ end
|
|||||||
-- @param #number Radius
|
-- @param #number Radius
|
||||||
-- @param #number Angle
|
-- @param #number Angle
|
||||||
function CARGO_PACKAGE:onafterUnBoard( From, Event, To, CargoCarrier, Speed, UnLoadDistance, UnBoardDistance, Radius, Angle )
|
function CARGO_PACKAGE:onafterUnBoard( From, Event, To, CargoCarrier, Speed, UnLoadDistance, UnBoardDistance, Radius, Angle )
|
||||||
self:F()
|
self:T()
|
||||||
|
|
||||||
self.CargoInAir = self.CargoCarrier:InAir()
|
self.CargoInAir = self.CargoCarrier:InAir()
|
||||||
|
|
||||||
@@ -1334,7 +1303,7 @@ function CARGO_PACKAGE:onafterUnBoard( From, Event, To, CargoCarrier, Speed, UnL
|
|||||||
if not self.CargoInAir then
|
if not self.CargoInAir then
|
||||||
|
|
||||||
self:_Next( self.FsmP.UnLoad, UnLoadDistance, Angle )
|
self:_Next( self.FsmP.UnLoad, UnLoadDistance, Angle )
|
||||||
|
|
||||||
local Points = {}
|
local Points = {}
|
||||||
|
|
||||||
local StartPointVec2 = CargoCarrier:GetPointVec2()
|
local StartPointVec2 = CargoCarrier:GetPointVec2()
|
||||||
@@ -1362,7 +1331,7 @@ end
|
|||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
-- @param #number Speed
|
-- @param #number Speed
|
||||||
function CARGO_PACKAGE:onafterUnBoarded( From, Event, To, CargoCarrier, Speed )
|
function CARGO_PACKAGE:onafterUnBoarded( From, Event, To, CargoCarrier, Speed )
|
||||||
self:F()
|
self:T()
|
||||||
|
|
||||||
if self:IsNear( CargoCarrier ) then
|
if self:IsNear( CargoCarrier ) then
|
||||||
self:__UnLoad( 1, CargoCarrier, Speed )
|
self:__UnLoad( 1, CargoCarrier, Speed )
|
||||||
@@ -1381,7 +1350,7 @@ end
|
|||||||
-- @param #number LoadDistance
|
-- @param #number LoadDistance
|
||||||
-- @param #number Angle
|
-- @param #number Angle
|
||||||
function CARGO_PACKAGE:onafterLoad( From, Event, To, CargoCarrier, Speed, LoadDistance, Angle )
|
function CARGO_PACKAGE:onafterLoad( From, Event, To, CargoCarrier, Speed, LoadDistance, Angle )
|
||||||
self:F()
|
self:T()
|
||||||
|
|
||||||
self.CargoCarrier = CargoCarrier
|
self.CargoCarrier = CargoCarrier
|
||||||
|
|
||||||
@@ -1389,7 +1358,7 @@ function CARGO_PACKAGE:onafterLoad( From, Event, To, CargoCarrier, Speed, LoadDi
|
|||||||
local CargoCarrierHeading = self.CargoCarrier:GetHeading() -- Get Heading of object in degrees.
|
local CargoCarrierHeading = self.CargoCarrier:GetHeading() -- Get Heading of object in degrees.
|
||||||
local CargoDeployHeading = ( ( CargoCarrierHeading + Angle ) >= 360 ) and ( CargoCarrierHeading + Angle - 360 ) or ( CargoCarrierHeading + Angle )
|
local CargoDeployHeading = ( ( CargoCarrierHeading + Angle ) >= 360 ) and ( CargoCarrierHeading + Angle - 360 ) or ( CargoCarrierHeading + Angle )
|
||||||
local CargoDeployPointVec2 = StartPointVec2:Translate( LoadDistance, CargoDeployHeading )
|
local CargoDeployPointVec2 = StartPointVec2:Translate( LoadDistance, CargoDeployHeading )
|
||||||
|
|
||||||
local Points = {}
|
local Points = {}
|
||||||
Points[#Points+1] = StartPointVec2:WaypointGround( Speed )
|
Points[#Points+1] = StartPointVec2:WaypointGround( Speed )
|
||||||
Points[#Points+1] = CargoDeployPointVec2:WaypointGround( Speed )
|
Points[#Points+1] = CargoDeployPointVec2:WaypointGround( Speed )
|
||||||
@@ -1409,13 +1378,13 @@ end
|
|||||||
-- @param #number Distance
|
-- @param #number Distance
|
||||||
-- @param #number Angle
|
-- @param #number Angle
|
||||||
function CARGO_PACKAGE:onafterUnLoad( From, Event, To, CargoCarrier, Speed, Distance, Angle )
|
function CARGO_PACKAGE:onafterUnLoad( From, Event, To, CargoCarrier, Speed, Distance, Angle )
|
||||||
self:F()
|
self:T()
|
||||||
|
|
||||||
local StartPointVec2 = self.CargoCarrier:GetPointVec2()
|
local StartPointVec2 = self.CargoCarrier:GetPointVec2()
|
||||||
local CargoCarrierHeading = self.CargoCarrier:GetHeading() -- Get Heading of object in degrees.
|
local CargoCarrierHeading = self.CargoCarrier:GetHeading() -- Get Heading of object in degrees.
|
||||||
local CargoDeployHeading = ( ( CargoCarrierHeading + Angle ) >= 360 ) and ( CargoCarrierHeading + Angle - 360 ) or ( CargoCarrierHeading + Angle )
|
local CargoDeployHeading = ( ( CargoCarrierHeading + Angle ) >= 360 ) and ( CargoCarrierHeading + Angle - 360 ) or ( CargoCarrierHeading + Angle )
|
||||||
local CargoDeployPointVec2 = StartPointVec2:Translate( Distance, CargoDeployHeading )
|
local CargoDeployPointVec2 = StartPointVec2:Translate( Distance, CargoDeployHeading )
|
||||||
|
|
||||||
self.CargoCarrier = CargoCarrier
|
self.CargoCarrier = CargoCarrier
|
||||||
|
|
||||||
local Points = {}
|
local Points = {}
|
||||||
@@ -1427,5 +1396,4 @@ function CARGO_PACKAGE:onafterUnLoad( From, Event, To, CargoCarrier, Speed, Dist
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **Cargo** -- Management of single cargo crates, which are based on a @{Static} object.
|
--- **Cargo** - Management of single cargo crates, which are based on a STATIC object.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -36,7 +36,12 @@ do -- CARGO_CRATE
|
|||||||
--
|
--
|
||||||
-- * @{Tasking.Task_Cargo_Transport#TASK_CARGO_TRANSPORT} to transport cargo by human players.
|
-- * @{Tasking.Task_Cargo_Transport#TASK_CARGO_TRANSPORT} to transport cargo by human players.
|
||||||
-- * @{Tasking.Task_Cargo_Transport#TASK_CARGO_CSAR} to transport downed pilots by human players.
|
-- * @{Tasking.Task_Cargo_Transport#TASK_CARGO_CSAR} to transport downed pilots by human players.
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #CARGO_CRATE
|
-- @field #CARGO_CRATE
|
||||||
@@ -54,7 +59,7 @@ do -- CARGO_CRATE
|
|||||||
-- @return #CARGO_CRATE
|
-- @return #CARGO_CRATE
|
||||||
function CARGO_CRATE:New( CargoStatic, Type, Name, LoadRadius, NearRadius )
|
function CARGO_CRATE:New( CargoStatic, Type, Name, LoadRadius, NearRadius )
|
||||||
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoStatic, Type, Name, nil, LoadRadius, NearRadius ) ) -- #CARGO_CRATE
|
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoStatic, Type, Name, nil, LoadRadius, NearRadius ) ) -- #CARGO_CRATE
|
||||||
self:F( { Type, Name, NearRadius } )
|
self:T( { Type, Name, NearRadius } )
|
||||||
|
|
||||||
self.CargoObject = CargoStatic -- Wrapper.Static#STATIC
|
self.CargoObject = CargoStatic -- Wrapper.Static#STATIC
|
||||||
|
|
||||||
@@ -111,7 +116,7 @@ do -- CARGO_CRATE
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#POINT_VEC2
|
-- @param Core.Point#POINT_VEC2
|
||||||
function CARGO_CRATE:onenterUnLoaded( From, Event, To, ToPointVec2 )
|
function CARGO_CRATE:onenterUnLoaded( From, Event, To, ToPointVec2 )
|
||||||
--self:F( { ToPointVec2, From, Event, To } )
|
--self:T( { ToPointVec2, From, Event, To } )
|
||||||
|
|
||||||
local Angle = 180
|
local Angle = 180
|
||||||
local Speed = 10
|
local Speed = 10
|
||||||
@@ -148,7 +153,7 @@ do -- CARGO_CRATE
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
function CARGO_CRATE:onenterLoaded( From, Event, To, CargoCarrier )
|
function CARGO_CRATE:onenterLoaded( From, Event, To, CargoCarrier )
|
||||||
--self:F( { From, Event, To, CargoCarrier } )
|
--self:T( { From, Event, To, CargoCarrier } )
|
||||||
|
|
||||||
self.CargoCarrier = CargoCarrier
|
self.CargoCarrier = CargoCarrier
|
||||||
|
|
||||||
@@ -185,7 +190,7 @@ do -- CARGO_CRATE
|
|||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
-- @return #boolean true if the Cargo Crate is within the report radius.
|
-- @return #boolean true if the Cargo Crate is within the report radius.
|
||||||
function CARGO_CRATE:IsInReportRadius( Coordinate )
|
function CARGO_CRATE:IsInReportRadius( Coordinate )
|
||||||
--self:F( { Coordinate, LoadRadius = self.LoadRadius } )
|
--self:T( { Coordinate, LoadRadius = self.LoadRadius } )
|
||||||
|
|
||||||
local Distance = 0
|
local Distance = 0
|
||||||
if self:IsUnLoaded() then
|
if self:IsUnLoaded() then
|
||||||
@@ -205,7 +210,7 @@ do -- CARGO_CRATE
|
|||||||
-- @param Core.Point#Coordinate Coordinate
|
-- @param Core.Point#Coordinate Coordinate
|
||||||
-- @return #boolean true if the Cargo Crate is within the loading radius.
|
-- @return #boolean true if the Cargo Crate is within the loading radius.
|
||||||
function CARGO_CRATE:IsInLoadRadius( Coordinate )
|
function CARGO_CRATE:IsInLoadRadius( Coordinate )
|
||||||
--self:F( { Coordinate, LoadRadius = self.NearRadius } )
|
--self:T( { Coordinate, LoadRadius = self.NearRadius } )
|
||||||
|
|
||||||
local Distance = 0
|
local Distance = 0
|
||||||
if self:IsUnLoaded() then
|
if self:IsUnLoaded() then
|
||||||
@@ -226,7 +231,7 @@ do -- CARGO_CRATE
|
|||||||
-- @return Core.Point#COORDINATE The current Coordinate of the first Cargo of the CargoGroup.
|
-- @return Core.Point#COORDINATE The current Coordinate of the first Cargo of the CargoGroup.
|
||||||
-- @return #nil There is no valid Cargo in the CargoGroup.
|
-- @return #nil There is no valid Cargo in the CargoGroup.
|
||||||
function CARGO_CRATE:GetCoordinate()
|
function CARGO_CRATE:GetCoordinate()
|
||||||
--self:F()
|
--self:T()
|
||||||
|
|
||||||
return self.CargoObject:GetCoordinate()
|
return self.CargoObject:GetCoordinate()
|
||||||
end
|
end
|
||||||
@@ -256,7 +261,7 @@ do -- CARGO_CRATE
|
|||||||
-- @param #CARGO_CRATE self
|
-- @param #CARGO_CRATE self
|
||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
function CARGO_CRATE:RouteTo( Coordinate )
|
function CARGO_CRATE:RouteTo( Coordinate )
|
||||||
self:F( {Coordinate = Coordinate } )
|
self:T( {Coordinate = Coordinate } )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -269,7 +274,7 @@ do -- CARGO_CRATE
|
|||||||
-- @return #boolean The Cargo is near to the Carrier.
|
-- @return #boolean The Cargo is near to the Carrier.
|
||||||
-- @return #nil The Cargo is not near to the Carrier.
|
-- @return #nil The Cargo is not near to the Carrier.
|
||||||
function CARGO_CRATE:IsNear( CargoCarrier, NearRadius )
|
function CARGO_CRATE:IsNear( CargoCarrier, NearRadius )
|
||||||
self:F( {NearRadius = NearRadius } )
|
self:T( {NearRadius = NearRadius } )
|
||||||
|
|
||||||
return self:IsNear( CargoCarrier:GetCoordinate(), NearRadius )
|
return self:IsNear( CargoCarrier:GetCoordinate(), NearRadius )
|
||||||
end
|
end
|
||||||
@@ -278,7 +283,7 @@ do -- CARGO_CRATE
|
|||||||
-- @param #CARGO_CRATE self
|
-- @param #CARGO_CRATE self
|
||||||
function CARGO_CRATE:Respawn()
|
function CARGO_CRATE:Respawn()
|
||||||
|
|
||||||
self:F( { "Respawning crate " .. self:GetName() } )
|
self:T( { "Respawning crate " .. self:GetName() } )
|
||||||
|
|
||||||
|
|
||||||
-- Respawn the group...
|
-- Respawn the group...
|
||||||
@@ -295,7 +300,7 @@ do -- CARGO_CRATE
|
|||||||
-- @param #CARGO_CRATE self
|
-- @param #CARGO_CRATE self
|
||||||
function CARGO_CRATE:onafterReset()
|
function CARGO_CRATE:onafterReset()
|
||||||
|
|
||||||
self:F( { "Reset crate " .. self:GetName() } )
|
self:T( { "Reset crate " .. self:GetName() } )
|
||||||
|
|
||||||
|
|
||||||
-- Respawn the group...
|
-- Respawn the group...
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **Cargo** - Management of grouped cargo logistics, which are based on a @{Wrapper.Group} object.
|
--- **Cargo** - Management of grouped cargo logistics, which are based on a GROUP object.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -38,7 +38,12 @@ do -- CARGO_GROUP
|
|||||||
--
|
--
|
||||||
-- * @{Tasking.Task_Cargo_Transport#TASK_CARGO_TRANSPORT} to transport cargo by human players.
|
-- * @{Tasking.Task_Cargo_Transport#TASK_CARGO_TRANSPORT} to transport cargo by human players.
|
||||||
-- * @{Tasking.Task_Cargo_Transport#TASK_CARGO_CSAR} to transport downed pilots by human players.
|
-- * @{Tasking.Task_Cargo_Transport#TASK_CARGO_CSAR} to transport downed pilots by human players.
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- @field #CARGO_GROUP CARGO_GROUP
|
-- @field #CARGO_GROUP CARGO_GROUP
|
||||||
--
|
--
|
||||||
CARGO_GROUP = {
|
CARGO_GROUP = {
|
||||||
@@ -47,7 +52,7 @@ do -- CARGO_GROUP
|
|||||||
|
|
||||||
--- CARGO_GROUP constructor.
|
--- CARGO_GROUP constructor.
|
||||||
-- This make a new CARGO_GROUP from a @{Wrapper.Group} object.
|
-- This make a new CARGO_GROUP from a @{Wrapper.Group} object.
|
||||||
-- It will "ungroup" the group object within the sim, and will create a @{Set} of individual Unit objects.
|
-- It will "ungroup" the group object within the sim, and will create a @{Core.Set} of individual Unit objects.
|
||||||
-- @param #CARGO_GROUP self
|
-- @param #CARGO_GROUP self
|
||||||
-- @param Wrapper.Group#GROUP CargoGroup Group to be transported as cargo.
|
-- @param Wrapper.Group#GROUP CargoGroup Group to be transported as cargo.
|
||||||
-- @param #string Type Cargo type, e.g. "Infantry". This is the type used in SET_CARGO:New():FilterTypes("Infantry") to define the valid cargo groups of the set.
|
-- @param #string Type Cargo type, e.g. "Infantry". This is the type used in SET_CARGO:New():FilterTypes("Infantry") to define the valid cargo groups of the set.
|
||||||
@@ -59,7 +64,7 @@ do -- CARGO_GROUP
|
|||||||
|
|
||||||
-- Inherit CAROG_REPORTABLE
|
-- Inherit CAROG_REPORTABLE
|
||||||
local self = BASE:Inherit( self, CARGO_REPORTABLE:New( Type, Name, 0, LoadRadius, NearRadius ) ) -- #CARGO_GROUP
|
local self = BASE:Inherit( self, CARGO_REPORTABLE:New( Type, Name, 0, LoadRadius, NearRadius ) ) -- #CARGO_GROUP
|
||||||
self:F( { Type, Name, LoadRadius } )
|
self:T( { Type, Name, LoadRadius } )
|
||||||
|
|
||||||
self.CargoSet = SET_CARGO:New()
|
self.CargoSet = SET_CARGO:New()
|
||||||
self.CargoGroup = CargoGroup
|
self.CargoGroup = CargoGroup
|
||||||
@@ -141,7 +146,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param #CARGO_GROUP self
|
-- @param #CARGO_GROUP self
|
||||||
function CARGO_GROUP:Respawn()
|
function CARGO_GROUP:Respawn()
|
||||||
|
|
||||||
self:F( { "Respawning" } )
|
self:T( { "Respawning" } )
|
||||||
|
|
||||||
for CargoID, CargoData in pairs( self.CargoSet:GetSet() ) do
|
for CargoID, CargoData in pairs( self.CargoSet:GetSet() ) do
|
||||||
local Cargo = CargoData -- Cargo.Cargo#CARGO
|
local Cargo = CargoData -- Cargo.Cargo#CARGO
|
||||||
@@ -222,7 +227,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param #CARGO_GROUP self
|
-- @param #CARGO_GROUP self
|
||||||
function CARGO_GROUP:Regroup()
|
function CARGO_GROUP:Regroup()
|
||||||
|
|
||||||
self:F("Regroup")
|
self:T("Regroup")
|
||||||
|
|
||||||
if self.Grouped == false then
|
if self.Grouped == false then
|
||||||
|
|
||||||
@@ -236,7 +241,7 @@ do -- CARGO_GROUP
|
|||||||
for CargoUnitName, CargoUnit in pairs( self.CargoSet:GetSet() ) do
|
for CargoUnitName, CargoUnit in pairs( self.CargoSet:GetSet() ) do
|
||||||
local CargoUnit = CargoUnit -- Cargo.CargoUnit#CARGO_UNIT
|
local CargoUnit = CargoUnit -- Cargo.CargoUnit#CARGO_UNIT
|
||||||
|
|
||||||
self:F( { CargoUnit:GetName(), UnLoaded = CargoUnit:IsUnLoaded() } )
|
self:T( { CargoUnit:GetName(), UnLoaded = CargoUnit:IsUnLoaded() } )
|
||||||
|
|
||||||
if CargoUnit:IsUnLoaded() then
|
if CargoUnit:IsUnLoaded() then
|
||||||
|
|
||||||
@@ -253,7 +258,7 @@ do -- CARGO_GROUP
|
|||||||
-- Then we register the new group in the database
|
-- Then we register the new group in the database
|
||||||
self.CargoGroup = GROUP:NewTemplate( GroupTemplate, GroupTemplate.CoalitionID, GroupTemplate.CategoryID, GroupTemplate.CountryID )
|
self.CargoGroup = GROUP:NewTemplate( GroupTemplate, GroupTemplate.CoalitionID, GroupTemplate.CategoryID, GroupTemplate.CountryID )
|
||||||
|
|
||||||
self:F( { "Regroup", GroupTemplate } )
|
self:T( { "Regroup", GroupTemplate } )
|
||||||
|
|
||||||
-- Now we spawn the new group based on the template created.
|
-- Now we spawn the new group based on the template created.
|
||||||
self.CargoObject = _DATABASE:Spawn( GroupTemplate )
|
self.CargoObject = _DATABASE:Spawn( GroupTemplate )
|
||||||
@@ -266,7 +271,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function CARGO_GROUP:OnEventCargoDead( EventData )
|
function CARGO_GROUP:OnEventCargoDead( EventData )
|
||||||
|
|
||||||
self:E(EventData)
|
self:T(EventData)
|
||||||
|
|
||||||
local Destroyed = false
|
local Destroyed = false
|
||||||
|
|
||||||
@@ -291,7 +296,7 @@ do -- CARGO_GROUP
|
|||||||
|
|
||||||
if Destroyed then
|
if Destroyed then
|
||||||
self:Destroyed()
|
self:Destroyed()
|
||||||
self:E( { "Cargo group destroyed" } )
|
self:T( { "Cargo group destroyed" } )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -304,14 +309,14 @@ do -- CARGO_GROUP
|
|||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
||||||
function CARGO_GROUP:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ... )
|
function CARGO_GROUP:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||||
self:F( { CargoCarrier.UnitName, From, Event, To, NearRadius = NearRadius } )
|
self:T( { CargoCarrier.UnitName, From, Event, To, NearRadius = NearRadius } )
|
||||||
|
|
||||||
NearRadius = NearRadius or self.NearRadius
|
NearRadius = NearRadius or self.NearRadius
|
||||||
|
|
||||||
-- For each Cargo object within the CARGO_GROUPED, route each object to the CargoLoadPointVec2
|
-- For each Cargo object within the CARGO_GROUPED, route each object to the CargoLoadPointVec2
|
||||||
self.CargoSet:ForEach(
|
self.CargoSet:ForEach(
|
||||||
function( Cargo, ... )
|
function( Cargo, ... )
|
||||||
self:F( { "Board Unit", Cargo:GetName( ), Cargo:IsDestroyed(), Cargo.CargoObject:IsAlive() } )
|
self:T( { "Board Unit", Cargo:GetName( ), Cargo:IsDestroyed(), Cargo.CargoObject:IsAlive() } )
|
||||||
local CargoGroup = Cargo.CargoObject --Wrapper.Group#GROUP
|
local CargoGroup = Cargo.CargoObject --Wrapper.Group#GROUP
|
||||||
CargoGroup:OptionAlarmStateGreen()
|
CargoGroup:OptionAlarmStateGreen()
|
||||||
Cargo:__Board( 1, CargoCarrier, NearRadius, ... )
|
Cargo:__Board( 1, CargoCarrier, NearRadius, ... )
|
||||||
@@ -329,7 +334,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
function CARGO_GROUP:onafterLoad( From, Event, To, CargoCarrier, ... )
|
function CARGO_GROUP:onafterLoad( From, Event, To, CargoCarrier, ... )
|
||||||
--self:F( { From, Event, To, CargoCarrier, ...} )
|
--self:T( { From, Event, To, CargoCarrier, ...} )
|
||||||
|
|
||||||
if From == "UnLoaded" then
|
if From == "UnLoaded" then
|
||||||
-- For each Cargo object within the CARGO_GROUP, load each cargo to the CargoCarrier.
|
-- For each Cargo object within the CARGO_GROUP, load each cargo to the CargoCarrier.
|
||||||
@@ -354,7 +359,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
||||||
function CARGO_GROUP:onafterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
|
function CARGO_GROUP:onafterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||||
--self:F( { CargoCarrier.UnitName, From, Event, To } )
|
--self:T( { CargoCarrier.UnitName, From, Event, To } )
|
||||||
|
|
||||||
local Boarded = true
|
local Boarded = true
|
||||||
local Cancelled = false
|
local Cancelled = false
|
||||||
@@ -388,7 +393,7 @@ do -- CARGO_GROUP
|
|||||||
if not Boarded then
|
if not Boarded then
|
||||||
self:__Boarding( -5, CargoCarrier, NearRadius, ... )
|
self:__Boarding( -5, CargoCarrier, NearRadius, ... )
|
||||||
else
|
else
|
||||||
self:F("Group Cargo is loaded")
|
self:T("Group Cargo is loaded")
|
||||||
self:__Load( 1, CargoCarrier, ... )
|
self:__Load( 1, CargoCarrier, ... )
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -408,7 +413,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
||||||
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
||||||
function CARGO_GROUP:onafterUnBoard( From, Event, To, ToPointVec2, NearRadius, ... )
|
function CARGO_GROUP:onafterUnBoard( From, Event, To, ToPointVec2, NearRadius, ... )
|
||||||
self:F( {From, Event, To, ToPointVec2, NearRadius } )
|
self:T( {From, Event, To, ToPointVec2, NearRadius } )
|
||||||
|
|
||||||
NearRadius = NearRadius or 25
|
NearRadius = NearRadius or 25
|
||||||
|
|
||||||
@@ -451,7 +456,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
||||||
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
||||||
function CARGO_GROUP:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... )
|
function CARGO_GROUP:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... )
|
||||||
--self:F( { From, Event, To, ToPointVec2, NearRadius } )
|
--self:T( { From, Event, To, ToPointVec2, NearRadius } )
|
||||||
|
|
||||||
--local NearRadius = NearRadius or 25
|
--local NearRadius = NearRadius or 25
|
||||||
|
|
||||||
@@ -488,7 +493,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
||||||
function CARGO_GROUP:onafterUnLoad( From, Event, To, ToPointVec2, ... )
|
function CARGO_GROUP:onafterUnLoad( From, Event, To, ToPointVec2, ... )
|
||||||
--self:F( { From, Event, To, ToPointVec2 } )
|
--self:T( { From, Event, To, ToPointVec2 } )
|
||||||
|
|
||||||
if From == "Loaded" then
|
if From == "Loaded" then
|
||||||
|
|
||||||
@@ -606,7 +611,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param #CARGO_GROUP self
|
-- @param #CARGO_GROUP self
|
||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
function CARGO_GROUP:RouteTo( Coordinate )
|
function CARGO_GROUP:RouteTo( Coordinate )
|
||||||
--self:F( {Coordinate = Coordinate } )
|
--self:T( {Coordinate = Coordinate } )
|
||||||
|
|
||||||
-- For each Cargo within the CargoSet, route each object to the Coordinate
|
-- For each Cargo within the CargoSet, route each object to the Coordinate
|
||||||
self.CargoSet:ForEach(
|
self.CargoSet:ForEach(
|
||||||
@@ -624,13 +629,13 @@ do -- CARGO_GROUP
|
|||||||
-- @param #number NearRadius
|
-- @param #number NearRadius
|
||||||
-- @return #boolean The Cargo is near to the Carrier or #nil if the Cargo is not near to the Carrier.
|
-- @return #boolean The Cargo is near to the Carrier or #nil if the Cargo is not near to the Carrier.
|
||||||
function CARGO_GROUP:IsNear( CargoCarrier, NearRadius )
|
function CARGO_GROUP:IsNear( CargoCarrier, NearRadius )
|
||||||
self:F( {NearRadius = NearRadius } )
|
self:T( {NearRadius = NearRadius } )
|
||||||
|
|
||||||
for _, Cargo in pairs( self.CargoSet:GetSet() ) do
|
for _, Cargo in pairs( self.CargoSet:GetSet() ) do
|
||||||
local Cargo = Cargo -- Cargo.Cargo#CARGO
|
local Cargo = Cargo -- Cargo.Cargo#CARGO
|
||||||
if Cargo:IsAlive() then
|
if Cargo:IsAlive() then
|
||||||
if Cargo:IsNear( CargoCarrier:GetCoordinate(), NearRadius ) then
|
if Cargo:IsNear( CargoCarrier:GetCoordinate(), NearRadius ) then
|
||||||
self:F( "Near" )
|
self:T( "Near" )
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -644,7 +649,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
-- @return #boolean true if the Cargo Group is within the load radius.
|
-- @return #boolean true if the Cargo Group is within the load radius.
|
||||||
function CARGO_GROUP:IsInLoadRadius( Coordinate )
|
function CARGO_GROUP:IsInLoadRadius( Coordinate )
|
||||||
--self:F( { Coordinate } )
|
--self:T( { Coordinate } )
|
||||||
|
|
||||||
local Cargo = self:GetFirstAlive() -- Cargo.Cargo#CARGO
|
local Cargo = self:GetFirstAlive() -- Cargo.Cargo#CARGO
|
||||||
|
|
||||||
@@ -664,7 +669,7 @@ do -- CARGO_GROUP
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
self:F( { Distance = Distance, LoadRadius = self.LoadRadius } )
|
self:T( { Distance = Distance, LoadRadius = self.LoadRadius } )
|
||||||
if Distance <= self.LoadRadius then
|
if Distance <= self.LoadRadius then
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
@@ -682,12 +687,12 @@ do -- CARGO_GROUP
|
|||||||
-- @param Core.Point#Coordinate Coordinate
|
-- @param Core.Point#Coordinate Coordinate
|
||||||
-- @return #boolean true if the Cargo Group is within the report radius.
|
-- @return #boolean true if the Cargo Group is within the report radius.
|
||||||
function CARGO_GROUP:IsInReportRadius( Coordinate )
|
function CARGO_GROUP:IsInReportRadius( Coordinate )
|
||||||
--self:F( { Coordinate } )
|
--self:T( { Coordinate } )
|
||||||
|
|
||||||
local Cargo = self:GetFirstAlive() -- Cargo.Cargo#CARGO
|
local Cargo = self:GetFirstAlive() -- Cargo.Cargo#CARGO
|
||||||
|
|
||||||
if Cargo then
|
if Cargo then
|
||||||
self:F( { Cargo } )
|
self:T( { Cargo } )
|
||||||
local Distance = 0
|
local Distance = 0
|
||||||
if Cargo:IsUnLoaded() then
|
if Cargo:IsUnLoaded() then
|
||||||
Distance = Coordinate:Get2DDistance( Cargo.CargoObject:GetCoordinate() )
|
Distance = Coordinate:Get2DDistance( Cargo.CargoObject:GetCoordinate() )
|
||||||
@@ -727,13 +732,13 @@ do -- CARGO_GROUP
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Check if the first element of the CargoGroup is the given @{Zone}.
|
--- Check if the first element of the CargoGroup is the given @{Core.Zone}.
|
||||||
-- @param #CARGO_GROUP self
|
-- @param #CARGO_GROUP self
|
||||||
-- @param Core.Zone#ZONE_BASE Zone
|
-- @param Core.Zone#ZONE_BASE Zone
|
||||||
-- @return #boolean **true** if the first element of the CargoGroup is in the Zone
|
-- @return #boolean **true** if the first element of the CargoGroup is in the Zone
|
||||||
-- @return #boolean **false** if there is no element of the CargoGroup in the Zone.
|
-- @return #boolean **false** if there is no element of the CargoGroup in the Zone.
|
||||||
function CARGO_GROUP:IsInZone( Zone )
|
function CARGO_GROUP:IsInZone( Zone )
|
||||||
--self:F( { Zone } )
|
--self:T( { Zone } )
|
||||||
|
|
||||||
local Cargo = self.CargoSet:GetFirst() -- Cargo.Cargo#CARGO
|
local Cargo = self.CargoSet:GetFirst() -- Cargo.Cargo#CARGO
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **Cargo** -- Management of single cargo crates, which are based on a @{Static} object. The cargo can only be slingloaded.
|
--- **Cargo** - Management of single cargo crates, which are based on a STATIC object. The cargo can only be slingloaded.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -29,7 +29,12 @@ do -- CARGO_SLINGLOAD
|
|||||||
--
|
--
|
||||||
-- * @{Tasking.Task_Cargo_Transport#TASK_CARGO_TRANSPORT} to transport cargo by human players.
|
-- * @{Tasking.Task_Cargo_Transport#TASK_CARGO_TRANSPORT} to transport cargo by human players.
|
||||||
-- * @{Tasking.Task_Cargo_Transport#TASK_CARGO_CSAR} to transport downed pilots by human players.
|
-- * @{Tasking.Task_Cargo_Transport#TASK_CARGO_CSAR} to transport downed pilots by human players.
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #CARGO_SLINGLOAD
|
-- @field #CARGO_SLINGLOAD
|
||||||
@@ -47,7 +52,7 @@ do -- CARGO_SLINGLOAD
|
|||||||
-- @return #CARGO_SLINGLOAD
|
-- @return #CARGO_SLINGLOAD
|
||||||
function CARGO_SLINGLOAD:New( CargoStatic, Type, Name, LoadRadius, NearRadius )
|
function CARGO_SLINGLOAD:New( CargoStatic, Type, Name, LoadRadius, NearRadius )
|
||||||
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoStatic, Type, Name, nil, LoadRadius, NearRadius ) ) -- #CARGO_SLINGLOAD
|
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoStatic, Type, Name, nil, LoadRadius, NearRadius ) ) -- #CARGO_SLINGLOAD
|
||||||
self:F( { Type, Name, NearRadius } )
|
self:T( { Type, Name, NearRadius } )
|
||||||
|
|
||||||
self.CargoObject = CargoStatic
|
self.CargoObject = CargoStatic
|
||||||
|
|
||||||
@@ -125,7 +130,7 @@ do -- CARGO_SLINGLOAD
|
|||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
-- @return #boolean true if the Cargo Crate is within the report radius.
|
-- @return #boolean true if the Cargo Crate is within the report radius.
|
||||||
function CARGO_SLINGLOAD:IsInReportRadius( Coordinate )
|
function CARGO_SLINGLOAD:IsInReportRadius( Coordinate )
|
||||||
--self:F( { Coordinate, LoadRadius = self.LoadRadius } )
|
--self:T( { Coordinate, LoadRadius = self.LoadRadius } )
|
||||||
|
|
||||||
local Distance = 0
|
local Distance = 0
|
||||||
if self:IsUnLoaded() then
|
if self:IsUnLoaded() then
|
||||||
@@ -144,7 +149,7 @@ do -- CARGO_SLINGLOAD
|
|||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
-- @return #boolean true if the Cargo Slingload is within the loading radius.
|
-- @return #boolean true if the Cargo Slingload is within the loading radius.
|
||||||
function CARGO_SLINGLOAD:IsInLoadRadius( Coordinate )
|
function CARGO_SLINGLOAD:IsInLoadRadius( Coordinate )
|
||||||
--self:F( { Coordinate } )
|
--self:T( { Coordinate } )
|
||||||
|
|
||||||
local Distance = 0
|
local Distance = 0
|
||||||
if self:IsUnLoaded() then
|
if self:IsUnLoaded() then
|
||||||
@@ -164,7 +169,7 @@ do -- CARGO_SLINGLOAD
|
|||||||
-- @return Core.Point#COORDINATE The current Coordinate of the first Cargo of the CargoGroup.
|
-- @return Core.Point#COORDINATE The current Coordinate of the first Cargo of the CargoGroup.
|
||||||
-- @return #nil There is no valid Cargo in the CargoGroup.
|
-- @return #nil There is no valid Cargo in the CargoGroup.
|
||||||
function CARGO_SLINGLOAD:GetCoordinate()
|
function CARGO_SLINGLOAD:GetCoordinate()
|
||||||
--self:F()
|
--self:T()
|
||||||
|
|
||||||
return self.CargoObject:GetCoordinate()
|
return self.CargoObject:GetCoordinate()
|
||||||
end
|
end
|
||||||
@@ -194,7 +199,7 @@ do -- CARGO_SLINGLOAD
|
|||||||
-- @param #CARGO_SLINGLOAD self
|
-- @param #CARGO_SLINGLOAD self
|
||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
function CARGO_SLINGLOAD:RouteTo( Coordinate )
|
function CARGO_SLINGLOAD:RouteTo( Coordinate )
|
||||||
--self:F( {Coordinate = Coordinate } )
|
--self:T( {Coordinate = Coordinate } )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -207,7 +212,7 @@ do -- CARGO_SLINGLOAD
|
|||||||
-- @return #boolean The Cargo is near to the Carrier.
|
-- @return #boolean The Cargo is near to the Carrier.
|
||||||
-- @return #nil The Cargo is not near to the Carrier.
|
-- @return #nil The Cargo is not near to the Carrier.
|
||||||
function CARGO_SLINGLOAD:IsNear( CargoCarrier, NearRadius )
|
function CARGO_SLINGLOAD:IsNear( CargoCarrier, NearRadius )
|
||||||
--self:F( {NearRadius = NearRadius } )
|
--self:T( {NearRadius = NearRadius } )
|
||||||
|
|
||||||
return self:IsNear( CargoCarrier:GetCoordinate(), NearRadius )
|
return self:IsNear( CargoCarrier:GetCoordinate(), NearRadius )
|
||||||
end
|
end
|
||||||
@@ -217,7 +222,7 @@ do -- CARGO_SLINGLOAD
|
|||||||
-- @param #CARGO_SLINGLOAD self
|
-- @param #CARGO_SLINGLOAD self
|
||||||
function CARGO_SLINGLOAD:Respawn()
|
function CARGO_SLINGLOAD:Respawn()
|
||||||
|
|
||||||
--self:F( { "Respawning slingload " .. self:GetName() } )
|
--self:T( { "Respawning slingload " .. self:GetName() } )
|
||||||
|
|
||||||
|
|
||||||
-- Respawn the group...
|
-- Respawn the group...
|
||||||
@@ -234,7 +239,7 @@ do -- CARGO_SLINGLOAD
|
|||||||
-- @param #CARGO_SLINGLOAD self
|
-- @param #CARGO_SLINGLOAD self
|
||||||
function CARGO_SLINGLOAD:onafterReset()
|
function CARGO_SLINGLOAD:onafterReset()
|
||||||
|
|
||||||
--self:F( { "Reset slingload " .. self:GetName() } )
|
--self:T( { "Reset slingload " .. self:GetName() } )
|
||||||
|
|
||||||
|
|
||||||
-- Respawn the group...
|
-- Respawn the group...
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **Cargo** - Management of single cargo logistics, which are based on a @{Wrapper.Unit} object.
|
--- **Cargo** - Management of single cargo logistics, which are based on a UNIT object.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -27,7 +27,12 @@ do -- CARGO_UNIT
|
|||||||
-- Note that ground forces behave in a group, and thus, act in formation, regardless if one unit is commanded to move.
|
-- Note that ground forces behave in a group, and thus, act in formation, regardless if one unit is commanded to move.
|
||||||
--
|
--
|
||||||
-- This class is used in CARGO_GROUP, and is not meant to be used by mission designers individually.
|
-- This class is used in CARGO_GROUP, and is not meant to be used by mission designers individually.
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #CARGO_UNIT CARGO_UNIT
|
-- @field #CARGO_UNIT CARGO_UNIT
|
||||||
@@ -70,7 +75,7 @@ do -- CARGO_UNIT
|
|||||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
-- @param Core.Point#POINT_VEC2 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:F( { From, Event, To, ToPointVec2, NearRadius } )
|
self:T( { From, Event, To, ToPointVec2, NearRadius } )
|
||||||
|
|
||||||
local Angle = 180
|
local Angle = 180
|
||||||
local Speed = 60
|
local Speed = 60
|
||||||
@@ -109,7 +114,7 @@ do -- CARGO_UNIT
|
|||||||
else
|
else
|
||||||
self.CargoObject:ReSpawnAt( FromPointVec2, CargoDeployHeading )
|
self.CargoObject:ReSpawnAt( FromPointVec2, CargoDeployHeading )
|
||||||
end
|
end
|
||||||
self:F( { "CargoUnits:", self.CargoObject:GetGroup():GetName() } )
|
self:T( { "CargoUnits:", self.CargoObject:GetGroup():GetName() } )
|
||||||
self.CargoCarrier = nil
|
self.CargoCarrier = nil
|
||||||
|
|
||||||
local Points = {}
|
local Points = {}
|
||||||
@@ -143,7 +148,7 @@ do -- CARGO_UNIT
|
|||||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
-- @param Core.Point#POINT_VEC2 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:F( { From, Event, To, ToPointVec2, NearRadius } )
|
self:T( { From, Event, To, ToPointVec2, NearRadius } )
|
||||||
|
|
||||||
local Angle = 180
|
local Angle = 180
|
||||||
local Speed = 10
|
local Speed = 10
|
||||||
@@ -169,7 +174,7 @@ do -- CARGO_UNIT
|
|||||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
-- @param Core.Point#POINT_VEC2 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:F( { From, Event, To, ToPointVec2, NearRadius } )
|
self:T( { From, Event, To, ToPointVec2, NearRadius } )
|
||||||
|
|
||||||
self.CargoInAir = self.CargoObject:InAir()
|
self.CargoInAir = self.CargoObject:InAir()
|
||||||
|
|
||||||
@@ -194,7 +199,7 @@ do -- CARGO_UNIT
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#POINT_VEC2
|
-- @param Core.Point#POINT_VEC2
|
||||||
function CARGO_UNIT:onenterUnLoaded( From, Event, To, ToPointVec2 )
|
function CARGO_UNIT:onenterUnLoaded( From, Event, To, ToPointVec2 )
|
||||||
self:F( { ToPointVec2, From, Event, To } )
|
self:T( { ToPointVec2, From, Event, To } )
|
||||||
|
|
||||||
local Angle = 180
|
local Angle = 180
|
||||||
local Speed = 10
|
local Speed = 10
|
||||||
@@ -231,7 +236,7 @@ do -- CARGO_UNIT
|
|||||||
-- @param Wrapper.Group#GROUP CargoCarrier
|
-- @param Wrapper.Group#GROUP CargoCarrier
|
||||||
-- @param #number NearRadius
|
-- @param #number NearRadius
|
||||||
function CARGO_UNIT:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ... )
|
function CARGO_UNIT:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||||
self:F( { From, Event, To, CargoCarrier, NearRadius = NearRadius } )
|
self:T( { From, Event, To, CargoCarrier, NearRadius = NearRadius } )
|
||||||
|
|
||||||
self.CargoInAir = self.CargoObject:InAir()
|
self.CargoInAir = self.CargoObject:InAir()
|
||||||
|
|
||||||
@@ -239,7 +244,7 @@ do -- CARGO_UNIT
|
|||||||
local MaxSpeed = Desc.speedMaxOffRoad
|
local MaxSpeed = Desc.speedMaxOffRoad
|
||||||
local TypeName = Desc.typeName
|
local TypeName = Desc.typeName
|
||||||
|
|
||||||
--self:F({Unit=self.CargoObject:GetName()})
|
--self:T({Unit=self.CargoObject:GetName()})
|
||||||
|
|
||||||
-- A cargo unit can only be boarded if it is not dead
|
-- A cargo unit can only be boarded if it is not dead
|
||||||
|
|
||||||
@@ -293,9 +298,9 @@ do -- CARGO_UNIT
|
|||||||
-- @param Wrapper.Client#CLIENT CargoCarrier
|
-- @param Wrapper.Client#CLIENT CargoCarrier
|
||||||
-- @param #number NearRadius Default 25 m.
|
-- @param #number NearRadius Default 25 m.
|
||||||
function CARGO_UNIT:onafterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
|
function CARGO_UNIT:onafterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||||
self:F( { From, Event, To, CargoCarrier:GetName(), NearRadius = NearRadius } )
|
self:T( { From, Event, To, CargoCarrier:GetName(), NearRadius = NearRadius } )
|
||||||
|
|
||||||
self:F( { IsAlive=self.CargoObject:IsAlive() } )
|
self:T( { IsAlive=self.CargoObject:IsAlive() } )
|
||||||
|
|
||||||
if CargoCarrier and CargoCarrier:IsAlive() then -- and self.CargoObject and self.CargoObject:IsAlive() then
|
if CargoCarrier and CargoCarrier:IsAlive() then -- and self.CargoObject and self.CargoObject:IsAlive() then
|
||||||
if (CargoCarrier:IsAir() and not CargoCarrier:InAir()) or true then
|
if (CargoCarrier:IsAir() and not CargoCarrier:InAir()) or true then
|
||||||
@@ -316,7 +321,7 @@ do -- CARGO_UNIT
|
|||||||
local Angle = 180
|
local Angle = 180
|
||||||
local Distance = 0
|
local Distance = 0
|
||||||
|
|
||||||
--self:F({Unit=self.CargoObject:GetName()})
|
--self:T({Unit=self.CargoObject:GetName()})
|
||||||
|
|
||||||
local CargoCarrierPointVec2 = CargoCarrier:GetPointVec2()
|
local CargoCarrierPointVec2 = CargoCarrier:GetPointVec2()
|
||||||
local CargoCarrierHeading = CargoCarrier:GetHeading() -- Get Heading of object in degrees.
|
local CargoCarrierHeading = CargoCarrier:GetHeading() -- Get Heading of object in degrees.
|
||||||
@@ -343,7 +348,7 @@ do -- CARGO_UNIT
|
|||||||
self.CargoObject:SetCommand( self.CargoObject:CommandStopRoute( true ) )
|
self.CargoObject:SetCommand( self.CargoObject:CommandStopRoute( true ) )
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
self:E("Something is wrong")
|
self:T("Something is wrong")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -356,11 +361,11 @@ do -- CARGO_UNIT
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
function CARGO_UNIT:onenterLoaded( From, Event, To, CargoCarrier )
|
function CARGO_UNIT:onenterLoaded( From, Event, To, CargoCarrier )
|
||||||
self:F( { From, Event, To, CargoCarrier } )
|
self:T( { From, Event, To, CargoCarrier } )
|
||||||
|
|
||||||
self.CargoCarrier = CargoCarrier
|
self.CargoCarrier = CargoCarrier
|
||||||
|
|
||||||
--self:F({Unit=self.CargoObject:GetName()})
|
--self:T({Unit=self.CargoObject:GetName()})
|
||||||
|
|
||||||
-- Only destroy the CargoObject if there is a CargoObject (packages don't have CargoObjects).
|
-- Only destroy the CargoObject if there is a CargoObject (packages don't have CargoObjects).
|
||||||
if self.CargoObject then
|
if self.CargoObject then
|
||||||
|
|||||||
@@ -112,7 +112,7 @@
|
|||||||
--
|
--
|
||||||
-- # Calculate the Path
|
-- # Calculate the Path
|
||||||
--
|
--
|
||||||
-- Finally, we have to calculate the path. This is done by the @{ASTAR.GetPath}(*ExcludeStart, ExcludeEnd*) function. This function returns a table of nodes, which
|
-- Finally, we have to calculate the path. This is done by the @{#GetPath}(*ExcludeStart, ExcludeEnd*) function. This function returns a table of nodes, which
|
||||||
-- describe the optimal path from the start node to the end node.
|
-- describe the optimal path from the start node to the end node.
|
||||||
--
|
--
|
||||||
-- By default, the start and end node are include in the table that is returned.
|
-- By default, the start and end node are include in the table that is returned.
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ local _TraceClassMethod = {}
|
|||||||
|
|
||||||
local _ClassID = 0
|
local _ClassID = 0
|
||||||
|
|
||||||
--- @type BASE
|
---
|
||||||
|
-- @type BASE
|
||||||
-- @field ClassName The name of the class.
|
-- @field ClassName The name of the class.
|
||||||
-- @field ClassID The ID number of the class.
|
-- @field ClassID The ID number of the class.
|
||||||
-- @field ClassNameAndID The name of the class concatenated with the ID number of the class.
|
-- @field ClassNameAndID The name of the class concatenated with the ID number of the class.
|
||||||
@@ -157,7 +158,7 @@ local _ClassID = 0
|
|||||||
-- self:SmokeBlue()
|
-- self:SmokeBlue()
|
||||||
-- end
|
-- end
|
||||||
--
|
--
|
||||||
-- See the @{Event} module for more information about event handling.
|
-- See the @{Core.Event} module for more information about event handling.
|
||||||
--
|
--
|
||||||
-- # 4. Class identification methods.
|
-- # 4. Class identification methods.
|
||||||
--
|
--
|
||||||
@@ -201,10 +202,10 @@ BASE = {
|
|||||||
Scheduler = nil,
|
Scheduler = nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- @field #BASE.__
|
-- @field #BASE.__
|
||||||
BASE.__ = {}
|
BASE.__ = {}
|
||||||
|
|
||||||
--- @field #BASE._
|
-- @field #BASE._
|
||||||
BASE._ = {
|
BASE._ = {
|
||||||
Schedules = {}, --- Contains the Schedulers Active
|
Schedules = {}, --- Contains the Schedulers Active
|
||||||
}
|
}
|
||||||
@@ -229,7 +230,7 @@ FORMATION = {
|
|||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @return #BASE
|
-- @return #BASE
|
||||||
function BASE:New()
|
function BASE:New()
|
||||||
--local self = routines.utils.deepCopy( self ) -- Create a new self instance
|
--local self = UTILS.DeepCopy( self ) -- Create a new self instance
|
||||||
local self = UTILS.DeepCopy(self)
|
local self = UTILS.DeepCopy(self)
|
||||||
|
|
||||||
_ClassID = _ClassID + 1
|
_ClassID = _ClassID + 1
|
||||||
@@ -252,7 +253,7 @@ end
|
|||||||
function BASE:Inherit( Child, Parent )
|
function BASE:Inherit( Child, Parent )
|
||||||
|
|
||||||
-- Create child.
|
-- Create child.
|
||||||
local Child = routines.utils.deepCopy( Child )
|
local Child = UTILS.DeepCopy( Child )
|
||||||
|
|
||||||
if Child ~= nil then
|
if Child ~= nil then
|
||||||
|
|
||||||
@@ -412,20 +413,20 @@ do -- Event Handling
|
|||||||
return _EVENTDISPATCHER
|
return _EVENTDISPATCHER
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the Class @{Event} processing Priority.
|
--- Get the Class @{Core.Event} processing Priority.
|
||||||
-- The Event processing Priority is a number from 1 to 10,
|
-- The Event processing Priority is a number from 1 to 10,
|
||||||
-- reflecting the order of the classes subscribed to the Event to be processed.
|
-- reflecting the order of the classes subscribed to the Event to be processed.
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @return #number The @{Event} processing Priority.
|
-- @return #number The @{Core.Event} processing Priority.
|
||||||
function BASE:GetEventPriority()
|
function BASE:GetEventPriority()
|
||||||
return self._.EventPriority or 5
|
return self._.EventPriority or 5
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set the Class @{Event} processing Priority.
|
--- Set the Class @{Core.Event} processing Priority.
|
||||||
-- The Event processing Priority is a number from 1 to 10,
|
-- The Event processing Priority is a number from 1 to 10,
|
||||||
-- reflecting the order of the classes subscribed to the Event to be processed.
|
-- reflecting the order of the classes subscribed to the Event to be processed.
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param #number EventPriority The @{Event} processing Priority.
|
-- @param #number EventPriority The @{Core.Event} processing Priority.
|
||||||
-- @return #BASE self
|
-- @return #BASE self
|
||||||
function BASE:SetEventPriority( EventPriority )
|
function BASE:SetEventPriority( EventPriority )
|
||||||
self._.EventPriority = EventPriority
|
self._.EventPriority = EventPriority
|
||||||
@@ -464,16 +465,16 @@ do -- Event Handling
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Event handling function prototypes - Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Event handling function prototypes - Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
|
|
||||||
--- Occurs whenever any unit in a mission fires a weapon. But not any machine gun or autocannon based weapon, those are handled by EVENT.ShootingStart.
|
--- Occurs whenever any unit in a mission fires a weapon. But not any machine gun or autocannon based weapon, those are handled by EVENT.ShootingStart.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- @function [parent=#BASE] OnEventShot
|
-- @function [parent=#BASE] OnEventShot
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Occurs whenever an object is hit by a weapon.
|
--- Occurs whenever an object is hit by a weapon.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- initiator : The unit object the fired the weapon
|
-- initiator : The unit object the fired the weapon
|
||||||
-- weapon: Weapon object that hit the target
|
-- weapon: Weapon object that hit the target
|
||||||
-- target: The Object that was hit.
|
-- target: The Object that was hit.
|
||||||
@@ -482,7 +483,7 @@ do -- Event Handling
|
|||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Occurs when an aircraft takes off from an airbase, farp, or ship.
|
--- Occurs when an aircraft takes off from an airbase, farp, or ship.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- initiator : The unit that tookoff
|
-- initiator : The unit that tookoff
|
||||||
-- place: Object from where the AI took-off from. Can be an Airbase Object, FARP, or Ships
|
-- place: Object from where the AI took-off from. Can be an Airbase Object, FARP, or Ships
|
||||||
-- @function [parent=#BASE] OnEventTakeoff
|
-- @function [parent=#BASE] OnEventTakeoff
|
||||||
@@ -490,7 +491,7 @@ do -- Event Handling
|
|||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Occurs when an aircraft lands at an airbase, farp or ship
|
--- Occurs when an aircraft lands at an airbase, farp or ship
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- initiator : The unit that has landed
|
-- initiator : The unit that has landed
|
||||||
-- place: Object that the unit landed on. Can be an Airbase Object, FARP, or Ships
|
-- place: Object that the unit landed on. Can be an Airbase Object, FARP, or Ships
|
||||||
-- @function [parent=#BASE] OnEventLand
|
-- @function [parent=#BASE] OnEventLand
|
||||||
@@ -498,49 +499,49 @@ do -- Event Handling
|
|||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Occurs when any aircraft crashes into the ground and is completely destroyed.
|
--- Occurs when any aircraft crashes into the ground and is completely destroyed.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- initiator : The unit that has crashed
|
-- initiator : The unit that has crashed
|
||||||
-- @function [parent=#BASE] OnEventCrash
|
-- @function [parent=#BASE] OnEventCrash
|
||||||
-- @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 pilot ejects from an aircraft
|
--- Occurs when a pilot ejects from an aircraft
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- initiator : The unit that has ejected
|
-- initiator : The unit that has ejected
|
||||||
-- @function [parent=#BASE] OnEventEjection
|
-- @function [parent=#BASE] OnEventEjection
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Occurs when an aircraft connects with a tanker and begins taking on fuel.
|
--- Occurs when an aircraft connects with a tanker and begins taking on fuel.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- initiator : The unit that is receiving fuel.
|
-- initiator : The unit that is receiving fuel.
|
||||||
-- @function [parent=#BASE] OnEventRefueling
|
-- @function [parent=#BASE] OnEventRefueling
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Occurs when an object is dead.
|
--- Occurs when an object is dead.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- initiator : The unit that is dead.
|
-- initiator : The unit that is dead.
|
||||||
-- @function [parent=#BASE] OnEventDead
|
-- @function [parent=#BASE] OnEventDead
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Occurs when an Event for an object is triggered.
|
--- Occurs when an Event for an object is triggered.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- initiator : The unit that triggered the event.
|
-- initiator : The unit that triggered the event.
|
||||||
-- @function [parent=#BASE] OnEvent
|
-- @function [parent=#BASE] OnEvent
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Occurs when the pilot of an aircraft is killed. Can occur either if the player is alive and crashes or if a weapon kills the pilot without completely destroying the plane.
|
--- Occurs when the pilot of an aircraft is killed. Can occur either if the player is alive and crashes or if a weapon kills the pilot without completely destroying the plane.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- initiator : The unit that the pilot has died in.
|
-- initiator : The unit that the pilot has died in.
|
||||||
-- @function [parent=#BASE] OnEventPilotDead
|
-- @function [parent=#BASE] OnEventPilotDead
|
||||||
-- @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 ground unit captures either an airbase or a farp.
|
--- Occurs when a ground unit captures either an airbase or a farp.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- initiator : The unit that captured the base
|
-- initiator : The unit that captured the base
|
||||||
-- place: The airbase that was captured, can be a FARP or Airbase. When calling place:getCoalition() the faction will already be the new owning faction.
|
-- place: The airbase that was captured, can be a FARP or Airbase. When calling place:getCoalition() the faction will already be the new owning faction.
|
||||||
-- @function [parent=#BASE] OnEventBaseCaptured
|
-- @function [parent=#BASE] OnEventBaseCaptured
|
||||||
@@ -548,68 +549,68 @@ do -- Event Handling
|
|||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Occurs when a mission starts
|
--- Occurs when a mission starts
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- @function [parent=#BASE] OnEventMissionStart
|
-- @function [parent=#BASE] OnEventMissionStart
|
||||||
-- @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 mission ends
|
--- Occurs when a mission ends
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- @function [parent=#BASE] OnEventMissionEnd
|
-- @function [parent=#BASE] OnEventMissionEnd
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Occurs when an aircraft is finished taking fuel.
|
--- Occurs when an aircraft is finished taking fuel.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- initiator : The unit that was receiving fuel.
|
-- initiator : The unit that was receiving fuel.
|
||||||
-- @function [parent=#BASE] OnEventRefuelingStop
|
-- @function [parent=#BASE] OnEventRefuelingStop
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Occurs when any object is spawned into the mission.
|
--- Occurs when any object is spawned into the mission.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- initiator : The unit that was spawned
|
-- initiator : The unit that was spawned
|
||||||
-- @function [parent=#BASE] OnEventBirth
|
-- @function [parent=#BASE] OnEventBirth
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Occurs when any system fails on a human controlled aircraft.
|
--- Occurs when any system fails on a human controlled aircraft.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- initiator : The unit that had the failure
|
-- initiator : The unit that had the failure
|
||||||
-- @function [parent=#BASE] OnEventHumanFailure
|
-- @function [parent=#BASE] OnEventHumanFailure
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Occurs when any aircraft starts its engines.
|
--- Occurs when any aircraft starts its engines.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- initiator : The unit that is starting its engines.
|
-- initiator : The unit that is starting its engines.
|
||||||
-- @function [parent=#BASE] OnEventEngineStartup
|
-- @function [parent=#BASE] OnEventEngineStartup
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Occurs when any aircraft shuts down its engines.
|
--- Occurs when any aircraft shuts down its engines.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- initiator : The unit that is stopping its engines.
|
-- initiator : The unit that is stopping its engines.
|
||||||
-- @function [parent=#BASE] OnEventEngineShutdown
|
-- @function [parent=#BASE] OnEventEngineShutdown
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Occurs when any player assumes direct control of a unit. Note - not Mulitplayer safe. Use PlayerEnterAircraft.
|
--- Occurs when any player assumes direct control of a unit. Note - not Mulitplayer safe. Use PlayerEnterAircraft.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- initiator : The unit that is being taken control of.
|
-- initiator : The unit that is being taken control of.
|
||||||
-- @function [parent=#BASE] OnEventPlayerEnterUnit
|
-- @function [parent=#BASE] OnEventPlayerEnterUnit
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Occurs when any player relieves control of a unit to the AI.
|
--- Occurs when any player relieves control of a unit to the AI.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- initiator : The unit that the player left.
|
-- initiator : The unit that the player left.
|
||||||
-- @function [parent=#BASE] OnEventPlayerLeaveUnit
|
-- @function [parent=#BASE] OnEventPlayerLeaveUnit
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Occurs when any unit begins firing a weapon that has a high rate of fire. Most common with aircraft cannons (GAU-8), autocannons, and machine guns.
|
--- Occurs when any unit begins firing a weapon that has a high rate of fire. Most common with aircraft cannons (GAU-8), autocannons, and machine guns.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- initiator : The unit that is doing the shooting.
|
-- initiator : The unit that is doing the shooting.
|
||||||
-- target: The unit that is being targeted.
|
-- target: The unit that is being targeted.
|
||||||
-- @function [parent=#BASE] OnEventShootingStart
|
-- @function [parent=#BASE] OnEventShootingStart
|
||||||
@@ -617,28 +618,28 @@ do -- Event Handling
|
|||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Occurs when any unit stops firing its weapon. Event will always correspond with a shooting start event.
|
--- Occurs when any unit stops firing its weapon. Event will always correspond with a shooting start event.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- initiator : The unit that was doing the shooting.
|
-- initiator : The unit that was doing the shooting.
|
||||||
-- @function [parent=#BASE] OnEventShootingEnd
|
-- @function [parent=#BASE] OnEventShootingEnd
|
||||||
-- @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 new mark was added.
|
--- Occurs when a new mark was added.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- MarkID: ID of the mark.
|
-- MarkID: ID of the mark.
|
||||||
-- @function [parent=#BASE] OnEventMarkAdded
|
-- @function [parent=#BASE] OnEventMarkAdded
|
||||||
-- @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 mark was removed.
|
--- Occurs when a mark was removed.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- MarkID: ID of the mark.
|
-- MarkID: ID of the mark.
|
||||||
-- @function [parent=#BASE] OnEventMarkRemoved
|
-- @function [parent=#BASE] OnEventMarkRemoved
|
||||||
-- @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 mark text was changed.
|
--- Occurs when a mark text was changed.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- MarkID: ID of the mark.
|
-- MarkID: ID of the mark.
|
||||||
-- @function [parent=#BASE] OnEventMarkChange
|
-- @function [parent=#BASE] OnEventMarkChange
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
@@ -654,13 +655,13 @@ do -- Event Handling
|
|||||||
|
|
||||||
--- Occurs when any modification to the "Score" as seen on the debrief menu would occur.
|
--- Occurs when any modification to the "Score" as seen on the debrief menu would occur.
|
||||||
-- There is no information on what values the score was changed to. Event is likely similar to player_comment in this regard.
|
-- There is no information on what values the score was changed to. Event is likely similar to player_comment in this regard.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- @function [parent=#BASE] OnEventScore
|
-- @function [parent=#BASE] OnEventScore
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Occurs on the death of a unit. Contains more and different information. Similar to unit_lost it will occur for aircraft before the aircraft crash event occurs.
|
--- Occurs on the death of a unit. Contains more and different information. Similar to unit_lost it will occur for aircraft before the aircraft crash event occurs.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
--
|
--
|
||||||
-- * initiator: The unit that killed the target
|
-- * initiator: The unit that killed the target
|
||||||
-- * target: Target Object
|
-- * target: Target Object
|
||||||
@@ -672,13 +673,13 @@ do -- Event Handling
|
|||||||
|
|
||||||
--- Occurs when any modification to the "Score" as seen on the debrief menu would occur.
|
--- Occurs when any modification to the "Score" as seen on the debrief menu would occur.
|
||||||
-- There is no information on what values the score was changed to. Event is likely similar to player_comment in this regard.
|
-- There is no information on what values the score was changed to. Event is likely similar to player_comment in this regard.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- @function [parent=#BASE] OnEventScore
|
-- @function [parent=#BASE] OnEventScore
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Occurs when the game thinks an object is destroyed.
|
--- Occurs when the game thinks an object is destroyed.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
--
|
--
|
||||||
-- * initiator: The unit that is was destroyed.
|
-- * initiator: The unit that is was destroyed.
|
||||||
--
|
--
|
||||||
@@ -687,7 +688,7 @@ do -- Event Handling
|
|||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Occurs shortly after the landing animation of an ejected pilot touching the ground and standing up. Event does not occur if the pilot lands in the water and sub combs to Davey Jones Locker.
|
--- Occurs shortly after the landing animation of an ejected pilot touching the ground and standing up. Event does not occur if the pilot lands in the water and sub combs to Davey Jones Locker.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
--
|
--
|
||||||
-- * initiator: Static object representing the ejected pilot. Place : Aircraft that the pilot ejected from.
|
-- * initiator: Static object representing the ejected pilot. Place : Aircraft that the pilot ejected from.
|
||||||
-- * place: may not return as a valid object if the aircraft has crashed into the ground and no longer exists.
|
-- * place: may not return as a valid object if the aircraft has crashed into the ground and no longer exists.
|
||||||
@@ -698,43 +699,43 @@ do -- Event Handling
|
|||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Paratrooper landing.
|
--- Paratrooper landing.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- @function [parent=#BASE] OnEventParatrooperLanding
|
-- @function [parent=#BASE] OnEventParatrooperLanding
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Discard chair after ejection.
|
--- Discard chair after ejection.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- @function [parent=#BASE] OnEventDiscardChairAfterEjection
|
-- @function [parent=#BASE] OnEventDiscardChairAfterEjection
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Weapon add. Fires when entering a mission per pylon with the name of the weapon (double pylons not counted, infinite wep reload not counted.
|
--- Weapon add. Fires when entering a mission per pylon with the name of the weapon (double pylons not counted, infinite wep reload not counted.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- @function [parent=#BASE] OnEventParatrooperLanding
|
-- @function [parent=#BASE] OnEventParatrooperLanding
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Trigger zone.
|
--- Trigger zone.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- @function [parent=#BASE] OnEventTriggerZone
|
-- @function [parent=#BASE] OnEventTriggerZone
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Landing quality mark.
|
--- Landing quality mark.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- @function [parent=#BASE] OnEventLandingQualityMark
|
-- @function [parent=#BASE] OnEventLandingQualityMark
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- BDA.
|
--- BDA.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- @function [parent=#BASE] OnEventBDA
|
-- @function [parent=#BASE] OnEventBDA
|
||||||
-- @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 enters a slot and takes control of an aircraft.
|
--- Occurs when a player enters a slot and takes control of an aircraft.
|
||||||
-- Have a look at the class @{Core.EVENT#EVENT} as these are just the prototypes.
|
-- Have a look at the class @{Core.Event#EVENT} as these are just the prototypes.
|
||||||
-- **NOTE**: This is a workaround of a long standing DCS bug with the PLAYER_ENTER_UNIT event.
|
-- **NOTE**: This is a workaround of a long standing DCS bug with the PLAYER_ENTER_UNIT event.
|
||||||
-- initiator : The unit that is being taken control of.
|
-- initiator : The unit that is being taken control of.
|
||||||
-- @function [parent=#BASE] OnEventPlayerEnterAircraft
|
-- @function [parent=#BASE] OnEventPlayerEnterAircraft
|
||||||
@@ -1167,7 +1168,7 @@ function BASE:_F( Arguments, DebugInfoCurrentParam, DebugInfoFromParam )
|
|||||||
if DebugInfoFrom then
|
if DebugInfoFrom then
|
||||||
LineFrom = DebugInfoFrom.currentline
|
LineFrom = DebugInfoFrom.currentline
|
||||||
end
|
end
|
||||||
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "F", self.ClassName, self.ClassID, Function, routines.utils.oneLineSerialize( Arguments ) ) )
|
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "F", self.ClassName, self.ClassID, Function, UTILS.BasicSerialize( Arguments ) ) )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1241,7 +1242,7 @@ function BASE:_T( Arguments, DebugInfoCurrentParam, DebugInfoFromParam )
|
|||||||
if DebugInfoFrom then
|
if DebugInfoFrom then
|
||||||
LineFrom = DebugInfoFrom.currentline
|
LineFrom = DebugInfoFrom.currentline
|
||||||
end
|
end
|
||||||
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s", LineCurrent, LineFrom, "T", self.ClassName, self.ClassID, routines.utils.oneLineSerialize( Arguments ) ) )
|
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s", LineCurrent, LineFrom, "T", self.ClassName, self.ClassID, UTILS.BasicSerialize( Arguments ) ) )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1311,9 +1312,9 @@ function BASE:E( Arguments )
|
|||||||
LineFrom = DebugInfoFrom.currentline
|
LineFrom = DebugInfoFrom.currentline
|
||||||
end
|
end
|
||||||
|
|
||||||
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "E", self.ClassName, self.ClassID, Function, routines.utils.oneLineSerialize( 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, routines.utils.oneLineSerialize( Arguments ) ) )
|
env.info( string.format( "%1s:%30s%05d(%s)", "E", self.ClassName, self.ClassID, UTILS.BasicSerialize( Arguments ) ) )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -1338,9 +1339,9 @@ function BASE:I( Arguments )
|
|||||||
LineFrom = DebugInfoFrom.currentline
|
LineFrom = DebugInfoFrom.currentline
|
||||||
end
|
end
|
||||||
|
|
||||||
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "I", self.ClassName, self.ClassID, Function, routines.utils.oneLineSerialize( 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, routines.utils.oneLineSerialize( Arguments ) ) )
|
env.info( string.format( "%1s:%30s%05d(%s)", "I", self.ClassName, self.ClassID, UTILS.BasicSerialize( Arguments ) ) )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
--
|
--
|
||||||
-- After attaching a @{#BEACON} to your @{Wrapper.Positionable#POSITIONABLE}, you need to select the right function to activate the kind of beacon you want.
|
-- After attaching a @{#BEACON} to your @{Wrapper.Positionable#POSITIONABLE}, you need to select the right function to activate the kind of beacon you want.
|
||||||
-- There are two types of BEACONs available : the (aircraft) TACAN Beacon and the general purpose Radio Beacon.
|
-- There are two types of BEACONs available : the (aircraft) TACAN Beacon and the general purpose Radio Beacon.
|
||||||
-- Note that in both case, you can set an optional parameter : the `BeaconDuration`. This can be very usefull to simulate the battery time if your BEACON is
|
-- Note that in both case, you can set an optional parameter : the `BeaconDuration`. This can be very useful to simulate the battery time if your BEACON is
|
||||||
-- attach to a cargo crate, for exemple.
|
-- attach to a cargo crate, for example.
|
||||||
--
|
--
|
||||||
-- ## Aircraft TACAN Beacon usage
|
-- ## Aircraft TACAN Beacon usage
|
||||||
--
|
--
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
--
|
--
|
||||||
-- @type BEACON
|
-- @type BEACON
|
||||||
-- @field #string ClassName Name of the class "BEACON".
|
-- @field #string ClassName Name of the class "BEACON".
|
||||||
-- @field Wrapper.Controllable#CONTROLLABLE Positionable The @{#CONTROLLABLE} that will receive radio capabilities.
|
-- @field Wrapper.Controllable#CONTROLLABLE Positionable The @{Wrapper.Controllable#CONTROLLABLE} that will receive radio capabilities.
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
BEACON = {
|
BEACON = {
|
||||||
ClassName = "BEACON",
|
ClassName = "BEACON",
|
||||||
@@ -72,12 +72,12 @@ BEACON.Type={
|
|||||||
TACAN = 4,
|
TACAN = 4,
|
||||||
VORTAC = 5,
|
VORTAC = 5,
|
||||||
RSBN = 128,
|
RSBN = 128,
|
||||||
BROADCAST_STATION = 1024,
|
BROADCAST_STATION = 1024,
|
||||||
HOMER = 8,
|
HOMER = 8,
|
||||||
AIRPORT_HOMER = 4104,
|
AIRPORT_HOMER = 4104,
|
||||||
AIRPORT_HOMER_WITH_MARKER = 4136,
|
AIRPORT_HOMER_WITH_MARKER = 4136,
|
||||||
ILS_FAR_HOMER = 16408,
|
ILS_FAR_HOMER = 16408,
|
||||||
ILS_NEAR_HOMER = 16424,
|
ILS_NEAR_HOMER = 16424,
|
||||||
ILS_LOCALIZER = 16640,
|
ILS_LOCALIZER = 16640,
|
||||||
ILS_GLIDESLOPE = 16896,
|
ILS_GLIDESLOPE = 16896,
|
||||||
PRMG_LOCALIZER = 33024,
|
PRMG_LOCALIZER = 33024,
|
||||||
@@ -108,13 +108,13 @@ BEACON.Type={
|
|||||||
-- @field #number ICLS_LOCALIZER Carrier landing system.
|
-- @field #number ICLS_LOCALIZER Carrier landing system.
|
||||||
-- @field #number ICLS_GLIDESLOPE Carrier landing system.
|
-- @field #number ICLS_GLIDESLOPE Carrier landing system.
|
||||||
BEACON.System={
|
BEACON.System={
|
||||||
PAR_10 = 1,
|
PAR_10 = 1,
|
||||||
RSBN_5 = 2,
|
RSBN_5 = 2,
|
||||||
TACAN = 3,
|
TACAN = 3,
|
||||||
TACAN_TANKER_X = 4,
|
TACAN_TANKER_X = 4,
|
||||||
TACAN_TANKER_Y = 5,
|
TACAN_TANKER_Y = 5,
|
||||||
VOR = 6,
|
VOR = 6,
|
||||||
ILS_LOCALIZER = 7,
|
ILS_LOCALIZER = 7,
|
||||||
ILS_GLIDESLOPE = 8,
|
ILS_GLIDESLOPE = 8,
|
||||||
PRMG_LOCALIZER = 9,
|
PRMG_LOCALIZER = 9,
|
||||||
PRMG_GLIDESLOPE = 10,
|
PRMG_GLIDESLOPE = 10,
|
||||||
@@ -130,16 +130,16 @@ BEACON.System={
|
|||||||
--- Create a new BEACON Object. This doesn't activate the beacon, though, use @{#BEACON.ActivateTACAN} etc.
|
--- Create a new BEACON Object. This doesn't activate the beacon, though, use @{#BEACON.ActivateTACAN} etc.
|
||||||
-- If you want to create a BEACON, you probably should use @{Wrapper.Positionable#POSITIONABLE.GetBeacon}() instead.
|
-- If you want to create a BEACON, you probably should use @{Wrapper.Positionable#POSITIONABLE.GetBeacon}() instead.
|
||||||
-- @param #BEACON self
|
-- @param #BEACON self
|
||||||
-- @param Wrapper.Positionable#POSITIONABLE Positionable The @{Positionable} that will receive radio capabilities.
|
-- @param Wrapper.Positionable#POSITIONABLE Positionable The @{Wrapper.Positionable} that will receive radio capabilities.
|
||||||
-- @return #BEACON Beacon object or #nil if the positionable is invalid.
|
-- @return #BEACON Beacon object or #nil if the positionable is invalid.
|
||||||
function BEACON:New(Positionable)
|
function BEACON:New(Positionable)
|
||||||
|
|
||||||
-- Inherit BASE.
|
-- Inherit BASE.
|
||||||
local self=BASE:Inherit(self, BASE:New()) --#BEACON
|
local self=BASE:Inherit(self, BASE:New()) --#BEACON
|
||||||
|
|
||||||
-- Debug.
|
-- Debug.
|
||||||
self:F(Positionable)
|
self:F(Positionable)
|
||||||
|
|
||||||
-- Set positionable.
|
-- Set positionable.
|
||||||
if Positionable:GetPointVec2() then -- It's stupid, but the only way I found to make sure positionable is valid
|
if Positionable:GetPointVec2() then -- It's stupid, but the only way I found to make sure positionable is valid
|
||||||
self.Positionable = Positionable
|
self.Positionable = Positionable
|
||||||
@@ -147,12 +147,11 @@ function BEACON:New(Positionable)
|
|||||||
self:I(string.format("New BEACON %s", tostring(self.name)))
|
self:I(string.format("New BEACON %s", tostring(self.name)))
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
self:E({"The passed positionable is invalid, no BEACON created", Positionable})
|
self:E({"The passed positionable is invalid, no BEACON created", Positionable})
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Activates a TACAN BEACON.
|
--- Activates a TACAN BEACON.
|
||||||
-- @param #BEACON self
|
-- @param #BEACON self
|
||||||
-- @param #number Channel TACAN channel, i.e. the "10" part in "10Y".
|
-- @param #number Channel TACAN channel, i.e. the "10" part in "10Y".
|
||||||
@@ -169,28 +168,28 @@ end
|
|||||||
-- myBeacon:ActivateTACAN(20, "Y", "TEXACO", true) -- Activate the beacon
|
-- myBeacon:ActivateTACAN(20, "Y", "TEXACO", true) -- Activate the beacon
|
||||||
function BEACON:ActivateTACAN(Channel, Mode, Message, Bearing, Duration)
|
function BEACON:ActivateTACAN(Channel, Mode, Message, Bearing, Duration)
|
||||||
self:T({channel=Channel, mode=Mode, callsign=Message, bearing=Bearing, duration=Duration})
|
self:T({channel=Channel, mode=Mode, callsign=Message, bearing=Bearing, duration=Duration})
|
||||||
|
|
||||||
Mode=Mode or "Y"
|
Mode=Mode or "Y"
|
||||||
|
|
||||||
-- Get frequency.
|
-- Get frequency.
|
||||||
local Frequency=UTILS.TACANToFrequency(Channel, Mode)
|
local Frequency=UTILS.TACANToFrequency(Channel, Mode)
|
||||||
|
|
||||||
-- Check.
|
-- Check.
|
||||||
if not Frequency then
|
if not Frequency then
|
||||||
self:E({"The passed TACAN channel is invalid, the BEACON is not emitting"})
|
self:E({"The passed TACAN channel is invalid, the BEACON is not emitting"})
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Beacon type.
|
-- Beacon type.
|
||||||
local Type=BEACON.Type.TACAN
|
local Type=BEACON.Type.TACAN
|
||||||
|
|
||||||
-- Beacon system.
|
-- Beacon system.
|
||||||
local System=BEACON.System.TACAN
|
local System=BEACON.System.TACAN
|
||||||
|
|
||||||
-- Check if unit is an aircraft and set system accordingly.
|
-- Check if unit is an aircraft and set system accordingly.
|
||||||
local AA=self.Positionable:IsAir()
|
local AA=self.Positionable:IsAir()
|
||||||
|
|
||||||
|
|
||||||
if AA then
|
if AA then
|
||||||
System=5 --NOTE: 5 is how you cat the correct tanker behaviour! --BEACON.System.TACAN_TANKER
|
System=5 --NOTE: 5 is how you cat the correct tanker behaviour! --BEACON.System.TACAN_TANKER
|
||||||
-- Check if "Y" mode is selected for aircraft.
|
-- Check if "Y" mode is selected for aircraft.
|
||||||
@@ -201,21 +200,21 @@ function BEACON:ActivateTACAN(Channel, Mode, Message, Bearing, Duration)
|
|||||||
System=BEACON.System.TACAN_TANKER_Y
|
System=BEACON.System.TACAN_TANKER_Y
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Attached unit.
|
-- Attached unit.
|
||||||
local UnitID=self.Positionable:GetID()
|
local UnitID=self.Positionable:GetID()
|
||||||
|
|
||||||
-- Debug.
|
-- Debug.
|
||||||
self:I({string.format("BEACON Activating TACAN %s: Channel=%d%s, Morse=%s, Bearing=%s, Duration=%s!", tostring(self.name), Channel, Mode, Message, tostring(Bearing), tostring(Duration))})
|
self:I({string.format("BEACON Activating TACAN %s: Channel=%d%s, Morse=%s, Bearing=%s, Duration=%s!", tostring(self.name), Channel, Mode, Message, tostring(Bearing), tostring(Duration))})
|
||||||
|
|
||||||
-- Start beacon.
|
-- Start beacon.
|
||||||
self.Positionable:CommandActivateBeacon(Type, System, Frequency, UnitID, Channel, Mode, AA, Message, Bearing)
|
self.Positionable:CommandActivateBeacon(Type, System, Frequency, UnitID, Channel, Mode, AA, Message, Bearing)
|
||||||
|
|
||||||
-- Stop scheduler.
|
-- Stop scheduler.
|
||||||
if Duration then
|
if Duration then
|
||||||
self.Positionable:DeactivateBeacon(Duration)
|
self.Positionable:DeactivateBeacon(Duration)
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -227,21 +226,21 @@ end
|
|||||||
-- @return #BEACON self
|
-- @return #BEACON self
|
||||||
function BEACON:ActivateICLS(Channel, Callsign, Duration)
|
function BEACON:ActivateICLS(Channel, Callsign, Duration)
|
||||||
self:F({Channel=Channel, Callsign=Callsign, Duration=Duration})
|
self:F({Channel=Channel, Callsign=Callsign, Duration=Duration})
|
||||||
|
|
||||||
-- Attached unit.
|
-- Attached unit.
|
||||||
local UnitID=self.Positionable:GetID()
|
local UnitID=self.Positionable:GetID()
|
||||||
|
|
||||||
-- Debug
|
-- Debug
|
||||||
self:T2({"ICLS BEACON started!"})
|
self:T2({"ICLS BEACON started!"})
|
||||||
|
|
||||||
-- Start beacon.
|
-- Start beacon.
|
||||||
self.Positionable:CommandActivateICLS(Channel, UnitID, Callsign)
|
self.Positionable:CommandActivateICLS(Channel, UnitID, Callsign)
|
||||||
|
|
||||||
-- Stop scheduler
|
-- Stop scheduler
|
||||||
if Duration then -- Schedule the stop of the BEACON if asked by the MD
|
if Duration then -- Schedule the stop of the BEACON if asked by the MD
|
||||||
self.Positionable:DeactivateBeacon(Duration)
|
self.Positionable:DeactivateBeacon(Duration)
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -253,25 +252,25 @@ end
|
|||||||
-- @return #BEACON self
|
-- @return #BEACON self
|
||||||
function BEACON:ActivateLink4(Frequency, Morse, Duration)
|
function BEACON:ActivateLink4(Frequency, Morse, Duration)
|
||||||
self:F({Frequency=Frequency, Morse=Morse, Duration=Duration})
|
self:F({Frequency=Frequency, Morse=Morse, Duration=Duration})
|
||||||
|
|
||||||
-- Attached unit.
|
-- Attached unit.
|
||||||
local UnitID=self.Positionable:GetID()
|
local UnitID=self.Positionable:GetID()
|
||||||
|
|
||||||
-- Debug
|
-- Debug
|
||||||
self:T2({"LINK4 BEACON started!"})
|
self:T2({"LINK4 BEACON started!"})
|
||||||
|
|
||||||
-- Start beacon.
|
-- Start beacon.
|
||||||
self.Positionable:CommandActivateLink4(Frequency,UnitID,Morse)
|
self.Positionable:CommandActivateLink4(Frequency,UnitID,Morse)
|
||||||
|
|
||||||
-- Stop sheduler
|
-- Stop sheduler
|
||||||
if Duration then -- Schedule the stop of the BEACON if asked by the MD
|
if Duration then -- Schedule the stop of the BEACON if asked by the MD
|
||||||
self.Positionable:CommandDeactivateLink4(Duration)
|
self.Positionable:CommandDeactivateLink4(Duration)
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- DEPRECATED: Please use @{BEACON:ActivateTACAN}() instead.
|
--- DEPRECATED: Please use @{#BEACON.ActivateTACAN}() instead.
|
||||||
-- Activates a TACAN BEACON on an Aircraft.
|
-- Activates a TACAN BEACON on an Aircraft.
|
||||||
-- @param #BEACON self
|
-- @param #BEACON self
|
||||||
-- @param #number TACANChannel (the "10" part in "10Y"). Note that AA TACAN are only available on Y Channels
|
-- @param #number TACANChannel (the "10" part in "10Y"). Note that AA TACAN are only available on Y Channels
|
||||||
@@ -287,20 +286,20 @@ end
|
|||||||
-- myBeacon:AATACAN(20, "TEXACO", true) -- Activate the beacon
|
-- myBeacon:AATACAN(20, "TEXACO", true) -- Activate the beacon
|
||||||
function BEACON:AATACAN(TACANChannel, Message, Bearing, BeaconDuration)
|
function BEACON:AATACAN(TACANChannel, Message, Bearing, BeaconDuration)
|
||||||
self:F({TACANChannel, Message, Bearing, BeaconDuration})
|
self:F({TACANChannel, Message, Bearing, BeaconDuration})
|
||||||
|
|
||||||
local IsValid = true
|
local IsValid = true
|
||||||
|
|
||||||
if not self.Positionable:IsAir() then
|
if not self.Positionable:IsAir() then
|
||||||
self:E({"The POSITIONABLE you want to attach the AA Tacan Beacon is not an aircraft ! The BEACON is not emitting", self.Positionable})
|
self:E({"The POSITIONABLE you want to attach the AA Tacan Beacon is not an aircraft ! The BEACON is not emitting", self.Positionable})
|
||||||
IsValid = false
|
IsValid = false
|
||||||
end
|
end
|
||||||
|
|
||||||
local Frequency = self:_TACANToFrequency(TACANChannel, "Y")
|
local Frequency = self:_TACANToFrequency(TACANChannel, "Y")
|
||||||
if not Frequency then
|
if not Frequency then
|
||||||
self:E({"The passed TACAN channel is invalid, the BEACON is not emitting"})
|
self:E({"The passed TACAN channel is invalid, the BEACON is not emitting"})
|
||||||
IsValid = false
|
IsValid = false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- I'm using the beacon type 4 (BEACON_TYPE_TACAN). For System, I'm using 5 (TACAN_TANKER_MODE_Y) if the bearing shows its bearing or 14 (TACAN_AA_MODE_Y) if it does not
|
-- I'm using the beacon type 4 (BEACON_TYPE_TACAN). For System, I'm using 5 (TACAN_TANKER_MODE_Y) if the bearing shows its bearing or 14 (TACAN_AA_MODE_Y) if it does not
|
||||||
local System
|
local System
|
||||||
if Bearing then
|
if Bearing then
|
||||||
@@ -308,7 +307,7 @@ function BEACON:AATACAN(TACANChannel, Message, Bearing, BeaconDuration)
|
|||||||
else
|
else
|
||||||
System = BEACON.System.TACAN_AA_MODE_Y
|
System = BEACON.System.TACAN_AA_MODE_Y
|
||||||
end
|
end
|
||||||
|
|
||||||
if IsValid then -- Starts the BEACON
|
if IsValid then -- Starts the BEACON
|
||||||
self:T2({"AA TACAN BEACON started !"})
|
self:T2({"AA TACAN BEACON started !"})
|
||||||
self.Positionable:SetCommand({
|
self.Positionable:SetCommand({
|
||||||
@@ -323,7 +322,7 @@ function BEACON:AATACAN(TACANChannel, Message, Bearing, BeaconDuration)
|
|||||||
modeChannel = "Y",
|
modeChannel = "Y",
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
if BeaconDuration then -- Schedule the stop of the BEACON if asked by the MD
|
if BeaconDuration then -- Schedule the stop of the BEACON if asked by the MD
|
||||||
SCHEDULER:New(nil,
|
SCHEDULER:New(nil,
|
||||||
function()
|
function()
|
||||||
@@ -331,7 +330,7 @@ function BEACON:AATACAN(TACANChannel, Message, Bearing, BeaconDuration)
|
|||||||
end, {}, BeaconDuration)
|
end, {}, BeaconDuration)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -351,7 +350,6 @@ function BEACON:StopAATACAN()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Activates a general purpose Radio Beacon
|
--- Activates a general purpose Radio Beacon
|
||||||
-- This uses the very generic singleton function "trigger.action.radioTransmission()" provided by DCS to broadcast a sound file on a specific frequency.
|
-- This uses the very generic singleton function "trigger.action.radioTransmission()" provided by DCS to broadcast a sound file on a specific frequency.
|
||||||
-- Although any frequency could be used, only a few DCS Modules can home on radio beacons at the time of writing, i.e. the Mi-8, Huey, Gazelle etc.
|
-- Although any frequency could be used, only a few DCS Modules can home on radio beacons at the time of writing, i.e. the Mi-8, Huey, Gazelle etc.
|
||||||
@@ -381,7 +379,7 @@ end
|
|||||||
function BEACON:RadioBeacon(FileName, Frequency, Modulation, Power, BeaconDuration)
|
function BEACON:RadioBeacon(FileName, Frequency, Modulation, Power, BeaconDuration)
|
||||||
self:F({FileName, Frequency, Modulation, Power, BeaconDuration})
|
self:F({FileName, Frequency, Modulation, Power, BeaconDuration})
|
||||||
local IsValid = false
|
local IsValid = false
|
||||||
|
|
||||||
-- Check the filename
|
-- Check the filename
|
||||||
if type(FileName) == "string" then
|
if type(FileName) == "string" then
|
||||||
if FileName:find(".ogg") or FileName:find(".wav") then
|
if FileName:find(".ogg") or FileName:find(".wav") then
|
||||||
@@ -394,32 +392,32 @@ function BEACON:RadioBeacon(FileName, Frequency, Modulation, Power, BeaconDurati
|
|||||||
if not IsValid then
|
if not IsValid then
|
||||||
self:E({"File name invalid. Maybe something wrong with the extension ? ", FileName})
|
self:E({"File name invalid. Maybe something wrong with the extension ? ", FileName})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check the Frequency
|
-- Check the Frequency
|
||||||
if type(Frequency) ~= "number" and IsValid then
|
if type(Frequency) ~= "number" and IsValid then
|
||||||
self:E({"Frequency invalid. ", Frequency})
|
self:E({"Frequency invalid. ", Frequency})
|
||||||
IsValid = false
|
IsValid = false
|
||||||
end
|
end
|
||||||
Frequency = Frequency * 1000000 -- Conversion to Hz
|
Frequency = Frequency * 1000000 -- Conversion to Hz
|
||||||
|
|
||||||
-- Check the modulation
|
-- Check the modulation
|
||||||
if Modulation ~= radio.modulation.AM and Modulation ~= radio.modulation.FM and IsValid then --TODO Maybe make this future proof if ED decides to add an other modulation ?
|
if Modulation ~= radio.modulation.AM and Modulation ~= radio.modulation.FM and IsValid then --TODO Maybe make this future proof if ED decides to add an other modulation ?
|
||||||
self:E({"Modulation is invalid. Use DCS's enum radio.modulation.", Modulation})
|
self:E({"Modulation is invalid. Use DCS's enum radio.modulation.", Modulation})
|
||||||
IsValid = false
|
IsValid = false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check the Power
|
-- Check the Power
|
||||||
if type(Power) ~= "number" and IsValid then
|
if type(Power) ~= "number" and IsValid then
|
||||||
self:E({"Power is invalid. ", Power})
|
self:E({"Power is invalid. ", Power})
|
||||||
IsValid = false
|
IsValid = false
|
||||||
end
|
end
|
||||||
Power = math.floor(math.abs(Power)) --TODO Find what is the maximum power allowed by DCS and limit power to that
|
Power = math.floor(math.abs(Power)) --TODO Find what is the maximum power allowed by DCS and limit power to that
|
||||||
|
|
||||||
if IsValid then
|
if IsValid then
|
||||||
self:T2({"Activating Beacon on ", Frequency, Modulation})
|
self:T2({"Activating Beacon on ", Frequency, Modulation})
|
||||||
-- Note that this is looped. I have to give this transmission a unique name, I use the class ID
|
-- Note that this is looped. I have to give this transmission a unique name, I use the class ID
|
||||||
trigger.action.radioTransmission(FileName, self.Positionable:GetPositionVec3(), Modulation, true, Frequency, Power, tostring(self.ID))
|
trigger.action.radioTransmission(FileName, self.Positionable:GetPositionVec3(), Modulation, true, Frequency, Power, tostring(self.ID))
|
||||||
|
|
||||||
if BeaconDuration then -- Schedule the stop of the BEACON if asked by the MD
|
if BeaconDuration then -- Schedule the stop of the BEACON if asked by the MD
|
||||||
SCHEDULER:New( nil,
|
SCHEDULER:New( nil,
|
||||||
function()
|
function()
|
||||||
@@ -453,16 +451,16 @@ function BEACON:_TACANToFrequency(TACANChannel, TACANMode)
|
|||||||
return nil -- error in arguments
|
return nil -- error in arguments
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- This code is largely based on ED's code, in DCS World\Scripts\World\Radio\BeaconTypes.lua, line 137.
|
-- This code is largely based on ED's code, in DCS World\Scripts\World\Radio\BeaconTypes.lua, line 137.
|
||||||
-- I have no idea what it does but it seems to work
|
-- I have no idea what it does but it seems to work
|
||||||
local A = 1151 -- 'X', channel >= 64
|
local A = 1151 -- 'X', channel >= 64
|
||||||
local B = 64 -- channel >= 64
|
local B = 64 -- channel >= 64
|
||||||
|
|
||||||
if TACANChannel < 64 then
|
if TACANChannel < 64 then
|
||||||
B = 1
|
B = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
if TACANMode == 'Y' then
|
if TACANMode == 'Y' then
|
||||||
A = 1025
|
A = 1025
|
||||||
if TACANChannel < 64 then
|
if TACANChannel < 64 then
|
||||||
@@ -473,6 +471,6 @@ function BEACON:_TACANToFrequency(TACANChannel, TACANMode)
|
|||||||
A = 962
|
A = 962
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return (A + TACANChannel - B) * 1000000
|
return (A + TACANChannel - B) * 1000000
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Example Missions:
|
-- ## Example Missions:
|
||||||
--
|
--
|
||||||
-- Demo missions can be found on [github](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/OPS%20-%20Operation).
|
-- Demo missions can be found on [github](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/Core/Condition).
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -17,17 +17,21 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
-- @module Core.Condition
|
-- @module Core.Condition
|
||||||
-- @image Core_Conditon.png
|
-- @image MOOSE.JPG
|
||||||
|
|
||||||
--- CONDITON class.
|
--- CONDITON class.
|
||||||
-- @type CONDITION
|
-- @type CONDITION
|
||||||
-- @field #string ClassName Name of the class.
|
-- @field #string ClassName Name of the class.
|
||||||
-- @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 #string name Name of the condition.
|
||||||
-- @field #boolean isAny General functions are evaluated as any condition.
|
-- @field #boolean isAny General functions are evaluated as any condition.
|
||||||
-- @field #boolean negateResult Negeate result of evaluation.
|
-- @field #boolean negateResult Negate result of evaluation.
|
||||||
|
-- @field #boolean noneResult Boolean that is returned if no condition functions at all were specified.
|
||||||
-- @field #table functionsGen General condition functions.
|
-- @field #table functionsGen General condition functions.
|
||||||
-- @field #table functionsAny Any condition functions.
|
-- @field #table functionsAny Any condition functions.
|
||||||
-- @field #table functionsAll All condition functions.
|
-- @field #table functionsAll All condition functions.
|
||||||
|
-- @field #number functionCounter Running number to determine the unique ID of condition functions.
|
||||||
|
-- @field #boolean defaultPersist Default persistence of condition functions.
|
||||||
--
|
--
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
@@ -41,27 +45,34 @@
|
|||||||
--
|
--
|
||||||
-- @field #CONDITION
|
-- @field #CONDITION
|
||||||
CONDITION = {
|
CONDITION = {
|
||||||
ClassName = "CONDITION",
|
ClassName = "CONDITION",
|
||||||
lid = nil,
|
lid = nil,
|
||||||
functionsGen = {},
|
functionsGen = {},
|
||||||
functionsAny = {},
|
functionsAny = {},
|
||||||
functionsAll = {},
|
functionsAll = {},
|
||||||
|
functionCounter = 0,
|
||||||
|
defaultPersist = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Condition function.
|
--- Condition function.
|
||||||
-- @type CONDITION.Function
|
-- @type CONDITION.Function
|
||||||
-- @field #function func Callback function to check for a condition. Should return a `#boolean`.
|
-- @field #number uid Unique ID of the condition function.
|
||||||
|
-- @field #string type Type of the condition function: "gen", "any", "all".
|
||||||
|
-- @field #boolean persistence If `true`, this is persistent.
|
||||||
|
-- @field #function func Callback function to check for a condition. Must return a `#boolean`.
|
||||||
-- @field #table arg (Optional) Arguments passed to the condition callback function if any.
|
-- @field #table arg (Optional) Arguments passed to the condition callback function if any.
|
||||||
|
|
||||||
--- CONDITION class version.
|
--- CONDITION class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
CONDITION.version="0.1.0"
|
CONDITION.version="0.3.0"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- TODO: Make FSM.
|
-- TODO: Make FSM. No sure if really necessary.
|
||||||
|
-- DONE: Option to remove condition functions.
|
||||||
|
-- DONE: Persistence option for condition functions.
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- Constructor
|
-- Constructor
|
||||||
@@ -78,6 +89,8 @@ function CONDITION:New(Name)
|
|||||||
|
|
||||||
self.name=Name or "Condition X"
|
self.name=Name or "Condition X"
|
||||||
|
|
||||||
|
self:SetNoneResult(false)
|
||||||
|
|
||||||
self.lid=string.format("%s | ", self.name)
|
self.lid=string.format("%s | ", self.name)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -101,6 +114,28 @@ function CONDITION:SetNegateResult(Negate)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set whether `true` or `false` is returned, if no conditions at all were specified. By default `false` is returned.
|
||||||
|
-- @param #CONDITION self
|
||||||
|
-- @param #boolean ReturnValue Returns this boolean.
|
||||||
|
-- @return #CONDITION self
|
||||||
|
function CONDITION:SetNoneResult(ReturnValue)
|
||||||
|
if not ReturnValue then
|
||||||
|
self.noneResult=false
|
||||||
|
else
|
||||||
|
self.noneResult=true
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Set whether condition functions are persistent, *i.e.* are removed.
|
||||||
|
-- @param #CONDITION self
|
||||||
|
-- @param #boolean IsPersistent If `true`, condition functions are persistent.
|
||||||
|
-- @return #CONDITION self
|
||||||
|
function CONDITION:SetDefaultPersistence(IsPersistent)
|
||||||
|
self.defaultPersist=IsPersistent
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Add a function that is evaluated. It must return a `#boolean` value, *i.e.* either `true` or `false` (or `nil`).
|
--- Add a function that is evaluated. It must return a `#boolean` value, *i.e.* either `true` or `false` (or `nil`).
|
||||||
-- @param #CONDITION self
|
-- @param #CONDITION self
|
||||||
-- @param #function Function The function to call.
|
-- @param #function Function The function to call.
|
||||||
@@ -113,47 +148,109 @@ end
|
|||||||
--
|
--
|
||||||
-- myCondition:AddFunction(isAequalB, a, b)
|
-- myCondition:AddFunction(isAequalB, a, b)
|
||||||
--
|
--
|
||||||
-- @return #CONDITION self
|
-- @return #CONDITION.Function Condition function table.
|
||||||
function CONDITION:AddFunction(Function, ...)
|
function CONDITION:AddFunction(Function, ...)
|
||||||
|
|
||||||
-- Condition function.
|
-- Condition function.
|
||||||
local condition=self:_CreateCondition(Function, ...)
|
local condition=self:_CreateCondition(0, Function, ...)
|
||||||
|
|
||||||
-- Add to table.
|
-- Add to table.
|
||||||
table.insert(self.functionsGen, condition)
|
table.insert(self.functionsGen, condition)
|
||||||
|
|
||||||
return self
|
return condition
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Add a function that is evaluated. It must return a `#boolean` value, *i.e.* either `true` or `false` (or `nil`).
|
--- Add a function that is evaluated. It must return a `#boolean` value, *i.e.* either `true` or `false` (or `nil`).
|
||||||
-- @param #CONDITION self
|
-- @param #CONDITION self
|
||||||
-- @param #function Function The function to call.
|
-- @param #function Function The function to call.
|
||||||
-- @param ... (Optional) Parameters passed to the function (if any).
|
-- @param ... (Optional) Parameters passed to the function (if any).
|
||||||
-- @return #CONDITION self
|
-- @return #CONDITION.Function Condition function table.
|
||||||
function CONDITION:AddFunctionAny(Function, ...)
|
function CONDITION:AddFunctionAny(Function, ...)
|
||||||
|
|
||||||
-- Condition function.
|
-- Condition function.
|
||||||
local condition=self:_CreateCondition(Function, ...)
|
local condition=self:_CreateCondition(1, Function, ...)
|
||||||
|
|
||||||
-- Add to table.
|
-- Add to table.
|
||||||
table.insert(self.functionsAny, condition)
|
table.insert(self.functionsAny, condition)
|
||||||
|
|
||||||
return self
|
return condition
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Add a function that is evaluated. It must return a `#boolean` value, *i.e.* either `true` or `false` (or `nil`).
|
--- Add a function that is evaluated. It must return a `#boolean` value, *i.e.* either `true` or `false` (or `nil`).
|
||||||
-- @param #CONDITION self
|
-- @param #CONDITION self
|
||||||
-- @param #function Function The function to call.
|
-- @param #function Function The function to call.
|
||||||
-- @param ... (Optional) Parameters passed to the function (if any).
|
-- @param ... (Optional) Parameters passed to the function (if any).
|
||||||
-- @return #CONDITION self
|
-- @return #CONDITION.Function Condition function table.
|
||||||
function CONDITION:AddFunctionAll(Function, ...)
|
function CONDITION:AddFunctionAll(Function, ...)
|
||||||
|
|
||||||
-- Condition function.
|
-- Condition function.
|
||||||
local condition=self:_CreateCondition(Function, ...)
|
local condition=self:_CreateCondition(2, Function, ...)
|
||||||
|
|
||||||
-- Add to table.
|
-- Add to table.
|
||||||
table.insert(self.functionsAll, condition)
|
table.insert(self.functionsAll, condition)
|
||||||
|
|
||||||
|
return condition
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Remove a condition function.
|
||||||
|
-- @param #CONDITION self
|
||||||
|
-- @param #CONDITION.Function ConditionFunction The condition function to be removed.
|
||||||
|
-- @return #CONDITION self
|
||||||
|
function CONDITION:RemoveFunction(ConditionFunction)
|
||||||
|
|
||||||
|
if ConditionFunction then
|
||||||
|
|
||||||
|
local data=nil
|
||||||
|
if ConditionFunction.type==0 then
|
||||||
|
data=self.functionsGen
|
||||||
|
elseif ConditionFunction.type==1 then
|
||||||
|
data=self.functionsAny
|
||||||
|
elseif ConditionFunction.type==2 then
|
||||||
|
data=self.functionsAll
|
||||||
|
end
|
||||||
|
|
||||||
|
if data then
|
||||||
|
for i=#data,1,-1 do
|
||||||
|
local cf=data[i] --#CONDITION.Function
|
||||||
|
if cf.uid==ConditionFunction.uid then
|
||||||
|
self:T(self.lid..string.format("Removed ConditionFunction UID=%d", cf.uid))
|
||||||
|
table.remove(data, i)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Remove all non-persistant condition functions.
|
||||||
|
-- @param #CONDITION self
|
||||||
|
-- @return #CONDITION self
|
||||||
|
function CONDITION:RemoveNonPersistant()
|
||||||
|
|
||||||
|
for i=#self.functionsGen,1,-1 do
|
||||||
|
local cf=self.functionsGen[i] --#CONDITION.Function
|
||||||
|
if not cf.persistence then
|
||||||
|
table.remove(self.functionsGen, i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for i=#self.functionsAll,1,-1 do
|
||||||
|
local cf=self.functionsAll[i] --#CONDITION.Function
|
||||||
|
if not cf.persistence then
|
||||||
|
table.remove(self.functionsAll, i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for i=#self.functionsAny,1,-1 do
|
||||||
|
local cf=self.functionsAny[i] --#CONDITION.Function
|
||||||
|
if not cf.persistence then
|
||||||
|
table.remove(self.functionsAny, i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -166,11 +263,7 @@ function CONDITION:Evaluate(AnyTrue)
|
|||||||
|
|
||||||
-- Check if at least one function was given.
|
-- Check if at least one function was given.
|
||||||
if #self.functionsAll + #self.functionsAny + #self.functionsAll == 0 then
|
if #self.functionsAll + #self.functionsAny + #self.functionsAll == 0 then
|
||||||
if self.negateResult then
|
return self.noneResult
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Any condition for gen.
|
-- Any condition for gen.
|
||||||
@@ -206,6 +299,10 @@ function CONDITION:Evaluate(AnyTrue)
|
|||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
-- Private Functions
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
--- Check if all given condition are true.
|
--- Check if all given condition are true.
|
||||||
-- @param #CONDITION self
|
-- @param #CONDITION self
|
||||||
-- @param #table functions Functions to evaluate.
|
-- @param #table functions Functions to evaluate.
|
||||||
@@ -275,13 +372,20 @@ end
|
|||||||
|
|
||||||
--- Create conditon function object.
|
--- Create conditon function object.
|
||||||
-- @param #CONDITION self
|
-- @param #CONDITION self
|
||||||
|
-- @param #number Ftype Function type: 0=Gen, 1=All, 2=Any.
|
||||||
-- @param #function Function The function to call.
|
-- @param #function Function The function to call.
|
||||||
-- @param ... (Optional) Parameters passed to the function (if any).
|
-- @param ... (Optional) Parameters passed to the function (if any).
|
||||||
-- @return #CONDITION.Function Condition function.
|
-- @return #CONDITION.Function Condition function.
|
||||||
function CONDITION:_CreateCondition(Function, ...)
|
function CONDITION:_CreateCondition(Ftype, Function, ...)
|
||||||
|
|
||||||
|
-- Increase counter.
|
||||||
|
self.functionCounter=self.functionCounter+1
|
||||||
|
|
||||||
local condition={} --#CONDITION.Function
|
local condition={} --#CONDITION.Function
|
||||||
|
|
||||||
|
condition.uid=self.functionCounter
|
||||||
|
condition.type=Ftype or 0
|
||||||
|
condition.persistence=self.defaultPersist
|
||||||
condition.func=Function
|
condition.func=Function
|
||||||
condition.arg={}
|
condition.arg={}
|
||||||
if arg then
|
if arg then
|
||||||
@@ -290,6 +394,71 @@ function CONDITION:_CreateCondition(Function, ...)
|
|||||||
|
|
||||||
return condition
|
return condition
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
-- Global Condition Functions
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
--- Condition to check if time is greater than a given threshold time.
|
||||||
|
-- @param #number Time Time in seconds.
|
||||||
|
-- @param #boolean Absolute If `true`, abs. mission time from `timer.getAbsTime()` is checked. Default is relative mission time from `timer.getTime()`.
|
||||||
|
-- @return #boolean Returns `true` if time is greater than give the time.
|
||||||
|
function CONDITION.IsTimeGreater(Time, Absolute)
|
||||||
|
|
||||||
|
local Tnow=nil
|
||||||
|
|
||||||
|
if Absolute then
|
||||||
|
Tnow=timer.getAbsTime()
|
||||||
|
else
|
||||||
|
Tnow=timer.getTime()
|
||||||
|
end
|
||||||
|
|
||||||
|
if Tnow>Time then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Function that returns `true` (success) with a certain probability. For example, if you specify `Probability=80` there is an 80% chance that `true` is returned.
|
||||||
|
-- Technically, a random number between 0 and 100 is created. If the given success probability is less then this number, `true` is returned.
|
||||||
|
-- @param #number Probability Success probability in percent. Default 50 %.
|
||||||
|
-- @return #boolean Returns `true` for success and `false` otherwise.
|
||||||
|
function CONDITION.IsRandomSuccess(Probability)
|
||||||
|
|
||||||
|
Probability=Probability or 50
|
||||||
|
|
||||||
|
-- Create some randomness.
|
||||||
|
math.random()
|
||||||
|
math.random()
|
||||||
|
math.random()
|
||||||
|
|
||||||
|
-- Number between 0 and 100.
|
||||||
|
local N=math.random()*100
|
||||||
|
|
||||||
|
if N<Probability then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Function that returns always `true`
|
||||||
|
-- @return #boolean Returns `true` unconditionally.
|
||||||
|
function CONDITION.ReturnTrue()
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Function that returns always `false`
|
||||||
|
-- @return #boolean Returns `false` unconditionally.
|
||||||
|
function CONDITION.ReturnFalse()
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -31,11 +31,12 @@
|
|||||||
-- @module Core.Database
|
-- @module Core.Database
|
||||||
-- @image Core_Database.JPG
|
-- @image Core_Database.JPG
|
||||||
|
|
||||||
|
---
|
||||||
--- @type DATABASE
|
-- @type DATABASE
|
||||||
-- @field #string ClassName Name of the class.
|
-- @field #string ClassName Name of the class.
|
||||||
-- @field #table Templates Templates: Units, Groups, Statics, ClientsByName, ClientsByID.
|
-- @field #table Templates Templates: Units, Groups, Statics, ClientsByName, ClientsByID.
|
||||||
-- @field #table CLIENTS Clients.
|
-- @field #table CLIENTS Clients.
|
||||||
|
-- @field #table STORAGES DCS warehouse storages.
|
||||||
-- @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.
|
||||||
@@ -50,8 +51,9 @@
|
|||||||
-- * PLAYERSJOINED
|
-- * PLAYERSJOINED
|
||||||
-- * PLAYERS
|
-- * PLAYERS
|
||||||
-- * CARGOS
|
-- * CARGOS
|
||||||
|
-- * STORAGES (DCS warehouses)
|
||||||
--
|
--
|
||||||
-- On top, for internal MOOSE administration purposes, the DATBASE 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.
|
||||||
--
|
--
|
||||||
-- The singleton object **_DATABASE** is automatically created by MOOSE, that administers all objects within the mission.
|
-- The singleton object **_DATABASE** is automatically created by MOOSE, that administers all objects within the mission.
|
||||||
-- Moose refers to **_DATABASE** within the framework extensively, but you can also refer to the _DATABASE object within your missions if required.
|
-- Moose refers to **_DATABASE** within the framework extensively, but you can also refer to the _DATABASE object within your missions if required.
|
||||||
@@ -88,6 +90,9 @@ DATABASE = {
|
|||||||
WAREHOUSES = {},
|
WAREHOUSES = {},
|
||||||
FLIGHTGROUPS = {},
|
FLIGHTGROUPS = {},
|
||||||
FLIGHTCONTROLS = {},
|
FLIGHTCONTROLS = {},
|
||||||
|
OPSZONES = {},
|
||||||
|
PATHLINES = {},
|
||||||
|
STORAGES = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
local _DATABASECoalition =
|
local _DATABASECoalition =
|
||||||
@@ -121,6 +126,8 @@ function DATABASE:New()
|
|||||||
self:SetEventPriority( 1 )
|
self:SetEventPriority( 1 )
|
||||||
|
|
||||||
self:HandleEvent( EVENTS.Birth, self._EventOnBirth )
|
self:HandleEvent( EVENTS.Birth, self._EventOnBirth )
|
||||||
|
-- DCS 2.9 fixed CA event for players -- TODO: reset unit when leaving
|
||||||
|
self:HandleEvent( EVENTS.PlayerEnterUnit, self._EventOnPlayerEnterUnit )
|
||||||
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 )
|
||||||
@@ -244,9 +251,41 @@ function DATABASE:FindAirbase( AirbaseName )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
do -- Zones
|
|
||||||
|
|
||||||
--- Finds a @{Zone} based on the zone name.
|
--- Adds a STORAGE (DCS warehouse wrapper) based on the Airbase Name to the DATABASE.
|
||||||
|
-- @param #DATABASE self
|
||||||
|
-- @param #string AirbaseName The name of the airbase.
|
||||||
|
-- @return Wrapper.Storage#STORAGE Storage object.
|
||||||
|
function DATABASE:AddStorage( AirbaseName )
|
||||||
|
|
||||||
|
if not self.STORAGES[AirbaseName] then
|
||||||
|
self.STORAGES[AirbaseName] = STORAGE:New( AirbaseName )
|
||||||
|
end
|
||||||
|
|
||||||
|
return self.STORAGES[AirbaseName]
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Deletes a STORAGE from the DATABASE based on the name of the associated airbase.
|
||||||
|
-- @param #DATABASE self
|
||||||
|
-- @param #string AirbaseName The name of the airbase.
|
||||||
|
function DATABASE:DeleteStorage( AirbaseName )
|
||||||
|
self.STORAGES[AirbaseName] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Finds an STORAGE based on the name of the associated airbase.
|
||||||
|
-- @param #DATABASE self
|
||||||
|
-- @param #string AirbaseName Name of the airbase.
|
||||||
|
-- @return Wrapper.Storage#STORAGE The found STORAGE.
|
||||||
|
function DATABASE:FindStorage( AirbaseName )
|
||||||
|
local storage = self.STORAGES[AirbaseName]
|
||||||
|
return storage
|
||||||
|
end
|
||||||
|
|
||||||
|
do -- Zones and Pathlines
|
||||||
|
|
||||||
|
--- Finds a @{Core.Zone} based on the zone name.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #string ZoneName The name of the zone.
|
-- @param #string ZoneName The name of the zone.
|
||||||
-- @return Core.Zone#ZONE_BASE The found ZONE.
|
-- @return Core.Zone#ZONE_BASE The found ZONE.
|
||||||
@@ -256,7 +295,7 @@ do -- Zones
|
|||||||
return ZoneFound
|
return ZoneFound
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Adds a @{Zone} based on the zone name in the DATABASE.
|
--- Adds a @{Core.Zone} based on the zone name in the DATABASE.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #string ZoneName The name of the zone.
|
-- @param #string ZoneName The name of the zone.
|
||||||
-- @param Core.Zone#ZONE_BASE Zone The zone.
|
-- @param Core.Zone#ZONE_BASE Zone The zone.
|
||||||
@@ -267,8 +306,7 @@ do -- Zones
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Deletes a @{Core.Zone} from the DATABASE based on the zone name.
|
||||||
--- Deletes a @{Zone} from the DATABASE based on the zone name.
|
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #string ZoneName The name of the zone.
|
-- @param #string ZoneName The name of the zone.
|
||||||
function DATABASE:DeleteZone( ZoneName )
|
function DATABASE:DeleteZone( ZoneName )
|
||||||
@@ -277,6 +315,39 @@ do -- Zones
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Adds a @{Core.Pathline} based on its name in the DATABASE.
|
||||||
|
-- @param #DATABASE self
|
||||||
|
-- @param #string PathlineName The name of the pathline
|
||||||
|
-- @param Core.Pathline#PATHLINE Pathline The pathline.
|
||||||
|
function DATABASE:AddPathline( PathlineName, Pathline )
|
||||||
|
|
||||||
|
if not self.PATHLINES[PathlineName] then
|
||||||
|
self.PATHLINES[PathlineName]=Pathline
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Finds a @{Core.Pathline} by its name.
|
||||||
|
-- @param #DATABASE self
|
||||||
|
-- @param #string PathlineName The name of the Pathline.
|
||||||
|
-- @return Core.Pathline#PATHLINE The found PATHLINE.
|
||||||
|
function DATABASE:FindPathline( PathlineName )
|
||||||
|
|
||||||
|
local pathline = self.PATHLINES[PathlineName]
|
||||||
|
|
||||||
|
return pathline
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Deletes a @{Core.Pathline} from the DATABASE based on its name.
|
||||||
|
-- @param #DATABASE self
|
||||||
|
-- @param #string PathlineName The name of the PATHLINE.
|
||||||
|
function DATABASE:DeletePathline( PathlineName )
|
||||||
|
|
||||||
|
self.PATHLINES[PathlineName]=nil
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Private method that registers new ZONE_BASE derived objects within the DATABASE Object.
|
--- Private method that registers new ZONE_BASE derived objects within the DATABASE Object.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @return #DATABASE self
|
-- @return #DATABASE self
|
||||||
@@ -309,7 +380,7 @@ do -- Zones
|
|||||||
|
|
||||||
self:I(string.format("Register ZONE: %s (Polygon, Quad)", ZoneName))
|
self:I(string.format("Register ZONE: %s (Polygon, Quad)", ZoneName))
|
||||||
|
|
||||||
Zone=ZONE_POLYGON_BASE:New(ZoneName, ZoneData.verticies)
|
Zone=ZONE_POLYGON:NewFromPointsArray(ZoneName, ZoneData.verticies)
|
||||||
|
|
||||||
--for i,vec2 in pairs(ZoneData.verticies) do
|
--for i,vec2 in pairs(ZoneData.verticies) do
|
||||||
-- local coord=COORDINATE:NewFromVec2(vec2)
|
-- local coord=COORDINATE:NewFromVec2(vec2)
|
||||||
@@ -322,7 +393,7 @@ do -- Zones
|
|||||||
|
|
||||||
-- Store color of zone.
|
-- Store color of zone.
|
||||||
Zone.Color=color
|
Zone.Color=color
|
||||||
|
|
||||||
-- Store zone ID.
|
-- Store zone ID.
|
||||||
Zone.ZoneID=ZoneData.zoneId
|
Zone.ZoneID=ZoneData.zoneId
|
||||||
|
|
||||||
@@ -370,16 +441,194 @@ do -- Zones
|
|||||||
-- Add zone to DB.
|
-- Add zone to DB.
|
||||||
self:AddZone( ZoneName, Zone_Polygon )
|
self:AddZone( ZoneName, Zone_Polygon )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
-- Drawings as zones
|
||||||
|
if env.mission.drawings and env.mission.drawings.layers then
|
||||||
|
|
||||||
|
-- Loop over layers.
|
||||||
|
for layerID, layerData in pairs(env.mission.drawings.layers or {}) do
|
||||||
|
|
||||||
|
-- Loop over objects in layers.
|
||||||
|
for objectID, objectData in pairs(layerData.objects or {}) do
|
||||||
|
|
||||||
|
-- Check for polygon which has at least 4 points (we would need 3 but the origin seems to be there twice)
|
||||||
|
if objectData.polygonMode and (objectData.polygonMode=="free") and objectData.points and #objectData.points>=4 then
|
||||||
|
|
||||||
|
---
|
||||||
|
-- Drawing: Polygon free
|
||||||
|
---
|
||||||
|
|
||||||
|
-- Name of the zone.
|
||||||
|
local ZoneName=objectData.name or "Unknown free Polygon Drawing"
|
||||||
|
|
||||||
|
-- Reference point. All other points need to be translated by this.
|
||||||
|
local vec2={x=objectData.mapX, y=objectData.mapY}
|
||||||
|
|
||||||
|
-- Debug stuff.
|
||||||
|
--local vec3={x=objectData.mapX, y=0, z=objectData.mapY}
|
||||||
|
--local coord=COORDINATE:NewFromVec2(vec2):MarkToAll("MapX, MapY")
|
||||||
|
--trigger.action.markToAll(id, "mapXY", vec3)
|
||||||
|
|
||||||
|
-- Copy points array.
|
||||||
|
local points=UTILS.DeepCopy(objectData.points)
|
||||||
|
|
||||||
|
-- Translate points.
|
||||||
|
for i,_point in pairs(points) do
|
||||||
|
local point=_point --DCS#Vec2
|
||||||
|
points[i]=UTILS.Vec2Add(point, vec2)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Remove last point.
|
||||||
|
table.remove(points, #points)
|
||||||
|
|
||||||
|
-- Debug output
|
||||||
|
self:I(string.format("Register ZONE: %s (Polygon (free) drawing with %d vertices)", ZoneName, #points))
|
||||||
|
|
||||||
|
-- Create new polygon zone.
|
||||||
|
local Zone=ZONE_POLYGON:NewFromPointsArray(ZoneName, points)
|
||||||
|
|
||||||
|
--Zone.DrawID = objectID
|
||||||
|
|
||||||
|
-- Set color.
|
||||||
|
Zone:SetColor({1, 0, 0}, 0.15)
|
||||||
|
Zone:SetFillColor({1, 0, 0}, 0.15)
|
||||||
|
|
||||||
|
if objectData.colorString then
|
||||||
|
-- eg colorString = 0xff0000ff
|
||||||
|
local color = string.gsub(objectData.colorString,"^0x","")
|
||||||
|
local r = tonumber(string.sub(color,1,2),16)/255
|
||||||
|
local g = tonumber(string.sub(color,3,4),16)/255
|
||||||
|
local b = tonumber(string.sub(color,5,6),16)/255
|
||||||
|
local a = tonumber(string.sub(color,7,8),16)/255
|
||||||
|
Zone:SetColor({r, g, b}, a)
|
||||||
|
end
|
||||||
|
if objectData.fillColorString then
|
||||||
|
-- eg fillColorString = 0xff00004b
|
||||||
|
local color = string.gsub(objectData.colorString,"^0x","")
|
||||||
|
local r = tonumber(string.sub(color,1,2),16)/255
|
||||||
|
local g = tonumber(string.sub(color,3,4),16)/255
|
||||||
|
local b = tonumber(string.sub(color,5,6),16)/255
|
||||||
|
local a = tonumber(string.sub(color,7,8),16)/255
|
||||||
|
Zone:SetFillColor({r, g, b}, a)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Store in DB.
|
||||||
|
self.ZONENAMES[ZoneName] = ZoneName
|
||||||
|
|
||||||
|
-- Add zone.
|
||||||
|
self:AddZone(ZoneName, Zone)
|
||||||
|
|
||||||
|
-- Check for polygon which has at least 4 points (we would need 3 but the origin seems to be there twice)
|
||||||
|
elseif objectData.polygonMode and objectData.polygonMode=="rect" then
|
||||||
|
|
||||||
|
---
|
||||||
|
-- Drawing: Polygon rect
|
||||||
|
---
|
||||||
|
|
||||||
|
-- Name of the zone.
|
||||||
|
local ZoneName=objectData.name or "Unknown rect Polygon Drawing"
|
||||||
|
|
||||||
|
-- Reference point (center of the rectangle).
|
||||||
|
local vec2={x=objectData.mapX, y=objectData.mapY}
|
||||||
|
|
||||||
|
-- For a rectangular polygon drawing, we have the width (y) and height (x).
|
||||||
|
local w=objectData.width
|
||||||
|
local h=objectData.height
|
||||||
|
|
||||||
|
-- Create points from center using with and height (width for y and height for x is a bit confusing, but this is how ED implemented it).
|
||||||
|
local points={}
|
||||||
|
points[1]={x=vec2.x-h/2, y=vec2.y+w/2} --Upper left
|
||||||
|
points[2]={x=vec2.x+h/2, y=vec2.y+w/2} --Upper right
|
||||||
|
points[3]={x=vec2.x+h/2, y=vec2.y-w/2} --Lower right
|
||||||
|
points[4]={x=vec2.x-h/2, y=vec2.y-w/2} --Lower left
|
||||||
|
|
||||||
|
--local coord=COORDINATE:NewFromVec2(vec2):MarkToAll("MapX, MapY")
|
||||||
|
|
||||||
|
-- Debug output
|
||||||
|
self:I(string.format("Register ZONE: %s (Polygon (rect) drawing with %d vertices)", ZoneName, #points))
|
||||||
|
|
||||||
|
-- Create new polygon zone.
|
||||||
|
local Zone=ZONE_POLYGON:NewFromPointsArray(ZoneName, points)
|
||||||
|
|
||||||
|
-- Set color.
|
||||||
|
Zone:SetColor({1, 0, 0}, 0.15)
|
||||||
|
|
||||||
|
if objectData.colorString then
|
||||||
|
-- eg colorString = 0xff0000ff
|
||||||
|
local color = string.gsub(objectData.colorString,"^0x","")
|
||||||
|
local r = tonumber(string.sub(color,1,2),16)/255
|
||||||
|
local g = tonumber(string.sub(color,3,4),16)/255
|
||||||
|
local b = tonumber(string.sub(color,5,6),16)/255
|
||||||
|
local a = tonumber(string.sub(color,7,8),16)/255
|
||||||
|
Zone:SetColor({r, g, b}, a)
|
||||||
|
end
|
||||||
|
if objectData.fillColorString then
|
||||||
|
-- eg fillColorString = 0xff00004b
|
||||||
|
local color = string.gsub(objectData.colorString,"^0x","")
|
||||||
|
local r = tonumber(string.sub(color,1,2),16)/255
|
||||||
|
local g = tonumber(string.sub(color,3,4),16)/255
|
||||||
|
local b = tonumber(string.sub(color,5,6),16)/255
|
||||||
|
local a = tonumber(string.sub(color,7,8),16)/255
|
||||||
|
Zone:SetFillColor({r, g, b}, a)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Store in DB.
|
||||||
|
self.ZONENAMES[ZoneName] = ZoneName
|
||||||
|
|
||||||
|
-- Add zone.
|
||||||
|
self:AddZone(ZoneName, Zone)
|
||||||
|
|
||||||
|
elseif objectData.lineMode and (objectData.lineMode=="segments" or objectData.lineMode=="segment" or objectData.lineMode=="free") and objectData.points and #objectData.points>=2 then
|
||||||
|
|
||||||
|
---
|
||||||
|
-- Drawing: Line (segments, segment or free)
|
||||||
|
---
|
||||||
|
|
||||||
|
-- Name of the zone.
|
||||||
|
local Name=objectData.name or "Unknown Line Drawing"
|
||||||
|
|
||||||
|
-- Reference point. All other points need to be translated by this.
|
||||||
|
local vec2={x=objectData.mapX, y=objectData.mapY}
|
||||||
|
|
||||||
|
-- Copy points array.
|
||||||
|
local points=UTILS.DeepCopy(objectData.points)
|
||||||
|
|
||||||
|
-- Translate points.
|
||||||
|
for i,_point in pairs(points) do
|
||||||
|
local point=_point --DCS#Vec2
|
||||||
|
points[i]=UTILS.Vec2Add(point, vec2)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Debug output
|
||||||
|
self:I(string.format("Register PATHLINE: %s (Line drawing with %d points)", Name, #points))
|
||||||
|
|
||||||
|
-- Create new polygon zone.
|
||||||
|
local Pathline=PATHLINE:NewFromVec2Array(Name, points)
|
||||||
|
|
||||||
|
-- Set color.
|
||||||
|
--Zone:SetColor({1, 0, 0}, 0.15)
|
||||||
|
|
||||||
|
-- Add zone.
|
||||||
|
self:AddPathline(Name,Pathline)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end -- zone
|
end -- zone
|
||||||
|
|
||||||
do -- Zone_Goal
|
do -- Zone_Goal
|
||||||
|
|
||||||
--- Finds a @{Zone} based on the zone name.
|
--- Finds a @{Core.Zone} based on the zone name.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #string ZoneName The name of the zone.
|
-- @param #string ZoneName The name of the zone.
|
||||||
-- @return Core.Zone#ZONE_BASE The found ZONE.
|
-- @return Core.Zone#ZONE_BASE The found ZONE.
|
||||||
@@ -389,7 +638,7 @@ do -- Zone_Goal
|
|||||||
return ZoneFound
|
return ZoneFound
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Adds a @{Zone} based on the zone name in the DATABASE.
|
--- Adds a @{Core.Zone} based on the zone name in the DATABASE.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #string ZoneName The name of the zone.
|
-- @param #string ZoneName The name of the zone.
|
||||||
-- @param Core.Zone#ZONE_BASE Zone The zone.
|
-- @param Core.Zone#ZONE_BASE Zone The zone.
|
||||||
@@ -401,7 +650,7 @@ do -- Zone_Goal
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Deletes a @{Zone} from the DATABASE based on the zone name.
|
--- Deletes a @{Core.Zone} from the DATABASE based on the zone name.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #string ZoneName The name of the zone.
|
-- @param #string ZoneName The name of the zone.
|
||||||
function DATABASE:DeleteZoneGoal( ZoneName )
|
function DATABASE:DeleteZoneGoal( ZoneName )
|
||||||
@@ -410,6 +659,46 @@ do -- Zone_Goal
|
|||||||
end
|
end
|
||||||
|
|
||||||
end -- Zone_Goal
|
end -- Zone_Goal
|
||||||
|
|
||||||
|
do -- OpsZone
|
||||||
|
|
||||||
|
--- Finds a @{Ops.OpsZone#OPSZONE} based on the zone name.
|
||||||
|
-- @param #DATABASE self
|
||||||
|
-- @param #string ZoneName The name of the zone.
|
||||||
|
-- @return Ops.OpsZone#OPSZONE The found OPSZONE.
|
||||||
|
function DATABASE:FindOpsZone( ZoneName )
|
||||||
|
|
||||||
|
local ZoneFound = self.OPSZONES[ZoneName]
|
||||||
|
|
||||||
|
return ZoneFound
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Adds a @{Ops.OpsZone#OPSZONE} based on the zone name in the DATABASE.
|
||||||
|
-- @param #DATABASE self
|
||||||
|
-- @param Ops.OpsZone#OPSZONE OpsZone The zone.
|
||||||
|
function DATABASE:AddOpsZone( OpsZone )
|
||||||
|
|
||||||
|
if OpsZone then
|
||||||
|
|
||||||
|
local ZoneName=OpsZone:GetName()
|
||||||
|
|
||||||
|
if not self.OPSZONES[ZoneName] then
|
||||||
|
self.OPSZONES[ZoneName] = OpsZone
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Deletes a @{Ops.OpsZone#OPSZONE} from the DATABASE based on the zone name.
|
||||||
|
-- @param #DATABASE self
|
||||||
|
-- @param #string ZoneName The name of the zone.
|
||||||
|
function DATABASE:DeleteOpsZone( ZoneName )
|
||||||
|
self.OPSZONES[ZoneName] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
end -- OpsZone
|
||||||
|
|
||||||
do -- cargo
|
do -- cargo
|
||||||
|
|
||||||
--- Adds a Cargo based on the Cargo Name in the DATABASE.
|
--- Adds a Cargo based on the Cargo Name in the DATABASE.
|
||||||
@@ -434,7 +723,7 @@ do -- cargo
|
|||||||
--- Finds an CARGO based on the CargoName.
|
--- Finds an CARGO based on the CargoName.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #string CargoName
|
-- @param #string CargoName
|
||||||
-- @return Wrapper.Cargo#CARGO The found CARGO.
|
-- @return Cargo.Cargo#CARGO The found CARGO.
|
||||||
function DATABASE:FindCargo( CargoName )
|
function DATABASE:FindCargo( CargoName )
|
||||||
|
|
||||||
local CargoFound = self.CARGOS[CargoName]
|
local CargoFound = self.CARGOS[CargoName]
|
||||||
@@ -508,7 +797,7 @@ end -- cargo
|
|||||||
|
|
||||||
--- Finds a CLIENT based on the ClientName.
|
--- Finds a CLIENT based on the ClientName.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #string ClientName
|
-- @param #string ClientName - Note this is the UNIT name of the client!
|
||||||
-- @return Wrapper.Client#CLIENT The found CLIENT.
|
-- @return Wrapper.Client#CLIENT The found CLIENT.
|
||||||
function DATABASE:FindClient( ClientName )
|
function DATABASE:FindClient( ClientName )
|
||||||
|
|
||||||
@@ -564,6 +853,7 @@ function DATABASE:AddPlayer( UnitName, PlayerName )
|
|||||||
self.PLAYERUNITS[PlayerName] = self:FindUnit( UnitName )
|
self.PLAYERUNITS[PlayerName] = self:FindUnit( UnitName )
|
||||||
self.PLAYERSJOINED[PlayerName] = PlayerName
|
self.PLAYERSJOINED[PlayerName] = PlayerName
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Deletes a player from the DATABASE based on the Player Name.
|
--- Deletes a player from the DATABASE based on the Player Name.
|
||||||
@@ -777,7 +1067,7 @@ function DATABASE:_RegisterStaticTemplate( StaticTemplate, CoalitionID, Category
|
|||||||
local StaticTemplate = UTILS.DeepCopy( StaticTemplate )
|
local StaticTemplate = UTILS.DeepCopy( StaticTemplate )
|
||||||
|
|
||||||
local StaticTemplateGroupName = env.getValueDictByKey(StaticTemplate.name)
|
local StaticTemplateGroupName = env.getValueDictByKey(StaticTemplate.name)
|
||||||
|
|
||||||
local StaticTemplateName=StaticTemplate.units[1].name
|
local StaticTemplateName=StaticTemplate.units[1].name
|
||||||
|
|
||||||
self.Templates.Statics[StaticTemplateName] = self.Templates.Statics[StaticTemplateName] or {}
|
self.Templates.Statics[StaticTemplateName] = self.Templates.Statics[StaticTemplateName] or {}
|
||||||
@@ -913,7 +1203,7 @@ end
|
|||||||
-- @param #string AirbaseName Name of the airbase.
|
-- @param #string AirbaseName Name of the airbase.
|
||||||
-- @return #number Category.
|
-- @return #number Category.
|
||||||
function DATABASE:GetCategoryFromAirbase( AirbaseName )
|
function DATABASE:GetCategoryFromAirbase( AirbaseName )
|
||||||
return self.AIRBASES[AirbaseName]:GetCategory()
|
return self.AIRBASES[AirbaseName]:GetAirbaseCategory()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -991,7 +1281,7 @@ function DATABASE:_RegisterClients()
|
|||||||
for ClientName, ClientTemplate in pairs( self.Templates.ClientsByName ) do
|
for ClientName, ClientTemplate in pairs( self.Templates.ClientsByName ) do
|
||||||
self:I(string.format("Register Client: %s", tostring(ClientName)))
|
self:I(string.format("Register Client: %s", tostring(ClientName)))
|
||||||
local client=self:AddClient( ClientName )
|
local client=self:AddClient( ClientName )
|
||||||
client.SpawnCoord=COORDINATE:New(ClientTemplate.x, ClientTemplate.alt, ClientTemplate.y)
|
client.SpawnCoord=COORDINATE:New(ClientTemplate.x, ClientTemplate.alt, ClientTemplate.y)
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -1027,20 +1317,43 @@ function DATABASE:_RegisterAirbases()
|
|||||||
|
|
||||||
for DCSAirbaseId, DCSAirbase in pairs(world.getAirbases()) do
|
for DCSAirbaseId, DCSAirbase in pairs(world.getAirbases()) do
|
||||||
|
|
||||||
|
self:_RegisterAirbase(DCSAirbase)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Register a DCS airbase.
|
||||||
|
-- @param #DATABASE self
|
||||||
|
-- @param DCS#Airbase airbase Airbase.
|
||||||
|
-- @return #DATABASE self
|
||||||
|
function DATABASE:_RegisterAirbase(airbase)
|
||||||
|
|
||||||
|
if airbase then
|
||||||
|
|
||||||
-- Get the airbase name.
|
-- Get the airbase name.
|
||||||
local DCSAirbaseName = DCSAirbase:getName()
|
local DCSAirbaseName = airbase:getName()
|
||||||
|
|
||||||
-- 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=DCSAirbase:getID()
|
local airbaseID=airbase:getID()
|
||||||
|
|
||||||
-- Add and register airbase.
|
-- Add and register airbase.
|
||||||
local airbase=self:AddAirbase( DCSAirbaseName )
|
local airbase=self:AddAirbase( DCSAirbaseName )
|
||||||
|
|
||||||
-- Unique ID.
|
-- Unique ID.
|
||||||
local airbaseUID=airbase:GetID(true)
|
local airbaseUID=airbase:GetID(true)
|
||||||
|
|
||||||
|
local typename = airbase:GetTypeName()
|
||||||
|
|
||||||
|
local category = airbase.category
|
||||||
|
|
||||||
|
if category == Airbase.Category.SHIP and typename == "FARP_SINGLE_01" then
|
||||||
|
category = Airbase.Category.HELIPAD
|
||||||
|
end
|
||||||
|
|
||||||
-- Debug output.
|
-- Debug output.
|
||||||
local text=string.format("Register %s: %s (UID=%d), Runways=%d, Parking=%d [", AIRBASE.CategoryName[airbase.category], tostring(DCSAirbaseName), airbaseUID, #airbase.runways, airbase.NparkingTotal)
|
local text=string.format("Register %s: %s (UID=%d), Runways=%d, Parking=%d [", AIRBASE.CategoryName[category], tostring(DCSAirbaseName), airbaseUID, #airbase.runways, airbase.NparkingTotal)
|
||||||
for _,terminalType in pairs(AIRBASE.TerminalType) do
|
for _,terminalType in pairs(AIRBASE.TerminalType) do
|
||||||
if airbase.NparkingTerminal and airbase.NparkingTerminal[terminalType] then
|
if airbase.NparkingTerminal and airbase.NparkingTerminal[terminalType] then
|
||||||
text=text..string.format("%d=%d ", terminalType, airbase.NparkingTerminal[terminalType])
|
text=text..string.format("%d=%d ", terminalType, airbase.NparkingTerminal[terminalType])
|
||||||
@@ -1065,20 +1378,23 @@ function DATABASE:_EventOnBirth( Event )
|
|||||||
|
|
||||||
if Event.IniDCSUnit then
|
if Event.IniDCSUnit then
|
||||||
|
|
||||||
if Event.IniObjectCategory == 3 then
|
if Event.IniObjectCategory == Object.Category.STATIC then
|
||||||
|
|
||||||
|
-- Add static object to DB.
|
||||||
self:AddStatic( Event.IniDCSUnitName )
|
self:AddStatic( Event.IniDCSUnitName )
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
if Event.IniObjectCategory == 1 then
|
if Event.IniObjectCategory == Object.Category.UNIT then
|
||||||
|
|
||||||
|
-- Add unit and group to DB.
|
||||||
self:AddUnit( Event.IniDCSUnitName )
|
self:AddUnit( Event.IniDCSUnitName )
|
||||||
self:AddGroup( Event.IniDCSGroupName )
|
self:AddGroup( Event.IniDCSGroupName )
|
||||||
|
|
||||||
-- Add airbase if it was spawned later in the mission.
|
-- A unit can also be an airbase (e.g. ships).
|
||||||
local DCSAirbase = Airbase.getByName(Event.IniDCSUnitName)
|
local DCSAirbase = Airbase.getByName(Event.IniDCSUnitName)
|
||||||
if DCSAirbase then
|
if DCSAirbase then
|
||||||
|
-- Add airbase if it was spawned later in the mission.
|
||||||
self:I(string.format("Adding airbase %s", tostring(Event.IniDCSUnitName)))
|
self:I(string.format("Adding airbase %s", tostring(Event.IniDCSUnitName)))
|
||||||
self:AddAirbase(Event.IniDCSUnitName)
|
self:AddAirbase(Event.IniDCSUnitName)
|
||||||
end
|
end
|
||||||
@@ -1086,7 +1402,7 @@ function DATABASE:_EventOnBirth( Event )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if Event.IniObjectCategory == 1 then
|
if Event.IniObjectCategory == Object.Category.UNIT then
|
||||||
|
|
||||||
Event.IniUnit = self:FindUnit( Event.IniDCSUnitName )
|
Event.IniUnit = self:FindUnit( Event.IniDCSUnitName )
|
||||||
Event.IniGroup = self:FindGroup( Event.IniDCSGroupName )
|
Event.IniGroup = self:FindGroup( Event.IniDCSGroupName )
|
||||||
@@ -1104,7 +1420,7 @@ function DATABASE:_EventOnBirth( Event )
|
|||||||
if PlayerName then
|
if PlayerName then
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:I(string.format("Player '%s' joint 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 not client then
|
||||||
@@ -1153,11 +1469,11 @@ function DATABASE:_EventOnDeadOrCrash( Event )
|
|||||||
if self.STATICS[Event.IniDCSUnitName] then
|
if self.STATICS[Event.IniDCSUnitName] then
|
||||||
self:DeleteStatic( Event.IniDCSUnitName )
|
self:DeleteStatic( Event.IniDCSUnitName )
|
||||||
end
|
end
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Maybe a UNIT?
|
-- Maybe a UNIT?
|
||||||
---
|
---
|
||||||
|
|
||||||
-- Delete unit.
|
-- Delete unit.
|
||||||
if self.UNITS[Event.IniDCSUnitName] then
|
if self.UNITS[Event.IniDCSUnitName] then
|
||||||
self:T("STATIC Event for UNIT "..tostring(Event.IniDCSUnitName))
|
self:T("STATIC Event for UNIT "..tostring(Event.IniDCSUnitName))
|
||||||
@@ -1206,39 +1522,43 @@ function DATABASE:_EventOnDeadOrCrash( Event )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Handles the OnPlayerEnterUnit event to fill the active players table (with the unit filter applied).
|
--- Handles the OnPlayerEnterUnit event to fill the active players table for CA units (with the unit filter applied).
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param Core.Event#EVENTDATA Event
|
-- @param Core.Event#EVENTDATA Event
|
||||||
function DATABASE:_EventOnPlayerEnterUnit( Event )
|
function DATABASE:_EventOnPlayerEnterUnit( Event )
|
||||||
self:F2( { Event } )
|
self:F2( { Event } )
|
||||||
|
|
||||||
if Event.IniDCSUnit then
|
if Event.IniDCSUnit then
|
||||||
if Event.IniObjectCategory == 1 then
|
-- Player entering a CA slot
|
||||||
|
if Event.IniObjectCategory == 1 and Event.IniGroup and Event.IniGroup:IsGround() then
|
||||||
|
|
||||||
|
local IsPlayer = Event.IniDCSUnit:getPlayerName()
|
||||||
|
if IsPlayer then
|
||||||
|
|
||||||
-- Add unit.
|
-- Debug info.
|
||||||
self:AddUnit( Event.IniDCSUnitName )
|
self:I(string.format("Player '%s' joined GROUND unit '%s' of group '%s'", tostring(Event.IniPlayerName), tostring(Event.IniDCSUnitName), tostring(Event.IniDCSGroupName)))
|
||||||
|
|
||||||
|
local client= self.CLIENTS[Event.IniDCSUnitName] --Wrapper.Client#CLIENT
|
||||||
|
|
||||||
|
-- Add client in case it does not exist already.
|
||||||
|
if not client then
|
||||||
|
client=self:AddClient(Event.IniDCSUnitName)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Add player.
|
||||||
|
client:AddPlayer(Event.IniPlayerName)
|
||||||
|
|
||||||
-- Ini unit.
|
-- Add player.
|
||||||
Event.IniUnit = self:FindUnit( Event.IniDCSUnitName )
|
if not self.PLAYERS[Event.IniPlayerName] then
|
||||||
|
self:AddPlayer( Event.IniUnitName, Event.IniPlayerName )
|
||||||
-- Add group.
|
|
||||||
self:AddGroup( Event.IniDCSGroupName )
|
|
||||||
|
|
||||||
-- Get player unit.
|
|
||||||
local PlayerName = Event.IniDCSUnit:getPlayerName()
|
|
||||||
|
|
||||||
if PlayerName then
|
|
||||||
|
|
||||||
if not self.PLAYERS[PlayerName] then
|
|
||||||
self:AddPlayer( Event.IniDCSUnitName, PlayerName )
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local Settings = SETTINGS:Set( PlayerName )
|
-- Player settings.
|
||||||
Settings:SetPlayerMenu( Event.IniUnit )
|
local Settings = SETTINGS:Set( Event.IniPlayerName )
|
||||||
|
Settings:SetPlayerMenu(Event.IniUnit)
|
||||||
|
|
||||||
else
|
|
||||||
self:E("ERROR: getPlayerName() returned nil for event PlayerEnterUnit")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1249,15 +1569,26 @@ end
|
|||||||
-- @param Core.Event#EVENTDATA Event
|
-- @param Core.Event#EVENTDATA Event
|
||||||
function DATABASE:_EventOnPlayerLeaveUnit( Event )
|
function DATABASE:_EventOnPlayerLeaveUnit( Event )
|
||||||
self:F2( { Event } )
|
self:F2( { Event } )
|
||||||
|
|
||||||
|
local function FindPlayerName(UnitName)
|
||||||
|
local playername = nil
|
||||||
|
for _name,_unitname in pairs(self.PLAYERS) do
|
||||||
|
if _unitname == UnitName then
|
||||||
|
playername = _name
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return playername
|
||||||
|
end
|
||||||
|
|
||||||
if Event.IniUnit then
|
if Event.IniUnit then
|
||||||
|
|
||||||
if Event.IniObjectCategory == 1 then
|
if Event.IniObjectCategory == 1 then
|
||||||
|
|
||||||
-- Try to get the player name. This can be buggy for multicrew aircraft!
|
-- Try to get the player name. This can be buggy for multicrew aircraft!
|
||||||
local PlayerName = Event.IniUnit:GetPlayerName()
|
local PlayerName = Event.IniUnit:GetPlayerName() or FindPlayerName(Event.IniUnitName)
|
||||||
|
|
||||||
if PlayerName then --and self.PLAYERS[PlayerName] then
|
if PlayerName then
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:I(string.format("Player '%s' left unit %s", tostring(PlayerName), tostring(Event.IniUnitName)))
|
self:I(string.format("Player '%s' left unit %s", tostring(PlayerName), tostring(Event.IniUnitName)))
|
||||||
@@ -1411,10 +1742,10 @@ end
|
|||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #function IteratorFunction The function that will be called object in the database. The function needs to accept a CLIENT parameter.
|
-- @param #function IteratorFunction The function that will be called object in the database. The function needs to accept a CLIENT parameter.
|
||||||
-- @return #DATABASE self
|
-- @return #DATABASE self
|
||||||
function DATABASE:ForEachClient( IteratorFunction, ... )
|
function DATABASE:ForEachClient( IteratorFunction, FinalizeFunction, ... )
|
||||||
self:F2( arg )
|
self:F2( arg )
|
||||||
|
|
||||||
self:ForEach( IteratorFunction, arg, self.CLIENTS )
|
self:ForEach( IteratorFunction, FinalizeFunction, arg, self.CLIENTS )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -1423,10 +1754,10 @@ end
|
|||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #function IteratorFunction The function that will be called for each object in the database. The function needs to accept a CLIENT parameter.
|
-- @param #function IteratorFunction The function that will be called for each object in the database. The function needs to accept a CLIENT parameter.
|
||||||
-- @return #DATABASE self
|
-- @return #DATABASE self
|
||||||
function DATABASE:ForEachCargo( IteratorFunction, ... )
|
function DATABASE:ForEachCargo( IteratorFunction, FinalizeFunction, ... )
|
||||||
self:F2( arg )
|
self:F2( arg )
|
||||||
|
|
||||||
self:ForEach( IteratorFunction, arg, self.CARGOS )
|
self:ForEach( IteratorFunction, FinalizeFunction, arg, self.CARGOS )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -1556,11 +1887,11 @@ function DATABASE:FindOpsGroupFromUnit(unitname)
|
|||||||
else
|
else
|
||||||
unit=unitname
|
unit=unitname
|
||||||
end
|
end
|
||||||
|
|
||||||
if unit then
|
if unit then
|
||||||
groupname=unit:GetGroup():GetName()
|
groupname=unit:GetGroup():GetName()
|
||||||
end
|
end
|
||||||
|
|
||||||
if groupname then
|
if groupname then
|
||||||
return self.FLIGHTGROUPS[groupname]
|
return self.FLIGHTGROUPS[groupname]
|
||||||
else
|
else
|
||||||
@@ -1570,7 +1901,7 @@ end
|
|||||||
|
|
||||||
--- Add a flight control to the data base.
|
--- Add a flight control to the data base.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param Ops.FlightControl#FLIGHTCONTROL flightcontrol
|
-- @param OPS.FlightControl#FLIGHTCONTROL flightcontrol
|
||||||
function DATABASE:AddFlightControl(flightcontrol)
|
function DATABASE:AddFlightControl(flightcontrol)
|
||||||
self:F2( { flightcontrol } )
|
self:F2( { flightcontrol } )
|
||||||
self.FLIGHTCONTROLS[flightcontrol.airbasename]=flightcontrol
|
self.FLIGHTCONTROLS[flightcontrol.airbasename]=flightcontrol
|
||||||
@@ -1579,18 +1910,18 @@ end
|
|||||||
--- Get a flight control object from the data base.
|
--- Get a flight control object from the data base.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #string airbasename Name of the associated airbase.
|
-- @param #string airbasename Name of the associated airbase.
|
||||||
-- @return Ops.FlightControl#FLIGHTCONTROL The FLIGHTCONTROL object.s
|
-- @return OPS.FlightControl#FLIGHTCONTROL The FLIGHTCONTROL object.s
|
||||||
function DATABASE:GetFlightControl(airbasename)
|
function DATABASE:GetFlightControl(airbasename)
|
||||||
return self.FLIGHTCONTROLS[airbasename]
|
return self.FLIGHTCONTROLS[airbasename]
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
function DATABASE:_RegisterTemplates()
|
function DATABASE:_RegisterTemplates()
|
||||||
self:F2()
|
self:F2()
|
||||||
|
|
||||||
self.Navpoints = {}
|
self.Navpoints = {}
|
||||||
self.UNITS = {}
|
self.UNITS = {}
|
||||||
--Build routines.db.units and self.Navpoints
|
--Build self.Navpoints
|
||||||
for CoalitionName, coa_data in pairs(env.mission.coalition) do
|
for CoalitionName, coa_data in pairs(env.mission.coalition) do
|
||||||
self:T({CoalitionName=CoalitionName})
|
self:T({CoalitionName=CoalitionName})
|
||||||
|
|
||||||
@@ -1612,7 +1943,7 @@ function DATABASE:_RegisterTemplates()
|
|||||||
for nav_ind, nav_data in pairs(coa_data.nav_points) do
|
for nav_ind, nav_data in pairs(coa_data.nav_points) do
|
||||||
|
|
||||||
if type(nav_data) == 'table' then
|
if type(nav_data) == 'table' then
|
||||||
self.Navpoints[CoalitionName][nav_ind] = routines.utils.deepCopy(nav_data)
|
self.Navpoints[CoalitionName][nav_ind] = UTILS.DeepCopy(nav_data)
|
||||||
|
|
||||||
self.Navpoints[CoalitionName][nav_ind]['name'] = nav_data.callsignStr -- name is a little bit more self-explanatory.
|
self.Navpoints[CoalitionName][nav_ind]['name'] = nav_data.callsignStr -- name is a little bit more self-explanatory.
|
||||||
self.Navpoints[CoalitionName][nav_ind]['point'] = {} -- point is used by SSE, support it.
|
self.Navpoints[CoalitionName][nav_ind]['point'] = {} -- point is used by SSE, support it.
|
||||||
@@ -1652,7 +1983,7 @@ function DATABASE:_RegisterTemplates()
|
|||||||
|
|
||||||
if obj_type_name ~= "static" and Template and Template.units and type(Template.units) == 'table' then --making sure again- this is a valid group
|
if obj_type_name ~= "static" and Template and Template.units and type(Template.units) == 'table' then --making sure again- this is a valid group
|
||||||
|
|
||||||
self:_RegisterGroupTemplate(Template, CoalitionSide, _DATABASECategory[string.lower(CategoryName)], CountryID)
|
self:_RegisterGroupTemplate(Template, CoalitionSide, _DATABASECategory[string.lower(CategoryName)], CountryID)
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
@@ -1741,8 +2072,6 @@ end
|
|||||||
TargetPlayerName = Event.IniPlayerName
|
TargetPlayerName = Event.IniPlayerName
|
||||||
|
|
||||||
TargetCoalition = Event.IniCoalition
|
TargetCoalition = Event.IniCoalition
|
||||||
--TargetCategory = TargetUnit:getCategory()
|
|
||||||
--TargetCategory = TargetUnit:getDesc().category -- Workaround
|
|
||||||
TargetCategory = Event.IniCategory
|
TargetCategory = Event.IniCategory
|
||||||
TargetType = Event.IniTypeName
|
TargetType = Event.IniTypeName
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
-- There are 5 types/levels of objects that the _EVENTDISPATCHER services:
|
-- There are 5 types/levels of objects that the _EVENTDISPATCHER services:
|
||||||
--
|
--
|
||||||
-- * _DATABASE object: The core of the MOOSE objects. Any object that is created, deleted or updated, is done in this database.
|
-- * _DATABASE object: The core of the MOOSE objects. Any object that is created, deleted or updated, is done in this database.
|
||||||
-- * SET_ derived classes: These are subsets of the _DATABASE object. These subsets are updated by the _EVENTDISPATCHER as the second priority.
|
-- * SET_ derived classes: These are subsets of the global _DATABASE object (an instance of @{Core.Database#DATABASE}). These subsets are updated by the _EVENTDISPATCHER as the second priority.
|
||||||
-- * UNIT objects: UNIT objects can subscribe to DCS events. Each DCS event will be directly published to the subscribed UNIT object.
|
-- * UNIT objects: UNIT objects can subscribe to DCS events. Each DCS event will be directly published to the subscribed UNIT object.
|
||||||
-- * GROUP objects: GROUP objects can subscribe to DCS events. Each DCS event will be directly published to the subscribed GROUP object.
|
-- * GROUP objects: GROUP objects can subscribe to DCS events. Each DCS event will be directly published to the subscribed GROUP object.
|
||||||
-- * Any other object: Various other objects can subscribe to DCS events. Each DCS event triggered will be published to each subscribed object.
|
-- * Any other object: Various other objects can subscribe to DCS events. Each DCS event triggered will be published to each subscribed object.
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
-- The actual event subscribing and handling is not facilitated through the _EVENTDISPATCHER, but it is done through the @{BASE} class, @{UNIT} class and @{GROUP} class.
|
-- The actual event subscribing and handling is not facilitated through the _EVENTDISPATCHER, but it is done through the @{Core.Base#BASE} class, @{Wrapper.Unit#UNIT} class and @{Wrapper.Group#GROUP} class.
|
||||||
-- The _EVENTDISPATCHER is a component that is quietly working in the background of MOOSE.
|
-- The _EVENTDISPATCHER is a component that is quietly working in the background of MOOSE.
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
@@ -173,7 +173,8 @@
|
|||||||
-- @image Core_Event.JPG
|
-- @image Core_Event.JPG
|
||||||
|
|
||||||
|
|
||||||
--- @type EVENT
|
---
|
||||||
|
-- @type EVENT
|
||||||
-- @field #EVENT.Events Events
|
-- @field #EVENT.Events Events
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
@@ -248,6 +249,27 @@ EVENTS = {
|
|||||||
TriggerZone = world.event.S_EVENT_TRIGGER_ZONE or -1,
|
TriggerZone = world.event.S_EVENT_TRIGGER_ZONE or -1,
|
||||||
LandingQualityMark = world.event.S_EVENT_LANDING_QUALITY_MARK or -1,
|
LandingQualityMark = world.event.S_EVENT_LANDING_QUALITY_MARK or -1,
|
||||||
BDA = world.event.S_EVENT_BDA or -1,
|
BDA = world.event.S_EVENT_BDA or -1,
|
||||||
|
-- Added with DCS 2.8.0
|
||||||
|
AIAbortMission = world.event.S_EVENT_AI_ABORT_MISSION or -1,
|
||||||
|
DayNight = world.event.S_EVENT_DAYNIGHT or -1,
|
||||||
|
FlightTime = world.event.S_EVENT_FLIGHT_TIME or -1,
|
||||||
|
SelfKillPilot = world.event.S_EVENT_PLAYER_SELF_KILL_PILOT or -1,
|
||||||
|
PlayerCaptureAirfield = world.event.S_EVENT_PLAYER_CAPTURE_AIRFIELD or -1,
|
||||||
|
EmergencyLanding = world.event.S_EVENT_EMERGENCY_LANDING or -1,
|
||||||
|
UnitCreateTask = world.event.S_EVENT_UNIT_CREATE_TASK or -1,
|
||||||
|
UnitDeleteTask = world.event.S_EVENT_UNIT_DELETE_TASK or -1,
|
||||||
|
SimulationStart = world.event.S_EVENT_SIMULATION_START or -1,
|
||||||
|
WeaponRearm = world.event.S_EVENT_WEAPON_REARM or -1,
|
||||||
|
WeaponDrop = world.event.S_EVENT_WEAPON_DROP or -1,
|
||||||
|
-- Added with DCS 2.9.0
|
||||||
|
UnitTaskTimeout = world.event.S_EVENT_UNIT_TASK_TIMEOUT or -1,
|
||||||
|
UnitTaskStage = world.event.S_EVENT_UNIT_TASK_STAGE or -1,
|
||||||
|
MacSubtaskScore = world.event.S_EVENT_MAC_SUBTASK_SCORE or -1,
|
||||||
|
MacExtraScore = world.event.S_EVENT_MAC_EXTRA_SCORE or -1,
|
||||||
|
MissionRestart = world.event.S_EVENT_MISSION_RESTART or -1,
|
||||||
|
MissionWinner = world.event.S_EVENT_MISSION_WINNER or -1,
|
||||||
|
PostponedTakeoff = world.event.S_EVENT_POSTPONED_TAKEOFF or -1,
|
||||||
|
PostponedLand = world.event.S_EVENT_POSTPONED_LAND or -1,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- The Event structure
|
--- The Event structure
|
||||||
@@ -270,6 +292,7 @@ EVENTS = {
|
|||||||
-- @field Wrapper.Group#GROUP IniGroup (UNIT) The initiating MOOSE wrapper @{Wrapper.Group#GROUP} of the initiator Group object.
|
-- @field Wrapper.Group#GROUP IniGroup (UNIT) The initiating MOOSE wrapper @{Wrapper.Group#GROUP} of the initiator Group object.
|
||||||
-- @field #string IniGroupName UNIT) The initiating GROUP name (same as IniDCSGroupName).
|
-- @field #string IniGroupName UNIT) The initiating GROUP name (same as IniDCSGroupName).
|
||||||
-- @field #string IniPlayerName (UNIT) The name of the initiating player in case the Unit is a client or player slot.
|
-- @field #string IniPlayerName (UNIT) The name of the initiating player in case the Unit is a client or player slot.
|
||||||
|
-- @field #string IniPlayerUCID (UNIT) The UCID of the initiating player in case the Unit is a client or player slot and on a multi-player server.
|
||||||
-- @field DCS#coalition.side IniCoalition (UNIT) The coalition of the initiator.
|
-- @field DCS#coalition.side IniCoalition (UNIT) The coalition of the initiator.
|
||||||
-- @field DCS#Unit.Category IniCategory (UNIT) The category of the initiator.
|
-- @field DCS#Unit.Category IniCategory (UNIT) The category of the initiator.
|
||||||
-- @field #string IniTypeName (UNIT) The type name of the initiator.
|
-- @field #string IniTypeName (UNIT) The type name of the initiator.
|
||||||
@@ -285,6 +308,7 @@ EVENTS = {
|
|||||||
-- @field Wrapper.Group#GROUP TgtGroup (UNIT) The target MOOSE wrapper @{Wrapper.Group#GROUP} of the target Group object.
|
-- @field Wrapper.Group#GROUP TgtGroup (UNIT) The target MOOSE wrapper @{Wrapper.Group#GROUP} of the target Group object.
|
||||||
-- @field #string TgtGroupName (UNIT) The target GROUP name (same as TgtDCSGroupName).
|
-- @field #string TgtGroupName (UNIT) The target GROUP name (same as TgtDCSGroupName).
|
||||||
-- @field #string TgtPlayerName (UNIT) The name of the target player in case the Unit is a client or player slot.
|
-- @field #string TgtPlayerName (UNIT) The name of the target player in case the Unit is a client or player slot.
|
||||||
|
-- @field #string TgtPlayerUCID (UNIT) The UCID of the target player in case the Unit is a client or player slot and on a multi-player server.
|
||||||
-- @field DCS#coalition.side TgtCoalition (UNIT) The coalition of the target.
|
-- @field DCS#coalition.side TgtCoalition (UNIT) The coalition of the target.
|
||||||
-- @field DCS#Unit.Category TgtCategory (UNIT) The category of the target.
|
-- @field DCS#Unit.Category TgtCategory (UNIT) The category of the target.
|
||||||
-- @field #string TgtTypeName (UNIT) The type name of the target.
|
-- @field #string TgtTypeName (UNIT) The type name of the target.
|
||||||
@@ -293,15 +317,15 @@ EVENTS = {
|
|||||||
-- @field Wrapper.Airbase#AIRBASE Place The MOOSE airbase object.
|
-- @field Wrapper.Airbase#AIRBASE Place The MOOSE airbase object.
|
||||||
-- @field #string PlaceName The name of the airbase.
|
-- @field #string PlaceName The name of the airbase.
|
||||||
--
|
--
|
||||||
-- @field #table weapon The weapon used during the event.
|
-- @field DCS#Weapon weapon The weapon used during the event.
|
||||||
-- @field #table Weapon
|
-- @field DCS#Weapon Weapon The weapon used during the event.
|
||||||
-- @field #string WeaponName Name of the weapon.
|
-- @field #string WeaponName Name of the weapon.
|
||||||
-- @field DCS#Unit WeaponTgtDCSUnit Target DCS unit of the weapon.
|
-- @field DCS#Unit WeaponTgtDCSUnit Target DCS unit of the weapon.
|
||||||
--
|
--
|
||||||
-- @field Cargo.Cargo#CARGO Cargo The cargo object.
|
-- @field Cargo.Cargo#CARGO Cargo The cargo object.
|
||||||
-- @field #string CargoName The name of the cargo object.
|
-- @field #string CargoName The name of the cargo object.
|
||||||
--
|
--
|
||||||
-- @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.
|
||||||
|
|
||||||
|
|
||||||
@@ -560,9 +584,118 @@ local _EVENTMETA = {
|
|||||||
Event = "OnEventBDA",
|
Event = "OnEventBDA",
|
||||||
Text = "S_EVENT_BDA"
|
Text = "S_EVENT_BDA"
|
||||||
},
|
},
|
||||||
|
-- Added with DCS 2.8
|
||||||
|
[EVENTS.AIAbortMission] = {
|
||||||
|
Order = 1,
|
||||||
|
Side = "I",
|
||||||
|
Event = "OnEventAIAbortMission",
|
||||||
|
Text = "S_EVENT_AI_ABORT_MISSION"
|
||||||
|
},
|
||||||
|
[EVENTS.DayNight] = {
|
||||||
|
Order = 1,
|
||||||
|
Event = "OnEventDayNight",
|
||||||
|
Text = "S_EVENT_DAYNIGHT"
|
||||||
|
},
|
||||||
|
[EVENTS.FlightTime] = {
|
||||||
|
Order = 1,
|
||||||
|
Event = "OnEventFlightTime",
|
||||||
|
Text = "S_EVENT_FLIGHT_TIME"
|
||||||
|
},
|
||||||
|
[EVENTS.SelfKillPilot] = {
|
||||||
|
Order = 1,
|
||||||
|
Side = "I",
|
||||||
|
Event = "OnEventSelfKillPilot",
|
||||||
|
Text = "S_EVENT_PLAYER_SELF_KILL_PILOT"
|
||||||
|
},
|
||||||
|
[EVENTS.PlayerCaptureAirfield] = {
|
||||||
|
Order = 1,
|
||||||
|
Event = "OnEventPlayerCaptureAirfield",
|
||||||
|
Text = "S_EVENT_PLAYER_CAPTURE_AIRFIELD"
|
||||||
|
},
|
||||||
|
[EVENTS.EmergencyLanding] = {
|
||||||
|
Order = 1,
|
||||||
|
Side = "I",
|
||||||
|
Event = "OnEventEmergencyLanding",
|
||||||
|
Text = "S_EVENT_EMERGENCY_LANDING"
|
||||||
|
},
|
||||||
|
[EVENTS.UnitCreateTask] = {
|
||||||
|
Order = 1,
|
||||||
|
Event = "OnEventUnitCreateTask",
|
||||||
|
Text = "S_EVENT_UNIT_CREATE_TASK"
|
||||||
|
},
|
||||||
|
[EVENTS.UnitDeleteTask] = {
|
||||||
|
Order = 1,
|
||||||
|
Event = "OnEventUnitDeleteTask",
|
||||||
|
Text = "S_EVENT_UNIT_DELETE_TASK"
|
||||||
|
},
|
||||||
|
[EVENTS.SimulationStart] = {
|
||||||
|
Order = 1,
|
||||||
|
Event = "OnEventSimulationStart",
|
||||||
|
Text = "S_EVENT_SIMULATION_START"
|
||||||
|
},
|
||||||
|
[EVENTS.WeaponRearm] = {
|
||||||
|
Order = 1,
|
||||||
|
Side = "I",
|
||||||
|
Event = "OnEventWeaponRearm",
|
||||||
|
Text = "S_EVENT_WEAPON_REARM"
|
||||||
|
},
|
||||||
|
[EVENTS.WeaponDrop] = {
|
||||||
|
Order = 1,
|
||||||
|
Side = "I",
|
||||||
|
Event = "OnEventWeaponDrop",
|
||||||
|
Text = "S_EVENT_WEAPON_DROP"
|
||||||
|
},
|
||||||
|
-- DCS 2.9
|
||||||
|
[EVENTS.UnitTaskTimeout] = {
|
||||||
|
Order = 1,
|
||||||
|
Side = "I",
|
||||||
|
Event = "OnEventUnitTaskTimeout",
|
||||||
|
Text = "S_EVENT_UNIT_TASK_TIMEOUT "
|
||||||
|
},
|
||||||
|
[EVENTS.UnitTaskStage] = {
|
||||||
|
Order = 1,
|
||||||
|
Side = "I",
|
||||||
|
Event = "OnEventUnitTaskStage",
|
||||||
|
Text = "S_EVENT_UNIT_TASK_STAGE "
|
||||||
|
},
|
||||||
|
[EVENTS.MacSubtaskScore] = {
|
||||||
|
Order = 1,
|
||||||
|
Side = "I",
|
||||||
|
Event = "OnEventMacSubtaskScore",
|
||||||
|
Text = "S_EVENT_MAC_SUBTASK_SCORE"
|
||||||
|
},
|
||||||
|
[EVENTS.MacExtraScore] = {
|
||||||
|
Order = 1,
|
||||||
|
Side = "I",
|
||||||
|
Event = "OnEventMacExtraScore",
|
||||||
|
Text = "S_EVENT_MAC_EXTRA_SCOREP"
|
||||||
|
},
|
||||||
|
[EVENTS.MissionRestart] = {
|
||||||
|
Order = 1,
|
||||||
|
Side = "I",
|
||||||
|
Event = "OnEventMissionRestart",
|
||||||
|
Text = "S_EVENT_MISSION_RESTART"
|
||||||
|
},
|
||||||
|
[EVENTS.MissionWinner] = {
|
||||||
|
Order = 1,
|
||||||
|
Side = "I",
|
||||||
|
Event = "OnEventMissionWinner",
|
||||||
|
Text = "S_EVENT_MISSION_WINNER"
|
||||||
|
},
|
||||||
|
[EVENTS.PostponedTakeoff] = {
|
||||||
|
Order = 1,
|
||||||
|
Side = "I",
|
||||||
|
Event = "OnEventPostponedTakeoff",
|
||||||
|
Text = "S_EVENT_POSTPONED_TAKEOFF"
|
||||||
|
},
|
||||||
|
[EVENTS.PostponedLand] = {
|
||||||
|
Order = 1,
|
||||||
|
Side = "I",
|
||||||
|
Event = "OnEventPostponedLand",
|
||||||
|
Text = "S_EVENT_POSTPONED_LAND"
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
--- The Events structure
|
--- The Events structure
|
||||||
-- @type EVENT.Events
|
-- @type EVENT.Events
|
||||||
-- @field #number IniUnit
|
-- @field #number IniUnit
|
||||||
@@ -916,7 +1049,7 @@ do -- Event Creation
|
|||||||
|
|
||||||
--- Creation of a New ZoneGoal Event.
|
--- Creation of a New ZoneGoal Event.
|
||||||
-- @param #EVENT self
|
-- @param #EVENT self
|
||||||
-- @param Core.Functional#ZONE_GOAL ZoneGoal The ZoneGoal created.
|
-- @param Functional.ZoneGoal#ZONE_GOAL ZoneGoal The ZoneGoal created.
|
||||||
function EVENT:CreateEventNewZoneGoal( ZoneGoal )
|
function EVENT:CreateEventNewZoneGoal( ZoneGoal )
|
||||||
self:F( { ZoneGoal } )
|
self:F( { ZoneGoal } )
|
||||||
|
|
||||||
@@ -932,7 +1065,7 @@ do -- Event Creation
|
|||||||
|
|
||||||
--- Creation of a ZoneGoal Deletion Event.
|
--- Creation of a ZoneGoal Deletion Event.
|
||||||
-- @param #EVENT self
|
-- @param #EVENT self
|
||||||
-- @param Core.ZoneGoal#ZONE_GOAL ZoneGoal The ZoneGoal created.
|
-- @param Functional.ZoneGoal#ZONE_GOAL ZoneGoal The ZoneGoal created.
|
||||||
function EVENT:CreateEventDeleteZoneGoal( ZoneGoal )
|
function EVENT:CreateEventDeleteZoneGoal( ZoneGoal )
|
||||||
self:F( { ZoneGoal } )
|
self:F( { ZoneGoal } )
|
||||||
|
|
||||||
@@ -1008,9 +1141,9 @@ function EVENT:onEvent( Event )
|
|||||||
|
|
||||||
if Event.initiator then
|
if Event.initiator then
|
||||||
|
|
||||||
Event.IniObjectCategory = Event.initiator:getCategory()
|
Event.IniObjectCategory = Object.getCategory(Event.initiator)
|
||||||
|
|
||||||
if Event.IniObjectCategory == Object.Category.STATIC then
|
if Event.IniObjectCategory == Object.Category.STATIC then
|
||||||
---
|
---
|
||||||
-- Static
|
-- Static
|
||||||
---
|
---
|
||||||
@@ -1046,10 +1179,9 @@ function EVENT:onEvent( Event )
|
|||||||
local Unit=UNIT:FindByName(Event.IniDCSUnitName)
|
local Unit=UNIT:FindByName(Event.IniDCSUnitName)
|
||||||
if Unit then
|
if Unit then
|
||||||
Event.IniObjectCategory = Object.Category.UNIT
|
Event.IniObjectCategory = Object.Category.UNIT
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if Event.IniObjectCategory == Object.Category.UNIT then
|
elseif Event.IniObjectCategory == Object.Category.UNIT then
|
||||||
---
|
---
|
||||||
-- Unit
|
-- Unit
|
||||||
---
|
---
|
||||||
@@ -1058,7 +1190,7 @@ function EVENT:onEvent( Event )
|
|||||||
Event.IniUnitName = Event.IniDCSUnitName
|
Event.IniUnitName = Event.IniDCSUnitName
|
||||||
Event.IniDCSGroup = Event.IniDCSUnit:getGroup()
|
Event.IniDCSGroup = Event.IniDCSUnit:getGroup()
|
||||||
Event.IniUnit = UNIT:FindByName( Event.IniDCSUnitName )
|
Event.IniUnit = UNIT:FindByName( Event.IniDCSUnitName )
|
||||||
|
|
||||||
if not Event.IniUnit then
|
if not Event.IniUnit then
|
||||||
-- Unit can be a CLIENT. Most likely this will be the case ...
|
-- Unit can be a CLIENT. Most likely this will be the case ...
|
||||||
Event.IniUnit = CLIENT:FindByName( Event.IniDCSUnitName, '', true )
|
Event.IniUnit = CLIENT:FindByName( Event.IniDCSUnitName, '', true )
|
||||||
@@ -1072,12 +1204,19 @@ function EVENT:onEvent( Event )
|
|||||||
end
|
end
|
||||||
|
|
||||||
Event.IniPlayerName = Event.IniDCSUnit:getPlayerName()
|
Event.IniPlayerName = Event.IniDCSUnit:getPlayerName()
|
||||||
|
if Event.IniPlayerName then
|
||||||
|
-- get UUCID
|
||||||
|
local PID = NET.GetPlayerIDByName(nil,Event.IniPlayerName)
|
||||||
|
if PID then
|
||||||
|
Event.IniPlayerUCID = net.get_player_info(tonumber(PID), 'ucid')
|
||||||
|
--env.info("Event.IniPlayerUCID="..tostring(Event.IniPlayerUCID),false)
|
||||||
|
end
|
||||||
|
end
|
||||||
Event.IniCoalition = Event.IniDCSUnit:getCoalition()
|
Event.IniCoalition = Event.IniDCSUnit:getCoalition()
|
||||||
Event.IniTypeName = Event.IniDCSUnit:getTypeName()
|
Event.IniTypeName = Event.IniDCSUnit:getTypeName()
|
||||||
Event.IniCategory = Event.IniDCSUnit:getDesc().category
|
Event.IniCategory = Event.IniDCSUnit:getDesc().category
|
||||||
end
|
|
||||||
|
|
||||||
if Event.IniObjectCategory == Object.Category.CARGO then
|
elseif Event.IniObjectCategory == Object.Category.CARGO then
|
||||||
---
|
---
|
||||||
-- Cargo
|
-- Cargo
|
||||||
---
|
---
|
||||||
@@ -1088,22 +1227,19 @@ function EVENT:onEvent( Event )
|
|||||||
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()
|
||||||
end
|
|
||||||
|
|
||||||
if Event.IniObjectCategory == Object.Category.SCENERY then
|
elseif Event.IniObjectCategory == Object.Category.SCENERY then
|
||||||
---
|
---
|
||||||
-- Scenery
|
-- Scenery
|
||||||
---
|
---
|
||||||
|
|
||||||
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 = SCENERY:Register( Event.IniDCSUnitName, Event.initiator )
|
Event.IniUnit = SCENERY:Register( Event.IniDCSUnitName, Event.initiator )
|
||||||
Event.IniCategory = Event.IniDCSUnit:getDesc().category
|
Event.IniCategory = Event.IniDCSUnit:getDesc().category
|
||||||
Event.IniTypeName = Event.initiator:isExist() and Event.IniDCSUnit:getTypeName() or "SCENERY"
|
Event.IniTypeName = Event.initiator:isExist() and Event.IniDCSUnit:getTypeName() or "SCENERY"
|
||||||
end
|
|
||||||
|
|
||||||
if Event.IniObjectCategory == Object.Category.BASE then
|
elseif Event.IniObjectCategory == Object.Category.BASE then
|
||||||
---
|
---
|
||||||
-- Base Object
|
-- Base Object
|
||||||
---
|
---
|
||||||
@@ -1114,6 +1250,12 @@ function EVENT:onEvent( Event )
|
|||||||
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()
|
||||||
|
|
||||||
|
-- If the airbase does not exist in the DB, we add it (e.g. when FARPS are spawned).
|
||||||
|
if not Event.IniUnit then
|
||||||
|
_DATABASE:_RegisterAirbase(Event.initiator)
|
||||||
|
Event.IniUnit = AIRBASE:FindByName(Event.IniDCSUnitName)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1124,9 +1266,12 @@ function EVENT:onEvent( Event )
|
|||||||
---
|
---
|
||||||
|
|
||||||
-- Target category.
|
-- Target category.
|
||||||
Event.TgtObjectCategory = Event.target:getCategory()
|
Event.TgtObjectCategory = Object.getCategory(Event.target)
|
||||||
|
|
||||||
if Event.TgtObjectCategory == Object.Category.UNIT then
|
if Event.TgtObjectCategory == Object.Category.UNIT then
|
||||||
|
---
|
||||||
|
-- UNIT
|
||||||
|
---
|
||||||
Event.TgtDCSUnit = Event.target
|
Event.TgtDCSUnit = Event.target
|
||||||
Event.TgtDCSGroup = Event.TgtDCSUnit:getGroup()
|
Event.TgtDCSGroup = Event.TgtDCSUnit:getGroup()
|
||||||
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
|
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
|
||||||
@@ -1139,21 +1284,33 @@ function EVENT:onEvent( Event )
|
|||||||
Event.TgtGroupName = Event.TgtDCSGroupName
|
Event.TgtGroupName = Event.TgtDCSGroupName
|
||||||
end
|
end
|
||||||
Event.TgtPlayerName = Event.TgtDCSUnit:getPlayerName()
|
Event.TgtPlayerName = Event.TgtDCSUnit:getPlayerName()
|
||||||
|
if Event.TgtPlayerName then
|
||||||
|
-- get UUCID
|
||||||
|
local PID = NET.GetPlayerIDByName(nil,Event.TgtPlayerName)
|
||||||
|
if PID then
|
||||||
|
Event.TgtPlayerUCID = net.get_player_info(tonumber(PID), 'ucid')
|
||||||
|
--env.info("Event.TgtPlayerUCID="..tostring(Event.TgtPlayerUCID),false)
|
||||||
|
end
|
||||||
|
end
|
||||||
Event.TgtCoalition = Event.TgtDCSUnit:getCoalition()
|
Event.TgtCoalition = Event.TgtDCSUnit:getCoalition()
|
||||||
Event.TgtCategory = Event.TgtDCSUnit:getDesc().category
|
Event.TgtCategory = Event.TgtDCSUnit:getDesc().category
|
||||||
Event.TgtTypeName = Event.TgtDCSUnit:getTypeName()
|
Event.TgtTypeName = Event.TgtDCSUnit:getTypeName()
|
||||||
end
|
|
||||||
|
|
||||||
if Event.TgtObjectCategory == Object.Category.STATIC then
|
elseif Event.TgtObjectCategory == Object.Category.STATIC then
|
||||||
-- get base data
|
---
|
||||||
|
-- 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.id ~= 33 then -- leave out ejected seat object
|
||||||
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
|
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
|
||||||
Event.TgtUnitName = Event.TgtDCSUnitName
|
-- Workaround for borked target info on cruise missiles
|
||||||
Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName, false )
|
if Event.TgtDCSUnitName and Event.TgtDCSUnitName ~= "" then
|
||||||
Event.TgtCoalition = Event.TgtDCSUnit:getCoalition()
|
Event.TgtUnitName = Event.TgtDCSUnitName
|
||||||
Event.TgtCategory = Event.TgtDCSUnit:getDesc().category
|
Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName, false )
|
||||||
Event.TgtTypeName = Event.TgtDCSUnit:getTypeName()
|
Event.TgtCoalition = Event.TgtDCSUnit:getCoalition()
|
||||||
|
Event.TgtCategory = Event.TgtDCSUnit:getDesc().category
|
||||||
|
Event.TgtTypeName = Event.TgtDCSUnit:getTypeName()
|
||||||
|
end
|
||||||
else
|
else
|
||||||
Event.TgtDCSUnitName = string.format("No target object for Event ID %s", tostring(Event.id))
|
Event.TgtDCSUnitName = string.format("No target object for Event ID %s", tostring(Event.id))
|
||||||
Event.TgtUnitName = Event.TgtDCSUnitName
|
Event.TgtUnitName = Event.TgtDCSUnitName
|
||||||
@@ -1172,9 +1329,11 @@ function EVENT:onEvent( Event )
|
|||||||
Event.TgtTypeName = "Static"
|
Event.TgtTypeName = "Static"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if Event.TgtObjectCategory == Object.Category.SCENERY then
|
elseif Event.TgtObjectCategory == Object.Category.SCENERY then
|
||||||
|
---
|
||||||
|
-- SCENERY
|
||||||
|
---
|
||||||
Event.TgtDCSUnit = Event.target
|
Event.TgtDCSUnit = Event.target
|
||||||
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
|
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
|
||||||
Event.TgtUnitName = Event.TgtDCSUnitName
|
Event.TgtUnitName = Event.TgtDCSUnitName
|
||||||
@@ -1189,7 +1348,8 @@ function EVENT:onEvent( Event )
|
|||||||
Event.Weapon = Event.weapon
|
Event.Weapon = Event.weapon
|
||||||
Event.WeaponName = Event.Weapon:getTypeName()
|
Event.WeaponName = Event.Weapon:getTypeName()
|
||||||
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()
|
Event.WeaponPlayerName = Event.WeaponUNIT and Event.Weapon.getPlayerName 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()
|
||||||
Event.WeaponCategory = Event.WeaponUNIT and Event.Weapon:getDesc().category
|
Event.WeaponCategory = Event.WeaponUNIT and Event.Weapon:getDesc().category
|
||||||
Event.WeaponTypeName = Event.WeaponUNIT and Event.Weapon:getTypeName()
|
Event.WeaponTypeName = Event.WeaponUNIT and Event.Weapon:getTypeName()
|
||||||
@@ -1203,9 +1363,11 @@ function EVENT:onEvent( Event )
|
|||||||
--local name=Event.place:getName() -- This returns a DCS error "Airbase doesn't exit" :(
|
--local name=Event.place:getName() -- This returns a DCS error "Airbase doesn't exit" :(
|
||||||
-- However, this is not a big thing, as the aircraft the pilot ejected from is usually long crashed before the ejected pilot touches the ground.
|
-- However, this is not a big thing, as the aircraft the pilot ejected from is usually long crashed before the ejected pilot touches the ground.
|
||||||
--Event.Place=UNIT:Find(Event.place)
|
--Event.Place=UNIT:Find(Event.place)
|
||||||
else
|
else
|
||||||
Event.Place=AIRBASE:Find(Event.place)
|
if Event.place:isExist() and Object.getCategory(Event.place) ~= Object.Category.SCENERY then
|
||||||
Event.PlaceName=Event.Place:GetName()
|
Event.Place=AIRBASE:Find(Event.place)
|
||||||
|
Event.PlaceName=Event.Place:GetName()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -47,9 +47,9 @@
|
|||||||
-- and tailored** by mission designers through **the implementation of Transition Handlers**.
|
-- and tailored** by mission designers through **the implementation of Transition Handlers**.
|
||||||
-- Each of these FSM implementation classes start either with:
|
-- Each of these FSM implementation classes start either with:
|
||||||
--
|
--
|
||||||
-- * an acronym **AI\_**, which indicates a FSM implementation directing **AI controlled** @{GROUP} and/or @{UNIT}. These AI\_ classes derive the @{#FSM_CONTROLLABLE} class.
|
-- * an acronym **AI\_**, which indicates a FSM implementation directing **AI controlled** @{Wrapper.Group#GROUP} and/or @{Wrapper.Unit#UNIT}. These AI\_ classes derive the @{#FSM_CONTROLLABLE} class.
|
||||||
-- * an acronym **TASK\_**, which indicates a FSM implementation executing a @{TASK} executed by Groups of players. These TASK\_ classes derive the @{#FSM_TASK} class.
|
-- * an acronym **TASK\_**, which indicates a FSM implementation executing a @{Tasking.Task#TASK} executed by Groups of players. These TASK\_ classes derive the @{#FSM_TASK} class.
|
||||||
-- * an acronym **ACT\_**, which indicates an Sub-FSM implementation, directing **Humans actions** that need to be done in a @{TASK}, seated in a @{CLIENT} (slot) or a @{UNIT} (CA join). These ACT\_ classes derive the @{#FSM_PROCESS} class.
|
-- * an acronym **ACT\_**, which indicates an Sub-FSM implementation, directing **Humans actions** that need to be done in a @{Tasking.Task#TASK}, seated in a @{Wrapper.Client#CLIENT} (slot) or a @{Wrapper.Unit#UNIT} (CA join). These ACT\_ classes derive the @{#FSM_PROCESS} class.
|
||||||
--
|
--
|
||||||
-- Detailed explanations and API specifics are further below clarified and FSM derived class specifics are described in those class documentation sections.
|
-- Detailed explanations and API specifics are further below clarified and FSM derived class specifics are described in those class documentation sections.
|
||||||
--
|
--
|
||||||
@@ -61,10 +61,10 @@
|
|||||||
--
|
--
|
||||||
-- The following derived classes are available in the MOOSE framework, that implement a specialized form of a FSM:
|
-- The following derived classes are available in the MOOSE framework, that implement a specialized form of a FSM:
|
||||||
--
|
--
|
||||||
-- * @{#FSM_TASK}: Models Finite State Machines for @{Task}s.
|
-- * @{#FSM_TASK}: Models Finite State Machines for @{Tasking.Task}s.
|
||||||
-- * @{#FSM_PROCESS}: Models Finite State Machines for @{Task} actions, which control @{Client}s.
|
-- * @{#FSM_PROCESS}: Models Finite State Machines for @{Tasking.Task} actions, which control @{Wrapper.Client}s.
|
||||||
-- * @{#FSM_CONTROLLABLE}: Models Finite State Machines for @{Wrapper.Controllable}s, which are @{Wrapper.Group}s, @{Wrapper.Unit}s, @{Client}s.
|
-- * @{#FSM_CONTROLLABLE}: Models Finite State Machines for @{Wrapper.Controllable}s, which are @{Wrapper.Group}s, @{Wrapper.Unit}s, @{Wrapper.Client}s.
|
||||||
-- * @{#FSM_SET}: Models Finite State Machines for @{Set}s. Note that these FSMs control multiple objects!!! So State concerns here
|
-- * @{#FSM_SET}: Models Finite State Machines for @{Core.Set}s. Note that these FSMs control multiple objects!!! So State concerns here
|
||||||
-- for multiple objects or the position of the state machine in the process.
|
-- for multiple objects or the position of the state machine in the process.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
@@ -119,9 +119,9 @@ do -- FSM
|
|||||||
-- and tailored** by mission designers through **the implementation of Transition Handlers**.
|
-- and tailored** by mission designers through **the implementation of Transition Handlers**.
|
||||||
-- Each of these FSM implementation classes start either with:
|
-- Each of these FSM implementation classes start either with:
|
||||||
--
|
--
|
||||||
-- * an acronym **AI\_**, which indicates an FSM implementation directing **AI controlled** @{GROUP} and/or @{UNIT}. These AI\_ classes derive the @{#FSM_CONTROLLABLE} class.
|
-- * an acronym **AI\_**, which indicates an FSM implementation directing **AI controlled** @{Wrapper.Group#GROUP} and/or @{Wrapper.Unit#UNIT}. These AI\_ classes derive the @{#FSM_CONTROLLABLE} class.
|
||||||
-- * an acronym **TASK\_**, which indicates an FSM implementation executing a @{TASK} executed by Groups of players. These TASK\_ classes derive the @{#FSM_TASK} class.
|
-- * an acronym **TASK\_**, which indicates an FSM implementation executing a @{Tasking.Task#TASK} executed by Groups of players. These TASK\_ classes derive the @{#FSM_TASK} class.
|
||||||
-- * an acronym **ACT\_**, which indicates an Sub-FSM implementation, directing **Humans actions** that need to be done in a @{TASK}, seated in a @{CLIENT} (slot) or a @{UNIT} (CA join). These ACT\_ classes derive the @{#FSM_PROCESS} class.
|
-- * an acronym **ACT\_**, which indicates an Sub-FSM implementation, directing **Humans actions** that need to be done in a @{Tasking.Task#TASK}, seated in a @{Wrapper.Client#CLIENT} (slot) or a @{Wrapper.Unit#UNIT} (CA join). These ACT\_ classes derive the @{#FSM_PROCESS} class.
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
@@ -249,7 +249,7 @@ do -- FSM
|
|||||||
--
|
--
|
||||||
-- ### Linear Transition Example
|
-- ### Linear Transition Example
|
||||||
--
|
--
|
||||||
-- This example is fully implemented in the MOOSE test mission on GITHUB: [FSM-100 - Transition Explanation](https://github.com/FlightControl-Master/MOOSE/blob/master/Moose%20Test%20Missions/FSM%20-%20Finite%20State%20Machine/FSM-100%20-%20Transition%20Explanation/FSM-100%20-%20Transition%20Explanation.lua)
|
-- This example is fully implemented in the MOOSE test mission on GitHub: [FSM-100 - Transition Explanation](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Core/FSM/FSM-100%20-%20Transition%20Explanation)
|
||||||
--
|
--
|
||||||
-- It models a unit standing still near Batumi, and flaring every 5 seconds while switching between a Green flare and a Red flare.
|
-- It models a unit standing still near Batumi, and flaring every 5 seconds while switching between a Green flare and a Red flare.
|
||||||
-- The purpose of this example is not to show how exciting flaring is, but it demonstrates how a Linear Transition FSM can be build.
|
-- The purpose of this example is not to show how exciting flaring is, but it demonstrates how a Linear Transition FSM can be build.
|
||||||
@@ -418,7 +418,7 @@ do -- FSM
|
|||||||
return self._Transitions or {}
|
return self._Transitions or {}
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set the default @{Process} template with key ProcessName providing the ProcessClass and the process object when it is assigned to a @{Wrapper.Controllable} by the task.
|
--- Set the default @{#FSM_PROCESS} template with key ProcessName providing the ProcessClass and the process object when it is assigned to a @{Wrapper.Controllable} by the task.
|
||||||
-- @param #FSM self
|
-- @param #FSM self
|
||||||
-- @param #table From Can contain a string indicating the From state or a table of strings containing multiple From states.
|
-- @param #table From Can contain a string indicating the From state or a table of strings containing multiple From states.
|
||||||
-- @param #string Event The Event name.
|
-- @param #string Event The Event name.
|
||||||
@@ -953,7 +953,7 @@ do -- FSM_CONTROLLABLE
|
|||||||
-- @field Wrapper.Controllable#CONTROLLABLE Controllable
|
-- @field Wrapper.Controllable#CONTROLLABLE Controllable
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
--- Models Finite State Machines for @{Wrapper.Controllable}s, which are @{Wrapper.Group}s, @{Wrapper.Unit}s, @{Client}s.
|
--- Models Finite State Machines for @{Wrapper.Controllable}s, which are @{Wrapper.Group}s, @{Wrapper.Unit}s, @{Wrapper.Client}s.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -1086,7 +1086,7 @@ do -- FSM_PROCESS
|
|||||||
-- @field Tasking.Task#TASK Task
|
-- @field Tasking.Task#TASK Task
|
||||||
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
||||||
|
|
||||||
--- FSM_PROCESS class models Finite State Machines for @{Task} actions, which control @{Client}s.
|
--- FSM_PROCESS class models Finite State Machines for @{Tasking.Task} actions, which control @{Wrapper.Client}s.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -1241,7 +1241,7 @@ do -- FSM_PROCESS
|
|||||||
|
|
||||||
-- TODO: Need to check and fix that an FSM_PROCESS is only for a UNIT. Not for a GROUP.
|
-- TODO: Need to check and fix that an FSM_PROCESS is only for a UNIT. Not for a GROUP.
|
||||||
|
|
||||||
--- Send a message of the @{Task} to the Group of the Unit.
|
--- Send a message of the @{Tasking.Task} to the Group of the Unit.
|
||||||
-- @param #FSM_PROCESS self
|
-- @param #FSM_PROCESS self
|
||||||
function FSM_PROCESS:Message( Message )
|
function FSM_PROCESS:Message( Message )
|
||||||
self:F( { Message = Message } )
|
self:F( { Message = Message } )
|
||||||
@@ -1260,7 +1260,7 @@ do -- FSM_PROCESS
|
|||||||
|
|
||||||
--- Assign the process to a @{Wrapper.Unit} and activate the process.
|
--- Assign the process to a @{Wrapper.Unit} and activate the process.
|
||||||
-- @param #FSM_PROCESS self
|
-- @param #FSM_PROCESS self
|
||||||
-- @param Task.Tasking#TASK Task
|
-- @param Tasking.Task#TASK Task
|
||||||
-- @param Wrapper.Unit#UNIT ProcessUnit
|
-- @param Wrapper.Unit#UNIT ProcessUnit
|
||||||
-- @return #FSM_PROCESS self
|
-- @return #FSM_PROCESS self
|
||||||
function FSM_PROCESS:Assign( ProcessUnit, Task )
|
function FSM_PROCESS:Assign( ProcessUnit, Task )
|
||||||
@@ -1382,7 +1382,7 @@ do -- FSM_SET
|
|||||||
-- @field Core.Set#SET_BASE Set
|
-- @field Core.Set#SET_BASE Set
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
--- FSM_SET class models Finite State Machines for @{Set}s. Note that these FSMs control multiple objects!!! So State concerns here
|
--- FSM_SET class models Finite State Machines for @{Core.Set}s. Note that these FSMs control multiple objects!!! So State concerns here
|
||||||
-- for multiple objects or the position of the state machine in the process.
|
-- for multiple objects or the position of the state machine in the process.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
|
|||||||
@@ -1,17 +1,23 @@
|
|||||||
--- **Core** - MarkerOps_Base.
|
--- **Core** - Tap into markers added to the F10 map by users.
|
||||||
--
|
--
|
||||||
-- **Main Features:**
|
-- **Main Features:**
|
||||||
--
|
--
|
||||||
-- * Create an easy way to tap into markers added to the F10 map by users.
|
-- * Create an easy way to tap into markers added to the F10 map by users.
|
||||||
-- * Recognize own tag and list of keywords.
|
-- * Recognize own tag and list of keywords.
|
||||||
-- * Matched keywords are handed down to functions.
|
-- * Matched keywords are handed down to functions.
|
||||||
|
-- ##Listen for your tag
|
||||||
|
-- myMarker = MARKEROPS_BASE:New("tag", {}, false)
|
||||||
|
-- function myMarker:OnAfterMarkChanged(From, Event, To, Text, Keywords, Coord, idx)
|
||||||
|
--
|
||||||
|
-- end
|
||||||
|
-- Make sure to use the "MarkChanged" event as "MarkAdded" comes in right after the user places a blank marker and your callback will never be called.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **Applevangelist**
|
-- ### Author: **Applevangelist**
|
||||||
--
|
--
|
||||||
-- Date: 5 May 2021
|
-- Date: 5 May 2021
|
||||||
-- Last Update: Sep 2022
|
-- Last Update: Feb 2023
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
---
|
---
|
||||||
@@ -44,7 +50,7 @@ MARKEROPS_BASE = {
|
|||||||
ClassName = "MARKEROPS",
|
ClassName = "MARKEROPS",
|
||||||
Tag = "mytag",
|
Tag = "mytag",
|
||||||
Keywords = {},
|
Keywords = {},
|
||||||
version = "0.1.0",
|
version = "0.1.1",
|
||||||
debug = false,
|
debug = false,
|
||||||
Casesensitive = true,
|
Casesensitive = true,
|
||||||
}
|
}
|
||||||
@@ -118,7 +124,8 @@ function MARKEROPS_BASE:New(Tagname,Keywords,Casesensitive)
|
|||||||
-- @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 idx DCS Marker ID
|
||||||
|
|
||||||
--- 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
|
||||||
-- @param #MARKEROPS_BASE self
|
-- @param #MARKEROPS_BASE self
|
||||||
@@ -166,7 +173,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)
|
self:MarkChanged(Eventtext,matchtable,coord,Event.idx)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif Event.id==world.event.S_EVENT_MARK_REMOVED then
|
elseif Event.id==world.event.S_EVENT_MARK_REMOVED then
|
||||||
|
|||||||
@@ -513,7 +513,7 @@ do -- MENU_COALITION
|
|||||||
--- @type MENU_COALITION
|
--- @type MENU_COALITION
|
||||||
-- @extends Core.Menu#MENU_BASE
|
-- @extends Core.Menu#MENU_BASE
|
||||||
|
|
||||||
--- Manages the main menus for @{DCS.coalition}s.
|
--- Manages the main menus for DCS.coalition.
|
||||||
--
|
--
|
||||||
-- You can add menus with the @{#MENU_COALITION.New} method, which constructs a MENU_COALITION object and returns you the object reference.
|
-- You can add menus with the @{#MENU_COALITION.New} method, which constructs a MENU_COALITION object and returns you the object reference.
|
||||||
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_COALITION.Remove}.
|
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_COALITION.Remove}.
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
--
|
--
|
||||||
-- Messages are sent:
|
-- Messages are sent:
|
||||||
--
|
--
|
||||||
-- * To a @{Client} using @{#MESSAGE.ToClient}().
|
-- * To a @{Wrapper.Client} using @{#MESSAGE.ToClient}().
|
||||||
-- * To a @{Wrapper.Group} using @{#MESSAGE.ToGroup}()
|
-- * To a @{Wrapper.Group} using @{#MESSAGE.ToGroup}()
|
||||||
-- * To a @{Wrapper.Unit} using @{#MESSAGE.ToUnit}()
|
-- * To a @{Wrapper.Unit} using @{#MESSAGE.ToUnit}()
|
||||||
-- * To a coalition using @{#MESSAGE.ToCoalition}().
|
-- * To a coalition using @{#MESSAGE.ToCoalition}().
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
-- ### Contributions:
|
-- ### Contributions: **Applevangelist**
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -73,7 +73,7 @@ MESSAGE.Type = {
|
|||||||
Detailed = "Detailed Report",
|
Detailed = "Detailed Report",
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Creates a new MESSAGE object. Note that these MESSAGE objects are not yet displayed on the display panel. You must use the functions @{ToClient} or @{ToCoalition} or @{ToAll} to send these Messages to the respective recipients.
|
--- 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 MessageText 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 MessageDuration is a number in seconds of how long the MESSAGE should be shown on the display panel.
|
||||||
@@ -98,7 +98,7 @@ function MESSAGE:New( MessageText, MessageDuration, MessageCategory, ClearScreen
|
|||||||
|
|
||||||
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 MessageCategory and MessageCategory ~= "" then
|
||||||
if MessageCategory:sub( -1 ) ~= "\n" then
|
if MessageCategory:sub( -1 ) ~= "\n" then
|
||||||
self.MessageCategory = MessageCategory .. ": "
|
self.MessageCategory = MessageCategory .. ": "
|
||||||
@@ -127,8 +127,8 @@ end
|
|||||||
|
|
||||||
--- Creates a new MESSAGE object of a certain type.
|
--- Creates a new MESSAGE object of a certain type.
|
||||||
-- Note that these MESSAGE objects are not yet displayed on the display panel.
|
-- Note that these MESSAGE objects are not yet displayed on the display panel.
|
||||||
-- You must use the functions @{ToClient} or @{ToCoalition} or @{ToAll} to send these Messages to the respective recipients.
|
-- You must use the functions @{Core.Message#ToClient} or @{Core.Message#ToCoalition} or @{Core.Message#ToAll} to send these Messages to the respective recipients.
|
||||||
-- The message display times are automatically defined based on the timing settings in the @{Settings} menu.
|
-- The message display times are automatically defined based on the timing settings in the @{Core.Settings} menu.
|
||||||
-- @param self
|
-- @param self
|
||||||
-- @param #string MessageText is the text of the Message.
|
-- @param #string MessageText is the text of the Message.
|
||||||
-- @param #MESSAGE.Type MessageType The type of the message.
|
-- @param #MESSAGE.Type MessageType The type of the message.
|
||||||
@@ -171,7 +171,7 @@ end
|
|||||||
--- Sends a MESSAGE to a Client Group. Note that the Group needs to be defined within the ME with the skillset "Client" or "Player".
|
--- Sends a MESSAGE to a Client Group. Note that the Group needs to be defined within the ME with the skillset "Client" or "Player".
|
||||||
-- @param #MESSAGE self
|
-- @param #MESSAGE self
|
||||||
-- @param Wrapper.Client#CLIENT Client is the Group of the Client.
|
-- @param Wrapper.Client#CLIENT Client is the Group of the Client.
|
||||||
-- @param Core.Settings#SETTINGS Settings Settings used to display the message.
|
-- @param Core.Settings#SETTINGS Settings used to display the message.
|
||||||
-- @return #MESSAGE
|
-- @return #MESSAGE
|
||||||
-- @usage
|
-- @usage
|
||||||
--
|
--
|
||||||
@@ -182,11 +182,11 @@ end
|
|||||||
-- 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", "Score", 25, "Score" ):ToClient( ClientGroup )
|
||||||
-- 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", "Score", 25, "Score" ):ToClient( ClientGroup )
|
||||||
-- or
|
-- or
|
||||||
-- MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25, "Score" ):ToClient( ClientGroup )
|
-- MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25 ):ToClient( ClientGroup )
|
||||||
-- MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25, "Score" ):ToClient( ClientGroup )
|
-- MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25 ):ToClient( ClientGroup )
|
||||||
-- or
|
-- or
|
||||||
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25, "Score" )
|
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25 )
|
||||||
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25, "Score" )
|
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25 )
|
||||||
-- MessageClient1:ToClient( ClientGroup )
|
-- MessageClient1:ToClient( ClientGroup )
|
||||||
-- MessageClient2:ToClient( ClientGroup )
|
-- MessageClient2:ToClient( ClientGroup )
|
||||||
--
|
--
|
||||||
@@ -204,19 +204,20 @@ function MESSAGE:ToClient( Client, Settings )
|
|||||||
local Unit = Client:GetClient()
|
local Unit = Client:GetClient()
|
||||||
|
|
||||||
if self.MessageDuration ~= 0 then
|
if self.MessageDuration ~= 0 then
|
||||||
local ClientGroupID = Client:GetClientGroupID()
|
local ClientGroupID = Client:GetClientGroupID()
|
||||||
self:T( self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration )
|
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.outTextForGroup( ClientGroupID, self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration , self.ClearScreen)
|
||||||
trigger.action.outTextForUnit( Unit:GetID(), self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration , self.ClearScreen)
|
trigger.action.outTextForUnit( Unit:GetID(), self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration , self.ClearScreen)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Sends a MESSAGE to a Group.
|
--- Sends a MESSAGE to a Group.
|
||||||
-- @param #MESSAGE self
|
-- @param #MESSAGE self
|
||||||
-- @param Wrapper.Group#GROUP Group to which the message is displayed.
|
-- @param Wrapper.Group#GROUP Group to which the message is displayed.
|
||||||
|
-- @param Core.Settings#Settings Settings (Optional) Settings for message display.
|
||||||
-- @return #MESSAGE Message object.
|
-- @return #MESSAGE Message object.
|
||||||
function MESSAGE:ToGroup( Group, Settings )
|
function MESSAGE:ToGroup( Group, Settings )
|
||||||
self:F( Group.GroupName )
|
self:F( Group.GroupName )
|
||||||
@@ -241,6 +242,7 @@ end
|
|||||||
--- Sends a MESSAGE to a Unit.
|
--- Sends a MESSAGE to a Unit.
|
||||||
-- @param #MESSAGE self
|
-- @param #MESSAGE self
|
||||||
-- @param Wrapper.Unit#UNIT Unit to which the message is displayed.
|
-- @param Wrapper.Unit#UNIT Unit to which the message is displayed.
|
||||||
|
-- @param Core.Settings#Settings Settings (Optional) Settings for message display.
|
||||||
-- @return #MESSAGE Message object.
|
-- @return #MESSAGE Message object.
|
||||||
function MESSAGE:ToUnit( Unit, Settings )
|
function MESSAGE:ToUnit( Unit, Settings )
|
||||||
self:F( Unit.IdentifiableName )
|
self:F( Unit.IdentifiableName )
|
||||||
@@ -262,27 +264,38 @@ function MESSAGE:ToUnit( Unit, Settings )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Sends a MESSAGE to a Unit.
|
--- Sends a MESSAGE to a Country.
|
||||||
-- @param #MESSAGE self
|
-- @param #MESSAGE self
|
||||||
-- @param Wrapper.Unit#UNIT Unit to which the message is displayed.
|
-- @param #number Country to which the message is displayed, e.g. country.id.GERMANY. For all country numbers see here: [Hoggit Wiki](https://wiki.hoggitworld.com/view/DCS_enum_country)
|
||||||
|
-- @param Core.Settings#Settings Settings (Optional) Settings for message display.
|
||||||
-- @return #MESSAGE Message object.
|
-- @return #MESSAGE Message object.
|
||||||
function MESSAGE:ToUnit( Unit, Settings )
|
function MESSAGE:ToCountry( Country, Settings )
|
||||||
self:F( Unit.IdentifiableName )
|
self:F(Country )
|
||||||
|
if Country then
|
||||||
if Unit 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 _SETTINGS -- Core.Settings#SETTINGS
|
||||||
self.MessageDuration = Settings:GetMessageTime( self.MessageType )
|
self.MessageDuration = Settings:GetMessageTime( self.MessageType )
|
||||||
self.MessageCategory = "" -- self.MessageType .. ": "
|
self.MessageCategory = "" -- self.MessageType .. ": "
|
||||||
end
|
end
|
||||||
|
|
||||||
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 )
|
||||||
trigger.action.outTextForUnit( Unit:GetID(), self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration, self.ClearScreen )
|
trigger.action.outTextForCountry( Country, self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration, self.ClearScreen )
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Sends a MESSAGE to a Country.
|
||||||
|
-- @param #MESSAGE self
|
||||||
|
-- @param #number Country to which the message is displayed, , e.g. country.id.GERMANY. For all country numbers see here: [Hoggit Wiki](https://wiki.hoggitworld.com/view/DCS_enum_country)
|
||||||
|
-- @param #boolean Condition Sends the message only if the condition is true.
|
||||||
|
-- @param Core.Settings#Settings Settings (Optional) Settings for message display.
|
||||||
|
-- @return #MESSAGE Message object.
|
||||||
|
function MESSAGE:ToCountryIf( Country, Condition, Settings )
|
||||||
|
self:F(Country )
|
||||||
|
if Country and Condition == true then
|
||||||
|
self:ToCountry( Country, Settings )
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -292,11 +305,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, "Score" ):ToBlue()
|
-- MessageBLUE = MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", "Penalty", 25):ToBlue()
|
||||||
-- or
|
-- or
|
||||||
-- MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ):ToBlue()
|
-- MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 ):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, "Score" )
|
-- MessageBLUE = MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 )
|
||||||
-- MessageBLUE:ToBlue()
|
-- MessageBLUE:ToBlue()
|
||||||
--
|
--
|
||||||
function MESSAGE:ToBlue()
|
function MESSAGE:ToBlue()
|
||||||
@@ -313,11 +326,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, "Score" ):ToRed()
|
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 ):ToRed()
|
||||||
-- or
|
-- or
|
||||||
-- MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ):ToRed()
|
-- MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 ):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, "Score" )
|
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 )
|
||||||
-- MessageRED:ToRed()
|
-- MessageRED:ToRed()
|
||||||
--
|
--
|
||||||
function MESSAGE:ToRed()
|
function MESSAGE:ToRed()
|
||||||
@@ -330,17 +343,17 @@ end
|
|||||||
|
|
||||||
--- Sends a MESSAGE to a Coalition.
|
--- Sends a MESSAGE to a Coalition.
|
||||||
-- @param #MESSAGE self
|
-- @param #MESSAGE self
|
||||||
-- @param #DCS.coalition.side CoalitionSide @{#DCS.coalition.side} to which the message is displayed.
|
-- @param DCS#coalition.side CoalitionSide @{#DCS.coalition.side} to which the message is displayed.
|
||||||
-- @param Core.Settings#SETTINGS Settings (Optional) Settings for message display.
|
-- @param Core.Settings#SETTINGS Settings (Optional) Settings for message display.
|
||||||
-- @return #MESSAGE Message object.
|
-- @return #MESSAGE Message object.
|
||||||
-- @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, "Score" ):ToCoalition( coalition.side.RED )
|
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 ):ToCoalition( coalition.side.RED )
|
||||||
-- or
|
-- or
|
||||||
-- MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ):ToCoalition( coalition.side.RED )
|
-- MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 ):ToCoalition( coalition.side.RED )
|
||||||
-- or
|
-- or
|
||||||
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" )
|
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 )
|
||||||
-- MessageRED:ToCoalition( coalition.side.RED )
|
-- MessageRED:ToCoalition( coalition.side.RED )
|
||||||
--
|
--
|
||||||
function MESSAGE:ToCoalition( CoalitionSide, Settings )
|
function MESSAGE:ToCoalition( CoalitionSide, Settings )
|
||||||
@@ -355,16 +368,18 @@ function MESSAGE:ToCoalition( CoalitionSide, Settings )
|
|||||||
if CoalitionSide then
|
if CoalitionSide then
|
||||||
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 )
|
||||||
trigger.action.outTextForCoalition( CoalitionSide, self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ), self.MessageDuration, self.ClearScreen )
|
trigger.action.outTextForCoalition( CoalitionSide, self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ), self.MessageDuration, self.ClearScreen )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
self.CoalitionSide = CoalitionSide
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Sends a MESSAGE to a Coalition if the given Condition is true.
|
--- Sends a MESSAGE to a Coalition if the given Condition is true.
|
||||||
-- @param #MESSAGE self
|
-- @param #MESSAGE self
|
||||||
-- @param CoalitionSide needs to be filled out by the defined structure of the standard scripting engine @{coalition.side}.
|
-- @param CoalitionSide needs to be filled out by the defined structure of the standard scripting engine @{#DCS.coalition.side}.
|
||||||
-- @param #boolean Condition Sends the message only if the condition is true.
|
-- @param #boolean Condition Sends the message only if the condition is true.
|
||||||
-- @return #MESSAGE self
|
-- @return #MESSAGE self
|
||||||
function MESSAGE:ToCoalitionIf( CoalitionSide, Condition )
|
function MESSAGE:ToCoalitionIf( CoalitionSide, Condition )
|
||||||
@@ -384,11 +399,11 @@ end
|
|||||||
-- @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, "Win" ):ToAll()
|
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25 ):ToAll()
|
||||||
-- or
|
-- or
|
||||||
-- MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25, "Win" ):ToAll()
|
-- MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25 ):ToAll()
|
||||||
-- or
|
-- or
|
||||||
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25, "Win" )
|
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25 )
|
||||||
-- MessageAll:ToAll()
|
-- MessageAll:ToAll()
|
||||||
--
|
--
|
||||||
function MESSAGE:ToAll( Settings )
|
function MESSAGE:ToAll( Settings )
|
||||||
@@ -410,6 +425,7 @@ end
|
|||||||
|
|
||||||
--- Sends a MESSAGE to all players if the given Condition is true.
|
--- Sends a MESSAGE to all players if the given Condition is true.
|
||||||
-- @param #MESSAGE self
|
-- @param #MESSAGE self
|
||||||
|
-- @param #boolean Condition
|
||||||
-- @return #MESSAGE
|
-- @return #MESSAGE
|
||||||
function MESSAGE:ToAllIf( Condition )
|
function MESSAGE:ToAllIf( Condition )
|
||||||
|
|
||||||
@@ -419,3 +435,190 @@ function MESSAGE:ToAllIf( Condition )
|
|||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Sends a MESSAGE to DCS log file.
|
||||||
|
-- @param #MESSAGE self
|
||||||
|
-- @return #MESSAGE self
|
||||||
|
function MESSAGE:ToLog()
|
||||||
|
|
||||||
|
env.info(self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ))
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Sends a MESSAGE to DCS log file if the given Condition is true.
|
||||||
|
-- @param #MESSAGE self
|
||||||
|
-- @return #MESSAGE self
|
||||||
|
function MESSAGE:ToLogIf( Condition )
|
||||||
|
|
||||||
|
if Condition and Condition == true then
|
||||||
|
env.info(self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ))
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
_MESSAGESRS = {}
|
||||||
|
|
||||||
|
--- Set up MESSAGE generally to allow Text-To-Speech via SRS and TTS functions. `SetMSRS()` will try to use as many attributes configured with @{Sound.SRS#MSRS.LoadConfigFile}() as possible.
|
||||||
|
-- @param #string PathToSRS (optional) Path to SRS Folder, defaults to "C:\\\\Program Files\\\\DCS-SimpleRadio-Standalone" or your configuration file setting.
|
||||||
|
-- @param #number Port Port (optional) number of SRS, defaults to 5002 or your configuration file setting.
|
||||||
|
-- @param #string PathToCredentials (optional) Path to credentials file for Google.
|
||||||
|
-- @param #number Frequency Frequency in MHz. Can also be given as a #table of frequencies.
|
||||||
|
-- @param #number Modulation Modulation, i.e. radio.modulation.AM or radio.modulation.FM. Can also be given as a #table of modulations.
|
||||||
|
-- @param #string Gender (optional) Gender, i.e. "male" or "female", defaults to "female" or your configuration file setting.
|
||||||
|
-- @param #string Culture (optional) Culture, e.g. "en-US", defaults to "en-GB" or your configuration file setting.
|
||||||
|
-- @param #string Voice (optional) Voice. Will override gender and culture settings, e.g. MSRS.Voices.Microsoft.Hazel or MSRS.Voices.Google.Standard.de_DE_Standard_D. Hint on Microsoft voices - working voices are limited to Hedda, Hazel, David, Zira and Hortense. **Must** be installed on your Desktop or Server!
|
||||||
|
-- @param #number Coalition (optional) Coalition, can be coalition.side.RED, coalition.side.BLUE or coalition.side.NEUTRAL. Defaults to coalition.side.NEUTRAL.
|
||||||
|
-- @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 Core.Point#COORDINATE Coordinate (optional) Coordinate this messages originates from.
|
||||||
|
-- @usage
|
||||||
|
-- -- Mind the dot here, not using the colon this time around!
|
||||||
|
-- -- Needed once only
|
||||||
|
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.BLUE)
|
||||||
|
-- -- later on in your code
|
||||||
|
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRS()
|
||||||
|
--
|
||||||
|
function MESSAGE.SetMSRS(PathToSRS,Port,PathToCredentials,Frequency,Modulation,Gender,Culture,Voice,Coalition,Volume,Label,Coordinate)
|
||||||
|
|
||||||
|
_MESSAGESRS.PathToSRS = PathToSRS or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
||||||
|
|
||||||
|
_MESSAGESRS.frequency = Frequency or MSRS.frequencies or 243
|
||||||
|
_MESSAGESRS.modulation = Modulation or MSRS.modulations or radio.modulation.AM
|
||||||
|
|
||||||
|
_MESSAGESRS.MSRS = MSRS:New(_MESSAGESRS.PathToSRS,_MESSAGESRS.frequency, _MESSAGESRS.modulation)
|
||||||
|
|
||||||
|
_MESSAGESRS.coalition = Coalition or MSRS.coalition or coalition.side.NEUTRAL
|
||||||
|
_MESSAGESRS.MSRS:SetCoalition(_MESSAGESRS.coalition)
|
||||||
|
|
||||||
|
_MESSAGESRS.coordinate = Coordinate
|
||||||
|
|
||||||
|
if Coordinate then
|
||||||
|
_MESSAGESRS.MSRS:SetCoordinate(Coordinate)
|
||||||
|
end
|
||||||
|
|
||||||
|
_MESSAGESRS.Culture = Culture or MSRS.culture or "en-GB"
|
||||||
|
_MESSAGESRS.MSRS:SetCulture(Culture)
|
||||||
|
|
||||||
|
_MESSAGESRS.Gender = Gender or MSRS.gender or "female"
|
||||||
|
_MESSAGESRS.MSRS:SetGender(Gender)
|
||||||
|
|
||||||
|
if PathToCredentials then
|
||||||
|
_MESSAGESRS.MSRS:SetProviderOptionsGoogle(PathToCredentials)
|
||||||
|
_MESSAGESRS.MSRS:SetProvider(MSRS.Provider.GOOGLE)
|
||||||
|
end
|
||||||
|
|
||||||
|
_MESSAGESRS.label = Label or MSRS.Label or "MESSAGE"
|
||||||
|
_MESSAGESRS.MSRS:SetLabel(Label or "MESSAGE")
|
||||||
|
|
||||||
|
_MESSAGESRS.port = Port or MSRS.port or 5002
|
||||||
|
_MESSAGESRS.MSRS:SetPort(Port or 5002)
|
||||||
|
|
||||||
|
_MESSAGESRS.volume = Volume or MSRS.volume or 1
|
||||||
|
_MESSAGESRS.MSRS:SetVolume(_MESSAGESRS.volume)
|
||||||
|
|
||||||
|
if Voice then _MESSAGESRS.MSRS:SetVoice(Voice) end
|
||||||
|
|
||||||
|
_MESSAGESRS.voice = Voice or MSRS.voice --or MSRS.Voices.Microsoft.Hedda
|
||||||
|
|
||||||
|
_MESSAGESRS.SRSQ = MSRSQUEUE:New(_MESSAGESRS.label)
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Sends a message via SRS. `ToSRS()` will try to use as many attributes configured with @{Core.Message#MESSAGE.SetMSRS}() and @{Sound.SRS#MSRS.LoadConfigFile}() as possible.
|
||||||
|
-- @param #MESSAGE self
|
||||||
|
-- @param #number frequency (optional) Frequency in MHz. Can also be given as a #table of frequencies. Only needed if you want to override defaults set with `MESSAGE.SetMSRS()` for this one setting.
|
||||||
|
-- @param #number modulation (optional) Modulation, i.e. radio.modulation.AM or radio.modulation.FM. Can also be given as a #table of modulations. Only needed if you want to override defaults set with `MESSAGE.SetMSRS()` for this one setting.
|
||||||
|
-- @param #string gender (optional) Gender, i.e. "male" or "female". Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
||||||
|
-- @param #string culture (optional) Culture, e.g. "en-US". Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
||||||
|
-- @param #string voice (optional) Voice. Will override gender and culture settings. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
||||||
|
-- @param #number coalition (optional) Coalition, can be coalition.side.RED, coalition.side.BLUE or coalition.side.NEUTRAL. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
||||||
|
-- @param #number volume (optional) Volume, can be between 0.0 and 1.0 (loudest). Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
||||||
|
-- @param Core.Point#COORDINATE coordinate (optional) Coordinate this messages originates from. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
||||||
|
-- @return #MESSAGE self
|
||||||
|
-- @usage
|
||||||
|
-- -- Mind the dot here, not using the colon this time around!
|
||||||
|
-- -- Needed once only
|
||||||
|
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.BLUE)
|
||||||
|
-- -- later on in your code
|
||||||
|
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRS()
|
||||||
|
--
|
||||||
|
function MESSAGE:ToSRS(frequency,modulation,gender,culture,voice,coalition,volume,coordinate)
|
||||||
|
local tgender = gender or _MESSAGESRS.Gender
|
||||||
|
if _MESSAGESRS.SRSQ then
|
||||||
|
if voice then
|
||||||
|
_MESSAGESRS.MSRS:SetVoice(voice or _MESSAGESRS.voice)
|
||||||
|
end
|
||||||
|
if coordinate then
|
||||||
|
_MESSAGESRS.MSRS:SetCoordinate(coordinate)
|
||||||
|
end
|
||||||
|
local category = string.gsub(self.MessageCategory,":","")
|
||||||
|
_MESSAGESRS.SRSQ:NewTransmission(self.MessageText,nil,_MESSAGESRS.MSRS,0.5,1,nil,nil,nil,frequency or _MESSAGESRS.frequency,modulation or _MESSAGESRS.modulation, gender or _MESSAGESRS.Gender,culture or _MESSAGESRS.Culture,nil,volume or _MESSAGESRS.volume,category,coordinate or _MESSAGESRS.coordinate)
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Sends a message via SRS on the blue coalition side.
|
||||||
|
-- @param #MESSAGE self
|
||||||
|
-- @param #number frequency (optional) Frequency in MHz. Can also be given as a #table of frequencies. Only needed if you want to override defaults set with `MESSAGE.SetMSRS()` for this one setting.
|
||||||
|
-- @param #number modulation (optional) Modulation, i.e. radio.modulation.AM or radio.modulation.FM. Can also be given as a #table of modulations. Only needed if you want to override defaults set with `MESSAGE.SetMSRS()` for this one setting.
|
||||||
|
-- @param #string gender (optional) Gender, i.e. "male" or "female". Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
||||||
|
-- @param #string culture (optional) Culture, e.g. "en-US. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
||||||
|
-- @param #string voice (optional) Voice. Will override gender and culture settings. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
||||||
|
-- @param #number volume (optional) Volume, can be between 0.0 and 1.0 (loudest). Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
||||||
|
-- @param Core.Point#COORDINATE coordinate (optional) Coordinate this messages originates from. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
||||||
|
-- @return #MESSAGE self
|
||||||
|
-- @usage
|
||||||
|
-- -- Mind the dot here, not using the colon this time around!
|
||||||
|
-- -- Needed once only
|
||||||
|
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.BLUE)
|
||||||
|
-- -- later on in your code
|
||||||
|
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRSBlue()
|
||||||
|
--
|
||||||
|
function MESSAGE:ToSRSBlue(frequency,modulation,gender,culture,voice,volume,coordinate)
|
||||||
|
self:ToSRS(frequency,modulation,gender,culture,voice,coalition.side.BLUE,volume,coordinate)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Sends a message via SRS on the red coalition side.
|
||||||
|
-- @param #MESSAGE self
|
||||||
|
-- @param #number frequency (optional) Frequency in MHz. Can also be given as a #table of frequencies. Only needed if you want to override defaults set with `MESSAGE.SetMSRS()` for this one setting.
|
||||||
|
-- @param #number modulation (optional) Modulation, i.e. radio.modulation.AM or radio.modulation.FM. Can also be given as a #table of modulations. Only needed if you want to override defaults set with `MESSAGE.SetMSRS()` for this one setting.
|
||||||
|
-- @param #string gender (optional) Gender, i.e. "male" or "female". Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
||||||
|
-- @param #string culture (optional) Culture, e.g. "en-US. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
||||||
|
-- @param #string voice (optional) Voice. Will override gender and culture settings. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
||||||
|
-- @param #number volume (optional) Volume, can be between 0.0 and 1.0 (loudest). Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
||||||
|
-- @param Core.Point#COORDINATE coordinate (optional) Coordinate this messages originates from. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
||||||
|
-- @return #MESSAGE self
|
||||||
|
-- @usage
|
||||||
|
-- -- Mind the dot here, not using the colon this time around!
|
||||||
|
-- -- Needed once only
|
||||||
|
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.RED)
|
||||||
|
-- -- later on in your code
|
||||||
|
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRSRed()
|
||||||
|
--
|
||||||
|
function MESSAGE:ToSRSRed(frequency,modulation,gender,culture,voice,volume,coordinate)
|
||||||
|
self:ToSRS(frequency,modulation,gender,culture,voice,coalition.side.RED,volume,coordinate)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Sends a message via SRS to all - via the neutral coalition side.
|
||||||
|
-- @param #MESSAGE self
|
||||||
|
-- @param #number frequency (optional) Frequency in MHz. Can also be given as a #table of frequencies. Only needed if you want to override defaults set with `MESSAGE.SetMSRS()` for this one setting.
|
||||||
|
-- @param #number modulation (optional) Modulation, i.e. radio.modulation.AM or radio.modulation.FM. Can also be given as a #table of modulations. Only needed if you want to override defaults set with `MESSAGE.SetMSRS()` for this one setting.
|
||||||
|
-- @param #string gender (optional) Gender, i.e. "male" or "female". Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
||||||
|
-- @param #string culture (optional) Culture, e.g. "en-US. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
||||||
|
-- @param #string voice (optional) Voice. Will override gender and culture settings. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
||||||
|
-- @param #number volume (optional) Volume, can be between 0.0 and 1.0 (loudest). Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
||||||
|
-- @param Core.Point#COORDINATE coordinate (optional) Coordinate this messages originates from. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
||||||
|
-- @return #MESSAGE self
|
||||||
|
-- @usage
|
||||||
|
-- -- Mind the dot here, not using the colon this time around!
|
||||||
|
-- -- Needed once only
|
||||||
|
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.NEUTRAL)
|
||||||
|
-- -- later on in your code
|
||||||
|
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRSAll()
|
||||||
|
--
|
||||||
|
function MESSAGE:ToSRSAll(frequency,modulation,gender,culture,voice,volume,coordinate)
|
||||||
|
self:ToSRS(frequency,modulation,gender,culture,voice,coalition.side.NEUTRAL,volume,coordinate)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|||||||
370
Moose Development/Moose/Core/Pathline.lua
Normal file
370
Moose Development/Moose/Core/Pathline.lua
Normal file
@@ -0,0 +1,370 @@
|
|||||||
|
--- **Core** - Path from A to B.
|
||||||
|
--
|
||||||
|
-- **Main Features:**
|
||||||
|
--
|
||||||
|
-- * Path from A to B
|
||||||
|
-- * Arbitrary number of points
|
||||||
|
-- * Automatically from lines drawtool
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
|
--
|
||||||
|
-- ### Author: **funkyfranky**
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
|
-- @module Core.Pathline
|
||||||
|
-- @image CORE_Pathline.png
|
||||||
|
|
||||||
|
|
||||||
|
--- PATHLINE class.
|
||||||
|
-- @type PATHLINE
|
||||||
|
-- @field #string ClassName Name of the class.
|
||||||
|
-- @field #string lid Class id string for output to DCS log file.
|
||||||
|
-- @field #string name Name of the path line.
|
||||||
|
-- @field #table points List of 3D points defining the path.
|
||||||
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
|
--- *The shortest distance between two points is a straight line.* -- Archimedes
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
|
--
|
||||||
|
-- # The PATHLINE Concept
|
||||||
|
--
|
||||||
|
-- List of points defining a path from A to B. The pathline can consist of multiple points. Each point holds the information of its position, the surface type, the land height
|
||||||
|
-- and the water depth (if over sea).
|
||||||
|
--
|
||||||
|
-- Line drawings created in the mission editor are automatically registered as pathlines and stored in the MOOSE database.
|
||||||
|
-- They can be accessed with the @{#PATHLINE.FindByName) function.
|
||||||
|
--
|
||||||
|
-- # Constructor
|
||||||
|
--
|
||||||
|
-- The @{PATHLINE.New) function creates a new PATHLINE object. This does not hold any points. Points can be added with the @{#PATHLINE.AddPointFromVec2} and @{#PATHLINE.AddPointFromVec3}
|
||||||
|
--
|
||||||
|
-- For a given table of 2D or 3D positions, a new PATHLINE object can be created with the @{#PATHLINE.NewFromVec2Array} or @{#PATHLINE.NewFromVec3Array}, respectively.
|
||||||
|
--
|
||||||
|
-- # Line Drawings
|
||||||
|
--
|
||||||
|
-- The most convenient way to create a pathline is the draw panel feature in the DCS mission editor. You can select "Line" and then "Segments", "Segment" or "Free" to draw your lines.
|
||||||
|
-- These line drawings are then automatically added to the MOOSE database as PATHLINE objects and can be retrieved with the @{#PATHLINE.FindByName) function, where the name is the one
|
||||||
|
-- you specify in the draw panel.
|
||||||
|
--
|
||||||
|
-- # Mark on F10 map
|
||||||
|
--
|
||||||
|
-- The ponints of the PATHLINE can be marked on the F10 map with the @{#PATHLINE.MarkPoints}(`true`) function. The mark points contain information of the surface type, land height and
|
||||||
|
-- water depth.
|
||||||
|
--
|
||||||
|
-- To remove the marks, use @{#PATHLINE.MarkPoints}(`false`).
|
||||||
|
--
|
||||||
|
-- @field #PATHLINE
|
||||||
|
PATHLINE = {
|
||||||
|
ClassName = "PATHLINE",
|
||||||
|
lid = nil,
|
||||||
|
points = {},
|
||||||
|
}
|
||||||
|
|
||||||
|
--- Point of line.
|
||||||
|
-- @type PATHLINE.Point
|
||||||
|
-- @field DCS#Vec3 vec3 3D position.
|
||||||
|
-- @field DCS#Vec2 vec2 2D position.
|
||||||
|
-- @field #number surfaceType Surface type.
|
||||||
|
-- @field #number landHeight Land height in meters.
|
||||||
|
-- @field #number depth Water depth in meters.
|
||||||
|
-- @field #number markerID Marker ID.
|
||||||
|
|
||||||
|
|
||||||
|
--- PATHLINE class version.
|
||||||
|
-- @field #string version
|
||||||
|
PATHLINE.version="0.1.0"
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
-- TODO list
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- TODO: A lot...
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
-- Constructor
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
--- Create a new PATHLINE object. Points need to be added later.
|
||||||
|
-- @param #PATHLINE self
|
||||||
|
-- @param #string Name Name of the path.
|
||||||
|
-- @return #PATHLINE self
|
||||||
|
function PATHLINE:New(Name)
|
||||||
|
|
||||||
|
-- Inherit everything from INTEL class.
|
||||||
|
local self=BASE:Inherit(self, BASE:New()) --#PATHLINE
|
||||||
|
|
||||||
|
self.name=Name or "Unknown Path"
|
||||||
|
|
||||||
|
self.lid=string.format("PATHLINE %s | ", Name)
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Create a new PATHLINE object from a given list of 2D points.
|
||||||
|
-- @param #PATHLINE self
|
||||||
|
-- @param #string Name Name of the pathline.
|
||||||
|
-- @param #table Vec2Array List of DCS#Vec2 points.
|
||||||
|
-- @return #PATHLINE self
|
||||||
|
function PATHLINE:NewFromVec2Array(Name, Vec2Array)
|
||||||
|
|
||||||
|
local self=PATHLINE:New(Name)
|
||||||
|
|
||||||
|
for i=1,#Vec2Array do
|
||||||
|
self:AddPointFromVec2(Vec2Array[i])
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Create a new PATHLINE object from a given list of 3D points.
|
||||||
|
-- @param #PATHLINE self
|
||||||
|
-- @param #string Name Name of the pathline.
|
||||||
|
-- @param #table Vec3Array List of DCS#Vec3 points.
|
||||||
|
-- @return #PATHLINE self
|
||||||
|
function PATHLINE:NewFromVec3Array(Name, Vec3Array)
|
||||||
|
|
||||||
|
local self=PATHLINE:New(Name)
|
||||||
|
|
||||||
|
for i=1,#Vec3Array do
|
||||||
|
self:AddPointFromVec3(Vec3Array[i])
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
-- User functions
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
--- Find a pathline in the database.
|
||||||
|
-- @param #PATHLINE self
|
||||||
|
-- @param #string Name The name of the pathline.
|
||||||
|
-- @return #PATHLINE self
|
||||||
|
function PATHLINE:FindByName(Name)
|
||||||
|
local pathline = _DATABASE:FindPathline(Name)
|
||||||
|
return pathline
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--- Add a point to the path from a given 2D position. The third dimension is determined from the land height.
|
||||||
|
-- @param #PATHLINE self
|
||||||
|
-- @param DCS#Vec2 Vec2 The 2D vector (x,y) to add.
|
||||||
|
-- @return #PATHLINE self
|
||||||
|
function PATHLINE:AddPointFromVec2(Vec2)
|
||||||
|
|
||||||
|
if Vec2 then
|
||||||
|
|
||||||
|
local point=self:_CreatePoint(Vec2)
|
||||||
|
|
||||||
|
table.insert(self.points, point)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Add a point to the path from a given 3D position.
|
||||||
|
-- @param #PATHLINE self
|
||||||
|
-- @param DCS#Vec3 Vec3 The 3D vector (x,y) to add.
|
||||||
|
-- @return #PATHLINE self
|
||||||
|
function PATHLINE:AddPointFromVec3(Vec3)
|
||||||
|
|
||||||
|
if Vec3 then
|
||||||
|
|
||||||
|
local point=self:_CreatePoint(Vec3)
|
||||||
|
|
||||||
|
table.insert(self.points, point)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Get name of pathline.
|
||||||
|
-- @param #PATHLINE self
|
||||||
|
-- @return #string Name of the pathline.
|
||||||
|
function PATHLINE:GetName()
|
||||||
|
return self.name
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Get number of points.
|
||||||
|
-- @param #PATHLINE self
|
||||||
|
-- @return #number Number of points.
|
||||||
|
function PATHLINE:GetNumberOfPoints()
|
||||||
|
local N=#self.points
|
||||||
|
return N
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Get points of pathline. Not that points are tables, that contain more information as just the 2D or 3D position but also the surface type etc.
|
||||||
|
-- @param #PATHLINE self
|
||||||
|
-- @return #list <#PATHLINE.Point> List of points.
|
||||||
|
function PATHLINE:GetPoints()
|
||||||
|
return self.points
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Get 3D points of pathline.
|
||||||
|
-- @param #PATHLINE self
|
||||||
|
-- @return <DCS#Vec3> List of DCS#Vec3 points.
|
||||||
|
function PATHLINE:GetPoints3D()
|
||||||
|
|
||||||
|
local vecs={}
|
||||||
|
|
||||||
|
for _,_point in pairs(self.points) do
|
||||||
|
local point=_point --#PATHLINE.Point
|
||||||
|
table.insert(vecs, point.vec3)
|
||||||
|
end
|
||||||
|
|
||||||
|
return vecs
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Get 2D points of pathline.
|
||||||
|
-- @param #PATHLINE self
|
||||||
|
-- @return <DCS#Vec2> List of DCS#Vec2 points.
|
||||||
|
function PATHLINE:GetPoints2D()
|
||||||
|
|
||||||
|
local vecs={}
|
||||||
|
|
||||||
|
for _,_point in pairs(self.points) do
|
||||||
|
local point=_point --#PATHLINE.Point
|
||||||
|
table.insert(vecs, point.vec2)
|
||||||
|
end
|
||||||
|
|
||||||
|
return vecs
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Get COORDINATES of pathline. Note that COORDINATE objects are created when calling this function. That does involve deep copy calls and can have an impact on performance if done too often.
|
||||||
|
-- @param #PATHLINE self
|
||||||
|
-- @return <Core.Point#COORDINATE> List of COORDINATES points.
|
||||||
|
function PATHLINE:GetCoordinats()
|
||||||
|
|
||||||
|
local vecs={}
|
||||||
|
|
||||||
|
for _,_point in pairs(self.points) do
|
||||||
|
local point=_point --#PATHLINE.Point
|
||||||
|
local coord=COORDINATE:NewFromVec3(point.vec3)
|
||||||
|
end
|
||||||
|
|
||||||
|
return vecs
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Get the n-th point of the pathline.
|
||||||
|
-- @param #PATHLINE self
|
||||||
|
-- @param #number n The index of the point. Default is the first point.
|
||||||
|
-- @return #PATHLINE.Point Point.
|
||||||
|
function PATHLINE:GetPointFromIndex(n)
|
||||||
|
|
||||||
|
local N=self:GetNumberOfPoints()
|
||||||
|
|
||||||
|
n=n or 1
|
||||||
|
|
||||||
|
local point=nil --#PATHLINE.Point
|
||||||
|
|
||||||
|
if n>=1 and n<=N then
|
||||||
|
point=self.point[n]
|
||||||
|
else
|
||||||
|
self:E(self.lid..string.format("ERROR: No point in pathline for N=%s", tostring(n)))
|
||||||
|
end
|
||||||
|
|
||||||
|
return point
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Get the 3D position of the n-th point.
|
||||||
|
-- @param #PATHLINE self
|
||||||
|
-- @param #number n The n-th point.
|
||||||
|
-- @return DCS#VEC3 Position in 3D.
|
||||||
|
function PATHLINE:GetPoint3DFromIndex(n)
|
||||||
|
|
||||||
|
local point=self:GetPointFromIndex(n)
|
||||||
|
|
||||||
|
if point then
|
||||||
|
return point.vec3
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Get the 2D position of the n-th point.
|
||||||
|
-- @param #PATHLINE self
|
||||||
|
-- @param #number n The n-th point.
|
||||||
|
-- @return DCS#VEC2 Position in 3D.
|
||||||
|
function PATHLINE:GetPoint2DFromIndex(n)
|
||||||
|
|
||||||
|
local point=self:GetPointFromIndex(n)
|
||||||
|
|
||||||
|
if point then
|
||||||
|
return point.vec2
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Mark points on F10 map.
|
||||||
|
-- @param #PATHLINE self
|
||||||
|
-- @param #boolean Switch If `true` or nil, set marks. If `false`, remove marks.
|
||||||
|
-- @return <DCS#Vec3> List of DCS#Vec3 points.
|
||||||
|
function PATHLINE:MarkPoints(Switch)
|
||||||
|
for i,_point in pairs(self.points) do
|
||||||
|
local point=_point --#PATHLINE.Point
|
||||||
|
if Switch==false then
|
||||||
|
|
||||||
|
if point.markerID then
|
||||||
|
UTILS.RemoveMark(point.markerID, Delay)
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
if point.markerID then
|
||||||
|
UTILS.RemoveMark(point.markerID)
|
||||||
|
end
|
||||||
|
|
||||||
|
point.markerID=UTILS.GetMarkID()
|
||||||
|
|
||||||
|
local text=string.format("Pathline %s: Point #%d\nSurface Type=%d\nHeight=%.1f m\nDepth=%.1f m", self.name, i, point.surfaceType, point.landHeight, point.depth)
|
||||||
|
|
||||||
|
trigger.action.markToAll(point.markerID, text, point.vec3, "")
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
-- Private functions
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
--- Get 3D points of pathline.
|
||||||
|
-- @param #PATHLINE self
|
||||||
|
-- @param DCS#Vec3 Vec Position vector. Can also be a DCS#Vec2 in which case the altitude at landheight is taken.
|
||||||
|
-- @return #PATHLINE.Point
|
||||||
|
function PATHLINE:_CreatePoint(Vec)
|
||||||
|
|
||||||
|
local point={} --#PATHLINE.Point
|
||||||
|
|
||||||
|
if Vec.z then
|
||||||
|
-- Given vec is 3D
|
||||||
|
point.vec3=UTILS.DeepCopy(Vec)
|
||||||
|
point.vec2={x=Vec.x, y=Vec.z}
|
||||||
|
else
|
||||||
|
-- Given vec is 2D
|
||||||
|
point.vec2=UTILS.DeepCopy(Vec)
|
||||||
|
point.vec3={x=Vec.x, y=land.getHeight(Vec), z=Vec.y}
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Get surface type.
|
||||||
|
point.surfaceType=land.getSurfaceType(point.vec2)
|
||||||
|
|
||||||
|
-- Get land height and depth.
|
||||||
|
point.landHeight, point.depth=land.getSurfaceHeightWithSeabed(point.vec2)
|
||||||
|
|
||||||
|
point.markerID=nil
|
||||||
|
|
||||||
|
return point
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -8,22 +8,6 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # Demo Missions
|
|
||||||
--
|
|
||||||
-- ### [POINT_VEC Demo Missions source code]()
|
|
||||||
--
|
|
||||||
-- ### [POINT_VEC Demo Missions, only for beta testers]()
|
|
||||||
--
|
|
||||||
-- ### [ALL Demo Missions pack of the last release](https://github.com/FlightControl-Master/MOOSE_MISSIONS/releases)
|
|
||||||
--
|
|
||||||
-- ===
|
|
||||||
--
|
|
||||||
-- # YouTube Channel
|
|
||||||
--
|
|
||||||
-- ### [POINT_VEC YouTube Channel]()
|
|
||||||
--
|
|
||||||
-- ===
|
|
||||||
--
|
|
||||||
-- ### Authors:
|
-- ### Authors:
|
||||||
--
|
--
|
||||||
-- * FlightControl (Design & Programming)
|
-- * FlightControl (Design & Programming)
|
||||||
@@ -40,8 +24,9 @@
|
|||||||
|
|
||||||
|
|
||||||
do -- COORDINATE
|
do -- COORDINATE
|
||||||
|
|
||||||
--- @type COORDINATE
|
---
|
||||||
|
-- @type COORDINATE
|
||||||
-- @field #string ClassName Name of the class
|
-- @field #string ClassName Name of the class
|
||||||
-- @field #number x Component of the 3D vector.
|
-- @field #number x Component of the 3D vector.
|
||||||
-- @field #number y Component of the 3D vector.
|
-- @field #number y Component of the 3D vector.
|
||||||
@@ -138,7 +123,7 @@ do -- COORDINATE
|
|||||||
--
|
--
|
||||||
-- Calculate if the coordinate has Line of Sight (LOS) with the other given coordinate.
|
-- Calculate if the coordinate has Line of Sight (LOS) with the other given coordinate.
|
||||||
-- Mountains, trees and other objects can be positioned between the two 3D points, preventing visibilty in a straight continuous line.
|
-- Mountains, trees and other objects can be positioned between the two 3D points, preventing visibilty in a straight continuous line.
|
||||||
-- The method @{#COORDINATE.IsLOS}() returns if the two coodinates have LOS.
|
-- The method @{#COORDINATE.IsLOS}() returns if the two coordinates have LOS.
|
||||||
--
|
--
|
||||||
-- ## 4.7) Check the coordinate position.
|
-- ## 4.7) Check the coordinate position.
|
||||||
--
|
--
|
||||||
@@ -196,7 +181,7 @@ do -- COORDINATE
|
|||||||
-- * @{#COORDINATE.ToStringBR}(): Generates a Bearing & Range text in the format of DDD for DI where DDD is degrees and DI is distance.
|
-- * @{#COORDINATE.ToStringBR}(): Generates a Bearing & Range text in the format of DDD for DI where DDD is degrees and DI is distance.
|
||||||
-- * @{#COORDINATE.ToStringBRA}(): Generates a Bearing, Range & Altitude text.
|
-- * @{#COORDINATE.ToStringBRA}(): Generates a Bearing, Range & Altitude text.
|
||||||
-- * @{#COORDINATE.ToStringBRAANATO}(): Generates a Generates a Bearing, Range, Aspect & Altitude text in NATOPS.
|
-- * @{#COORDINATE.ToStringBRAANATO}(): Generates a Generates a Bearing, Range, Aspect & Altitude text in NATOPS.
|
||||||
-- * @{#COORDINATE.ToStringLL}(): Generates a Latutide & Longitude text.
|
-- * @{#COORDINATE.ToStringLL}(): Generates a Latitude & Longitude text.
|
||||||
-- * @{#COORDINATE.ToStringLLDMS}(): Generates a Lat, Lon, Degree, Minute, Second text.
|
-- * @{#COORDINATE.ToStringLLDMS}(): Generates a Lat, Lon, Degree, Minute, Second text.
|
||||||
-- * @{#COORDINATE.ToStringLLDDM}(): Generates a Lat, Lon, Degree, decimal Minute text.
|
-- * @{#COORDINATE.ToStringLLDDM}(): Generates a Lat, Lon, Degree, decimal Minute text.
|
||||||
-- * @{#COORDINATE.ToStringMGRS}(): Generates a MGRS grid coordinate text.
|
-- * @{#COORDINATE.ToStringMGRS}(): Generates a MGRS grid coordinate text.
|
||||||
@@ -406,6 +391,42 @@ do -- COORDINATE
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Returns the magnetic declination at the given coordinate.
|
||||||
|
-- NOTE that this needs `require` to be available so you need to desanitize the `MissionScripting.lua` file in your DCS/Scrips folder.
|
||||||
|
-- If `require` is not available, a constant value for the whole map.
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @param #number Month (Optional) The month at which the declination is calculated. Default is the mission month.
|
||||||
|
-- @param #number Year (Optional) The year at which the declination is calculated. Default is the mission year.
|
||||||
|
-- @return #number Magnetic declination in degrees.
|
||||||
|
function COORDINATE:GetMagneticDeclination(Month, Year)
|
||||||
|
|
||||||
|
local decl=UTILS.GetMagneticDeclination()
|
||||||
|
|
||||||
|
if require then
|
||||||
|
|
||||||
|
local magvar = require('magvar')
|
||||||
|
|
||||||
|
if magvar then
|
||||||
|
|
||||||
|
local date, year, month, day=UTILS.GetDCSMissionDate()
|
||||||
|
|
||||||
|
magvar.init(Month or month, Year or year)
|
||||||
|
|
||||||
|
local lat, lon=self:GetLLDDM()
|
||||||
|
|
||||||
|
decl=magvar.get_mag_decl(lat, lon)
|
||||||
|
|
||||||
|
if decl then
|
||||||
|
decl=math.deg(decl)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self:T("The require package is not available. Using constant value for magnetic declination")
|
||||||
|
end
|
||||||
|
|
||||||
|
return decl
|
||||||
|
end
|
||||||
|
|
||||||
--- Returns the coordinate from the latitude and longitude given in decimal degrees.
|
--- Returns the coordinate from the latitude and longitude given in decimal degrees.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
@@ -508,7 +529,7 @@ do -- COORDINATE
|
|||||||
if ZoneObject then
|
if ZoneObject then
|
||||||
|
|
||||||
-- Get category of scanned object.
|
-- Get category of scanned object.
|
||||||
local ObjectCategory = ZoneObject:getCategory()
|
local ObjectCategory = Object.getCategory(ZoneObject)
|
||||||
|
|
||||||
-- Check for unit or static objects
|
-- Check for unit or static objects
|
||||||
if ObjectCategory==Object.Category.UNIT and ZoneObject:isExist() then
|
if ObjectCategory==Object.Category.UNIT and ZoneObject:isExist() then
|
||||||
@@ -567,6 +588,46 @@ do -- COORDINATE
|
|||||||
|
|
||||||
return set
|
return set
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Scan/find STATICS within a certain radius around the coordinate using the world.searchObjects() DCS API function.
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @param #number radius (Optional) Scan radius in meters. Default 100 m.
|
||||||
|
-- @return Core.Set#SET_UNIT Set of units.
|
||||||
|
function COORDINATE:ScanStatics(radius)
|
||||||
|
|
||||||
|
local _,_,_,_,statics=self:ScanObjects(radius, false, true, false)
|
||||||
|
|
||||||
|
local set=SET_STATIC:New()
|
||||||
|
|
||||||
|
for _,stat in pairs(statics) do
|
||||||
|
set:AddStatic(STATIC:Find(stat))
|
||||||
|
end
|
||||||
|
|
||||||
|
return set
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Find the closest static to the COORDINATE within a certain radius.
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @param #number radius Scan radius in meters. Default 100 m.
|
||||||
|
-- @return Wrapper.Static#STATIC The closest static or #nil if no unit is inside the given radius.
|
||||||
|
function COORDINATE:FindClosestStatic(radius)
|
||||||
|
|
||||||
|
local units=self:ScanStatics(radius)
|
||||||
|
|
||||||
|
local umin=nil --Wrapper.Unit#UNIT
|
||||||
|
local dmin=math.huge
|
||||||
|
for _,_unit in pairs(units.Set) do
|
||||||
|
local unit=_unit --Wrapper.Static#STATIC
|
||||||
|
local coordinate=unit:GetCoordinate()
|
||||||
|
local d=self:Get2DDistance(coordinate)
|
||||||
|
if d<dmin then
|
||||||
|
dmin=d
|
||||||
|
umin=unit
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return umin
|
||||||
|
end
|
||||||
|
|
||||||
--- Find the closest unit to the COORDINATE within a certain radius.
|
--- Find the closest unit to the COORDINATE within a certain radius.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
@@ -594,7 +655,7 @@ do -- COORDINATE
|
|||||||
--- Scan/find SCENERY objects within a certain radius around the coordinate using the world.searchObjects() DCS API function.
|
--- Scan/find SCENERY objects within a certain radius around the coordinate using the world.searchObjects() DCS API function.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param #number radius (Optional) Scan radius in meters. Default 100 m.
|
-- @param #number radius (Optional) Scan radius in meters. Default 100 m.
|
||||||
-- @return table Set of scenery objects.
|
-- @return table Table of SCENERY objects.
|
||||||
function COORDINATE:ScanScenery(radius)
|
function COORDINATE:ScanScenery(radius)
|
||||||
|
|
||||||
local _,_,_,_,_,scenerys=self:ScanObjects(radius, false, false, true)
|
local _,_,_,_,_,scenerys=self:ScanObjects(radius, false, false, true)
|
||||||
@@ -654,7 +715,7 @@ do -- COORDINATE
|
|||||||
-- @param DCS#Distance Distance The Distance to be added in meters.
|
-- @param DCS#Distance Distance The Distance to be added in meters.
|
||||||
-- @param DCS#Angle Angle The Angle in degrees. Defaults to 0 if not specified (nil).
|
-- @param DCS#Angle Angle The Angle in degrees. Defaults to 0 if not specified (nil).
|
||||||
-- @param #boolean Keepalt If true, keep altitude of original coordinate. Default is that the new coordinate is created at the translated land height.
|
-- @param #boolean Keepalt If true, keep altitude of original coordinate. Default is that the new coordinate is created at the translated land height.
|
||||||
-- @param #boolean Overwrite If true, overwrite the original COORDINATE with the translated one. Otherwise, create a new COODINATE.
|
-- @param #boolean Overwrite If true, overwrite the original COORDINATE with the translated one. Otherwise, create a new COORDINATE.
|
||||||
-- @return #COORDINATE The new calculated COORDINATE.
|
-- @return #COORDINATE The new calculated COORDINATE.
|
||||||
function COORDINATE:Translate( Distance, Angle, Keepalt, Overwrite )
|
function COORDINATE:Translate( Distance, Angle, Keepalt, Overwrite )
|
||||||
|
|
||||||
@@ -844,7 +905,7 @@ do -- COORDINATE
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Return an angle in radians from the COORDINATE using a direction vector in Vec3 format.
|
--- Return an angle in radians from the COORDINATE using a **direction vector in Vec3 format**.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param DCS#Vec3 DirectionVec3 The direction vector in Vec3 format.
|
-- @param DCS#Vec3 DirectionVec3 The direction vector in Vec3 format.
|
||||||
-- @return #number DirectionRadians The angle in radians.
|
-- @return #number DirectionRadians The angle in radians.
|
||||||
@@ -857,10 +918,12 @@ do -- COORDINATE
|
|||||||
return DirectionRadians
|
return DirectionRadians
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Return an angle in degrees from the COORDINATE using a direction vector in Vec3 format.
|
--- Return an angle in degrees from the COORDINATE using a **direction vector in Vec3 format**.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param DCS#Vec3 DirectionVec3 The direction vector in Vec3 format.
|
-- @param DCS#Vec3 DirectionVec3 The direction vector in Vec3 format.
|
||||||
-- @return #number DirectionRadians The angle in degrees.
|
-- @return #number DirectionRadians The angle in degrees.
|
||||||
|
-- @usage
|
||||||
|
-- local directionAngle = currentCoordinate:GetAngleDegrees(currentCoordinate:GetDirectionVec3(sourceCoordinate:GetVec3()))
|
||||||
function COORDINATE:GetAngleDegrees( DirectionVec3 )
|
function COORDINATE:GetAngleDegrees( DirectionVec3 )
|
||||||
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
||||||
local Angle = UTILS.ToDegree( AngleRadians )
|
local Angle = UTILS.ToDegree( AngleRadians )
|
||||||
@@ -923,7 +986,7 @@ do -- COORDINATE
|
|||||||
return T-273.15
|
return T-273.15
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Returns a text of the temperature according the measurement system @{Settings}.
|
--- Returns a text of the temperature according the measurement system @{Core.Settings}.
|
||||||
-- The text will reflect the temperature like this:
|
-- The text will reflect the temperature like this:
|
||||||
--
|
--
|
||||||
-- - For Russian and European aircraft using the metric system - Degrees Celcius (°C)
|
-- - For Russian and European aircraft using the metric system - Degrees Celcius (°C)
|
||||||
@@ -936,7 +999,7 @@ do -- COORDINATE
|
|||||||
--
|
--
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param height (Optional) parameter specifying the height ASL.
|
-- @param height (Optional) parameter specifying the height ASL.
|
||||||
-- @return #string Temperature according the measurement system @{Settings}.
|
-- @return #string Temperature according the measurement system @{Core.Settings}.
|
||||||
function COORDINATE:GetTemperatureText( height, Settings )
|
function COORDINATE:GetTemperatureText( height, Settings )
|
||||||
|
|
||||||
local DegreesCelcius = self:GetTemperature( height )
|
local DegreesCelcius = self:GetTemperature( height )
|
||||||
@@ -969,7 +1032,7 @@ do -- COORDINATE
|
|||||||
return P/100
|
return P/100
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Returns a text of the pressure according the measurement system @{Settings}.
|
--- Returns a text of the pressure according the measurement system @{Core.Settings}.
|
||||||
-- The text will contain always the pressure in hPa and:
|
-- The text will contain always the pressure in hPa and:
|
||||||
--
|
--
|
||||||
-- - For Russian and European aircraft using the metric system - hPa and mmHg
|
-- - For Russian and European aircraft using the metric system - hPa and mmHg
|
||||||
@@ -982,7 +1045,7 @@ do -- COORDINATE
|
|||||||
--
|
--
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param height (Optional) parameter specifying the height ASL. E.g. set height=0 for QNH.
|
-- @param height (Optional) parameter specifying the height ASL. E.g. set height=0 for QNH.
|
||||||
-- @return #string Pressure in hPa and mmHg or inHg depending on the measurement system @{Settings}.
|
-- @return #string Pressure in hPa and mmHg or inHg depending on the measurement system @{Core.Settings}.
|
||||||
function COORDINATE:GetPressureText( height, Settings )
|
function COORDINATE:GetPressureText( height, Settings )
|
||||||
|
|
||||||
local Pressure_hPa = self:GetPressure( height )
|
local Pressure_hPa = self:GetPressure( height )
|
||||||
@@ -1018,28 +1081,55 @@ do -- COORDINATE
|
|||||||
return heading
|
return heading
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Returns the 3D wind direction vector. Note that vector points into the direction the wind in blowing to.
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @param #number height (Optional) parameter specifying the height ASL in meters. The minimum height will be always be the land height since the wind is zero below the ground.
|
||||||
|
-- @param #boolean turbulence (Optional) If `true`, include turbulence.
|
||||||
|
-- @return DCS#Vec3 Wind 3D vector. Components in m/s.
|
||||||
|
function COORDINATE:GetWindVec3(height, turbulence)
|
||||||
|
|
||||||
|
-- We at 0.1 meters to be sure to be above ground since wind is zero below ground level.
|
||||||
|
local landheight=self:GetLandHeight()+0.1
|
||||||
|
|
||||||
|
local point={x=self.x, y=math.max(height or self.y, landheight), z=self.z}
|
||||||
|
|
||||||
|
-- Get wind velocity vector.
|
||||||
|
local wind = nil --DCS#Vec3
|
||||||
|
|
||||||
|
if turbulence then
|
||||||
|
wind = atmosphere.getWindWithTurbulence(point)
|
||||||
|
else
|
||||||
|
wind = atmosphere.getWind(point)
|
||||||
|
end
|
||||||
|
|
||||||
|
return wind
|
||||||
|
end
|
||||||
|
|
||||||
--- Returns the wind direction (from) and strength.
|
--- Returns the wind direction (from) and strength.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param height (Optional) parameter specifying the height ASL. The minimum height will be always be the land height since the wind is zero below the ground.
|
-- @param #number height (Optional) parameter specifying the height ASL. The minimum height will be always be the land height since the wind is zero below the ground.
|
||||||
-- @return Direction the wind is blowing from in degrees.
|
-- @param #boolean turbulence If `true`, include turbulence. If `false` or `nil`, wind without turbulence.
|
||||||
-- @return Wind strength in m/s.
|
-- @return #number Direction the wind is blowing from in degrees.
|
||||||
function COORDINATE:GetWind(height)
|
-- @return #number Wind strength in m/s.
|
||||||
local landheight=self:GetLandHeight()+0.1 -- we at 0.1 meters to be sure to be above ground since wind is zero below ground level.
|
function COORDINATE:GetWind(height, turbulence)
|
||||||
local point={x=self.x, y=math.max(height or self.y, landheight), z=self.z}
|
|
||||||
-- get wind velocity vector
|
-- Get wind velocity vector
|
||||||
local wind = atmosphere.getWind(point)
|
local wind = self:GetWindVec3(height, turbulence)
|
||||||
local direction = math.deg(math.atan2(wind.z, wind.x))
|
|
||||||
if direction < 0 then
|
-- Calculate the direction of the vector.
|
||||||
direction = 360 + direction
|
local direction=UTILS.VecHdg(wind)
|
||||||
end
|
|
||||||
-- Convert to direction to from direction
|
-- Invert "to" direction to "from" direction.
|
||||||
if direction > 180 then
|
if direction > 180 then
|
||||||
direction = direction-180
|
direction = direction-180
|
||||||
else
|
else
|
||||||
direction = direction+180
|
direction = direction+180
|
||||||
end
|
end
|
||||||
local strength=math.sqrt((wind.x)^2+(wind.z)^2)
|
|
||||||
-- Return wind direction and strength km/h.
|
-- Wind strength in m/s.
|
||||||
|
local strength=UTILS.VecNorm(wind) -- math.sqrt((wind.x)^2+(wind.z)^2)
|
||||||
|
|
||||||
|
-- Return wind direction and strength.
|
||||||
return direction, strength
|
return direction, strength
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1062,7 +1152,7 @@ do -- COORDINATE
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Returns a text documenting the wind direction (from) and strength according the measurement system @{Settings}.
|
--- Returns a text documenting the wind direction (from) and strength according the measurement system @{Core.Settings}.
|
||||||
-- The text will reflect the wind like this:
|
-- The text will reflect the wind like this:
|
||||||
--
|
--
|
||||||
-- - For Russian and European aircraft using the metric system - Wind direction in degrees (°) and wind speed in meters per second (mps).
|
-- - For Russian and European aircraft using the metric system - Wind direction in degrees (°) and wind speed in meters per second (mps).
|
||||||
@@ -1075,7 +1165,7 @@ do -- COORDINATE
|
|||||||
--
|
--
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param height (Optional) parameter specifying the height ASL. The minimum height will be always be the land height since the wind is zero below the ground.
|
-- @param height (Optional) parameter specifying the height ASL. The minimum height will be always be the land height since the wind is zero below the ground.
|
||||||
-- @return #string Wind direction and strength according the measurement system @{Settings}.
|
-- @return #string Wind direction and strength according the measurement system @{Core.Settings}.
|
||||||
function COORDINATE:GetWindText( height, Settings )
|
function COORDINATE:GetWindText( height, Settings )
|
||||||
|
|
||||||
local Direction, Strength = self:GetWind( height )
|
local Direction, Strength = self:GetWind( height )
|
||||||
@@ -1097,12 +1187,15 @@ do -- COORDINATE
|
|||||||
|
|
||||||
--- Return the 3D distance in meters between the target COORDINATE and the COORDINATE.
|
--- Return the 3D distance in meters between the target COORDINATE and the COORDINATE.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param #COORDINATE TargetCoordinate The target COORDINATE.
|
-- @param #COORDINATE TargetCoordinate The target COORDINATE. Can also be a DCS#Vec3.
|
||||||
-- @return DCS#Distance Distance The distance in meters.
|
-- @return DCS#Distance Distance The distance in meters.
|
||||||
function COORDINATE:Get3DDistance( TargetCoordinate )
|
function COORDINATE:Get3DDistance( TargetCoordinate )
|
||||||
local TargetVec3 = TargetCoordinate:GetVec3()
|
--local TargetVec3 = TargetCoordinate:GetVec3()
|
||||||
|
local TargetVec3 = {x=TargetCoordinate.x, y=TargetCoordinate.y, z=TargetCoordinate.z}
|
||||||
local SourceVec3 = self:GetVec3()
|
local SourceVec3 = self:GetVec3()
|
||||||
return ( ( TargetVec3.x - SourceVec3.x ) ^ 2 + ( TargetVec3.y - SourceVec3.y ) ^ 2 + ( TargetVec3.z - SourceVec3.z ) ^ 2 ) ^ 0.5
|
--local dist=( ( TargetVec3.x - SourceVec3.x ) ^ 2 + ( TargetVec3.y - SourceVec3.y ) ^ 2 + ( TargetVec3.z - SourceVec3.z ) ^ 2 ) ^ 0.5
|
||||||
|
local dist=UTILS.VecDist3D(TargetVec3, SourceVec3)
|
||||||
|
return dist
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -1111,15 +1204,25 @@ do -- COORDINATE
|
|||||||
-- @param #number AngleRadians The angle in randians.
|
-- @param #number AngleRadians The angle in randians.
|
||||||
-- @param #number Precision The precision.
|
-- @param #number Precision The precision.
|
||||||
-- @param Core.Settings#SETTINGS Settings
|
-- @param Core.Settings#SETTINGS Settings
|
||||||
|
-- @param #boolean MagVar If true, include magentic degrees
|
||||||
-- @return #string The bearing text in degrees.
|
-- @return #string The bearing text in degrees.
|
||||||
function COORDINATE:GetBearingText( AngleRadians, Precision, Settings, Language )
|
function COORDINATE:GetBearingText( AngleRadians, Precision, Settings, MagVar )
|
||||||
|
|
||||||
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
||||||
|
|
||||||
local AngleDegrees = UTILS.Round( UTILS.ToDegree( AngleRadians ), Precision )
|
local AngleDegrees = UTILS.Round( UTILS.ToDegree( AngleRadians ), Precision )
|
||||||
|
|
||||||
local s = string.format( '%03d°', AngleDegrees )
|
local s = string.format( '%03d°', AngleDegrees )
|
||||||
|
|
||||||
|
if MagVar then
|
||||||
|
local variation = UTILS.GetMagneticDeclination() or 0
|
||||||
|
local AngleMagnetic = AngleDegrees - variation
|
||||||
|
|
||||||
|
if AngleMagnetic < 0 then AngleMagnetic = 360-AngleMagnetic end
|
||||||
|
|
||||||
|
s = string.format( '%03d°M|%03d°', AngleMagnetic,AngleDegrees )
|
||||||
|
end
|
||||||
|
|
||||||
return s
|
return s
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1133,21 +1236,22 @@ do -- COORDINATE
|
|||||||
function COORDINATE:GetDistanceText( Distance, Settings, Language, Precision )
|
function COORDINATE:GetDistanceText( Distance, Settings, Language, Precision )
|
||||||
|
|
||||||
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
||||||
local Language = Language or "EN"
|
local Language = Language or Settings.Locale or _SETTINGS.Locale or "EN"
|
||||||
|
Language = string.lower(Language)
|
||||||
local Precision = Precision or 0
|
local Precision = Precision or 0
|
||||||
|
|
||||||
local DistanceText
|
local DistanceText
|
||||||
|
|
||||||
if Settings:IsMetric() then
|
if Settings:IsMetric() then
|
||||||
if Language == "EN" then
|
if Language == "en" then
|
||||||
DistanceText = " for " .. UTILS.Round( Distance / 1000, Precision ) .. " km"
|
DistanceText = " for " .. UTILS.Round( Distance / 1000, Precision ) .. " km"
|
||||||
elseif Language == "RU" then
|
elseif Language == "ru" then
|
||||||
DistanceText = " за " .. UTILS.Round( Distance / 1000, Precision ) .. " километров"
|
DistanceText = " за " .. UTILS.Round( Distance / 1000, Precision ) .. " километров"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if Language == "EN" then
|
if Language == "en" then
|
||||||
DistanceText = " for " .. UTILS.Round( UTILS.MetersToNM( Distance ), Precision ) .. " miles"
|
DistanceText = " for " .. UTILS.Round( UTILS.MetersToNM( Distance ), Precision ) .. " miles"
|
||||||
elseif Language == "RU" then
|
elseif Language == "ru" then
|
||||||
DistanceText = " за " .. UTILS.Round( UTILS.MetersToNM( Distance ), Precision ) .. " миль"
|
DistanceText = " за " .. UTILS.Round( UTILS.MetersToNM( Distance ), Precision ) .. " миль"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1161,19 +1265,21 @@ do -- COORDINATE
|
|||||||
function COORDINATE:GetAltitudeText( Settings, Language )
|
function COORDINATE:GetAltitudeText( Settings, Language )
|
||||||
local Altitude = self.y
|
local Altitude = self.y
|
||||||
local Settings = Settings or _SETTINGS
|
local Settings = Settings or _SETTINGS
|
||||||
local Language = Language or "EN"
|
local Language = Language or Settings.Locale or _SETTINGS.Locale or "EN"
|
||||||
|
|
||||||
|
Language = string.lower(Language)
|
||||||
|
|
||||||
if Altitude ~= 0 then
|
if Altitude ~= 0 then
|
||||||
if Settings:IsMetric() then
|
if Settings:IsMetric() then
|
||||||
if Language == "EN" then
|
if Language == "en" then
|
||||||
return " at " .. UTILS.Round( self.y, -3 ) .. " meters"
|
return " at " .. UTILS.Round( self.y, -3 ) .. " meters"
|
||||||
elseif Language == "RU" then
|
elseif Language == "ru" then
|
||||||
return " в " .. UTILS.Round( self.y, -3 ) .. " метры"
|
return " в " .. UTILS.Round( self.y, -3 ) .. " метры"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if Language == "EN" then
|
if Language == "en" then
|
||||||
return " at " .. UTILS.Round( UTILS.MetersToFeet( self.y ), -3 ) .. " feet"
|
return " at " .. UTILS.Round( UTILS.MetersToFeet( self.y ), -3 ) .. " feet"
|
||||||
elseif Language == "RU" then
|
elseif Language == "ru" then
|
||||||
return " в " .. UTILS.Round( self.y, -3 ) .. " ноги"
|
return " в " .. UTILS.Round( self.y, -3 ) .. " ноги"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1220,12 +1326,14 @@ do -- COORDINATE
|
|||||||
-- @param #number AngleRadians The angle in randians
|
-- @param #number AngleRadians The angle in randians
|
||||||
-- @param #number Distance The distance
|
-- @param #number Distance The distance
|
||||||
-- @param Core.Settings#SETTINGS Settings
|
-- @param Core.Settings#SETTINGS Settings
|
||||||
|
-- @param #string Language (Optional) Language "en" or "ru"
|
||||||
|
-- @param #boolean MagVar If true, also state angle in magnetic
|
||||||
-- @return #string The BR Text
|
-- @return #string The BR Text
|
||||||
function COORDINATE:GetBRText( AngleRadians, Distance, Settings, Language )
|
function COORDINATE:GetBRText( AngleRadians, Distance, Settings, Language, MagVar )
|
||||||
|
|
||||||
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
||||||
|
|
||||||
local BearingText = self:GetBearingText( AngleRadians, 0, Settings, Language )
|
local BearingText = self:GetBearingText( AngleRadians, 0, Settings, MagVar )
|
||||||
local DistanceText = self:GetDistanceText( Distance, Settings, Language, 0 )
|
local DistanceText = self:GetDistanceText( Distance, Settings, Language, 0 )
|
||||||
|
|
||||||
local BRText = BearingText .. DistanceText
|
local BRText = BearingText .. DistanceText
|
||||||
@@ -1238,12 +1346,14 @@ do -- COORDINATE
|
|||||||
-- @param #number AngleRadians The angle in randians
|
-- @param #number AngleRadians The angle in randians
|
||||||
-- @param #number Distance The distance
|
-- @param #number Distance The distance
|
||||||
-- @param Core.Settings#SETTINGS Settings
|
-- @param Core.Settings#SETTINGS Settings
|
||||||
|
-- @param #string Language (Optional) Language "en" or "ru"
|
||||||
|
-- @param #boolean MagVar If true, also state angle in magnetic
|
||||||
-- @return #string The BRA Text
|
-- @return #string The BRA Text
|
||||||
function COORDINATE:GetBRAText( AngleRadians, Distance, Settings, Language )
|
function COORDINATE:GetBRAText( AngleRadians, Distance, Settings, Language, MagVar )
|
||||||
|
|
||||||
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
||||||
|
|
||||||
local BearingText = self:GetBearingText( AngleRadians, 0, Settings, Language )
|
local BearingText = self:GetBearingText( AngleRadians, 0, Settings, MagVar )
|
||||||
local DistanceText = self:GetDistanceText( Distance, Settings, Language, 0 )
|
local DistanceText = self:GetDistanceText( Distance, Settings, Language, 0 )
|
||||||
local AltitudeText = self:GetAltitudeText( Settings, Language )
|
local AltitudeText = self:GetAltitudeText( Settings, Language )
|
||||||
|
|
||||||
@@ -1268,7 +1378,15 @@ do -- COORDINATE
|
|||||||
self.y=alt
|
self.y=alt
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set altitude to be at land height (i.e. on the ground!)
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
function COORDINATE:SetAtLandheight()
|
||||||
|
local alt=self:GetLandHeight()
|
||||||
|
self.y=alt
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Build an air type route point.
|
--- Build an air type route point.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param #COORDINATE.WaypointAltType AltType The altitude type.
|
-- @param #COORDINATE.WaypointAltType AltType The altitude type.
|
||||||
@@ -1519,7 +1637,7 @@ do -- COORDINATE
|
|||||||
-- @param #number Coalition (Optional) Coalition of the airbase.
|
-- @param #number Coalition (Optional) Coalition of the airbase.
|
||||||
-- @return Wrapper.Airbase#AIRBASE Closest Airbase to the given coordinate.
|
-- @return Wrapper.Airbase#AIRBASE Closest Airbase to the given coordinate.
|
||||||
-- @return #number Distance to the closest airbase in meters.
|
-- @return #number Distance to the closest airbase in meters.
|
||||||
function COORDINATE:GetClosestAirbase2(Category, Coalition)
|
function COORDINATE:GetClosestAirbase(Category, Coalition)
|
||||||
|
|
||||||
-- Get all airbases of the map.
|
-- Get all airbases of the map.
|
||||||
local airbases=AIRBASE.GetAllAirbases(Coalition)
|
local airbases=AIRBASE.GetAllAirbases(Coalition)
|
||||||
@@ -1553,34 +1671,15 @@ do -- COORDINATE
|
|||||||
return closest,distmin
|
return closest,distmin
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Gets the nearest airbase with respect to the current coordinates.
|
--- [kept for downwards compatibility only] Gets the nearest airbase with respect to the current coordinates.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param #number Category (Optional) Category of the airbase. Enumerator of @{Wrapper.Airbase#AIRBASE.Category}.
|
-- @param #number Category (Optional) Category of the airbase. Enumerator of @{Wrapper.Airbase#AIRBASE.Category}.
|
||||||
-- @param #number Coalition (Optional) Coalition of the airbase.
|
-- @param #number Coalition (Optional) Coalition of the airbase.
|
||||||
-- @return Wrapper.Airbase#AIRBASE Closest Airbase to the given coordinate.
|
-- @return Wrapper.Airbase#AIRBASE Closest Airbase to the given coordinate.
|
||||||
-- @return #number Distance to the closest airbase in meters.
|
-- @return #number Distance to the closest airbase in meters.
|
||||||
function COORDINATE:GetClosestAirbase(Category, Coalition)
|
function COORDINATE:GetClosestAirbase2(Category, Coalition)
|
||||||
|
local closest, distmin = self:GetClosestAirbase(Category, Coalition)
|
||||||
local a=self:GetVec3()
|
return closest, distmin
|
||||||
|
|
||||||
local distmin=math.huge
|
|
||||||
local airbase=nil
|
|
||||||
for DCSairbaseID, DCSairbase in pairs(world.getAirbases(Coalition)) do
|
|
||||||
local b=DCSairbase:getPoint()
|
|
||||||
|
|
||||||
local c=UTILS.VecSubstract(a,b)
|
|
||||||
local dist=UTILS.VecNorm(c)
|
|
||||||
|
|
||||||
--env.info(string.format("Airbase %s dist=%d category=%d", DCSairbase:getName(), dist, DCSairbase:getCategory()))
|
|
||||||
|
|
||||||
if dist<distmin and (Category==nil or Category==DCSairbase:getDesc().category) then
|
|
||||||
distmin=dist
|
|
||||||
airbase=DCSairbase
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
return AIRBASE:Find(airbase)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Gets the nearest parking spot.
|
--- Gets the nearest parking spot.
|
||||||
@@ -1913,7 +2012,6 @@ do -- COORDINATE
|
|||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param #string name (Optional) Name of the fire to stop it, if not using the same COORDINATE object.
|
-- @param #string name (Optional) Name of the fire to stop it, if not using the same COORDINATE object.
|
||||||
function COORDINATE:StopBigSmokeAndFire( name )
|
function COORDINATE:StopBigSmokeAndFire( name )
|
||||||
self:F2( { name = name } )
|
|
||||||
name = name or self.firename
|
name = name or self.firename
|
||||||
trigger.action.effectSmokeStop( name )
|
trigger.action.effectSmokeStop( name )
|
||||||
end
|
end
|
||||||
@@ -2278,7 +2376,6 @@ do -- COORDINATE
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Creates a free form shape on the F10 map. The first point is the current COORDINATE. The remaining points need to be specified.
|
--- Creates a free form shape on the F10 map. The first point is the current COORDINATE. The remaining points need to be specified.
|
||||||
-- **NOTE**: A free form polygon must have **at least three points** in total and currently only **up to 15 points** in total are supported.
|
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param #table Coordinates Table of coordinates of the remaining points of the shape.
|
-- @param #table Coordinates Table of coordinates of the remaining points of the shape.
|
||||||
-- @param #number Coalition Coalition: All=-1, Neutral=0, Red=1, Blue=2. Default -1=All.
|
-- @param #number Coalition Coalition: All=-1, Neutral=0, Red=1, Blue=2. Default -1=All.
|
||||||
@@ -2352,9 +2449,33 @@ do -- COORDINATE
|
|||||||
vecs[11], vecs[12], vecs[13], vecs[14], vecs[15],
|
vecs[11], vecs[12], vecs[13], vecs[14], vecs[15],
|
||||||
Color, FillColor, LineType, ReadOnly, Text or "")
|
Color, FillColor, LineType, ReadOnly, Text or "")
|
||||||
else
|
else
|
||||||
self:E("ERROR: Currently a free form polygon can only have 15 points in total!")
|
|
||||||
-- Unfortunately, unpack(vecs) does not work! So no idea how to generalize this :(
|
-- Unfortunately, unpack(vecs) does not work! So no idea how to generalize this :(
|
||||||
trigger.action.markupToAll(7, Coalition, MarkID, unpack(vecs), Color, FillColor, LineType, ReadOnly, Text or "")
|
--trigger.action.markupToAll(7, Coalition, MarkID, unpack(vecs), Color, FillColor, LineType, ReadOnly, Text or "")
|
||||||
|
|
||||||
|
-- Write command as string and execute that. Idea by Grimes https://forum.dcs.world/topic/324201-mark-to-all-function/#comment-5273793
|
||||||
|
local s=string.format("trigger.action.markupToAll(7, %d, %d,", Coalition, MarkID)
|
||||||
|
for _,vec in pairs(vecs) do
|
||||||
|
--s=s..string.format("%s,", UTILS._OneLineSerialize(vec))
|
||||||
|
s=s..string.format("{x=%.1f, y=%.1f, z=%.1f},", vec.x, vec.y, vec.z)
|
||||||
|
end
|
||||||
|
s=s..string.format("{%.3f, %.3f, %.3f, %.3f},", Color[1], Color[2], Color[3], Color[4])
|
||||||
|
s=s..string.format("{%.3f, %.3f, %.3f, %.3f},", FillColor[1], FillColor[2], FillColor[3], FillColor[4])
|
||||||
|
s=s..string.format("%d,", LineType or 1)
|
||||||
|
s=s..string.format("%s", tostring(ReadOnly))
|
||||||
|
if Text and type(Text)=="string" and string.len(Text)>0 then
|
||||||
|
s=s..string.format(", \"%s\"", tostring(Text))
|
||||||
|
end
|
||||||
|
s=s..")"
|
||||||
|
|
||||||
|
-- Execute string command
|
||||||
|
local success=UTILS.DoString(s)
|
||||||
|
|
||||||
|
if not success then
|
||||||
|
self:E("ERROR: Could not draw polygon")
|
||||||
|
env.info(s)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return MarkID
|
return MarkID
|
||||||
@@ -2434,7 +2555,7 @@ do -- COORDINATE
|
|||||||
|
|
||||||
Offset=Offset or 2
|
Offset=Offset or 2
|
||||||
|
|
||||||
-- Measurement of visibility should not be from the ground, so Adding a hypotethical 2 meters to each Coordinate.
|
-- Measurement of visibility should not be from the ground, so Adding a hypothetical 2 meters to each Coordinate.
|
||||||
local FromVec3 = self:GetVec3()
|
local FromVec3 = self:GetVec3()
|
||||||
FromVec3.y = FromVec3.y + Offset
|
FromVec3.y = FromVec3.y + Offset
|
||||||
|
|
||||||
@@ -2774,25 +2895,27 @@ do -- COORDINATE
|
|||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param #COORDINATE FromCoordinate The coordinate to measure the distance and the bearing from.
|
-- @param #COORDINATE FromCoordinate The coordinate to measure the distance and the bearing from.
|
||||||
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
||||||
|
-- @param #boolean MagVar If true, also get angle in MagVar for BR/BRA
|
||||||
-- @return #string The BR text.
|
-- @return #string The BR text.
|
||||||
function COORDINATE:ToStringBR( FromCoordinate, Settings )
|
function COORDINATE:ToStringBR( FromCoordinate, Settings, MagVar )
|
||||||
local DirectionVec3 = FromCoordinate:GetDirectionVec3( self )
|
local DirectionVec3 = FromCoordinate:GetDirectionVec3( self )
|
||||||
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
||||||
local Distance = self:Get2DDistance( FromCoordinate )
|
local Distance = self:Get2DDistance( FromCoordinate )
|
||||||
return "BR, " .. self:GetBRText( AngleRadians, Distance, Settings )
|
return "BR, " .. self:GetBRText( AngleRadians, Distance, Settings, nil, MagVar )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Return a BRA string from a COORDINATE to the COORDINATE.
|
--- Return a BRA string from a COORDINATE to the COORDINATE.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param #COORDINATE FromCoordinate The coordinate to measure the distance and the bearing from.
|
-- @param #COORDINATE FromCoordinate The coordinate to measure the distance and the bearing from.
|
||||||
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
||||||
|
-- @param #boolean MagVar If true, also get angle in MagVar for BR/BRA
|
||||||
-- @return #string The BR text.
|
-- @return #string The BR text.
|
||||||
function COORDINATE:ToStringBRA( FromCoordinate, Settings, Language )
|
function COORDINATE:ToStringBRA( FromCoordinate, Settings, MagVar )
|
||||||
local DirectionVec3 = FromCoordinate:GetDirectionVec3( self )
|
local DirectionVec3 = FromCoordinate:GetDirectionVec3( self )
|
||||||
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
||||||
local Distance = FromCoordinate:Get2DDistance( self )
|
local Distance = FromCoordinate:Get2DDistance( self )
|
||||||
local Altitude = self:GetAltitudeText()
|
local Altitude = self:GetAltitudeText()
|
||||||
return "BRA, " .. self:GetBRAText( AngleRadians, Distance, Settings, Language )
|
return "BRA, " .. self:GetBRAText( AngleRadians, Distance, Settings, nil, MagVar )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Create a BRAA NATO call string to this COORDINATE from the FromCOORDINATE. Note - BRA delivered if no aspect can be obtained and "Merged" if range < 3nm
|
--- Create a BRAA NATO call string to this COORDINATE from the FromCOORDINATE. Note - BRA delivered if no aspect can be obtained and "Merged" if range < 3nm
|
||||||
@@ -2831,8 +2954,13 @@ do -- COORDINATE
|
|||||||
if alt < 1 then
|
if alt < 1 then
|
||||||
alttext = "very low"
|
alttext = "very low"
|
||||||
end
|
end
|
||||||
|
|
||||||
local track = UTILS.BearingToCardinal(bearing) or "North"
|
-- corrected Track to be direction of travel of bogey (self in this case)
|
||||||
|
local track = "Maneuver"
|
||||||
|
|
||||||
|
if self.Heading then
|
||||||
|
track = UTILS.BearingToCardinal(self.Heading) or "North"
|
||||||
|
end
|
||||||
|
|
||||||
if rangeNM > 3 then
|
if rangeNM > 3 then
|
||||||
if SSML then -- google says "oh" instead of zero, be aware
|
if SSML then -- google says "oh" instead of zero, be aware
|
||||||
@@ -2883,18 +3011,29 @@ do -- COORDINATE
|
|||||||
return BRAANATO
|
return BRAANATO
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Return the BULLSEYE as COORDINATE Object
|
||||||
|
-- @param #number Coalition Coalition of the bulls eye to return, e.g. coalition.side.BLUE
|
||||||
|
-- @return #COORDINATE self
|
||||||
|
-- @usage
|
||||||
|
-- -- note the dot (.) here,not using the colon (:)
|
||||||
|
-- local redbulls = COORDINATE.GetBullseyeCoordinate(coalition.side.RED)
|
||||||
|
function COORDINATE.GetBullseyeCoordinate(Coalition)
|
||||||
|
return COORDINATE:NewFromVec3( coalition.getMainRefPoint( Coalition ) )
|
||||||
|
end
|
||||||
|
|
||||||
--- Return a BULLS string out of the BULLS of the coalition to the COORDINATE.
|
--- Return a BULLS string out of the BULLS of the coalition to the COORDINATE.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param DCS#coalition.side Coalition The coalition.
|
-- @param DCS#coalition.side Coalition The coalition.
|
||||||
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
||||||
|
-- @param #boolean MagVar If true, als get angle in magnetic
|
||||||
-- @return #string The BR text.
|
-- @return #string The BR text.
|
||||||
function COORDINATE:ToStringBULLS( Coalition, Settings )
|
function COORDINATE:ToStringBULLS( Coalition, Settings, MagVar )
|
||||||
local BullsCoordinate = COORDINATE:NewFromVec3( coalition.getMainRefPoint( Coalition ) )
|
local BullsCoordinate = COORDINATE:NewFromVec3( coalition.getMainRefPoint( Coalition ) )
|
||||||
local DirectionVec3 = BullsCoordinate:GetDirectionVec3( self )
|
local DirectionVec3 = BullsCoordinate:GetDirectionVec3( self )
|
||||||
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
||||||
local Distance = self:Get2DDistance( BullsCoordinate )
|
local Distance = self:Get2DDistance( BullsCoordinate )
|
||||||
local Altitude = self:GetAltitudeText()
|
local Altitude = self:GetAltitudeText()
|
||||||
return "BULLS, " .. self:GetBRText( AngleRadians, Distance, Settings )
|
return "BULLS, " .. self:GetBRText( AngleRadians, Distance, Settings, nil, MagVar )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Return an aspect string from a COORDINATE to the Angle of the object.
|
--- Return an aspect string from a COORDINATE to the Angle of the object.
|
||||||
@@ -2932,6 +3071,18 @@ do -- COORDINATE
|
|||||||
return coord.LOtoLL( self:GetVec3() )
|
return coord.LOtoLL( self:GetVec3() )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Get Latitude & Longitude text.
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
||||||
|
-- @return #string LLText
|
||||||
|
function COORDINATE:ToStringLL( Settings )
|
||||||
|
|
||||||
|
local LL_Accuracy = Settings and Settings.LL_Accuracy or _SETTINGS.LL_Accuracy
|
||||||
|
local lat, lon = coord.LOtoLL( self:GetVec3() )
|
||||||
|
return string.format('%f', lat) .. ' ' .. string.format('%f', lon)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Provides a Lat Lon string in Degree Minute Second format.
|
--- Provides a Lat Lon string in Degree Minute Second format.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
||||||
@@ -2958,24 +3109,68 @@ do -- COORDINATE
|
|||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
||||||
-- @return #string The MGRS Text
|
-- @return #string The MGRS Text
|
||||||
function COORDINATE:ToStringMGRS( Settings ) --R2.1 Fixes issue #424.
|
function COORDINATE:ToStringMGRS( Settings )
|
||||||
|
|
||||||
local MGRS_Accuracy = Settings and Settings.MGRS_Accuracy or _SETTINGS.MGRS_Accuracy
|
local MGRS_Accuracy = Settings and Settings.MGRS_Accuracy or _SETTINGS.MGRS_Accuracy
|
||||||
local lat, lon = coord.LOtoLL( self:GetVec3() )
|
local lat, lon = coord.LOtoLL( self:GetVec3() )
|
||||||
local MGRS = coord.LLtoMGRS( lat, lon )
|
local MGRS = coord.LLtoMGRS( lat, lon )
|
||||||
return "MGRS " .. UTILS.tostringMGRS( MGRS, MGRS_Accuracy )
|
return "MGRS " .. UTILS.tostringMGRS( MGRS, MGRS_Accuracy )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Provides a COORDINATE from an MGRS String
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @param #string MGRSString MGRS String, e.g. "MGRS 37T DK 12345 12345"
|
||||||
|
-- @return #COORDINATE self
|
||||||
|
function COORDINATE:NewFromMGRSString( MGRSString )
|
||||||
|
local myparts = UTILS.Split(MGRSString," ")
|
||||||
|
local northing = tostring(myparts[5]) or ""
|
||||||
|
local easting = tostring(myparts[4]) or ""
|
||||||
|
if string.len(easting) < 5 then easting = easting..string.rep("0",5-string.len(easting)) end
|
||||||
|
if string.len(northing) < 5 then northing = northing..string.rep("0",5-string.len(northing)) end
|
||||||
|
local MGRS = {
|
||||||
|
UTMZone = myparts[2],
|
||||||
|
MGRSDigraph = myparts[3],
|
||||||
|
Easting = easting,
|
||||||
|
Northing = northing,
|
||||||
|
}
|
||||||
|
local lat, lon = coord.MGRStoLL(MGRS)
|
||||||
|
local point = coord.LLtoLO(lat, lon, 0)
|
||||||
|
local coord = COORDINATE:NewFromVec2({x=point.x,y=point.z})
|
||||||
|
return coord
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Provides a COORDINATE from an MGRS Coordinate
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @param #string UTMZone UTM Zone, e.g. "37T"
|
||||||
|
-- @param #string MGRSDigraph Digraph, e.g. "DK"
|
||||||
|
-- @param #string Easting Meters easting - string in order to allow for leading zeros, e.g. "01234". Should be 5 digits.
|
||||||
|
-- @param #string Northing Meters northing - string in order to allow for leading zeros, e.g. "12340". Should be 5 digits.
|
||||||
|
-- @return #COORDINATE self
|
||||||
|
function COORDINATE:NewFromMGRS( UTMZone, MGRSDigraph, Easting, Northing )
|
||||||
|
if string.len(Easting) < 5 then Easting = Easting..string.rep("0",5-string.len(Easting) )end
|
||||||
|
if string.len(Northing) < 5 then Northing = Northing..string.rep("0",5-string.len(Northing) )end
|
||||||
|
local MGRS = {
|
||||||
|
UTMZone = UTMZone,
|
||||||
|
MGRSDigraph = MGRSDigraph,
|
||||||
|
Easting = Easting,
|
||||||
|
Northing = Northing,
|
||||||
|
}
|
||||||
|
local lat, lon = coord.MGRStoLL(MGRS)
|
||||||
|
local point = coord.LLtoLO(lat, lon, 0)
|
||||||
|
local coord = COORDINATE:NewFromVec2({x=point.x,y=point.z})
|
||||||
|
end
|
||||||
|
|
||||||
--- Provides a coordinate string of the point, based on a coordinate format system:
|
--- Provides a coordinate string of the point, based on a coordinate format system:
|
||||||
-- * Uses default settings in COORDINATE.
|
-- * Uses default settings in COORDINATE.
|
||||||
-- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default.
|
-- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param #COORDINATE ReferenceCoord The refrence coordinate.
|
-- @param #COORDINATE ReferenceCoord The reference coordinate.
|
||||||
-- @param #string ReferenceName The refrence name.
|
-- @param #string ReferenceName The reference name.
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
|
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
|
||||||
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
||||||
|
-- @param #boolean MagVar If true also show angle in magnetic
|
||||||
-- @return #string The coordinate Text in the configured coordinate system.
|
-- @return #string The coordinate Text in the configured coordinate system.
|
||||||
function COORDINATE:ToStringFromRP( ReferenceCoord, ReferenceName, Controllable, Settings )
|
function COORDINATE:ToStringFromRP( ReferenceCoord, ReferenceName, Controllable, Settings, MagVar )
|
||||||
|
|
||||||
self:F2( { ReferenceCoord = ReferenceCoord, ReferenceName = ReferenceName } )
|
self:F2( { ReferenceCoord = ReferenceCoord, ReferenceName = ReferenceName } )
|
||||||
|
|
||||||
@@ -2987,24 +3182,59 @@ do -- COORDINATE
|
|||||||
local DirectionVec3 = ReferenceCoord:GetDirectionVec3( self )
|
local DirectionVec3 = ReferenceCoord:GetDirectionVec3( self )
|
||||||
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
||||||
local Distance = self:Get2DDistance( ReferenceCoord )
|
local Distance = self:Get2DDistance( ReferenceCoord )
|
||||||
return "Targets are the last seen " .. self:GetBRText( AngleRadians, Distance, Settings ) .. " from " .. ReferenceName
|
return "Targets are the last seen " .. self:GetBRText( AngleRadians, Distance, Settings, nil, MagVar ) .. " from " .. ReferenceName
|
||||||
else
|
else
|
||||||
local DirectionVec3 = ReferenceCoord:GetDirectionVec3( self )
|
local DirectionVec3 = ReferenceCoord:GetDirectionVec3( self )
|
||||||
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
||||||
local Distance = self:Get2DDistance( ReferenceCoord )
|
local Distance = self:Get2DDistance( ReferenceCoord )
|
||||||
return "Target are located " .. self:GetBRText( AngleRadians, Distance, Settings ) .. " from " .. ReferenceName
|
return "Target are located " .. self:GetBRText( AngleRadians, Distance, Settings, nil, MagVar ) .. " from " .. ReferenceName
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Provides a coordinate string of the point, based on a coordinate format system:
|
||||||
|
-- * Uses default settings in COORDINATE.
|
||||||
|
-- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default.
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @param #COORDINATE ReferenceCoord The reference coordinate.
|
||||||
|
-- @param #string ReferenceName The reference name.
|
||||||
|
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
|
||||||
|
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
||||||
|
-- @param #boolean MagVar If true also get the angle as magnetic
|
||||||
|
-- @return #string The coordinate Text in the configured coordinate system.
|
||||||
|
function COORDINATE:ToStringFromRPShort( ReferenceCoord, ReferenceName, Controllable, Settings, MagVar )
|
||||||
|
|
||||||
|
self:F2( { ReferenceCoord = ReferenceCoord, ReferenceName = ReferenceName } )
|
||||||
|
|
||||||
|
local Settings = Settings or ( Controllable and _DATABASE:GetPlayerSettings( Controllable:GetPlayerName() ) ) or _SETTINGS
|
||||||
|
|
||||||
|
local IsAir = Controllable and Controllable:IsAirPlane() or false
|
||||||
|
|
||||||
|
if IsAir then
|
||||||
|
local DirectionVec3 = ReferenceCoord:GetDirectionVec3( self )
|
||||||
|
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
||||||
|
local Distance = self:Get2DDistance( ReferenceCoord )
|
||||||
|
return self:GetBRText( AngleRadians, Distance, Settings, nil, MagVar ) .. " from " .. ReferenceName
|
||||||
|
else
|
||||||
|
local DirectionVec3 = ReferenceCoord:GetDirectionVec3( self )
|
||||||
|
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
||||||
|
local Distance = self:Get2DDistance( ReferenceCoord )
|
||||||
|
return self:GetBRText( AngleRadians, Distance, Settings, nil, MagVar ) .. " from " .. ReferenceName
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
--- Provides a coordinate string of the point, based on the A2G coordinate format system.
|
--- Provides a coordinate string of the point, based on the A2G coordinate format system.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
|
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
|
||||||
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
||||||
|
-- @param #boolean MagVar If true, also get angle in MagVar for BR/BRA
|
||||||
-- @return #string The coordinate Text in the configured coordinate system.
|
-- @return #string The coordinate Text in the configured coordinate system.
|
||||||
function COORDINATE:ToStringA2G( Controllable, Settings )
|
function COORDINATE:ToStringA2G( Controllable, Settings, MagVar )
|
||||||
|
|
||||||
self:F2( { Controllable = Controllable and Controllable:GetName() } )
|
self:F2( { Controllable = Controllable and Controllable:GetName() } )
|
||||||
|
|
||||||
@@ -3014,7 +3244,7 @@ do -- COORDINATE
|
|||||||
-- If no Controllable is given to calculate the BR from, then MGRS will be used!!!
|
-- If no Controllable is given to calculate the BR from, then MGRS will be used!!!
|
||||||
if Controllable then
|
if Controllable then
|
||||||
local Coordinate = Controllable:GetCoordinate()
|
local Coordinate = Controllable:GetCoordinate()
|
||||||
return Controllable and self:ToStringBR( Coordinate, Settings ) or self:ToStringMGRS( Settings )
|
return Controllable and self:ToStringBR( Coordinate, Settings, MagVar ) or self:ToStringMGRS( Settings )
|
||||||
else
|
else
|
||||||
return self:ToStringMGRS( Settings )
|
return self:ToStringMGRS( Settings )
|
||||||
end
|
end
|
||||||
@@ -3038,33 +3268,34 @@ do -- COORDINATE
|
|||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
|
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
|
||||||
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
||||||
|
-- @param #boolean MagVar If true, also get angle in MagVar for BR/BRA
|
||||||
-- @return #string The coordinate Text in the configured coordinate system.
|
-- @return #string The coordinate Text in the configured coordinate system.
|
||||||
function COORDINATE:ToStringA2A( Controllable, Settings, Language ) -- R2.2
|
function COORDINATE:ToStringA2A( Controllable, Settings, MagVar )
|
||||||
|
|
||||||
self:F2( { Controllable = Controllable and Controllable:GetName() } )
|
self:F2( { Controllable = Controllable and Controllable:GetName() } )
|
||||||
|
|
||||||
local Settings = Settings or ( Controllable and _DATABASE:GetPlayerSettings( Controllable:GetPlayerName() ) ) or _SETTINGS
|
local Settings = Settings or ( Controllable and _DATABASE:GetPlayerSettings( Controllable:GetPlayerName() ) ) or _SETTINGS
|
||||||
|
|
||||||
if Settings:IsA2A_BRAA() then
|
if Settings:IsA2A_BRAA() then
|
||||||
if Controllable then
|
if Controllable then
|
||||||
local Coordinate = Controllable:GetCoordinate()
|
local Coordinate = Controllable:GetCoordinate()
|
||||||
return self:ToStringBRA( Coordinate, Settings, Language )
|
return self:ToStringBRA( Coordinate, Settings, MagVar )
|
||||||
else
|
else
|
||||||
return self:ToStringMGRS( Settings, Language )
|
return self:ToStringMGRS( Settings )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if Settings:IsA2A_BULLS() then
|
if Settings:IsA2A_BULLS() then
|
||||||
local Coalition = Controllable:GetCoalition()
|
local Coalition = Controllable:GetCoalition()
|
||||||
return self:ToStringBULLS( Coalition, Settings, Language )
|
return self:ToStringBULLS( Coalition, Settings, MagVar )
|
||||||
end
|
end
|
||||||
if Settings:IsA2A_LL_DMS() then
|
if Settings:IsA2A_LL_DMS() then
|
||||||
return self:ToStringLLDMS( Settings, Language )
|
return self:ToStringLLDMS( Settings )
|
||||||
end
|
end
|
||||||
if Settings:IsA2A_LL_DDM() then
|
if Settings:IsA2A_LL_DDM() then
|
||||||
return self:ToStringLLDDM( Settings, Language )
|
return self:ToStringLLDDM( Settings )
|
||||||
end
|
end
|
||||||
if Settings:IsA2A_MGRS() then
|
if Settings:IsA2A_MGRS() then
|
||||||
return self:ToStringMGRS( Settings, Language )
|
return self:ToStringMGRS( Settings )
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@@ -3132,7 +3363,7 @@ do -- COORDINATE
|
|||||||
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
|
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
|
||||||
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
||||||
-- @return #string The pressure text in the configured measurement system.
|
-- @return #string The pressure text in the configured measurement system.
|
||||||
function COORDINATE:ToStringPressure( Controllable, Settings ) -- R2.3
|
function COORDINATE:ToStringPressure( Controllable, Settings )
|
||||||
|
|
||||||
self:F2( { Controllable = Controllable and Controllable:GetName() } )
|
self:F2( { Controllable = Controllable and Controllable:GetName() } )
|
||||||
|
|
||||||
@@ -3172,7 +3403,52 @@ do -- COORDINATE
|
|||||||
|
|
||||||
return self:GetTemperatureText( nil, Settings )
|
return self:GetTemperatureText( nil, Settings )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Function to check if a coordinate is in a steep (>8% elevation) area of the map
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @param #number Radius (Optional) Radius to check around the coordinate, defaults to 50m (100m diameter)
|
||||||
|
-- @param #number Minelevation (Optional) Elevation from which on a area is defined as steep, defaults to 8% (8m height gain across 100 meters)
|
||||||
|
-- @return #boolen IsSteep If true, area is steep
|
||||||
|
-- @return #number MaxElevation Elevation in meters measured over 100m
|
||||||
|
function COORDINATE:IsInSteepArea(Radius,Minelevation)
|
||||||
|
local steep = false
|
||||||
|
local elev = Minelevation or 8
|
||||||
|
local bdelta = 0
|
||||||
|
local h0 = self:GetLandHeight()
|
||||||
|
local radius = Radius or 50
|
||||||
|
local diam = radius * 2
|
||||||
|
for i=0,150,30 do
|
||||||
|
local polar = math.fmod(i+180,360)
|
||||||
|
local c1 = self:Translate(radius,i,false,false)
|
||||||
|
local c2 = self:Translate(radius,polar,false,false)
|
||||||
|
local h1 = c1:GetLandHeight()
|
||||||
|
local h2 = c2:GetLandHeight()
|
||||||
|
local d1 = math.abs(h1-h2)
|
||||||
|
local d2 = math.abs(h0-h1)
|
||||||
|
local d3 = math.abs(h0-h2)
|
||||||
|
local dm = d1 > d2 and d1 or d2
|
||||||
|
local dm1 = dm > d3 and dm or d3
|
||||||
|
bdelta = dm1 > bdelta and dm1 or bdelta
|
||||||
|
self:T(string.format("d1=%d, d2=%d, d3=%d, max delta=%d",d1,d2,d3,bdelta))
|
||||||
|
end
|
||||||
|
local steepness = bdelta / (radius / 100)
|
||||||
|
if steepness >= elev then steep = true end
|
||||||
|
return steep, math.floor(steepness)
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Function to check if a coordinate is in a flat (<8% elevation) area of the map
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @param #number Radius (Optional) Radius to check around the coordinate, defaults to 50m (100m diameter)
|
||||||
|
-- @param #number Minelevation (Optional) Elevation from which on a area is defined as steep, defaults to 8% (8m height gain across 100 meters)
|
||||||
|
-- @return #boolen IsFlat If true, area is flat
|
||||||
|
-- @return #number MaxElevation Elevation in meters measured over 100m
|
||||||
|
function COORDINATE:IsInFlatArea(Radius,Minelevation)
|
||||||
|
local steep, elev = self:IsInSteepArea(Radius,Minelevation)
|
||||||
|
local flat = not steep
|
||||||
|
return flat, elev
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
do -- POINT_VEC3
|
do -- POINT_VEC3
|
||||||
@@ -3309,21 +3585,21 @@ do -- POINT_VEC3
|
|||||||
|
|
||||||
--- Return the x coordinate of the POINT_VEC3.
|
--- Return the x coordinate of the POINT_VEC3.
|
||||||
-- @param #POINT_VEC3 self
|
-- @param #POINT_VEC3 self
|
||||||
-- @return #number The x coodinate.
|
-- @return #number The x coordinate.
|
||||||
function POINT_VEC3:GetX()
|
function POINT_VEC3:GetX()
|
||||||
return self.x
|
return self.x
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Return the y coordinate of the POINT_VEC3.
|
--- Return the y coordinate of the POINT_VEC3.
|
||||||
-- @param #POINT_VEC3 self
|
-- @param #POINT_VEC3 self
|
||||||
-- @return #number The y coodinate.
|
-- @return #number The y coordinate.
|
||||||
function POINT_VEC3:GetY()
|
function POINT_VEC3:GetY()
|
||||||
return self.y
|
return self.y
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Return the z coordinate of the POINT_VEC3.
|
--- Return the z coordinate of the POINT_VEC3.
|
||||||
-- @param #POINT_VEC3 self
|
-- @param #POINT_VEC3 self
|
||||||
-- @return #number The z coodinate.
|
-- @return #number The z coordinate.
|
||||||
function POINT_VEC3:GetZ()
|
function POINT_VEC3:GetZ()
|
||||||
return self.z
|
return self.z
|
||||||
end
|
end
|
||||||
@@ -3357,7 +3633,7 @@ do -- POINT_VEC3
|
|||||||
|
|
||||||
--- Add to the x coordinate of the POINT_VEC3.
|
--- Add to the x coordinate of the POINT_VEC3.
|
||||||
-- @param #POINT_VEC3 self
|
-- @param #POINT_VEC3 self
|
||||||
-- @param #number x The x coordinate value to add to the current x coodinate.
|
-- @param #number x The x coordinate value to add to the current x coordinate.
|
||||||
-- @return #POINT_VEC3
|
-- @return #POINT_VEC3
|
||||||
function POINT_VEC3:AddX( x )
|
function POINT_VEC3:AddX( x )
|
||||||
self.x = self.x + x
|
self.x = self.x + x
|
||||||
@@ -3366,7 +3642,7 @@ do -- POINT_VEC3
|
|||||||
|
|
||||||
--- Add to the y coordinate of the POINT_VEC3.
|
--- Add to the y coordinate of the POINT_VEC3.
|
||||||
-- @param #POINT_VEC3 self
|
-- @param #POINT_VEC3 self
|
||||||
-- @param #number y The y coordinate value to add to the current y coodinate.
|
-- @param #number y The y coordinate value to add to the current y coordinate.
|
||||||
-- @return #POINT_VEC3
|
-- @return #POINT_VEC3
|
||||||
function POINT_VEC3:AddY( y )
|
function POINT_VEC3:AddY( y )
|
||||||
self.y = self.y + y
|
self.y = self.y + y
|
||||||
@@ -3375,7 +3651,7 @@ do -- POINT_VEC3
|
|||||||
|
|
||||||
--- Add to the z coordinate of the POINT_VEC3.
|
--- Add to the z coordinate of the POINT_VEC3.
|
||||||
-- @param #POINT_VEC3 self
|
-- @param #POINT_VEC3 self
|
||||||
-- @param #number z The z coordinate value to add to the current z coodinate.
|
-- @param #number z The z coordinate value to add to the current z coordinate.
|
||||||
-- @return #POINT_VEC3
|
-- @return #POINT_VEC3
|
||||||
function POINT_VEC3:AddZ( z )
|
function POINT_VEC3:AddZ( z )
|
||||||
self.z = self.z +z
|
self.z = self.z +z
|
||||||
@@ -3396,7 +3672,7 @@ end
|
|||||||
|
|
||||||
do -- POINT_VEC2
|
do -- POINT_VEC2
|
||||||
|
|
||||||
--- @type POINT_VEC2
|
-- @type POINT_VEC2
|
||||||
-- @field DCS#Distance x The x coordinate in meters.
|
-- @field DCS#Distance x The x coordinate in meters.
|
||||||
-- @field DCS#Distance y the y coordinate in meters.
|
-- @field DCS#Distance y the y coordinate in meters.
|
||||||
-- @extends Core.Point#COORDINATE
|
-- @extends Core.Point#COORDINATE
|
||||||
@@ -3481,14 +3757,14 @@ do -- POINT_VEC2
|
|||||||
|
|
||||||
--- Return the x coordinate of the POINT_VEC2.
|
--- Return the x coordinate of the POINT_VEC2.
|
||||||
-- @param #POINT_VEC2 self
|
-- @param #POINT_VEC2 self
|
||||||
-- @return #number The x coodinate.
|
-- @return #number The x coordinate.
|
||||||
function POINT_VEC2:GetX()
|
function POINT_VEC2:GetX()
|
||||||
return self.x
|
return self.x
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Return the y coordinate of the POINT_VEC2.
|
--- Return the y coordinate of the POINT_VEC2.
|
||||||
-- @param #POINT_VEC2 self
|
-- @param #POINT_VEC2 self
|
||||||
-- @return #number The y coodinate.
|
-- @return #number The y coordinate.
|
||||||
function POINT_VEC2:GetY()
|
function POINT_VEC2:GetY()
|
||||||
return self.z
|
return self.z
|
||||||
end
|
end
|
||||||
@@ -3513,7 +3789,7 @@ do -- POINT_VEC2
|
|||||||
|
|
||||||
--- Return Return the Lat(itude) coordinate of the POINT_VEC2 (ie: (parent)POINT_VEC3.x).
|
--- Return Return the Lat(itude) coordinate of the POINT_VEC2 (ie: (parent)POINT_VEC3.x).
|
||||||
-- @param #POINT_VEC2 self
|
-- @param #POINT_VEC2 self
|
||||||
-- @return #number The x coodinate.
|
-- @return #number The x coordinate.
|
||||||
function POINT_VEC2:GetLat()
|
function POINT_VEC2:GetLat()
|
||||||
return self.x
|
return self.x
|
||||||
end
|
end
|
||||||
@@ -3529,7 +3805,7 @@ do -- POINT_VEC2
|
|||||||
|
|
||||||
--- Return the Lon(gitude) coordinate of the POINT_VEC2 (ie: (parent)POINT_VEC3.z).
|
--- Return the Lon(gitude) coordinate of the POINT_VEC2 (ie: (parent)POINT_VEC3.z).
|
||||||
-- @param #POINT_VEC2 self
|
-- @param #POINT_VEC2 self
|
||||||
-- @return #number The y coodinate.
|
-- @return #number The y coordinate.
|
||||||
function POINT_VEC2:GetLon()
|
function POINT_VEC2:GetLon()
|
||||||
return self.z
|
return self.z
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **Core** -- SCHEDULEDISPATCHER dispatches the different schedules.
|
--- **Core** - SCHEDULEDISPATCHER dispatches the different schedules.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -14,17 +14,13 @@
|
|||||||
--
|
--
|
||||||
-- # Demo Missions
|
-- # Demo Missions
|
||||||
--
|
--
|
||||||
-- ### [SCHEDULER Demo Missions source code](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SCH%20-%20Scheduler)
|
-- ### [SCHEDULER Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Core/Scheduler)
|
||||||
--
|
|
||||||
-- ### [SCHEDULER Demo Missions, only for beta testers](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SCH%20-%20Scheduler)
|
|
||||||
--
|
|
||||||
-- ### [ALL Demo Missions pack of the last release](https://github.com/FlightControl-Master/MOOSE_MISSIONS/releases)
|
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # YouTube Channel
|
-- # YouTube Channel
|
||||||
--
|
--
|
||||||
-- ### [SCHEDULER YouTube Channel (none)]()
|
-- ### None
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -52,7 +48,7 @@
|
|||||||
--
|
--
|
||||||
-- A SCHEDULER can manage **multiple** (repeating) schedules. Each planned or executing schedule has a unique **ScheduleID**.
|
-- A SCHEDULER can manage **multiple** (repeating) schedules. Each planned or executing schedule has a unique **ScheduleID**.
|
||||||
-- The ScheduleID is returned when the method @{#SCHEDULER.Schedule}() is called.
|
-- The ScheduleID is returned when the method @{#SCHEDULER.Schedule}() is called.
|
||||||
-- It is recommended to store the ScheduleID in a variable, as it is used in the methods @{SCHEDULER.Start}() and @{SCHEDULER.Stop}(),
|
-- It is recommended to store the ScheduleID in a variable, as it is used in the methods @{#SCHEDULER.Start}() and @{#SCHEDULER.Stop}(),
|
||||||
-- which can start and stop specific repeating schedules respectively within a SCHEDULER object.
|
-- which can start and stop specific repeating schedules respectively within a SCHEDULER object.
|
||||||
--
|
--
|
||||||
-- ## SCHEDULER constructor
|
-- ## SCHEDULER constructor
|
||||||
@@ -208,7 +204,7 @@ SCHEDULER = {
|
|||||||
-- @param #number RandomizeFactor Specifies a randomization factor between 0 and 1 to randomize the Repeat.
|
-- @param #number RandomizeFactor Specifies a randomization factor between 0 and 1 to randomize the Repeat.
|
||||||
-- @param #number Stop Specifies the amount of seconds when the scheduler will be stopped.
|
-- @param #number Stop Specifies the amount of seconds when the scheduler will be stopped.
|
||||||
-- @return #SCHEDULER self.
|
-- @return #SCHEDULER self.
|
||||||
-- @return #table The ScheduleID of the planned schedule.
|
-- @return #string The ScheduleID of the planned schedule.
|
||||||
function SCHEDULER:New( MasterObject, SchedulerFunction, SchedulerArguments, Start, Repeat, RandomizeFactor, Stop )
|
function SCHEDULER:New( MasterObject, SchedulerFunction, SchedulerArguments, Start, Repeat, RandomizeFactor, Stop )
|
||||||
|
|
||||||
local self = BASE:Inherit( self, BASE:New() ) -- #SCHEDULER
|
local self = BASE:Inherit( self, BASE:New() ) -- #SCHEDULER
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
|||||||
--- **Core** - Manages various settings for running missions, consumed by moose classes and provides a menu system for players to tweak settings in running missions.
|
--- **Core** - Manages various settings for missions, providing a menu for players to tweak settings in running missions.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
--
|
--
|
||||||
-- Will customize which display format is used to indicate A2G coordinates in text as part of the Command Center communications.
|
-- Will customize which display format is used to indicate A2G coordinates in text as part of the Command Center communications.
|
||||||
--
|
--
|
||||||
-- - A2G BR: [Bearing Range](https://en.wikipedia.org/wiki/Bearing_(navigation)).
|
-- - A2G BR: [Bearing Range](https://en.wikipedia.org/wiki/Bearing_\(navigation\)).
|
||||||
-- - A2G MGRS: The [Military Grid Reference System](https://en.wikipedia.org/wiki/Military_Grid_Reference_System). The accuracy can also be adapted.
|
-- - A2G MGRS: The [Military Grid Reference System](https://en.wikipedia.org/wiki/Military_Grid_Reference_System). The accuracy can also be adapted.
|
||||||
-- - A2G LL DMS: Latitude Longitude [Degrees Minutes Seconds](https://en.wikipedia.org/wiki/Geographic_coordinate_conversion). The accuracy can also be adapted.
|
-- - A2G LL DMS: Latitude Longitude [Degrees Minutes Seconds](https://en.wikipedia.org/wiki/Geographic_coordinate_conversion). The accuracy can also be adapted.
|
||||||
-- - A2G LL DDM: Latitude Longitude [Decimal Degrees Minutes](https://en.wikipedia.org/wiki/Decimal_degrees). The accuracy can also be adapted.
|
-- - A2G LL DDM: Latitude Longitude [Decimal Degrees Minutes](https://en.wikipedia.org/wiki/Decimal_degrees). The accuracy can also be adapted.
|
||||||
@@ -105,9 +105,9 @@
|
|||||||
-- There are different methods that can be used to change the **System settings** using the \_SETTINGS object.
|
-- There are different methods that can be used to change the **System settings** using the \_SETTINGS object.
|
||||||
--
|
--
|
||||||
-- - @{#SETTINGS.SetA2G_BR}(): Enable the BR display formatting by default.
|
-- - @{#SETTINGS.SetA2G_BR}(): Enable the BR display formatting by default.
|
||||||
-- - @{#SETTINGS.SetA2G_MGRS}(): Enable the MGRS display formatting by default. Use @{SETTINGS.SetMGRS_Accuracy}() to adapt the accuracy of the MGRS formatting.
|
-- - @{#SETTINGS.SetA2G_MGRS}(): Enable the MGRS display formatting by default. Use @{#SETTINGS.SetMGRS_Accuracy}() to adapt the accuracy of the MGRS formatting.
|
||||||
-- - @{#SETTINGS.SetA2G_LL_DMS}(): Enable the LL DMS display formatting by default. Use @{SETTINGS.SetLL_Accuracy}() to adapt the accuracy of the Seconds formatting.
|
-- - @{#SETTINGS.SetA2G_LL_DMS}(): Enable the LL DMS display formatting by default. Use @{#SETTINGS.SetLL_Accuracy}() to adapt the accuracy of the Seconds formatting.
|
||||||
-- - @{#SETTINGS.SetA2G_LL_DDM}(): Enable the LL DDM display formatting by default. Use @{SETTINGS.SetLL_Accuracy}() to adapt the accuracy of the Seconds formatting.
|
-- - @{#SETTINGS.SetA2G_LL_DDM}(): Enable the LL DDM display formatting by default. Use @{#SETTINGS.SetLL_Accuracy}() to adapt the accuracy of the Seconds formatting.
|
||||||
--
|
--
|
||||||
-- ### 3.1.4) A2G coordinates setting - additional notes
|
-- ### 3.1.4) A2G coordinates setting - additional notes
|
||||||
--
|
--
|
||||||
@@ -120,7 +120,7 @@
|
|||||||
--
|
--
|
||||||
-- Will customize which display format is used to indicate A2A coordinates in text as part of the Command Center communications.
|
-- Will customize which display format is used to indicate A2A coordinates in text as part of the Command Center communications.
|
||||||
--
|
--
|
||||||
-- - A2A BRAA: [Bearing Range Altitude Aspect](https://en.wikipedia.org/wiki/Bearing_(navigation)).
|
-- - A2A BRAA: [Bearing Range Altitude Aspect](https://en.wikipedia.org/wiki/Bearing_\(navigation\)).
|
||||||
-- - A2A MGRS: The [Military Grid Reference System](https://en.wikipedia.org/wiki/Military_Grid_Reference_System). The accuracy can also be adapted.
|
-- - A2A MGRS: The [Military Grid Reference System](https://en.wikipedia.org/wiki/Military_Grid_Reference_System). The accuracy can also be adapted.
|
||||||
-- - A2A LL DMS: Lattitude Longitude [Degrees Minutes Seconds](https://en.wikipedia.org/wiki/Geographic_coordinate_conversion). The accuracy can also be adapted.
|
-- - A2A LL DMS: Lattitude Longitude [Degrees Minutes Seconds](https://en.wikipedia.org/wiki/Geographic_coordinate_conversion). The accuracy can also be adapted.
|
||||||
-- - A2A LL DDM: Lattitude Longitude [Decimal Degrees and Minutes](https://en.wikipedia.org/wiki/Decimal_degrees). The accuracy can also be adapted.
|
-- - A2A LL DDM: Lattitude Longitude [Decimal Degrees and Minutes](https://en.wikipedia.org/wiki/Decimal_degrees). The accuracy can also be adapted.
|
||||||
@@ -135,9 +135,9 @@
|
|||||||
-- There are different methods that can be used to change the **System settings** using the \_SETTINGS object.
|
-- There are different methods that can be used to change the **System settings** using the \_SETTINGS object.
|
||||||
--
|
--
|
||||||
-- - @{#SETTINGS.SetA2A_BRAA}(): Enable the BR display formatting by default.
|
-- - @{#SETTINGS.SetA2A_BRAA}(): Enable the BR display formatting by default.
|
||||||
-- - @{#SETTINGS.SetA2A_MGRS}(): Enable the MGRS display formatting by default. Use @{SETTINGS.SetMGRS_Accuracy}() to adapt the accuracy of the MGRS formatting.
|
-- - @{#SETTINGS.SetA2A_MGRS}(): Enable the MGRS display formatting by default. Use @{#SETTINGS.SetMGRS_Accuracy}() to adapt the accuracy of the MGRS formatting.
|
||||||
-- - @{#SETTINGS.SetA2A_LL_DMS}(): Enable the LL DMS display formatting by default. Use @{SETTINGS.SetLL_Accuracy}() to adapt the accuracy of the Seconds formatting.
|
-- - @{#SETTINGS.SetA2A_LL_DMS}(): Enable the LL DMS display formatting by default. Use @{#SETTINGS.SetLL_Accuracy}() to adapt the accuracy of the Seconds formatting.
|
||||||
-- - @{#SETTINGS.SetA2A_LL_DDM}(): Enable the LL DDM display formatting by default. Use @{SETTINGS.SetLL_Accuracy}() to adapt the accuracy of the Seconds formatting.
|
-- - @{#SETTINGS.SetA2A_LL_DDM}(): Enable the LL DDM display formatting by default. Use @{#SETTINGS.SetLL_Accuracy}() to adapt the accuracy of the Seconds formatting.
|
||||||
-- - @{#SETTINGS.SetA2A_BULLS}(): Enable the BULLSeye display formatting by default.
|
-- - @{#SETTINGS.SetA2A_BULLS}(): Enable the BULLSeye display formatting by default.
|
||||||
--
|
--
|
||||||
-- ### 3.2.4) A2A coordinates settings - additional notes
|
-- ### 3.2.4) A2A coordinates settings - additional notes
|
||||||
@@ -190,8 +190,8 @@
|
|||||||
--
|
--
|
||||||
-- There are different methods that can be used to change the **System settings** using the \_SETTINGS object.
|
-- There are different methods that can be used to change the **System settings** using the \_SETTINGS object.
|
||||||
--
|
--
|
||||||
-- - @{#SETTINGS.SetMessageTime}(): Define for a specific @{Message.MESSAGE.MessageType} the duration to be displayed in seconds.
|
-- - @{#SETTINGS.SetMessageTime}(): Define for a specific @{Core.Message#MESSAGE.MessageType} the duration to be displayed in seconds.
|
||||||
-- - @{#SETTINGS.GetMessageTime}(): Retrieves for a specific @{Message.MESSAGE.MessageType} the duration to be displayed in seconds.
|
-- - @{#SETTINGS.GetMessageTime}(): Retrieves for a specific @{Core.Message#MESSAGE.MessageType} the duration to be displayed in seconds.
|
||||||
--
|
--
|
||||||
-- ## 3.5) **Era** of the battle
|
-- ## 3.5) **Era** of the battle
|
||||||
--
|
--
|
||||||
@@ -283,21 +283,21 @@ do -- SETTINGS
|
|||||||
function SETTINGS:SetMetric()
|
function SETTINGS:SetMetric()
|
||||||
self.Metric = true
|
self.Metric = true
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Sets the SETTINGS default text locale.
|
--- Sets the SETTINGS default text locale.
|
||||||
-- @param #SETTINGS self
|
-- @param #SETTINGS self
|
||||||
-- @param #string Locale
|
-- @param #string Locale
|
||||||
function SETTINGS:SetLocale(Locale)
|
function SETTINGS:SetLocale(Locale)
|
||||||
self.Locale = Locale or "en"
|
self.Locale = Locale or "en"
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Gets the SETTINGS text locale.
|
--- Gets the SETTINGS text locale.
|
||||||
-- @param #SETTINGS self
|
-- @param #SETTINGS self
|
||||||
-- @return #string
|
-- @return #string
|
||||||
function SETTINGS:GetLocale()
|
function SETTINGS:GetLocale()
|
||||||
return self.Locale or _SETTINGS:GetLocale()
|
return self.Locale or _SETTINGS:GetLocale()
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Gets if the SETTINGS is metric.
|
--- Gets if the SETTINGS is metric.
|
||||||
-- @param #SETTINGS self
|
-- @param #SETTINGS self
|
||||||
-- @return #boolean true if metric.
|
-- @return #boolean true if metric.
|
||||||
@@ -335,7 +335,7 @@ do -- SETTINGS
|
|||||||
|
|
||||||
--- Sets the SETTINGS MGRS accuracy.
|
--- Sets the SETTINGS MGRS accuracy.
|
||||||
-- @param #SETTINGS self
|
-- @param #SETTINGS self
|
||||||
-- @param #number MGRS_Accuracy
|
-- @param #number MGRS_Accuracy 0 to 5
|
||||||
-- @return #SETTINGS
|
-- @return #SETTINGS
|
||||||
function SETTINGS:SetMGRS_Accuracy( MGRS_Accuracy )
|
function SETTINGS:SetMGRS_Accuracy( MGRS_Accuracy )
|
||||||
self.MGRS_Accuracy = MGRS_Accuracy
|
self.MGRS_Accuracy = MGRS_Accuracy
|
||||||
@@ -744,7 +744,7 @@ do -- SETTINGS
|
|||||||
|
|
||||||
self.PlayerMenu = PlayerMenu
|
self.PlayerMenu = PlayerMenu
|
||||||
|
|
||||||
self:I( string.format( "Setting menu for player %s", tostring( PlayerName ) ) )
|
self:T( string.format( "Setting menu for player %s", tostring( PlayerName ) ) )
|
||||||
|
|
||||||
local submenu = MENU_GROUP:New( PlayerGroup, "LL Accuracy", PlayerMenu )
|
local submenu = MENU_GROUP:New( PlayerGroup, "LL Accuracy", PlayerMenu )
|
||||||
MENU_GROUP_COMMAND:New( PlayerGroup, "LL 0 Decimals", submenu, self.MenuGroupLL_DDM_AccuracySystem, self, PlayerUnit, PlayerGroup, PlayerName, 0 )
|
MENU_GROUP_COMMAND:New( PlayerGroup, "LL 0 Decimals", submenu, self.MenuGroupLL_DDM_AccuracySystem, self, PlayerUnit, PlayerGroup, PlayerName, 0 )
|
||||||
@@ -989,7 +989,7 @@ do -- SETTINGS
|
|||||||
do
|
do
|
||||||
--- @param #SETTINGS self
|
--- @param #SETTINGS self
|
||||||
function SETTINGS:MenuGroupA2GSystem( PlayerUnit, PlayerGroup, PlayerName, A2GSystem )
|
function SETTINGS:MenuGroupA2GSystem( PlayerUnit, PlayerGroup, PlayerName, A2GSystem )
|
||||||
BASE:E( { self, PlayerUnit:GetName(), A2GSystem } )
|
--BASE:E( {PlayerUnit:GetName(), A2GSystem } )
|
||||||
self.A2GSystem = A2GSystem
|
self.A2GSystem = A2GSystem
|
||||||
MESSAGE:New( string.format( "Settings: A2G format set to %s for player %s.", A2GSystem, PlayerName ), 5 ):ToGroup( PlayerGroup )
|
MESSAGE:New( string.format( "Settings: A2G format set to %s for player %s.", A2GSystem, PlayerName ), 5 ):ToGroup( PlayerGroup )
|
||||||
if _SETTINGS.MenuStatic == false then
|
if _SETTINGS.MenuStatic == false then
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SPA%20-%20Spawning)
|
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Core/Spawn)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
-- @field #SPAWN.SpawnZoneTable SpawnZoneTable
|
-- @field #SPAWN.SpawnZoneTable SpawnZoneTable
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
--- Allows to spawn dynamically new @{Core.Group}s.
|
--- Allows to spawn dynamically new @{Wrapper.Group}s.
|
||||||
--
|
--
|
||||||
-- Each SPAWN object needs to be have related **template groups** setup in the Mission Editor (ME),
|
-- Each SPAWN object needs to be have related **template groups** setup in the Mission Editor (ME),
|
||||||
-- which is a normal group with the **Late Activation** flag set.
|
-- which is a normal group with the **Late Activation** flag set.
|
||||||
@@ -162,12 +162,22 @@
|
|||||||
-- ### Array formation
|
-- ### Array formation
|
||||||
--
|
--
|
||||||
-- * @{#SPAWN.InitArray}(): Make groups visible before they are actually activated, and order these groups like a battalion in an array.
|
-- * @{#SPAWN.InitArray}(): Make groups visible before they are actually activated, and order these groups like a battalion in an array.
|
||||||
--
|
--
|
||||||
|
-- ### Group initial position - if wanted different from template position, for use with e.g. @{#SPAWN.SpawnScheduled}().
|
||||||
|
--
|
||||||
|
-- * @{#SPAWN.InitPositionCoordinate}(): Set initial position of group via a COORDINATE.
|
||||||
|
-- * @{#SPAWN.InitPositionVec2}(): Set initial position of group via a VEC2.
|
||||||
|
--
|
||||||
|
-- ### Set the positions of a group's units to absolute positions, or relative positions to unit No. 1
|
||||||
|
--
|
||||||
|
-- * @{#SPAWN.InitSetUnitRelativePositions}(): Spawn the UNITs of this group with individual relative positions to unit #1 and individual headings.
|
||||||
|
-- * @{#SPAWN.InitSetUnitAbsolutePositions}(): Spawn the UNITs of this group with individual absolute positions and individual headings.
|
||||||
|
--
|
||||||
-- ### Position randomization
|
-- ### Position randomization
|
||||||
--
|
--
|
||||||
-- * @{#SPAWN.InitRandomizePosition}(): Randomizes the position of @{Wrapper.Group}s that are spawned within a **radius band**, given an Outer and Inner radius, from the point that the spawn happens.
|
-- * @{#SPAWN.InitRandomizePosition}(): Randomizes the position of @{Wrapper.Group}s that are spawned within a **radius band**, given an Outer and Inner radius, from the point that the spawn happens.
|
||||||
-- * @{#SPAWN.InitRandomizeUnits}(): Randomizes the @{Wrapper.Unit}s in the @{Wrapper.Group} that is spawned within a **radius band**, given an Outer and Inner radius.
|
-- * @{#SPAWN.InitRandomizeUnits}(): Randomizes the @{Wrapper.Unit}s in the @{Wrapper.Group} that is spawned within a **radius band**, given an Outer and Inner radius.
|
||||||
-- * @{#SPAWN.InitRandomizeZones}(): Randomizes the spawning between a predefined list of @{Zone}s that are declared using this function. Each zone can be given a probability factor.
|
-- * @{#SPAWN.InitRandomizeZones}(): Randomizes the spawning between a predefined list of @{Core.Zone}s that are declared using this function. Each zone can be given a probability factor.
|
||||||
--
|
--
|
||||||
-- ### Enable / Disable AI when spawning a new @{Wrapper.Group}
|
-- ### Enable / Disable AI when spawning a new @{Wrapper.Group}
|
||||||
--
|
--
|
||||||
@@ -200,13 +210,13 @@
|
|||||||
-- * @{#SPAWN.ReSpawn}(): Re-spawn a group based on a given index.
|
-- * @{#SPAWN.ReSpawn}(): Re-spawn a group based on a given index.
|
||||||
-- * @{#SPAWN.SpawnFromVec3}(): Spawn a new group from a Vec3 coordinate. (The group will can be spawned at a point in the air).
|
-- * @{#SPAWN.SpawnFromVec3}(): Spawn a new group from a Vec3 coordinate. (The group will can be spawned at a point in the air).
|
||||||
-- * @{#SPAWN.SpawnFromVec2}(): Spawn a new group from a Vec2 coordinate. (The group will be spawned at land height ).
|
-- * @{#SPAWN.SpawnFromVec2}(): Spawn a new group from a Vec2 coordinate. (The group will be spawned at land height ).
|
||||||
-- * @{#SPAWN.SpawnFromStatic}(): Spawn a new group from a structure, taking the position of a @{Static}.
|
-- * @{#SPAWN.SpawnFromStatic}(): Spawn a new group from a structure, taking the position of a @{Wrapper.Static}.
|
||||||
-- * @{#SPAWN.SpawnFromUnit}(): Spawn a new group taking the position of a @{Wrapper.Unit}.
|
-- * @{#SPAWN.SpawnFromUnit}(): Spawn a new group taking the position of a @{Wrapper.Unit}.
|
||||||
-- * @{#SPAWN.SpawnInZone}(): Spawn a new group in a @{Zone}.
|
-- * @{#SPAWN.SpawnInZone}(): Spawn a new group in a @{Core.Zone}.
|
||||||
-- * @{#SPAWN.SpawnAtAirbase}(): Spawn a new group at an @{Wrapper.Airbase}, which can be an airdrome, ship or helipad.
|
-- * @{#SPAWN.SpawnAtAirbase}(): Spawn a new group at an @{Wrapper.Airbase}, which can be an airdrome, ship or helipad.
|
||||||
--
|
--
|
||||||
-- Note that @{#SPAWN.Spawn} and @{#SPAWN.ReSpawn} return a @{Wrapper.Group#GROUP.New} object, that contains a reference to the DCSGroup object.
|
-- Note that @{#SPAWN.Spawn} and @{#SPAWN.ReSpawn} return a @{Wrapper.Group#GROUP.New} object, that contains a reference to the DCSGroup object.
|
||||||
-- You can use the @{GROUP} object to do further actions with the DCSGroup.
|
-- You can use the @{Wrapper.Group#GROUP} object to do further actions with the DCSGroup.
|
||||||
--
|
--
|
||||||
-- ### **Scheduled** spawning methods
|
-- ### **Scheduled** spawning methods
|
||||||
--
|
--
|
||||||
@@ -268,7 +278,7 @@ SPAWN = {
|
|||||||
-- @type SPAWN.Takeoff
|
-- @type SPAWN.Takeoff
|
||||||
-- @extends Wrapper.Group#GROUP.Takeoff
|
-- @extends Wrapper.Group#GROUP.Takeoff
|
||||||
|
|
||||||
--- @field #SPAWN.Takeoff Takeoff
|
-- @field #SPAWN.Takeoff Takeoff
|
||||||
SPAWN.Takeoff = {
|
SPAWN.Takeoff = {
|
||||||
Air = 1,
|
Air = 1,
|
||||||
Runway = 2,
|
Runway = 2,
|
||||||
@@ -276,7 +286,8 @@ SPAWN.Takeoff = {
|
|||||||
Cold = 4,
|
Cold = 4,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- @type SPAWN.SpawnZoneTable
|
---
|
||||||
|
-- @type SPAWN.SpawnZoneTable
|
||||||
-- @list <Core.Zone#ZONE_BASE> SpawnZone
|
-- @list <Core.Zone#ZONE_BASE> SpawnZone
|
||||||
|
|
||||||
--- Creates the main object to spawn a @{Wrapper.Group} defined in the DCS ME.
|
--- Creates the main object to spawn a @{Wrapper.Group} defined in the DCS ME.
|
||||||
@@ -309,7 +320,7 @@ function SPAWN:New( SpawnTemplatePrefix )
|
|||||||
self.AIOnOff = true -- The AI is on by default when spawning a group.
|
self.AIOnOff = true -- The AI is on by default when spawning a group.
|
||||||
self.SpawnUnControlled = false
|
self.SpawnUnControlled = false
|
||||||
self.SpawnInitKeepUnitNames = false -- Overwrite unit names by default with group name.
|
self.SpawnInitKeepUnitNames = false -- Overwrite unit names by default with group name.
|
||||||
self.DelayOnOff = false -- No intial delay when spawning the first group.
|
self.DelayOnOff = false -- No initial delay when spawning the first group.
|
||||||
self.SpawnGrouping = nil -- No grouping.
|
self.SpawnGrouping = nil -- No grouping.
|
||||||
self.SpawnInitLivery = nil -- No special livery.
|
self.SpawnInitLivery = nil -- No special livery.
|
||||||
self.SpawnInitSkill = nil -- No special skill.
|
self.SpawnInitSkill = nil -- No special skill.
|
||||||
@@ -317,8 +328,11 @@ function SPAWN:New( SpawnTemplatePrefix )
|
|||||||
self.SpawnInitModu = nil -- No special modulation.
|
self.SpawnInitModu = nil -- No special modulation.
|
||||||
self.SpawnInitRadio = nil -- No radio comms setting.
|
self.SpawnInitRadio = nil -- No radio comms setting.
|
||||||
self.SpawnInitModex = nil
|
self.SpawnInitModex = nil
|
||||||
|
self.SpawnInitModexPrefix = nil
|
||||||
|
self.SpawnInitModexPostfix = nil
|
||||||
self.SpawnInitAirbase = nil
|
self.SpawnInitAirbase = nil
|
||||||
self.TweakedTemplate = false -- Check if the user is using self made template.
|
self.TweakedTemplate = false -- Check if the user is using self made template.
|
||||||
|
self.SpawnRandomCallsign = false
|
||||||
|
|
||||||
self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned.
|
self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned.
|
||||||
else
|
else
|
||||||
@@ -335,7 +349,7 @@ end
|
|||||||
-- @param #SPAWN self
|
-- @param #SPAWN self
|
||||||
-- @param #string SpawnTemplatePrefix is the name of the Group in the ME that defines the Template.
|
-- @param #string SpawnTemplatePrefix is the name of the Group in the ME that defines the Template.
|
||||||
-- @param #string SpawnAliasPrefix is the name that will be given to the Group at runtime.
|
-- @param #string SpawnAliasPrefix is the name that will be given to the Group at runtime.
|
||||||
-- @return #SPAWN
|
-- @return #SPAWN self
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- NATO helicopters engaging in the battle field.
|
-- -- NATO helicopters engaging in the battle field.
|
||||||
-- Spawn_BE_KA50 = SPAWN:NewWithAlias( 'BE KA-50@RAMP-Ground Defense', 'Helicopter Attacking a City' )
|
-- Spawn_BE_KA50 = SPAWN:NewWithAlias( 'BE KA-50@RAMP-Ground Defense', 'Helicopter Attacking a City' )
|
||||||
@@ -371,6 +385,8 @@ function SPAWN:NewWithAlias( SpawnTemplatePrefix, SpawnAliasPrefix )
|
|||||||
self.SpawnInitModu = nil -- No special modulation.
|
self.SpawnInitModu = nil -- No special modulation.
|
||||||
self.SpawnInitRadio = nil -- No radio communication setting.
|
self.SpawnInitRadio = nil -- No radio communication setting.
|
||||||
self.SpawnInitModex = nil
|
self.SpawnInitModex = nil
|
||||||
|
self.SpawnInitModexPrefix = nil
|
||||||
|
self.SpawnInitModexPostfix = nil
|
||||||
self.SpawnInitAirbase = nil
|
self.SpawnInitAirbase = nil
|
||||||
self.TweakedTemplate = false -- Check if the user is using self made template.
|
self.TweakedTemplate = false -- Check if the user is using self made template.
|
||||||
|
|
||||||
@@ -385,32 +401,129 @@ function SPAWN:NewWithAlias( SpawnTemplatePrefix, SpawnAliasPrefix )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Creates a new SPAWN instance to create new groups based on the provided template.
|
--- Creates a new SPAWN instance to create new groups based on the provided template. This will also register the template for future use.
|
||||||
-- @param #SPAWN self
|
-- @param #SPAWN self
|
||||||
-- @param #table SpawnTemplate is the Template of the Group. This must be a valid Group Template structure!
|
-- @param #table SpawnTemplate is the Template of the Group. This must be a valid Group Template structure - see [Hoggit Wiki](https://wiki.hoggitworld.com/view/DCS_func_addGroup)!
|
||||||
-- @param #string SpawnTemplatePrefix is the name of the Group that will be given at each spawn.
|
-- @param #string SpawnTemplatePrefix [Mandatory] is the name of the template and the prefix of the GROUP on spawn. The name in the template **will** be overwritten!
|
||||||
-- @param #string SpawnAliasPrefix (optional) is the name that will be given to the Group at runtime.
|
-- @param #string SpawnAliasPrefix [Optional] is the prefix that will be given to the GROUP on spawn.
|
||||||
-- @return #SPAWN
|
-- @param #boolean NoMooseNamingPostfix [Optional] If true, skip the Moose naming additions (like groupname#001-01) - **but** you need to ensure yourself no duplicate group names exist!
|
||||||
|
-- @return #SPAWN self
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Create a new SPAWN object based on a Group Template defined from scratch.
|
-- -- Spawn a P51 Mustang from scratch
|
||||||
-- Spawn_BE_KA50 = SPAWN:NewWithAlias( 'BE KA-50@RAMP-Ground Defense', 'Helicopter Attacking a City' )
|
-- local ttemp =
|
||||||
-- @usage
|
-- {
|
||||||
--
|
-- ["modulation"] = 0,
|
||||||
-- -- Create a new CSAR_Spawn object based on a normal Group Template to spawn a soldier.
|
-- ["tasks"] =
|
||||||
-- local CSAR_Spawn = SPAWN:NewWithFromTemplate( Template, "CSAR", "Pilot" )
|
-- {
|
||||||
--
|
-- }, -- end of ["tasks"]
|
||||||
function SPAWN:NewFromTemplate( SpawnTemplate, SpawnTemplatePrefix, SpawnAliasPrefix )
|
-- ["task"] = "Reconnaissance",
|
||||||
local self = BASE:Inherit( self, BASE:New() )
|
-- ["uncontrolled"] = false,
|
||||||
self:F( { SpawnTemplate, SpawnTemplatePrefix, SpawnAliasPrefix } )
|
-- ["route"] =
|
||||||
if SpawnAliasPrefix == nil or SpawnAliasPrefix == "" then
|
-- {
|
||||||
BASE:I( "ERROR: in function NewFromTemplate, required paramter SpawnAliasPrefix is not set" )
|
-- ["points"] =
|
||||||
|
-- {
|
||||||
|
-- [1] =
|
||||||
|
-- {
|
||||||
|
-- ["alt"] = 2000,
|
||||||
|
-- ["action"] = "Turning Point",
|
||||||
|
-- ["alt_type"] = "BARO",
|
||||||
|
-- ["speed"] = 125,
|
||||||
|
-- ["task"] =
|
||||||
|
-- {
|
||||||
|
-- ["id"] = "ComboTask",
|
||||||
|
-- ["params"] =
|
||||||
|
-- {
|
||||||
|
-- ["tasks"] =
|
||||||
|
-- {
|
||||||
|
-- }, -- end of ["tasks"]
|
||||||
|
-- }, -- end of ["params"]
|
||||||
|
-- }, -- end of ["task"]
|
||||||
|
-- ["type"] = "Turning Point",
|
||||||
|
-- ["ETA"] = 0,
|
||||||
|
-- ["ETA_locked"] = true,
|
||||||
|
-- ["y"] = 666285.71428571,
|
||||||
|
-- ["x"] = -312000,
|
||||||
|
-- ["formation_template"] = "",
|
||||||
|
-- ["speed_locked"] = true,
|
||||||
|
-- }, -- end of [1]
|
||||||
|
-- }, -- end of ["points"]
|
||||||
|
-- }, -- end of ["route"]
|
||||||
|
-- ["groupId"] = 1,
|
||||||
|
-- ["hidden"] = false,
|
||||||
|
-- ["units"] =
|
||||||
|
-- {
|
||||||
|
-- [1] =
|
||||||
|
-- {
|
||||||
|
-- ["alt"] = 2000,
|
||||||
|
-- ["alt_type"] = "BARO",
|
||||||
|
-- ["livery_id"] = "USAF 364th FS",
|
||||||
|
-- ["skill"] = "High",
|
||||||
|
-- ["speed"] = 125,
|
||||||
|
-- ["type"] = "TF-51D",
|
||||||
|
-- ["unitId"] = 1,
|
||||||
|
-- ["psi"] = 0,
|
||||||
|
-- ["y"] = 666285.71428571,
|
||||||
|
-- ["x"] = -312000,
|
||||||
|
-- ["name"] = "P51-1-1",
|
||||||
|
-- ["payload"] =
|
||||||
|
-- {
|
||||||
|
-- ["pylons"] =
|
||||||
|
-- {
|
||||||
|
-- }, -- end of ["pylons"]
|
||||||
|
-- ["fuel"] = 340.68,
|
||||||
|
-- ["flare"] = 0,
|
||||||
|
-- ["chaff"] = 0,
|
||||||
|
-- ["gun"] = 100,
|
||||||
|
-- }, -- end of ["payload"]
|
||||||
|
-- ["heading"] = 0,
|
||||||
|
-- ["callsign"] =
|
||||||
|
-- {
|
||||||
|
-- [1] = 1,
|
||||||
|
-- [2] = 1,
|
||||||
|
-- ["name"] = "Enfield11",
|
||||||
|
-- [3] = 1,
|
||||||
|
-- }, -- end of ["callsign"]
|
||||||
|
-- ["onboard_num"] = "010",
|
||||||
|
-- }, -- end of [1]
|
||||||
|
-- }, -- end of ["units"]
|
||||||
|
-- ["y"] = 666285.71428571,
|
||||||
|
-- ["x"] = -312000,
|
||||||
|
-- ["name"] = "P51",
|
||||||
|
-- ["communication"] = true,
|
||||||
|
-- ["start_time"] = 0,
|
||||||
|
-- ["frequency"] = 124,
|
||||||
|
-- }
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- local mustang = SPAWN:NewFromTemplate(ttemp,"P51D")
|
||||||
|
-- -- you MUST set the next three:
|
||||||
|
-- mustang:InitCountry(country.id.FRANCE)
|
||||||
|
-- mustang:InitCategory(Group.Category.AIRPLANE)
|
||||||
|
-- mustang:InitCoalition(coalition.side.BLUE)
|
||||||
|
-- mustang:OnSpawnGroup(
|
||||||
|
-- function(grp)
|
||||||
|
-- MESSAGE:New("Group Spawned: "..grp:GetName(),15,"SPAWN"):ToAll()
|
||||||
|
-- end
|
||||||
|
-- )
|
||||||
|
-- mustang:Spawn()
|
||||||
|
--
|
||||||
|
function SPAWN:NewFromTemplate( SpawnTemplate, SpawnTemplatePrefix, SpawnAliasPrefix, NoMooseNamingPostfix )
|
||||||
|
local self = BASE:Inherit( self, BASE:New() )
|
||||||
|
self:F( { SpawnTemplate, SpawnTemplatePrefix, SpawnAliasPrefix } )
|
||||||
|
--if SpawnAliasPrefix == nil or SpawnAliasPrefix == "" then
|
||||||
|
--BASE:I( "ERROR: in function NewFromTemplate, required parameter SpawnAliasPrefix is not set" )
|
||||||
|
--return nil
|
||||||
|
--end
|
||||||
|
if SpawnTemplatePrefix == nil or SpawnTemplatePrefix == "" then
|
||||||
|
BASE:I( "ERROR: in function NewFromTemplate, required parameter SpawnTemplatePrefix is not set" )
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
if SpawnTemplate then
|
if SpawnTemplate then
|
||||||
self.SpawnTemplate = SpawnTemplate -- Contains the template structure for a Group Spawn from the Mission Editor. Note that this group must have lateActivation always on!!!
|
self.SpawnTemplate = SpawnTemplate -- Contains the template structure for a Group Spawn from the Mission Editor. Note that this group must have lateActivation always on!!!
|
||||||
self.SpawnTemplatePrefix = SpawnTemplatePrefix
|
self.SpawnTemplatePrefix = SpawnTemplatePrefix
|
||||||
self.SpawnAliasPrefix = SpawnAliasPrefix
|
self.SpawnAliasPrefix = SpawnAliasPrefix or SpawnTemplatePrefix
|
||||||
|
self.SpawnTemplate.name = SpawnTemplatePrefix
|
||||||
self.SpawnIndex = 0
|
self.SpawnIndex = 0
|
||||||
self.SpawnCount = 0 -- The internal counter of the amount of spawning the has happened since SpawnStart.
|
self.SpawnCount = 0 -- The internal counter of the amount of spawning the has happened since SpawnStart.
|
||||||
self.AliveUnits = 0 -- Contains the counter how many units are currently alive
|
self.AliveUnits = 0 -- Contains the counter how many units are currently alive
|
||||||
@@ -433,9 +546,15 @@ function SPAWN:NewFromTemplate( SpawnTemplate, SpawnTemplatePrefix, SpawnAliasPr
|
|||||||
self.SpawnInitModu = nil -- No special modulation.
|
self.SpawnInitModu = nil -- No special modulation.
|
||||||
self.SpawnInitRadio = nil -- No radio communication setting.
|
self.SpawnInitRadio = nil -- No radio communication setting.
|
||||||
self.SpawnInitModex = nil
|
self.SpawnInitModex = nil
|
||||||
|
self.SpawnInitModexPrefix = nil
|
||||||
|
self.SpawnInitModexPostfix = nil
|
||||||
self.SpawnInitAirbase = nil
|
self.SpawnInitAirbase = nil
|
||||||
self.TweakedTemplate = true -- Check if the user is using self made template.
|
self.TweakedTemplate = true -- Check if the user is using self made template.
|
||||||
|
self.MooseNameing = true
|
||||||
|
if NoMooseNamingPostfix == true then
|
||||||
|
self.MooseNameing = false
|
||||||
|
end
|
||||||
|
|
||||||
self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned.
|
self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned.
|
||||||
else
|
else
|
||||||
error( "There is no template provided for SpawnTemplatePrefix = '" .. SpawnTemplatePrefix .. "'" )
|
error( "There is no template provided for SpawnTemplatePrefix = '" .. SpawnTemplatePrefix .. "'" )
|
||||||
@@ -700,12 +819,17 @@ end
|
|||||||
--- Sets the modex of the first unit of the group. If more units are in the group, the number is increased by one with every unit.
|
--- Sets the modex of the first unit of the group. If more units are in the group, the number is increased by one with every unit.
|
||||||
-- @param #SPAWN self
|
-- @param #SPAWN self
|
||||||
-- @param #number modex Modex of the first unit.
|
-- @param #number modex Modex of the first unit.
|
||||||
|
-- @param #string prefix (optional) String to prefix to modex, e.g. for French AdA Modex, eg. -L-102 then "-L-" would be the prefix.
|
||||||
|
-- @param #string postfix (optional) String to postfix to modex, example tbd.
|
||||||
-- @return #SPAWN self
|
-- @return #SPAWN self
|
||||||
function SPAWN:InitModex( modex )
|
function SPAWN:InitModex( modex, prefix, postfix )
|
||||||
|
|
||||||
if modex then
|
if modex then
|
||||||
self.SpawnInitModex = tonumber( modex )
|
self.SpawnInitModex = tonumber( modex )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
self.SpawnInitModexPrefix = prefix
|
||||||
|
self.SpawnInitModexPostfix = postfix
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -765,17 +889,15 @@ end
|
|||||||
|
|
||||||
--- Randomizes the UNITs that are spawned within a radius band given an Outer and Inner radius.
|
--- Randomizes the UNITs that are spawned within a radius band given an Outer and Inner radius.
|
||||||
-- @param #SPAWN self
|
-- @param #SPAWN self
|
||||||
-- @param #boolean RandomizeUnits If true, SPAWN will perform the randomization of the @{UNIT}s position within the group between a given outer and inner radius.
|
-- @param #boolean RandomizeUnits If true, SPAWN will perform the randomization of the @{Wrapper.Unit#UNIT}s position within the group between a given outer and inner radius.
|
||||||
-- @param DCS#Distance OuterRadius (optional) The outer radius in meters where the new group will be spawned.
|
-- @param DCS#Distance OuterRadius (optional) The outer radius in meters where the new group will be spawned.
|
||||||
-- @param DCS#Distance InnerRadius (optional) The inner radius in meters where the new group will NOT be spawned.
|
-- @param DCS#Distance InnerRadius (optional) The inner radius in meters where the new group will NOT be spawned.
|
||||||
-- @return #SPAWN
|
-- @return #SPAWN
|
||||||
-- @usage
|
-- @usage
|
||||||
--
|
--
|
||||||
-- -- NATO helicopters engaging in the battle field.
|
-- -- NATO helicopters engaging in the battle field.
|
||||||
-- -- The KA-50 has waypoints Start point ( =0 or SP ), 1, 2, 3, 4, End point (= 5 or DP).
|
-- -- UNIT positions of this group will be randomized around the base unit #1 in a circle of 50 to 500 meters.
|
||||||
-- -- Waypoints 2 and 3 will only be randomized. The others will remain on their original position with each new spawn of the helicopter.
|
-- Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):InitRandomizeUnits( true, 500, 50 )
|
||||||
-- -- The randomization of waypoint 2 and 3 will take place within a radius of 2000 meters.
|
|
||||||
-- Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):InitRandomizeRoute( 2, 2, 2000 )
|
|
||||||
--
|
--
|
||||||
function SPAWN:InitRandomizeUnits( RandomizeUnits, OuterRadius, InnerRadius )
|
function SPAWN:InitRandomizeUnits( RandomizeUnits, OuterRadius, InnerRadius )
|
||||||
self:F( { self.SpawnTemplatePrefix, RandomizeUnits, OuterRadius, InnerRadius } )
|
self:F( { self.SpawnTemplatePrefix, RandomizeUnits, OuterRadius, InnerRadius } )
|
||||||
@@ -791,6 +913,46 @@ function SPAWN:InitRandomizeUnits( RandomizeUnits, OuterRadius, InnerRadius )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Spawn the UNITs of this group with individual relative positions to unit #1 and individual headings.
|
||||||
|
-- @param #SPAWN self
|
||||||
|
-- @param #table Positions Table of positions, needs to one entry per unit in the group(!). The table contains one table each for each unit, with x,y, and optionally z
|
||||||
|
-- relative positions, and optionally an individual heading.
|
||||||
|
-- @return #SPAWN
|
||||||
|
-- @usage
|
||||||
|
--
|
||||||
|
-- -- NATO helicopter group of three units engaging in the battle field.
|
||||||
|
-- local Positions = { [1] = {x = 0, y = 0, heading = 0}, [2] = {x = 50, y = 50, heading = 90}, [3] = {x = -50, y = 50, heading = 180} }
|
||||||
|
-- Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):InitSetUnitRelativePositions(Positions)
|
||||||
|
--
|
||||||
|
function SPAWN:InitSetUnitRelativePositions(Positions)
|
||||||
|
self:F({self.SpawnTemplatePrefix, Positions})
|
||||||
|
|
||||||
|
self.SpawnUnitsWithRelativePositions = true
|
||||||
|
self.UnitsRelativePositions = Positions
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Spawn the UNITs of this group with individual absolute positions and individual headings.
|
||||||
|
-- @param #SPAWN self
|
||||||
|
-- @param #table Positions Table of positions, needs to one entry per unit in the group(!). The table contains one table each for each unit, with x,y, and optionally z
|
||||||
|
-- absolute positions, and optionally an individual heading.
|
||||||
|
-- @return #SPAWN
|
||||||
|
-- @usage
|
||||||
|
--
|
||||||
|
-- -- NATO helicopter group of three units engaging in the battle field.
|
||||||
|
-- local Positions = { [1] = {x = 0, y = 0, heading = 0}, [2] = {x = 50, y = 50, heading = 90}, [3] = {x = -50, y = 50, heading = 180} }
|
||||||
|
-- Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):InitSetUnitAbsolutePositions(Positions)
|
||||||
|
--
|
||||||
|
function SPAWN:InitSetUnitAbsolutePositions(Positions)
|
||||||
|
self:F({self.SpawnTemplatePrefix, Positions})
|
||||||
|
|
||||||
|
self.SpawnUnitsWithAbsolutePositions = true
|
||||||
|
self.UnitsAbsolutePositions = Positions
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- This method is rather complicated to understand. But I'll try to explain.
|
--- This method is rather complicated to understand. But I'll try to explain.
|
||||||
-- This method becomes useful when you need to spawn groups with random templates of groups defined within the mission editor,
|
-- This method becomes useful when you need to spawn groups with random templates of groups defined within the mission editor,
|
||||||
-- but they will all follow the same Template route and have the same prefix name.
|
-- but they will all follow the same Template route and have the same prefix name.
|
||||||
@@ -813,8 +975,13 @@ end
|
|||||||
-- Spawn_US_Platoon_Right = SPAWN:New( 'US Tank Platoon Right' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplate( Spawn_US_Platoon ):InitRandomizeRoute( 3, 3, 2000 )
|
-- Spawn_US_Platoon_Right = SPAWN:New( 'US Tank Platoon Right' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplate( Spawn_US_Platoon ):InitRandomizeRoute( 3, 3, 2000 )
|
||||||
function SPAWN:InitRandomizeTemplate( SpawnTemplatePrefixTable )
|
function SPAWN:InitRandomizeTemplate( SpawnTemplatePrefixTable )
|
||||||
self:F( { self.SpawnTemplatePrefix, SpawnTemplatePrefixTable } )
|
self:F( { self.SpawnTemplatePrefix, SpawnTemplatePrefixTable } )
|
||||||
|
|
||||||
self.SpawnTemplatePrefixTable = SpawnTemplatePrefixTable
|
local temptable = {}
|
||||||
|
for _,_temp in pairs(SpawnTemplatePrefixTable) do
|
||||||
|
temptable[#temptable+1] = _temp
|
||||||
|
end
|
||||||
|
|
||||||
|
self.SpawnTemplatePrefixTable = UTILS.ShuffleTable(temptable)
|
||||||
self.SpawnRandomizeTemplate = true
|
self.SpawnRandomizeTemplate = true
|
||||||
|
|
||||||
for SpawnGroupID = 1, self.SpawnMaxGroups do
|
for SpawnGroupID = 1, self.SpawnMaxGroups do
|
||||||
@@ -848,16 +1015,12 @@ end
|
|||||||
-- Spawn_US_Platoon_Middle = SPAWN:New( 'US Tank Platoon Middle' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplateSet( Spawn_US_PlatoonSet ):InitRandomizeRoute( 3, 3, 2000 )
|
-- Spawn_US_Platoon_Middle = SPAWN:New( 'US Tank Platoon Middle' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplateSet( Spawn_US_PlatoonSet ):InitRandomizeRoute( 3, 3, 2000 )
|
||||||
-- Spawn_US_Platoon_Right = SPAWN:New( 'US Tank Platoon Right' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplateSet( Spawn_US_PlatoonSet ):InitRandomizeRoute( 3, 3, 2000 )
|
-- Spawn_US_Platoon_Right = SPAWN:New( 'US Tank Platoon Right' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplateSet( Spawn_US_PlatoonSet ):InitRandomizeRoute( 3, 3, 2000 )
|
||||||
--
|
--
|
||||||
function SPAWN:InitRandomizeTemplateSet( SpawnTemplateSet ) -- R2.3
|
function SPAWN:InitRandomizeTemplateSet( SpawnTemplateSet )
|
||||||
self:F( { self.SpawnTemplatePrefix } )
|
self:F( { self.SpawnTemplatePrefix } )
|
||||||
|
|
||||||
self.SpawnTemplatePrefixTable = SpawnTemplateSet:GetSetNames()
|
local setnames = SpawnTemplateSet:GetSetNames()
|
||||||
self.SpawnRandomizeTemplate = true
|
self:InitRandomizeTemplate(setnames)
|
||||||
|
|
||||||
for SpawnGroupID = 1, self.SpawnMaxGroups do
|
|
||||||
self:_RandomizeTemplate( SpawnGroupID )
|
|
||||||
end
|
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -906,8 +1069,8 @@ end
|
|||||||
|
|
||||||
--- This method provides the functionality to randomize the spawning of the Groups at a given list of zones of different types.
|
--- This method provides the functionality to randomize the spawning of the Groups at a given list of zones of different types.
|
||||||
-- @param #SPAWN self
|
-- @param #SPAWN self
|
||||||
-- @param #table SpawnZoneTable A table with @{Zone} objects. If this table is given, then each spawn will be executed within the given list of @{Zone}s objects.
|
-- @param #table SpawnZoneTable A table with @{Core.Zone} objects. If this table is given, then each spawn will be executed within the given list of @{Core.Zone}s objects.
|
||||||
-- @return #SPAWN
|
-- @return #SPAWN self
|
||||||
-- @usage
|
-- @usage
|
||||||
--
|
--
|
||||||
-- -- Create a zone table of the 2 zones.
|
-- -- Create a zone table of the 2 zones.
|
||||||
@@ -921,8 +1084,13 @@ end
|
|||||||
--
|
--
|
||||||
function SPAWN:InitRandomizeZones( SpawnZoneTable )
|
function SPAWN:InitRandomizeZones( SpawnZoneTable )
|
||||||
self:F( { self.SpawnTemplatePrefix, SpawnZoneTable } )
|
self:F( { self.SpawnTemplatePrefix, SpawnZoneTable } )
|
||||||
|
|
||||||
self.SpawnZoneTable = SpawnZoneTable
|
local temptable = {}
|
||||||
|
for _,_temp in pairs(SpawnZoneTable) do
|
||||||
|
temptable[#temptable+1] = _temp
|
||||||
|
end
|
||||||
|
|
||||||
|
self.SpawnZoneTable = UTILS.ShuffleTable(temptable)
|
||||||
self.SpawnRandomizeZones = true
|
self.SpawnRandomizeZones = true
|
||||||
|
|
||||||
for SpawnGroupID = 1, self.SpawnMaxGroups do
|
for SpawnGroupID = 1, self.SpawnMaxGroups do
|
||||||
@@ -932,6 +1100,55 @@ function SPAWN:InitRandomizeZones( SpawnZoneTable )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- [AIR/Fighter only!] This method randomizes the callsign for a new group.
|
||||||
|
-- @param #SPAWN self
|
||||||
|
-- @return #SPAWN self
|
||||||
|
function SPAWN:InitRandomizeCallsign()
|
||||||
|
self.SpawnRandomCallsign = true
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [BLUE AIR only!] This method sets a specific callsign for a spawned group. Use for a group with one unit only!
|
||||||
|
-- @param #SPAWN self
|
||||||
|
-- @param #number ID ID of the callsign enumerator, e.g. CALLSIGN.Tanker.Texaco - - resulting in e.g. Texaco-2-1
|
||||||
|
-- @param #string Name Name of this callsign as it cannot be determined from the ID because of the dependency on the task type of the plane, and the plane type. E.g. "Texaco"
|
||||||
|
-- @param #number Minor Minor number, i.e. the unit number within the group, e.g 2 - resulting in e.g. Texaco-2-1
|
||||||
|
-- @param #number Major Major number, i.e. the group number of this name, e.g. 1 - resulting in e.g. Texaco-2-1
|
||||||
|
-- @return #SPAWN self
|
||||||
|
function SPAWN:InitCallSign(ID,Name,Minor,Major)
|
||||||
|
self.SpawnInitCallSign = true
|
||||||
|
self.SpawnInitCallSignID = ID or 1
|
||||||
|
self.SpawnInitCallSignMinor = Minor or 1
|
||||||
|
self.SpawnInitCallSignMajor = Major or 1
|
||||||
|
self.SpawnInitCallSignName = string.lower(Name) or "enfield"
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- This method sets a spawn position for the group that is different from the location of the template.
|
||||||
|
-- @param #SPAWN self
|
||||||
|
-- @param Core.Point#COORDINATE Coordinate The position to spawn from
|
||||||
|
-- @return #SPAWN self
|
||||||
|
function SPAWN:InitPositionCoordinate(Coordinate)
|
||||||
|
self:T( { self.SpawnTemplatePrefix, Coordinate:GetVec2()} )
|
||||||
|
self:InitPositionVec2(Coordinate:GetVec2())
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- This method sets a spawn position for the group that is different from the location of the template.
|
||||||
|
-- @param #SPAWN self
|
||||||
|
-- @param DCS#Vec2 Vec2 The position to spawn from
|
||||||
|
-- @return #SPAWN self
|
||||||
|
function SPAWN:InitPositionVec2(Vec2)
|
||||||
|
self:T( { self.SpawnTemplatePrefix, Vec2} )
|
||||||
|
self.SpawnInitPosition = Vec2
|
||||||
|
self.SpawnFromNewPosition = true
|
||||||
|
self:I("MaxGroups:"..self.SpawnMaxGroups)
|
||||||
|
for SpawnGroupID = 1, self.SpawnMaxGroups do
|
||||||
|
self:_SetInitialPosition( SpawnGroupID )
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- For planes and helicopters, when these groups go home and land on their home airbases and FARPs, they normally would taxi to the parking spot, shut-down their engines and wait forever until the Group is removed by the runtime environment.
|
--- For planes and helicopters, when these groups go home and land on their home airbases and FARPs, they normally would taxi to the parking spot, shut-down their engines and wait forever until the Group is removed by the runtime environment.
|
||||||
-- This method is used to re-spawn automatically (so no extra call is needed anymore) the same group after it has landed.
|
-- This method is used to re-spawn automatically (so no extra call is needed anymore) the same group after it has landed.
|
||||||
-- This will enable a spawned group to be re-spawned after it lands, until it is destroyed...
|
-- This will enable a spawned group to be re-spawned after it lands, until it is destroyed...
|
||||||
@@ -1022,7 +1239,6 @@ function SPAWN:InitCleanUp( SpawnCleanUpInterval )
|
|||||||
local SpawnGroup, SpawnCursor = self:GetFirstAliveGroup()
|
local SpawnGroup, SpawnCursor = self:GetFirstAliveGroup()
|
||||||
self:T( { "CleanUp Scheduler:", SpawnGroup } )
|
self:T( { "CleanUp Scheduler:", SpawnGroup } )
|
||||||
|
|
||||||
-- self.CleanUpFunction = routines.scheduleFunction( self._SpawnCleanUpScheduler, { self }, timer.getTime() + 1, SpawnCleanUpInterval )
|
|
||||||
self.CleanUpScheduler = SCHEDULER:New( self, self._SpawnCleanUpScheduler, {}, 1, SpawnCleanUpInterval, 0.2 )
|
self.CleanUpScheduler = SCHEDULER:New( self, self._SpawnCleanUpScheduler, {}, 1, SpawnCleanUpInterval, 0.2 )
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -1140,7 +1356,8 @@ do -- Delay methods
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Turns the Delay On for the @{Wrapper.Group} when spawning.
|
--- Turns the Delay On for the @{Wrapper.Group} when spawning with @{#SpawnScheduled}(). In effect then the 1st group will only be spawned
|
||||||
|
-- after the number of seconds given in SpawnScheduled as arguments, and not immediately.
|
||||||
-- @param #SPAWN self
|
-- @param #SPAWN self
|
||||||
-- @return #SPAWN The SPAWN object
|
-- @return #SPAWN The SPAWN object
|
||||||
function SPAWN:InitDelayOn()
|
function SPAWN:InitDelayOn()
|
||||||
@@ -1159,7 +1376,7 @@ do -- Delay methods
|
|||||||
end -- Delay methods
|
end -- Delay methods
|
||||||
|
|
||||||
--- Will spawn a group based on the internal index.
|
--- Will spawn a group based on the internal index.
|
||||||
-- Note: Uses @{DATABASE} module defined in MOOSE.
|
-- Note: This method uses the global _DATABASE object (an instance of @{Core.Database#DATABASE}), which contains ALL initial and new spawned objects in MOOSE.
|
||||||
-- @param #SPAWN self
|
-- @param #SPAWN self
|
||||||
-- @return Wrapper.Group#GROUP The group that was spawned. You can use this group for further actions.
|
-- @return Wrapper.Group#GROUP The group that was spawned. You can use this group for further actions.
|
||||||
function SPAWN:Spawn()
|
function SPAWN:Spawn()
|
||||||
@@ -1174,7 +1391,7 @@ function SPAWN:Spawn()
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Will re-spawn a group based on a given index.
|
--- Will re-spawn a group based on a given index.
|
||||||
-- Note: Uses @{DATABASE} module defined in MOOSE.
|
-- Note: This method uses the global _DATABASE object (an instance of @{Core.Database#DATABASE}), which contains ALL initial and new spawned objects in MOOSE.
|
||||||
-- @param #SPAWN self
|
-- @param #SPAWN self
|
||||||
-- @param #string SpawnIndex The index of the group to be spawned.
|
-- @param #string SpawnIndex The index of the group to be spawned.
|
||||||
-- @return Wrapper.Group#GROUP The group that was spawned. You can use this group for further actions.
|
-- @return Wrapper.Group#GROUP The group that was spawned. You can use this group for further actions.
|
||||||
@@ -1222,7 +1439,7 @@ function SPAWN:SetSpawnIndex( SpawnIndex )
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Will spawn a group with a specified index number.
|
--- Will spawn a group with a specified index number.
|
||||||
-- Uses @{DATABASE} global object defined in MOOSE.
|
-- Note: This method uses the global _DATABASE object (an instance of @{Core.Database#DATABASE}), which contains ALL initial and new spawned objects in MOOSE.
|
||||||
-- @param #SPAWN self
|
-- @param #SPAWN self
|
||||||
-- @param #string SpawnIndex The index of the group to be spawned.
|
-- @param #string SpawnIndex The index of the group to be spawned.
|
||||||
-- @return Wrapper.Group#GROUP The group that was spawned. You can use this group for further actions.
|
-- @return Wrapper.Group#GROUP The group that was spawned. You can use this group for further actions.
|
||||||
@@ -1230,12 +1447,18 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
|
|||||||
self:F2( { SpawnTemplatePrefix = self.SpawnTemplatePrefix, SpawnIndex = SpawnIndex, AliveUnits = self.AliveUnits, SpawnMaxGroups = self.SpawnMaxGroups } )
|
self:F2( { SpawnTemplatePrefix = self.SpawnTemplatePrefix, SpawnIndex = SpawnIndex, AliveUnits = self.AliveUnits, SpawnMaxGroups = self.SpawnMaxGroups } )
|
||||||
|
|
||||||
if self:_GetSpawnIndex( SpawnIndex ) then
|
if self:_GetSpawnIndex( SpawnIndex ) then
|
||||||
|
|
||||||
|
if self.SpawnFromNewPosition then
|
||||||
|
self:_SetInitialPosition( SpawnIndex )
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
if self.SpawnGroups[self.SpawnIndex].Visible then
|
if self.SpawnGroups[self.SpawnIndex].Visible then
|
||||||
self.SpawnGroups[self.SpawnIndex].Group:Activate()
|
self.SpawnGroups[self.SpawnIndex].Group:Activate()
|
||||||
else
|
else
|
||||||
|
|
||||||
local SpawnTemplate = self.SpawnGroups[self.SpawnIndex].SpawnTemplate
|
local SpawnTemplate = self.SpawnGroups[self.SpawnIndex].SpawnTemplate
|
||||||
|
local SpawnZone = self.SpawnGroups[self.SpawnIndex].SpawnZone
|
||||||
self:T( SpawnTemplate.name )
|
self:T( SpawnTemplate.name )
|
||||||
|
|
||||||
if SpawnTemplate then
|
if SpawnTemplate then
|
||||||
@@ -1261,6 +1484,23 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
|
|||||||
if self.SpawnRandomizeUnits then
|
if self.SpawnRandomizeUnits then
|
||||||
for UnitID = 1, #SpawnTemplate.units do
|
for UnitID = 1, #SpawnTemplate.units do
|
||||||
local RandomVec2 = PointVec3:GetRandomVec2InRadius( self.SpawnOuterRadius, self.SpawnInnerRadius )
|
local RandomVec2 = PointVec3:GetRandomVec2InRadius( self.SpawnOuterRadius, self.SpawnInnerRadius )
|
||||||
|
if (SpawnZone) then
|
||||||
|
local inZone = SpawnZone:IsVec2InZone(RandomVec2)
|
||||||
|
local numTries = 1
|
||||||
|
while (not inZone) and (numTries < 20) do
|
||||||
|
if not inZone then
|
||||||
|
RandomVec2 = PointVec3:GetRandomVec2InRadius( self.SpawnOuterRadius, self.SpawnInnerRadius )
|
||||||
|
numTries = numTries + 1
|
||||||
|
inZone = SpawnZone:IsVec2InZone(RandomVec2)
|
||||||
|
self:I("Retrying " .. numTries .. "spawn " .. SpawnTemplate.name .. " in Zone " .. SpawnZone:GetName() .. "!")
|
||||||
|
self:I(SpawnZone)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if (not inZone) then
|
||||||
|
self:I("Could not place unit within zone and within radius!")
|
||||||
|
RandomVec2 = SpawnZone:GetRandomVec2()
|
||||||
|
end
|
||||||
|
end
|
||||||
SpawnTemplate.units[UnitID].x = RandomVec2.x
|
SpawnTemplate.units[UnitID].x = RandomVec2.x
|
||||||
SpawnTemplate.units[UnitID].y = RandomVec2.y
|
SpawnTemplate.units[UnitID].y = RandomVec2.y
|
||||||
self:T( 'SpawnTemplate.units[' .. UnitID .. '].x = ' .. SpawnTemplate.units[UnitID].x .. ', SpawnTemplate.units[' .. UnitID .. '].y = ' .. SpawnTemplate.units[UnitID].y )
|
self:T( 'SpawnTemplate.units[' .. UnitID .. '].x = ' .. SpawnTemplate.units[UnitID].x .. ', SpawnTemplate.units[' .. UnitID .. '].y = ' .. SpawnTemplate.units[UnitID].y )
|
||||||
@@ -1312,12 +1552,14 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
|
|||||||
|
|
||||||
for UnitID = 1, #SpawnTemplate.units do
|
for UnitID = 1, #SpawnTemplate.units do
|
||||||
|
|
||||||
if UnitID > 1 then -- don't rotate position of unit #1
|
if not self.SpawnRandomizeUnits then
|
||||||
local unitXOff = SpawnTemplate.units[UnitID].x - pivotX -- rotate position offset around unit #1
|
if UnitID > 1 then -- don't rotate position of unit #1
|
||||||
local unitYOff = SpawnTemplate.units[UnitID].y - pivotY
|
local unitXOff = SpawnTemplate.units[UnitID].x - pivotX -- rotate position offset around unit #1
|
||||||
|
local unitYOff = SpawnTemplate.units[UnitID].y - pivotY
|
||||||
|
|
||||||
SpawnTemplate.units[UnitID].x = pivotX + (unitXOff * cosHeading) - (unitYOff * sinHeading)
|
SpawnTemplate.units[UnitID].x = pivotX + (unitXOff * cosHeading) - (unitYOff * sinHeading)
|
||||||
SpawnTemplate.units[UnitID].y = pivotY + (unitYOff * cosHeading) + (unitXOff * sinHeading)
|
SpawnTemplate.units[UnitID].y = pivotY + (unitYOff * cosHeading) + (unitXOff * sinHeading)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- adjust heading of all units, including unit #1
|
-- adjust heading of all units, including unit #1
|
||||||
@@ -1336,7 +1578,38 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
|
|||||||
SpawnTemplate.units[UnitID].psi = -SpawnTemplate.units[UnitID].heading
|
SpawnTemplate.units[UnitID].psi = -SpawnTemplate.units[UnitID].heading
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Individual relative unit positions + heading
|
||||||
|
if self.SpawnUnitsWithRelativePositions and self.UnitsRelativePositions then
|
||||||
|
local BaseX = SpawnTemplate.units[1].x or 0
|
||||||
|
local BaseY = SpawnTemplate.units[1].y or 0
|
||||||
|
local BaseZ = SpawnTemplate.units[1].z or 0
|
||||||
|
for UnitID = 1, #SpawnTemplate.units do
|
||||||
|
if self.UnitsRelativePositions[UnitID].heading then
|
||||||
|
SpawnTemplate.units[UnitID].heading = math.rad(self.UnitsRelativePositions[UnitID].heading or 0)
|
||||||
|
end
|
||||||
|
SpawnTemplate.units[UnitID].x = BaseX + (self.UnitsRelativePositions[UnitID].x or 0)
|
||||||
|
SpawnTemplate.units[UnitID].y = BaseY + (self.UnitsRelativePositions[UnitID].y or 0)
|
||||||
|
if self.UnitsRelativePositions[UnitID].z then
|
||||||
|
SpawnTemplate.units[UnitID].z = BaseZ + (self.UnitsRelativePositions[UnitID].z or 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Individual asbolute unit positions + heading
|
||||||
|
if self.SpawnUnitsWithAbsolutePositions and self.UnitsAbsolutePositions then
|
||||||
|
for UnitID = 1, #SpawnTemplate.units do
|
||||||
|
if self.UnitsAbsolutePositions[UnitID].heading then
|
||||||
|
SpawnTemplate.units[UnitID].heading = math.rad(self.UnitsAbsolutePositions[UnitID].heading or 0)
|
||||||
|
end
|
||||||
|
SpawnTemplate.units[UnitID].x = self.UnitsAbsolutePositions[UnitID].x or 0
|
||||||
|
SpawnTemplate.units[UnitID].y = self.UnitsAbsolutePositions[UnitID].y or 0
|
||||||
|
if self.UnitsAbsolutePositions[UnitID].z then
|
||||||
|
SpawnTemplate.units[UnitID].z = self.UnitsAbsolutePositions[UnitID].z or 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Set livery.
|
-- Set livery.
|
||||||
if self.SpawnInitLivery then
|
if self.SpawnInitLivery then
|
||||||
for UnitID = 1, #SpawnTemplate.units do
|
for UnitID = 1, #SpawnTemplate.units do
|
||||||
@@ -1354,7 +1627,10 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
|
|||||||
-- Set tail number.
|
-- Set tail number.
|
||||||
if self.SpawnInitModex then
|
if self.SpawnInitModex then
|
||||||
for UnitID = 1, #SpawnTemplate.units do
|
for UnitID = 1, #SpawnTemplate.units do
|
||||||
SpawnTemplate.units[UnitID].onboard_num = string.format( "%03d", self.SpawnInitModex + (UnitID - 1) )
|
local modexnumber = string.format( "%03d", self.SpawnInitModex + (UnitID - 1) )
|
||||||
|
if self.SpawnInitModexPrefix then modexnumber = self.SpawnInitModexPrefix..modexnumber end
|
||||||
|
if self.SpawnInitModexPostfix then modexnumber = modexnumber..self.SpawnInitModexPostfix end
|
||||||
|
SpawnTemplate.units[UnitID].onboard_num = modexnumber
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1437,6 +1713,8 @@ end
|
|||||||
-- @param #number SpawnTime The time interval defined in seconds between each new spawn of new groups.
|
-- @param #number SpawnTime The time interval defined in seconds between each new spawn of new groups.
|
||||||
-- @param #number SpawnTimeVariation The variation to be applied on the defined time interval between each new spawn.
|
-- @param #number SpawnTimeVariation The variation to be applied on the defined time interval between each new spawn.
|
||||||
-- The variation is a number between 0 and 1, representing the % of variation to be applied on the time interval.
|
-- The variation is a number between 0 and 1, representing the % of variation to be applied on the time interval.
|
||||||
|
-- @param #boolean WithDelay Do not spawn the **first** group immediately, but delay the spawn as per the calculation below.
|
||||||
|
-- Effectively the same as @{#InitDelayOn}().
|
||||||
-- @return #SPAWN self
|
-- @return #SPAWN self
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- NATO helicopters engaging in the battle field.
|
-- -- NATO helicopters engaging in the battle field.
|
||||||
@@ -1447,17 +1725,20 @@ end
|
|||||||
-- -- High limit: 600 * ( 1 + 0.5 / 2 ) = 750
|
-- -- High limit: 600 * ( 1 + 0.5 / 2 ) = 750
|
||||||
-- -- Between these two values, a random amount of seconds will be chosen for each new spawn of the helicopters.
|
-- -- Between these two values, a random amount of seconds will be chosen for each new spawn of the helicopters.
|
||||||
-- Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):SpawnScheduled( 600, 0.5 )
|
-- Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):SpawnScheduled( 600, 0.5 )
|
||||||
function SPAWN:SpawnScheduled( SpawnTime, SpawnTimeVariation )
|
function SPAWN:SpawnScheduled( SpawnTime, SpawnTimeVariation, WithDelay )
|
||||||
self:F( { SpawnTime, SpawnTimeVariation } )
|
self:F( { SpawnTime, SpawnTimeVariation } )
|
||||||
|
|
||||||
|
local SpawnTime = SpawnTime or 60
|
||||||
|
local SpawnTimeVariation = SpawnTimeVariation or 0.5
|
||||||
|
|
||||||
if SpawnTime ~= nil and SpawnTimeVariation ~= nil then
|
if SpawnTime ~= nil and SpawnTimeVariation ~= nil then
|
||||||
local InitialDelay = 0
|
local InitialDelay = 0
|
||||||
if self.DelayOnOff == true then
|
if WithDelay or self.DelayOnOff == true then
|
||||||
InitialDelay = math.random( SpawnTime - SpawnTime * SpawnTimeVariation, SpawnTime + SpawnTime * SpawnTimeVariation )
|
InitialDelay = math.random( SpawnTime - SpawnTime * SpawnTimeVariation, SpawnTime + SpawnTime * SpawnTimeVariation )
|
||||||
end
|
end
|
||||||
self.SpawnScheduler = SCHEDULER:New( self, self._Scheduler, {}, InitialDelay, SpawnTime, SpawnTimeVariation )
|
self.SpawnScheduler = SCHEDULER:New( self, self._Scheduler, {}, InitialDelay, SpawnTime, SpawnTimeVariation )
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1956,14 +2237,18 @@ end
|
|||||||
-- @param #table Spots Table of parking spot IDs. Note that these in general are different from the numbering in the mission editor!
|
-- @param #table Spots Table of parking spot IDs. Note that these in general are different from the numbering in the mission editor!
|
||||||
-- @param #SPAWN.Takeoff Takeoff (Optional) Takeoff type, i.e. either SPAWN.Takeoff.Cold or SPAWN.Takeoff.Hot. Default is Hot.
|
-- @param #SPAWN.Takeoff Takeoff (Optional) Takeoff type, i.e. either SPAWN.Takeoff.Cold or SPAWN.Takeoff.Hot. Default is Hot.
|
||||||
-- @return Wrapper.Group#GROUP The group that was spawned or nil when nothing was spawned.
|
-- @return Wrapper.Group#GROUP The group that was spawned or nil when nothing was spawned.
|
||||||
function SPAWN:SpawnAtParkingSpot( Airbase, Spots, Takeoff ) -- R2.5
|
function SPAWN:SpawnAtParkingSpot( Airbase, Spots, Takeoff )
|
||||||
self:F( { Airbase = Airbase, Spots = Spots, Takeoff = Takeoff } )
|
self:F( { Airbase = Airbase, Spots = Spots, Takeoff = Takeoff } )
|
||||||
|
|
||||||
-- Ensure that Spots parameter is a table.
|
-- Ensure that Spots parameter is a table.
|
||||||
if type( Spots ) ~= "table" then
|
if type( Spots ) ~= "table" then
|
||||||
Spots = { Spots }
|
Spots = { Spots }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if type(Airbase) == "string" then
|
||||||
|
Airbase = AIRBASE:FindByName(Airbase)
|
||||||
|
end
|
||||||
|
|
||||||
-- Get template group.
|
-- Get template group.
|
||||||
local group = GROUP:FindByName( self.SpawnTemplatePrefix )
|
local group = GROUP:FindByName( self.SpawnTemplatePrefix )
|
||||||
|
|
||||||
@@ -2543,7 +2828,7 @@ end
|
|||||||
-- @return Wrapper.Group#GROUP that was spawned or #nil if nothing was spawned.
|
-- @return Wrapper.Group#GROUP that was spawned or #nil if nothing was spawned.
|
||||||
-- @usage
|
-- @usage
|
||||||
--
|
--
|
||||||
-- local SpawnPointVec2 = ZONE:New( ZoneName ):GetPointVec2()
|
-- local SpawnPointVec2 = ZONE:New( ZoneName ):GetPointVec2()
|
||||||
--
|
--
|
||||||
-- -- Spawn at the zone center position at the height specified in the ME of the group template!
|
-- -- Spawn at the zone center position at the height specified in the ME of the group template!
|
||||||
-- SpawnAirplanes:SpawnFromPointVec2( SpawnPointVec2 )
|
-- SpawnAirplanes:SpawnFromPointVec2( SpawnPointVec2 )
|
||||||
@@ -2615,8 +2900,8 @@ function SPAWN:SpawnFromStatic( HostStatic, MinHeight, MaxHeight, SpawnIndex )
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Will spawn a Group within a given @{Zone}.
|
--- Will spawn a Group within a given @{Core.Zone}.
|
||||||
-- The @{Zone} can be of any type derived from @{Core.Zone#ZONE_BASE}.
|
-- The @{Core.Zone} can be of any type derived from @{Core.Zone#ZONE_BASE}.
|
||||||
-- Once the @{Wrapper.Group} is spawned within the zone, the @{Wrapper.Group} will continue on its route.
|
-- Once the @{Wrapper.Group} is spawned within the zone, the @{Wrapper.Group} will continue on its route.
|
||||||
-- The **first waypoint** (where the group is spawned) is replaced with the zone location coordinates.
|
-- The **first waypoint** (where the group is spawned) is replaced with the zone location coordinates.
|
||||||
-- @param #SPAWN self
|
-- @param #SPAWN self
|
||||||
@@ -2937,7 +3222,7 @@ function SPAWN:_GetGroupCountryID( SpawnPrefix )
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Gets the Group Template from the ME environment definition.
|
--- Gets the Group Template from the ME environment definition.
|
||||||
-- This method used the @{DATABASE} object, which contains ALL initial and new spawned object in MOOSE.
|
-- Note: This method uses the global _DATABASE object (an instance of @{Core.Database#DATABASE}), which contains ALL initial and new spawned objects in MOOSE.
|
||||||
-- @param #SPAWN self
|
-- @param #SPAWN self
|
||||||
-- @param #string SpawnTemplatePrefix
|
-- @param #string SpawnTemplatePrefix
|
||||||
-- @return @SPAWN self
|
-- @return @SPAWN self
|
||||||
@@ -2945,7 +3230,11 @@ function SPAWN:_GetTemplate( SpawnTemplatePrefix )
|
|||||||
self:F( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, SpawnTemplatePrefix } )
|
self:F( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, SpawnTemplatePrefix } )
|
||||||
|
|
||||||
local SpawnTemplate = nil
|
local SpawnTemplate = nil
|
||||||
|
|
||||||
|
if _DATABASE.Templates.Groups[SpawnTemplatePrefix] == nil then
|
||||||
|
error( 'No Template exists for SpawnTemplatePrefix = ' .. SpawnTemplatePrefix )
|
||||||
|
end
|
||||||
|
|
||||||
local Template = _DATABASE.Templates.Groups[SpawnTemplatePrefix].Template
|
local Template = _DATABASE.Templates.Groups[SpawnTemplatePrefix].Template
|
||||||
self:F( { Template = Template } )
|
self:F( { Template = Template } )
|
||||||
|
|
||||||
@@ -2979,6 +3268,11 @@ function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex ) -- R2.2
|
|||||||
if self.TweakedTemplate ~= nil and self.TweakedTemplate == true then
|
if self.TweakedTemplate ~= nil and self.TweakedTemplate == true then
|
||||||
BASE:I( "WARNING: You are using a tweaked template." )
|
BASE:I( "WARNING: You are using a tweaked template." )
|
||||||
SpawnTemplate = self.SpawnTemplate
|
SpawnTemplate = self.SpawnTemplate
|
||||||
|
if self.MooseNameing == true then
|
||||||
|
SpawnTemplate.name = self:SpawnGroupName( SpawnIndex )
|
||||||
|
else
|
||||||
|
SpawnTemplate.name = self:SpawnGroupName()
|
||||||
|
end
|
||||||
else
|
else
|
||||||
SpawnTemplate = self:_GetTemplate( SpawnTemplatePrefix )
|
SpawnTemplate = self:_GetTemplate( SpawnTemplatePrefix )
|
||||||
SpawnTemplate.name = self:SpawnGroupName( SpawnIndex )
|
SpawnTemplate.name = self:SpawnGroupName( SpawnIndex )
|
||||||
@@ -3026,21 +3320,156 @@ function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex ) -- R2.2
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Callsign
|
-- Callsign
|
||||||
|
|
||||||
|
if self.SpawnRandomCallsign and SpawnTemplate.units[1].callsign then
|
||||||
|
if type( SpawnTemplate.units[1].callsign ) ~= "number" then
|
||||||
|
-- change callsign
|
||||||
|
local min = 1
|
||||||
|
local max = 8
|
||||||
|
local ctable = CALLSIGN.Aircraft
|
||||||
|
if string.find(SpawnTemplate.units[1].type, "A-10",1,true) then
|
||||||
|
max = 12
|
||||||
|
end
|
||||||
|
if string.find(SpawnTemplate.units[1].type, "18",1,true) then
|
||||||
|
min = 9
|
||||||
|
max = 20
|
||||||
|
ctable = CALLSIGN.F18
|
||||||
|
end
|
||||||
|
if string.find(SpawnTemplate.units[1].type, "16",1,true) then
|
||||||
|
min = 9
|
||||||
|
max = 20
|
||||||
|
ctable = CALLSIGN.F16
|
||||||
|
end
|
||||||
|
if SpawnTemplate.units[1].type == "F-15E" then
|
||||||
|
min = 9
|
||||||
|
max = 18
|
||||||
|
ctable = CALLSIGN.F15E
|
||||||
|
end
|
||||||
|
local callsignnr = math.random(min,max)
|
||||||
|
local callsignname = "Enfield"
|
||||||
|
for name, value in pairs(ctable) do
|
||||||
|
if value==callsignnr then
|
||||||
|
callsignname = name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for UnitID = 1, #SpawnTemplate.units do
|
||||||
|
SpawnTemplate.units[UnitID].callsign[1] = callsignnr
|
||||||
|
SpawnTemplate.units[UnitID].callsign[2] = UnitID
|
||||||
|
SpawnTemplate.units[UnitID].callsign[3] = "1"
|
||||||
|
SpawnTemplate.units[UnitID].callsign["name"] = tostring(callsignname)..tostring(UnitID).."1"
|
||||||
|
-- UTILS.PrintTableToLog(SpawnTemplate.units[UnitID].callsign,1)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- Russkis
|
||||||
|
for UnitID = 1, #SpawnTemplate.units do
|
||||||
|
SpawnTemplate.units[UnitID].callsign = math.random(1,999)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.SpawnInitCallSign then
|
||||||
|
for UnitID = 1, #SpawnTemplate.units do
|
||||||
|
local Callsign = SpawnTemplate.units[UnitID].callsign
|
||||||
|
if Callsign and type( Callsign ) ~= "number" then
|
||||||
|
SpawnTemplate.units[UnitID].callsign[1] = self.SpawnInitCallSignID
|
||||||
|
SpawnTemplate.units[UnitID].callsign[2] = self.SpawnInitCallSignMinor
|
||||||
|
SpawnTemplate.units[UnitID].callsign[3] = self.SpawnInitCallSignMajor
|
||||||
|
SpawnTemplate.units[UnitID].callsign["name"] = string.format("%s%d%d",self.SpawnInitCallSignName,self.SpawnInitCallSignMinor,self.SpawnInitCallSignMajor)
|
||||||
|
--UTILS.PrintTableToLog(SpawnTemplate.units[UnitID].callsign,1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
for UnitID = 1, #SpawnTemplate.units do
|
for UnitID = 1, #SpawnTemplate.units do
|
||||||
local Callsign = SpawnTemplate.units[UnitID].callsign
|
local Callsign = SpawnTemplate.units[UnitID].callsign
|
||||||
if Callsign then
|
if Callsign then
|
||||||
if type( Callsign ) ~= "number" then -- blue callsign
|
if type( Callsign ) ~= "number" and not self.SpawnInitCallSign then -- blue callsign
|
||||||
|
-- UTILS.PrintTableToLog(Callsign,1)
|
||||||
Callsign[2] = ((SpawnIndex - 1) % 10) + 1
|
Callsign[2] = ((SpawnIndex - 1) % 10) + 1
|
||||||
local CallsignName = SpawnTemplate.units[UnitID].callsign["name"] -- #string
|
local CallsignName = SpawnTemplate.units[UnitID].callsign["name"] -- #string
|
||||||
|
CallsignName = string.match(CallsignName,"^(%a+)") -- 2.8 - only the part w/o numbers
|
||||||
local CallsignLen = CallsignName:len()
|
local CallsignLen = CallsignName:len()
|
||||||
|
SpawnTemplate.units[UnitID].callsign[2] = UnitID
|
||||||
SpawnTemplate.units[UnitID].callsign["name"] = CallsignName:sub( 1, CallsignLen ) .. SpawnTemplate.units[UnitID].callsign[2] .. SpawnTemplate.units[UnitID].callsign[3]
|
SpawnTemplate.units[UnitID].callsign["name"] = CallsignName:sub( 1, CallsignLen ) .. SpawnTemplate.units[UnitID].callsign[2] .. SpawnTemplate.units[UnitID].callsign[3]
|
||||||
else
|
elseif type( Callsign ) == "number" then
|
||||||
SpawnTemplate.units[UnitID].callsign = Callsign + SpawnIndex
|
SpawnTemplate.units[UnitID].callsign = Callsign + SpawnIndex
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-- Link16
|
||||||
|
local AddProps = SpawnTemplate.units[UnitID].AddPropAircraft
|
||||||
|
if AddProps then
|
||||||
|
if SpawnTemplate.units[UnitID].AddPropAircraft.STN_L16 then
|
||||||
|
-- 4 digit octal with leading 0
|
||||||
|
if tonumber(SpawnTemplate.units[UnitID].AddPropAircraft.STN_L16) ~= nil then
|
||||||
|
local octal = SpawnTemplate.units[UnitID].AddPropAircraft.STN_L16
|
||||||
|
local decimal = UTILS.OctalToDecimal(octal)+UnitID-1
|
||||||
|
SpawnTemplate.units[UnitID].AddPropAircraft.STN_L16 = string.format("%05d",UTILS.DecimalToOctal(decimal))
|
||||||
|
else -- ED bug - chars in here
|
||||||
|
local STN = math.floor(UTILS.RandomGaussian(4088/2,nil,1000,4088))
|
||||||
|
STN = STN+UnitID-1
|
||||||
|
local OSTN = UTILS.DecimalToOctal(STN)
|
||||||
|
SpawnTemplate.units[UnitID].AddPropAircraft.STN_L16 = string.format("%05d",OSTN)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- A10CII
|
||||||
|
if SpawnTemplate.units[UnitID].AddPropAircraft.SADL_TN then
|
||||||
|
-- 3 digit octal with leading 0
|
||||||
|
if tonumber(SpawnTemplate.units[UnitID].AddPropAircraft.SADL_TN) ~= nil then
|
||||||
|
local octal = SpawnTemplate.units[UnitID].AddPropAircraft.SADL_TN
|
||||||
|
local decimal = UTILS.OctalToDecimal(octal)+UnitID-1
|
||||||
|
SpawnTemplate.units[UnitID].AddPropAircraft.SADL_TN = string.format("%04d",UTILS.DecimalToOctal(decimal))
|
||||||
|
else -- ED bug - chars in here
|
||||||
|
local STN = math.floor(UTILS.RandomGaussian(504/2,nil,100,504))
|
||||||
|
STN = STN+UnitID-1
|
||||||
|
local OSTN = UTILS.DecimalToOctal(STN)
|
||||||
|
SpawnTemplate.units[UnitID].AddPropAircraft.SADL_TN = string.format("%04d",OSTN)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- VoiceCallsignNumber
|
||||||
|
if SpawnTemplate.units[UnitID].AddPropAircraft.VoiceCallsignNumber and type( Callsign ) ~= "number" then
|
||||||
|
SpawnTemplate.units[UnitID].AddPropAircraft.VoiceCallsignNumber = SpawnTemplate.units[UnitID].callsign[2] .. SpawnTemplate.units[UnitID].callsign[3]
|
||||||
|
end
|
||||||
|
-- VoiceCallsignLabel
|
||||||
|
if SpawnTemplate.units[UnitID].AddPropAircraft.VoiceCallsignLabel and type( Callsign ) ~= "number" then
|
||||||
|
local CallsignName = SpawnTemplate.units[UnitID].callsign["name"] -- #string
|
||||||
|
CallsignName = string.match(CallsignName,"^(%a+)") -- 2.8 - only the part w/o numbers
|
||||||
|
local label = "NY" -- Navy One exception
|
||||||
|
if not string.find(CallsignName," ") then
|
||||||
|
label = string.upper(string.match(CallsignName,"^%a")..string.match(CallsignName,"%a$"))
|
||||||
|
end
|
||||||
|
SpawnTemplate.units[UnitID].AddPropAircraft.VoiceCallsignLabel = label
|
||||||
|
end
|
||||||
|
-- UTILS.PrintTableToLog(SpawnTemplate.units[UnitID].AddPropAircraft,1)
|
||||||
|
-- FlightLead
|
||||||
|
if SpawnTemplate.units[UnitID].datalinks and SpawnTemplate.units[UnitID].datalinks.Link16 and SpawnTemplate.units[UnitID].datalinks.Link16.settings then
|
||||||
|
SpawnTemplate.units[UnitID].datalinks.Link16.settings.flightLead = UnitID == 1 and true or false
|
||||||
|
end
|
||||||
|
-- A10CII
|
||||||
|
if SpawnTemplate.units[UnitID].datalinks and SpawnTemplate.units[UnitID].datalinks.SADL and SpawnTemplate.units[UnitID].datalinks.SADL.settings then
|
||||||
|
SpawnTemplate.units[UnitID].datalinks.SADL.settings.flightLead = UnitID == 1 and true or false
|
||||||
|
end
|
||||||
|
-- UTILS.PrintTableToLog(SpawnTemplate.units[UnitID].datalinks,1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- Link16 team members
|
||||||
|
for UnitID = 1, #SpawnTemplate.units do
|
||||||
|
if SpawnTemplate.units[UnitID].datalinks and SpawnTemplate.units[UnitID].datalinks.Link16 and SpawnTemplate.units[UnitID].datalinks.Link16.network then
|
||||||
|
local team = {}
|
||||||
|
local isF16 = string.find(SpawnTemplate.units[UnitID].type,"F-16",1,true) and true or false
|
||||||
|
for ID = 1, #SpawnTemplate.units do
|
||||||
|
local member = {}
|
||||||
|
member.missionUnitId = ID
|
||||||
|
if isF16 then
|
||||||
|
member.TDOA = true
|
||||||
|
end
|
||||||
|
table.insert(team,member)
|
||||||
|
end
|
||||||
|
SpawnTemplate.units[UnitID].datalinks.Link16.network.teamMembers = team
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self:T3( { "Template:", SpawnTemplate } )
|
self:T3( { "Template:", SpawnTemplate } )
|
||||||
|
--UTILS.PrintTableToLog(SpawnTemplate,1)
|
||||||
return SpawnTemplate
|
return SpawnTemplate
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -3108,7 +3537,58 @@ function SPAWN:_RandomizeTemplate( SpawnIndex )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Private method that randomizes the @{Zone}s where the Group will be spawned.
|
--- Private method that sets the DCS#Vec2 where the Group will be spawned.
|
||||||
|
-- @param #SPAWN self
|
||||||
|
-- @param #number SpawnIndex
|
||||||
|
-- @return #SPAWN self
|
||||||
|
function SPAWN:_SetInitialPosition( SpawnIndex )
|
||||||
|
self:T( { self.SpawnTemplatePrefix, SpawnIndex, self.SpawnRandomizeZones } )
|
||||||
|
|
||||||
|
if self.SpawnFromNewPosition then
|
||||||
|
|
||||||
|
self:T( "Preparing Spawn at Vec2 ", self.SpawnInitPosition )
|
||||||
|
|
||||||
|
local SpawnVec2 = self.SpawnInitPosition
|
||||||
|
|
||||||
|
self:T( { SpawnVec2 = SpawnVec2 } )
|
||||||
|
|
||||||
|
local SpawnTemplate = self.SpawnGroups[SpawnIndex].SpawnTemplate
|
||||||
|
|
||||||
|
SpawnTemplate.route = SpawnTemplate.route or {}
|
||||||
|
SpawnTemplate.route.points = SpawnTemplate.route.points or {}
|
||||||
|
SpawnTemplate.route.points[1] = SpawnTemplate.route.points[1] or {}
|
||||||
|
SpawnTemplate.route.points[1].x = SpawnTemplate.route.points[1].x or 0
|
||||||
|
SpawnTemplate.route.points[1].y = SpawnTemplate.route.points[1].y or 0
|
||||||
|
|
||||||
|
self:T( { Route = SpawnTemplate.route } )
|
||||||
|
|
||||||
|
for UnitID = 1, #SpawnTemplate.units do
|
||||||
|
local UnitTemplate = SpawnTemplate.units[UnitID]
|
||||||
|
self:T( 'Before Translation SpawnTemplate.units[' .. UnitID .. '].x = ' .. UnitTemplate.x .. ', SpawnTemplate.units[' .. UnitID .. '].y = ' .. UnitTemplate.y )
|
||||||
|
local SX = UnitTemplate.x
|
||||||
|
local SY = UnitTemplate.y
|
||||||
|
local BX = SpawnTemplate.route.points[1].x
|
||||||
|
local BY = SpawnTemplate.route.points[1].y
|
||||||
|
local TX = SpawnVec2.x + (SX - BX)
|
||||||
|
local TY = SpawnVec2.y + (SY - BY)
|
||||||
|
UnitTemplate.x = TX
|
||||||
|
UnitTemplate.y = TY
|
||||||
|
-- TODO: Manage altitude based on landheight...
|
||||||
|
-- SpawnTemplate.units[UnitID].alt = SpawnVec2:
|
||||||
|
self:T( 'After Translation SpawnTemplate.units[' .. UnitID .. '].x = ' .. UnitTemplate.x .. ', SpawnTemplate.units[' .. UnitID .. '].y = ' .. UnitTemplate.y )
|
||||||
|
end
|
||||||
|
|
||||||
|
SpawnTemplate.route.points[1].x = SpawnVec2.x
|
||||||
|
SpawnTemplate.route.points[1].y = SpawnVec2.y
|
||||||
|
SpawnTemplate.x = SpawnVec2.x
|
||||||
|
SpawnTemplate.y = SpawnVec2.y
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Private method that randomizes the @{Core.Zone}s where the Group will be spawned.
|
||||||
-- @param #SPAWN self
|
-- @param #SPAWN self
|
||||||
-- @param #number SpawnIndex
|
-- @param #number SpawnIndex
|
||||||
-- @return #SPAWN self
|
-- @return #SPAWN self
|
||||||
@@ -3131,6 +3611,7 @@ function SPAWN:_RandomizeZones( SpawnIndex )
|
|||||||
self:T( { SpawnVec2 = SpawnVec2 } )
|
self:T( { SpawnVec2 = SpawnVec2 } )
|
||||||
|
|
||||||
local SpawnTemplate = self.SpawnGroups[SpawnIndex].SpawnTemplate
|
local SpawnTemplate = self.SpawnGroups[SpawnIndex].SpawnTemplate
|
||||||
|
self.SpawnGroups[SpawnIndex].SpawnZone = SpawnZone
|
||||||
|
|
||||||
self:T( { Route = SpawnTemplate.route } )
|
self:T( { Route = SpawnTemplate.route } )
|
||||||
|
|
||||||
@@ -3227,7 +3708,7 @@ end
|
|||||||
|
|
||||||
-- TODO Need to delete this... _DATABASE does this now ...
|
-- TODO Need to delete this... _DATABASE does this now ...
|
||||||
|
|
||||||
--- @param #SPAWN self
|
-- @param #SPAWN self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function SPAWN:_OnBirth( EventData )
|
function SPAWN:_OnBirth( EventData )
|
||||||
self:F( self.SpawnTemplatePrefix )
|
self:F( self.SpawnTemplatePrefix )
|
||||||
@@ -3247,7 +3728,7 @@ function SPAWN:_OnBirth( EventData )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #SPAWN self
|
-- @param #SPAWN self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function SPAWN:_OnDeadOrCrash( EventData )
|
function SPAWN:_OnDeadOrCrash( EventData )
|
||||||
self:F( self.SpawnTemplatePrefix )
|
self:F( self.SpawnTemplatePrefix )
|
||||||
@@ -3321,7 +3802,7 @@ function SPAWN:_OnLand( EventData )
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Will detect AIR Units shutting down their engines ...
|
--- Will detect AIR Units shutting down their engines ...
|
||||||
-- When the event takes place, and the method @{RepeatOnEngineShutDown} was called, the spawned Group will Re-SPAWN.
|
-- When the event takes place, and the method @{#InitRepeatOnEngineShutDown} was called, the spawned Group will Re-SPAWN.
|
||||||
-- But only when the Unit was registered to have landed.
|
-- But only when the Unit was registered to have landed.
|
||||||
-- @param #SPAWN self
|
-- @param #SPAWN self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
|
|||||||
@@ -15,14 +15,14 @@
|
|||||||
--
|
--
|
||||||
-- # Demo Missions
|
-- # Demo Missions
|
||||||
--
|
--
|
||||||
-- ## [SPAWNSTATIC Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SPS%20-%20Spawning%20Statics)
|
-- ## [SPAWNSTATIC Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Core/SpawnStatic)
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # YouTube Channel
|
-- # YouTube Channel
|
||||||
--
|
--
|
||||||
-- ## [SPAWNSTATIC YouTube Channel]() [No videos yet!]
|
-- ## No videos yet!
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -57,15 +57,15 @@
|
|||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
|
|
||||||
--- Allows to spawn dynamically new @{Static}s into your mission.
|
--- Allows to spawn dynamically new @{Wrapper.Static}s into your mission.
|
||||||
--
|
--
|
||||||
-- Through creating a copy of an existing static object template as defined in the Mission Editor (ME), SPAWNSTATIC can retireve the properties of the defined static object template (like type, category etc),
|
-- Through creating a copy of an existing static object template as defined in the Mission Editor (ME), SPAWNSTATIC can retireve the properties of the defined static object template (like type, category etc),
|
||||||
-- and "copy" these properties to create a new static object and place it at the desired coordinate.
|
-- and "copy" these properties to create a new static object and place it at the desired coordinate.
|
||||||
--
|
--
|
||||||
-- New spawned @{Static}s get **the same name** as the name of the template Static, or gets the given name when a new name is provided at the Spawn method.
|
-- New spawned @{Wrapper.Static}s get **the same name** as the name of the template Static, or gets the given name when a new name is provided at the Spawn method.
|
||||||
-- By default, spawned @{Static}s will follow a naming convention at run-time:
|
-- By default, spawned @{Wrapper.Static}s will follow a naming convention at run-time:
|
||||||
--
|
--
|
||||||
-- * Spawned @{Static}s will have the name _StaticName_#_nnn_, where _StaticName_ is the name of the **Template Static**, and _nnn_ is a **counter from 0 to 99999**.
|
-- * Spawned @{Wrapper.Static}s will have the name _StaticName_#_nnn_, where _StaticName_ is the name of the **Template Static**, and _nnn_ is a **counter from 0 to 99999**.
|
||||||
--
|
--
|
||||||
-- # SPAWNSTATIC Constructors
|
-- # SPAWNSTATIC Constructors
|
||||||
--
|
--
|
||||||
@@ -106,7 +106,7 @@
|
|||||||
-- * @{#SPAWNSTATIC.Spawn}(Heading, NewName) spawns the static with the set parameters. Optionally, heading and name can be given. The name **must be unique**!
|
-- * @{#SPAWNSTATIC.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 POINT_VEC2 coordinate. Optionally, heading and name can be given. The name **must be unique**!
|
||||||
-- * @{#SPAWNSTATIC.SpawnFromZone}(Zone, Heading, NewName) spawns the static at the center of a @{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
|
||||||
--
|
--
|
||||||
@@ -131,7 +131,7 @@ SPAWNSTATIC = {
|
|||||||
-- @field #number mass Cargo mass in kg.
|
-- @field #number mass Cargo mass in kg.
|
||||||
-- @field #boolean canCargo Static can be a cargo.
|
-- @field #boolean canCargo Static can be a cargo.
|
||||||
|
|
||||||
--- Creates the main object to spawn a @{Static} defined in the mission editor (ME).
|
--- Creates the main object to spawn a @{Wrapper.Static} defined in the mission editor (ME).
|
||||||
-- @param #SPAWNSTATIC self
|
-- @param #SPAWNSTATIC self
|
||||||
-- @param #string SpawnTemplateName Name of the static object in the ME. Each new static will have the name starting with this prefix.
|
-- @param #string SpawnTemplateName Name of the static object in the ME. Each new static will have the name starting with this prefix.
|
||||||
-- @param DCS#country.id SpawnCountryID (Optional) The ID of the country.
|
-- @param DCS#country.id SpawnCountryID (Optional) The ID of the country.
|
||||||
@@ -158,7 +158,7 @@ function SPAWNSTATIC:NewFromStatic(SpawnTemplateName, SpawnCountryID)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Creates the main object to spawn a @{Static} given a template table.
|
--- Creates the main object to spawn a @{Wrapper.Static} given a template table.
|
||||||
-- @param #SPAWNSTATIC self
|
-- @param #SPAWNSTATIC self
|
||||||
-- @param #table SpawnTemplate Template used for spawning.
|
-- @param #table SpawnTemplate Template used for spawning.
|
||||||
-- @param DCS#country.id CountryID The ID of the country. Default `country.id.USA`.
|
-- @param DCS#country.id CountryID The ID of the country. Default `country.id.USA`.
|
||||||
@@ -174,7 +174,7 @@ function SPAWNSTATIC:NewFromTemplate(SpawnTemplate, CountryID)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Creates the main object to spawn a @{Static} from a given type.
|
--- Creates the main object to spawn a @{Wrapper.Static} from a given type.
|
||||||
-- NOTE that you have to init many other parameters as spawn coordinate etc.
|
-- NOTE that you have to init many other parameters as spawn coordinate etc.
|
||||||
-- @param #SPAWNSTATIC self
|
-- @param #SPAWNSTATIC self
|
||||||
-- @param #string StaticType Type of the static.
|
-- @param #string StaticType Type of the static.
|
||||||
@@ -275,7 +275,7 @@ end
|
|||||||
|
|
||||||
--- Initialize as dead.
|
--- Initialize as dead.
|
||||||
-- @param #SPAWNSTATIC self
|
-- @param #SPAWNSTATIC self
|
||||||
-- @param #boolean IsCargo If true, this static is dead.
|
-- @param #boolean IsDead If true, this static is dead.
|
||||||
-- @return #SPAWNSTATIC self
|
-- @return #SPAWNSTATIC self
|
||||||
function SPAWNSTATIC:InitDead(IsDead)
|
function SPAWNSTATIC:InitDead(IsDead)
|
||||||
self.InitStaticDead=IsDead
|
self.InitStaticDead=IsDead
|
||||||
@@ -336,7 +336,7 @@ function SPAWNSTATIC:Spawn(Heading, NewName)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Creates a new @{Static} from a POINT_VEC2.
|
--- Creates a new @{Wrapper.Static} from a POINT_VEC2.
|
||||||
-- @param #SPAWNSTATIC self
|
-- @param #SPAWNSTATIC self
|
||||||
-- @param Core.Point#POINT_VEC2 PointVec2 The 2D coordinate where to spawn the static.
|
-- @param Core.Point#POINT_VEC2 PointVec2 The 2D coordinate where to spawn the static.
|
||||||
-- @param #number Heading The heading of the static, which is a number in degrees from 0 to 360.
|
-- @param #number Heading The heading of the static, which is a number in degrees from 0 to 360.
|
||||||
@@ -352,7 +352,7 @@ function SPAWNSTATIC:SpawnFromPointVec2(PointVec2, Heading, NewName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Creates a new @{Static} from a COORDINATE.
|
--- Creates a new @{Wrapper.Static} from a COORDINATE.
|
||||||
-- @param #SPAWNSTATIC self
|
-- @param #SPAWNSTATIC self
|
||||||
-- @param Core.Point#COORDINATE Coordinate The 3D coordinate where to spawn the static.
|
-- @param Core.Point#COORDINATE Coordinate The 3D coordinate where to spawn the static.
|
||||||
-- @param #number Heading (Optional) Heading The heading of the static in degrees. Default is 0 degrees.
|
-- @param #number Heading (Optional) Heading The heading of the static in degrees. Default is 0 degrees.
|
||||||
@@ -375,7 +375,7 @@ function SPAWNSTATIC:SpawnFromCoordinate(Coordinate, Heading, NewName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Creates a new @{Static} from a @{Zone}.
|
--- Creates a new @{Wrapper.Static} from a @{Core.Zone}.
|
||||||
-- @param #SPAWNSTATIC self
|
-- @param #SPAWNSTATIC self
|
||||||
-- @param Core.Zone#ZONE_BASE Zone The Zone where to spawn the static.
|
-- @param Core.Zone#ZONE_BASE Zone The Zone where to spawn the static.
|
||||||
-- @param #number Heading (Optional)The heading of the static in degrees. Default is the heading of the template.
|
-- @param #number Heading (Optional)The heading of the static in degrees. Default is the heading of the template.
|
||||||
@@ -467,7 +467,7 @@ function SPAWNSTATIC:_SpawnStatic(Template, CountryID)
|
|||||||
self:T(Template)
|
self:T(Template)
|
||||||
|
|
||||||
-- Add static to the game.
|
-- Add static to the game.
|
||||||
local Static=nil
|
local Static=nil --DCS#StaticObject
|
||||||
|
|
||||||
if self.InitFarp then
|
if self.InitFarp then
|
||||||
|
|
||||||
@@ -487,6 +487,17 @@ 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!
|
||||||
|
-- We create such an event. The airbase is registered in Core.Event
|
||||||
|
local Event = {
|
||||||
|
id = EVENTS.Birth,
|
||||||
|
time = timer.getTime(),
|
||||||
|
initiator = Static
|
||||||
|
}
|
||||||
|
-- Create BIRTH event.
|
||||||
|
world.onEvent(Event)
|
||||||
|
|
||||||
else
|
else
|
||||||
self:T("Spawning Static")
|
self:T("Spawning Static")
|
||||||
self:T2({Template=Template})
|
self:T2({Template=Template})
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
-- SPOT implements the DCS Spot class functionality, but adds additional luxury to be able to:
|
-- SPOT implements the DCS Spot class functionality, but adds additional luxury to be able to:
|
||||||
--
|
--
|
||||||
-- * Spot for a defined duration.
|
-- * Spot for a defined duration.
|
||||||
-- * Updates of laer spot position every 0.2 seconds for moving targets.
|
-- * Updates of laser spot position every 0.2 seconds for moving targets.
|
||||||
-- * Wiggle the spot at the target.
|
-- * Wiggle the spot at the target.
|
||||||
-- * Provide a @{Wrapper.Unit} as a target, instead of a point.
|
-- * Provide a @{Wrapper.Unit} as a target, instead of a point.
|
||||||
-- * Implement a status machine, LaseOn, LaseOff.
|
-- * Implement a status machine, LaseOn, LaseOff.
|
||||||
@@ -13,27 +13,17 @@
|
|||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # Demo Missions
|
-- # Demo Missions
|
||||||
--
|
|
||||||
-- ### [SPOT Demo Missions source code]()
|
|
||||||
--
|
|
||||||
-- ### [SPOT Demo Missions, only for beta testers]()
|
|
||||||
--
|
--
|
||||||
-- ### [ALL Demo Missions pack of the last release](https://github.com/FlightControl-Master/MOOSE_MISSIONS/releases)
|
-- ### [Demo Missions on GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS)
|
||||||
--
|
|
||||||
-- ===
|
|
||||||
--
|
|
||||||
-- # YouTube Channel
|
|
||||||
--
|
|
||||||
-- ### [SPOT YouTube Channel]()
|
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
-- ### Contributions:
|
-- ### Contributions:
|
||||||
--
|
--
|
||||||
-- * [**Ciribob**](https://forums.eagle.ru/member.php?u=112175): Showing the way how to lase targets + how laser codes work!!! Explained the autolase script.
|
-- * **Ciribob**: Showing the way how to lase targets + how laser codes work!!! Explained the autolase script.
|
||||||
-- * [**EasyEB**](https://forums.eagle.ru/member.php?u=112055): Ideas and Beta Testing
|
-- * **EasyEB**: Ideas and Beta Testing
|
||||||
-- * [**Wingthor**](https://forums.eagle.ru/member.php?u=123698): Beta Testing
|
-- * **Wingthor**: Beta Testing
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -43,21 +33,22 @@
|
|||||||
|
|
||||||
do
|
do
|
||||||
|
|
||||||
--- @type SPOT
|
---
|
||||||
|
-- @type SPOT
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
|
|
||||||
--- Implements the target spotting or marking functionality, but adds additional luxury to be able to:
|
--- Implements the target spotting or marking functionality, but adds additional luxury to be able to:
|
||||||
--
|
--
|
||||||
-- * Mark targets for a defined duration.
|
-- * Mark targets for a defined duration.
|
||||||
-- * Updates of laer spot position every 0.2 seconds for moving targets.
|
-- * Updates of laser spot position every 0.25 seconds for moving targets.
|
||||||
-- * Wiggle the spot at the target.
|
-- * Wiggle the spot at the target.
|
||||||
-- * Provide a @{Wrapper.Unit} as a target, instead of a point.
|
-- * Provide a @{Wrapper.Unit} as a target, instead of a point.
|
||||||
-- * Implement a status machine, LaseOn, LaseOff.
|
-- * Implement a status machine, LaseOn, LaseOff.
|
||||||
--
|
--
|
||||||
-- ## 1. SPOT constructor
|
-- ## 1. SPOT constructor
|
||||||
--
|
--
|
||||||
-- * @{#SPOT.New}(..\Presentations\SPOT\Dia2.JPG): Creates a new SPOT object.
|
-- * @{#SPOT.New}(): Creates a new SPOT object.
|
||||||
--
|
--
|
||||||
-- ## 2. SPOT is a FSM
|
-- ## 2. SPOT is a FSM
|
||||||
--
|
--
|
||||||
@@ -217,6 +208,8 @@ do
|
|||||||
|
|
||||||
|
|
||||||
self.Recce = Recce
|
self.Recce = Recce
|
||||||
|
|
||||||
|
self.RecceName = self.Recce:GetName()
|
||||||
|
|
||||||
self.LaseScheduler = SCHEDULER:New( self )
|
self.LaseScheduler = SCHEDULER:New( self )
|
||||||
|
|
||||||
@@ -236,21 +229,27 @@ do
|
|||||||
-- @param #number LaserCode Laser code.
|
-- @param #number LaserCode Laser code.
|
||||||
-- @param #number Duration Duration of lasing in seconds.
|
-- @param #number Duration Duration of lasing in seconds.
|
||||||
function SPOT:onafterLaseOn( From, Event, To, Target, LaserCode, Duration )
|
function SPOT:onafterLaseOn( From, Event, To, Target, LaserCode, Duration )
|
||||||
self:F( { "LaseOn", Target, LaserCode, Duration } )
|
self:T({From, Event, To})
|
||||||
|
self:T2( { "LaseOn", Target, LaserCode, Duration } )
|
||||||
|
|
||||||
local function StopLase( self )
|
local function StopLase( self )
|
||||||
self:LaseOff()
|
self:LaseOff()
|
||||||
end
|
end
|
||||||
|
|
||||||
self.Target = Target
|
self.Target = Target
|
||||||
|
|
||||||
|
self.TargetName = Target:GetName()
|
||||||
|
|
||||||
self.LaserCode = LaserCode
|
self.LaserCode = LaserCode
|
||||||
|
|
||||||
self.Lasing = true
|
self.Lasing = true
|
||||||
|
|
||||||
local RecceDcsUnit = self.Recce:GetDCSObject()
|
local RecceDcsUnit = self.Recce:GetDCSObject()
|
||||||
|
|
||||||
self.SpotIR = Spot.createInfraRed( RecceDcsUnit, { x = 0, y = 2, z = 0 }, Target:GetPointVec3():AddY(1):GetVec3() )
|
local relativespot = self.relstartpos or { x = 0, y = 2, z = 0 }
|
||||||
self.SpotLaser = Spot.createLaser( RecceDcsUnit, { x = 0, y = 2, z = 0 }, Target:GetPointVec3():AddY(1):GetVec3(), LaserCode )
|
|
||||||
|
self.SpotIR = Spot.createInfraRed( RecceDcsUnit, relativespot, Target:GetPointVec3():AddY(1):GetVec3() )
|
||||||
|
self.SpotLaser = Spot.createLaser( RecceDcsUnit, relativespot, Target:GetPointVec3():AddY(1):GetVec3(), LaserCode )
|
||||||
|
|
||||||
if Duration then
|
if Duration then
|
||||||
self.ScheduleID = self.LaseScheduler:Schedule( self, StopLase, {self}, Duration )
|
self.ScheduleID = self.LaseScheduler:Schedule( self, StopLase, {self}, Duration )
|
||||||
@@ -259,6 +258,8 @@ do
|
|||||||
self:HandleEvent( EVENTS.Dead )
|
self:HandleEvent( EVENTS.Dead )
|
||||||
|
|
||||||
self:__Lasing( -1 )
|
self:__Lasing( -1 )
|
||||||
|
|
||||||
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -271,7 +272,7 @@ do
|
|||||||
-- @param #number LaserCode Laser code.
|
-- @param #number LaserCode Laser code.
|
||||||
-- @param #number Duration Duration of lasing in seconds.
|
-- @param #number Duration Duration of lasing in seconds.
|
||||||
function SPOT:onafterLaseOnCoordinate(From, Event, To, Coordinate, LaserCode, Duration)
|
function SPOT:onafterLaseOnCoordinate(From, Event, To, Coordinate, LaserCode, Duration)
|
||||||
self:F( { "LaseOnCoordinate", Coordinate, LaserCode, Duration } )
|
self:T2( { "LaseOnCoordinate", Coordinate, LaserCode, Duration } )
|
||||||
|
|
||||||
local function StopLase( self )
|
local function StopLase( self )
|
||||||
self:LaseOff()
|
self:LaseOff()
|
||||||
@@ -293,55 +294,72 @@ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
self:__Lasing(-1)
|
self:__Lasing(-1)
|
||||||
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #SPOT self
|
---
|
||||||
|
-- @param #SPOT self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function SPOT:OnEventDead(EventData)
|
function SPOT:OnEventDead(EventData)
|
||||||
self:F( { Dead = EventData.IniDCSUnitName, Target = self.Target } )
|
self:T2( { Dead = EventData.IniDCSUnitName, Target = self.Target } )
|
||||||
if self.Target then
|
if self.Target then
|
||||||
if EventData.IniDCSUnitName == self.Target:GetName() then
|
if EventData.IniDCSUnitName == self.TargetName then
|
||||||
self:F( {"Target dead ", self.Target:GetName() } )
|
self:F( {"Target dead ", self.TargetName } )
|
||||||
self:Destroyed()
|
self:Destroyed()
|
||||||
self:LaseOff()
|
self:LaseOff()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if self.Recce then
|
||||||
|
if EventData.IniDCSUnitName == self.RecceName then
|
||||||
|
self:F( {"Recce dead ", self.RecceName } )
|
||||||
|
self:LaseOff()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #SPOT self
|
---
|
||||||
|
-- @param #SPOT self
|
||||||
-- @param From
|
-- @param From
|
||||||
-- @param Event
|
-- @param Event
|
||||||
-- @param To
|
-- @param To
|
||||||
function SPOT:onafterLasing( From, Event, To )
|
function SPOT:onafterLasing( From, Event, To )
|
||||||
|
self:T({From, Event, To})
|
||||||
if self.Target and self.Target:IsAlive() then
|
|
||||||
self.SpotIR:setPoint( self.Target:GetPointVec3():AddY(1):AddY(math.random(-100,100)/100):AddX(math.random(-100,100)/100):GetVec3() )
|
|
||||||
self.SpotLaser:setPoint( self.Target:GetPointVec3():AddY(1):GetVec3() )
|
|
||||||
self:__Lasing( -0.2 )
|
|
||||||
elseif self.TargetCoord then
|
|
||||||
|
|
||||||
-- Wiggle the IR spot a bit.
|
if self.Lasing then
|
||||||
local irvec3={x=self.TargetCoord.x+math.random(-100,100)/100, y=self.TargetCoord.y+math.random(-100,100)/100, z=self.TargetCoord.z} --#DCS.Vec3
|
if self.Target and self.Target:IsAlive() then
|
||||||
local lsvec3={x=self.TargetCoord.x, y=self.TargetCoord.y, z=self.TargetCoord.z} --#DCS.Vec3
|
|
||||||
|
self.SpotIR:setPoint( self.Target:GetPointVec3():AddY(1):AddY(math.random(-100,100)/200):AddX(math.random(-100,100)/200):GetVec3() )
|
||||||
|
self.SpotLaser:setPoint( self.Target:GetPointVec3():AddY(1):GetVec3() )
|
||||||
|
|
||||||
|
self:__Lasing(0.2)
|
||||||
|
elseif self.TargetCoord then
|
||||||
|
|
||||||
self.SpotIR:setPoint(irvec3)
|
-- Wiggle the IR spot a bit.
|
||||||
self.SpotLaser:setPoint(lsvec3)
|
local irvec3={x=self.TargetCoord.x+math.random(-100,100)/200, y=self.TargetCoord.y+math.random(-100,100)/200, z=self.TargetCoord.z} --#DCS.Vec3
|
||||||
|
local lsvec3={x=self.TargetCoord.x, y=self.TargetCoord.y, z=self.TargetCoord.z} --#DCS.Vec3
|
||||||
self:__Lasing(-0.25)
|
|
||||||
else
|
self.SpotIR:setPoint(irvec3)
|
||||||
self:F( { "Target is not alive", self.Target:IsAlive() } )
|
self.SpotLaser:setPoint(lsvec3)
|
||||||
|
|
||||||
|
self:__Lasing(0.2)
|
||||||
|
else
|
||||||
|
self:F( { "Target is not alive", self.Target:IsAlive() } )
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #SPOT self
|
---
|
||||||
|
-- @param #SPOT self
|
||||||
-- @param From
|
-- @param From
|
||||||
-- @param Event
|
-- @param Event
|
||||||
-- @param To
|
-- @param To
|
||||||
-- @return #SPOT
|
-- @return #SPOT
|
||||||
function SPOT:onafterLaseOff( From, Event, To )
|
function SPOT:onafterLaseOff( From, Event, To )
|
||||||
|
self:T({From, Event, To})
|
||||||
self:F( {"Stopped lasing for ", self.Target and self.Target:GetName() or "coord", SpotIR = self.SportIR, SpotLaser = self.SpotLaser } )
|
|
||||||
|
self:T2( {"Stopped lasing for ", self.Target and self.Target:GetName() or "coord", SpotIR = self.SportIR, SpotLaser = self.SpotLaser } )
|
||||||
|
|
||||||
self.Lasing = false
|
self.Lasing = false
|
||||||
|
|
||||||
@@ -368,4 +386,16 @@ do
|
|||||||
return self.Lasing
|
return self.Lasing
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
--- Set laser start position relative to the lasing unit.
|
||||||
|
-- @param #SPOT self
|
||||||
|
-- @param #table position Start position of the laser relative to the lasing unit. Default is { x = 0, y = 2, z = 0 }
|
||||||
|
-- @return #SPOT self
|
||||||
|
-- @usage
|
||||||
|
-- -- Set lasing position to be the position of the optics of the Gazelle M:
|
||||||
|
-- myspot:SetRelativeStartPosition({ x = 1.7, y = 1.2, z = 0 })
|
||||||
|
function SPOT:SetRelativeStartPosition(position)
|
||||||
|
self.relstartpos = position or { x = 0, y = 2, z = 0 }
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **Core** - TEXTANDSOUND (MOOSE gettext) system
|
--- **Core** - A Moose GetText system.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ _TIMERID=0
|
|||||||
|
|
||||||
--- TIMER class version.
|
--- TIMER class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
TIMER.version="0.1.2"
|
TIMER.version="0.2.0"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
@@ -155,7 +155,7 @@ function TIMER:New(Function, ...)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Create a new TIMER object.
|
--- Start TIMER object.
|
||||||
-- @param #TIMER self
|
-- @param #TIMER self
|
||||||
-- @param #number Tstart Relative start time in seconds.
|
-- @param #number Tstart Relative start time in seconds.
|
||||||
-- @param #number dT Interval between function calls in seconds. If not specified `nil`, the function is called only once.
|
-- @param #number dT Interval between function calls in seconds. If not specified `nil`, the function is called only once.
|
||||||
@@ -192,6 +192,20 @@ function TIMER:Start(Tstart, dT, Duration)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Start TIMER object if a condition is met. Useful for e.g. debugging.
|
||||||
|
-- @param #TIMER self
|
||||||
|
-- @param #boolean Condition Must be true for the TIMER to start
|
||||||
|
-- @param #number Tstart Relative start time in seconds.
|
||||||
|
-- @param #number dT Interval between function calls in seconds. If not specified `nil`, the function is called only once.
|
||||||
|
-- @param #number Duration Time in seconds for how long the timer is running. If not specified `nil`, the timer runs forever or until stopped manually by the `TIMER:Stop()` function.
|
||||||
|
-- @return #TIMER self
|
||||||
|
function TIMER:StartIf(Condition,Tstart, dT, Duration)
|
||||||
|
if Condition then
|
||||||
|
self:Start(Tstart, dT, Duration)
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Stop the timer by removing the timer function.
|
--- Stop the timer by removing the timer function.
|
||||||
-- @param #TIMER self
|
-- @param #TIMER self
|
||||||
-- @param #number Delay (Optional) Delay in seconds, before the timer is stopped.
|
-- @param #number Delay (Optional) Delay in seconds, before the timer is stopped.
|
||||||
@@ -208,7 +222,20 @@ function TIMER:Stop(Delay)
|
|||||||
|
|
||||||
-- Remove timer function.
|
-- Remove timer function.
|
||||||
self:T(self.lid..string.format("Stopping timer by removing timer function after %d calls!", self.ncalls))
|
self:T(self.lid..string.format("Stopping timer by removing timer function after %d calls!", self.ncalls))
|
||||||
timer.removeFunction(self.tid)
|
|
||||||
|
-- We use a pcall here because if the DCS timer does not exist any more, it crashes the whole script!
|
||||||
|
local status=pcall(
|
||||||
|
function ()
|
||||||
|
timer.removeFunction(self.tid)
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
-- Debug messages.
|
||||||
|
if status then
|
||||||
|
self:T2(self.lid..string.format("Stopped timer!"))
|
||||||
|
else
|
||||||
|
self:E(self.lid..string.format("WARNING: Could not remove timer function! isrunning=%s", tostring(self.isrunning)))
|
||||||
|
end
|
||||||
|
|
||||||
-- Not running any more.
|
-- Not running any more.
|
||||||
self.isrunning=false
|
self.isrunning=false
|
||||||
|
|||||||
@@ -35,13 +35,13 @@ do -- UserFlag
|
|||||||
ClassName = "USERFLAG",
|
ClassName = "USERFLAG",
|
||||||
UserFlagName = nil,
|
UserFlagName = nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- USERFLAG Constructor.
|
--- USERFLAG Constructor.
|
||||||
-- @param #USERFLAG self
|
-- @param #USERFLAG self
|
||||||
-- @param #string UserFlagName The name of the userflag, which is a free text string.
|
-- @param #string UserFlagName The name of the userflag, which is a free text string.
|
||||||
-- @return #USERFLAG
|
-- @return #USERFLAG
|
||||||
function USERFLAG:New( UserFlagName ) --R2.3
|
function USERFLAG:New( UserFlagName ) --R2.3
|
||||||
|
|
||||||
local self = BASE:Inherit( self, BASE:New() ) -- #USERFLAG
|
local self = BASE:Inherit( self, BASE:New() ) -- #USERFLAG
|
||||||
|
|
||||||
self.UserFlagName = UserFlagName
|
self.UserFlagName = UserFlagName
|
||||||
@@ -52,7 +52,7 @@ do -- UserFlag
|
|||||||
--- Get the userflag name.
|
--- Get the userflag name.
|
||||||
-- @param #USERFLAG self
|
-- @param #USERFLAG self
|
||||||
-- @return #string Name of the user flag.
|
-- @return #string Name of the user flag.
|
||||||
function USERFLAG:GetName()
|
function USERFLAG:GetName()
|
||||||
return self.UserFlagName
|
return self.UserFlagName
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -66,18 +66,17 @@ do -- UserFlag
|
|||||||
-- BlueVictory:Set( 100 ) -- Set the UserFlag VictoryBlue to 100.
|
-- BlueVictory:Set( 100 ) -- Set the UserFlag VictoryBlue to 100.
|
||||||
--
|
--
|
||||||
function USERFLAG:Set( Number, Delay ) --R2.3
|
function USERFLAG:Set( Number, Delay ) --R2.3
|
||||||
|
|
||||||
if Delay and Delay>0 then
|
if Delay and Delay>0 then
|
||||||
self:ScheduleOnce(Delay, USERFLAG.Set, self, Number)
|
self:ScheduleOnce(Delay, USERFLAG.Set, self, Number)
|
||||||
else
|
else
|
||||||
--env.info(string.format("Setting flag \"%s\" to %d at T=%.1f", self.UserFlagName, Number, timer.getTime()))
|
--env.info(string.format("Setting flag \"%s\" to %d at T=%.1f", self.UserFlagName, Number, timer.getTime()))
|
||||||
trigger.action.setUserFlag( self.UserFlagName, Number )
|
trigger.action.setUserFlag( self.UserFlagName, Number )
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Get the userflag Number.
|
--- Get the userflag Number.
|
||||||
-- @param #USERFLAG self
|
-- @param #USERFLAG self
|
||||||
-- @return #number Number The number value to be checked if it is the same as the userflag.
|
-- @return #number Number The number value to be checked if it is the same as the userflag.
|
||||||
@@ -86,12 +85,10 @@ do -- UserFlag
|
|||||||
-- local BlueVictoryValue = BlueVictory:Get() -- Get the UserFlag VictoryBlue value.
|
-- local BlueVictoryValue = BlueVictory:Get() -- Get the UserFlag VictoryBlue value.
|
||||||
--
|
--
|
||||||
function USERFLAG:Get() --R2.3
|
function USERFLAG:Get() --R2.3
|
||||||
|
|
||||||
return trigger.misc.getUserFlag( self.UserFlagName )
|
|
||||||
end
|
|
||||||
|
|
||||||
|
return trigger.misc.getUserFlag( self.UserFlagName )
|
||||||
|
end
|
||||||
|
|
||||||
--- Check if the userflag has a value of Number.
|
--- Check if the userflag has a value of 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 be checked if it is the same as the userflag.
|
||||||
@@ -102,9 +99,9 @@ do -- UserFlag
|
|||||||
-- return "Blue has won"
|
-- return "Blue has won"
|
||||||
-- end
|
-- end
|
||||||
function USERFLAG:Is( Number ) --R2.3
|
function USERFLAG:Is( Number ) --R2.3
|
||||||
|
|
||||||
return trigger.misc.getUserFlag( self.UserFlagName ) == Number
|
return trigger.misc.getUserFlag( self.UserFlagName ) == Number
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -54,7 +54,7 @@ do -- Velocity
|
|||||||
self.Velocity = VelocityMps
|
self.Velocity = VelocityMps
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the velocity in Mps (meters per second).
|
--- Get the velocity in Mps (meters per second).
|
||||||
-- @param #VELOCITY self
|
-- @param #VELOCITY self
|
||||||
-- @return #number The velocity in meters per second.
|
-- @return #number The velocity in meters per second.
|
||||||
@@ -70,12 +70,12 @@ do -- Velocity
|
|||||||
self.Velocity = UTILS.KmphToMps( VelocityKmph )
|
self.Velocity = UTILS.KmphToMps( VelocityKmph )
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the velocity in Kmph (kilometers per hour).
|
--- Get the velocity in Kmph (kilometers per hour).
|
||||||
-- @param #VELOCITY self
|
-- @param #VELOCITY self
|
||||||
-- @return #number The velocity in kilometers per hour.
|
-- @return #number The velocity in kilometers per hour.
|
||||||
function VELOCITY:GetKmph()
|
function VELOCITY:GetKmph()
|
||||||
|
|
||||||
return UTILS.MpsToKmph( self.Velocity )
|
return UTILS.MpsToKmph( self.Velocity )
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ do -- Velocity
|
|||||||
self.Velocity = UTILS.MiphToMps( VelocityMiph )
|
self.Velocity = UTILS.MiphToMps( VelocityMiph )
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the velocity in Miph (miles per hour).
|
--- Get the velocity in Miph (miles per hour).
|
||||||
-- @param #VELOCITY self
|
-- @param #VELOCITY self
|
||||||
-- @return #number The velocity in miles per hour.
|
-- @return #number The velocity in miles per hour.
|
||||||
@@ -95,8 +95,7 @@ do -- Velocity
|
|||||||
return UTILS.MpsToMiph( self.Velocity )
|
return UTILS.MpsToMiph( self.Velocity )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Get the velocity in text, according the player @{Core.Settings}.
|
||||||
--- Get the velocity in text, according the player @{Settings}.
|
|
||||||
-- @param #VELOCITY self
|
-- @param #VELOCITY self
|
||||||
-- @param Core.Settings#SETTINGS Settings
|
-- @param Core.Settings#SETTINGS Settings
|
||||||
-- @return #string The velocity in text.
|
-- @return #string The velocity in text.
|
||||||
@@ -113,11 +112,11 @@ do -- Velocity
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the velocity in text, according the player or default @{Settings}.
|
--- Get the velocity in text, according the player or default @{Core.Settings}.
|
||||||
-- @param #VELOCITY self
|
-- @param #VELOCITY self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
|
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
|
||||||
-- @param Core.Settings#SETTINGS Settings
|
-- @param Core.Settings#SETTINGS Settings
|
||||||
-- @return #string The velocity in text according the player or default @{Settings}
|
-- @return #string The velocity in text according the player or default @{Core.Settings}
|
||||||
function VELOCITY:ToString( VelocityGroup, Settings ) -- R2.3
|
function VELOCITY:ToString( VelocityGroup, Settings ) -- R2.3
|
||||||
self:F( { Group = VelocityGroup and VelocityGroup:GetName() } )
|
self:F( { Group = VelocityGroup and VelocityGroup:GetName() } )
|
||||||
local Settings = Settings or ( VelocityGroup and _DATABASE:GetPlayerSettings( VelocityGroup:GetPlayerName() ) ) or _SETTINGS
|
local Settings = Settings or ( VelocityGroup and _DATABASE:GetPlayerSettings( VelocityGroup:GetPlayerName() ) ) or _SETTINGS
|
||||||
@@ -134,7 +133,7 @@ do -- VELOCITY_POSITIONABLE
|
|||||||
|
|
||||||
--- # VELOCITY_POSITIONABLE class, extends @{Core.Base#BASE}
|
--- # VELOCITY_POSITIONABLE class, extends @{Core.Base#BASE}
|
||||||
--
|
--
|
||||||
-- VELOCITY_POSITIONABLE monitors the speed of an @{Positionable} in the simulation, which can be expressed in various formats according the Settings.
|
-- @{#VELOCITY_POSITIONABLE} monitors the speed of a @{Wrapper.Positionable#POSITIONABLE} in the simulation, which can be expressed in various formats according the Settings.
|
||||||
--
|
--
|
||||||
-- ## 1. VELOCITY_POSITIONABLE constructor
|
-- ## 1. VELOCITY_POSITIONABLE constructor
|
||||||
--
|
--
|
||||||
@@ -167,7 +166,7 @@ do -- VELOCITY_POSITIONABLE
|
|||||||
-- @param #VELOCITY_POSITIONABLE self
|
-- @param #VELOCITY_POSITIONABLE self
|
||||||
-- @return #number The velocity in kilometers per hour.
|
-- @return #number The velocity in kilometers per hour.
|
||||||
function VELOCITY_POSITIONABLE:GetKmph()
|
function VELOCITY_POSITIONABLE:GetKmph()
|
||||||
|
|
||||||
return UTILS.MpsToKmph( self.Positionable:GetVelocityMPS() or 0)
|
return UTILS.MpsToKmph( self.Positionable:GetVelocityMPS() or 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -178,9 +177,9 @@ do -- VELOCITY_POSITIONABLE
|
|||||||
return UTILS.MpsToMiph( self.Positionable:GetVelocityMPS() or 0 )
|
return UTILS.MpsToMiph( self.Positionable:GetVelocityMPS() or 0 )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the velocity in text, according the player or default @{Settings}.
|
--- Get the velocity in text, according the player or default @{Core.Settings}.
|
||||||
-- @param #VELOCITY_POSITIONABLE self
|
-- @param #VELOCITY_POSITIONABLE self
|
||||||
-- @return #string The velocity in text according the player or default @{Settings}
|
-- @return #string The velocity in text according the player or default @{Core.Settings}
|
||||||
function VELOCITY_POSITIONABLE:ToString() -- R2.3
|
function VELOCITY_POSITIONABLE:ToString() -- R2.3
|
||||||
self:F( { Group = self.Positionable and self.Positionable:GetName() } )
|
self:F( { Group = self.Positionable and self.Positionable:GetName() } )
|
||||||
local Settings = Settings or ( self.Positionable and _DATABASE:GetPlayerSettings( self.Positionable:GetPlayerName() ) ) or _SETTINGS
|
local Settings = Settings or ( self.Positionable and _DATABASE:GetPlayerSettings( self.Positionable:GetPlayerName() ) ) or _SETTINGS
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,8 @@
|
|||||||
|
--- **Core** - The ZONE_DETECTION class, defined by a zone name, a detection object and a radius.
|
||||||
|
-- @module Core.Zone_Detection
|
||||||
|
-- @image MOOSE.JPG
|
||||||
|
|
||||||
--- The ZONE_DETECTION class, defined by a zone name, a detection object and a radius.
|
--- @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
|
||||||
@@ -29,7 +31,7 @@ function ZONE_DETECTION:New( ZoneName, Detection, Radius )
|
|||||||
|
|
||||||
self.Detection = Detection
|
self.Detection = Detection
|
||||||
self.Radius = Radius
|
self.Radius = Radius
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -48,15 +50,14 @@ function ZONE_DETECTION:BoundZone( Points, CountryID, UnBound )
|
|||||||
|
|
||||||
local Angle
|
local Angle
|
||||||
local RadialBase = math.pi*2
|
local RadialBase = math.pi*2
|
||||||
|
|
||||||
--
|
|
||||||
for Angle = 0, 360, (360 / Points ) do
|
for Angle = 0, 360, (360 / Points ) do
|
||||||
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()
|
||||||
|
|
||||||
local CountryName = _DATABASE.COUNTRY_NAME[CountryID]
|
local CountryName = _DATABASE.COUNTRY_NAME[CountryID]
|
||||||
|
|
||||||
local Tire = {
|
local Tire = {
|
||||||
["country"] = CountryName,
|
["country"] = CountryName,
|
||||||
["category"] = "Fortifications",
|
["category"] = "Fortifications",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
--- **DCS API** Prototypes
|
--- **DCS API** Prototypes.
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
--
|
--
|
||||||
-- See the [Simulator Scripting Engine Documentation](https://wiki.hoggitworld.com/view/Simulator_Scripting_Engine_Documentation) on Hoggit for further explanation and examples.
|
-- See the [Simulator Scripting Engine Documentation](https://wiki.hoggitworld.com/view/Simulator_Scripting_Engine_Documentation) on Hoggit for further explanation and examples.
|
||||||
--
|
--
|
||||||
@@ -133,6 +135,22 @@ do -- env
|
|||||||
|
|
||||||
end -- env
|
end -- env
|
||||||
|
|
||||||
|
do -- radio
|
||||||
|
|
||||||
|
---@type radio
|
||||||
|
-- @field #radio.modulation modulation
|
||||||
|
|
||||||
|
---
|
||||||
|
-- @type radio.modulation
|
||||||
|
-- @field AM
|
||||||
|
-- @field FM
|
||||||
|
|
||||||
|
radio = {}
|
||||||
|
radio.modulation = {}
|
||||||
|
radio.modulation.AM = 0
|
||||||
|
radio.modulation.FM = 1
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
do -- timer
|
do -- timer
|
||||||
|
|
||||||
@@ -191,21 +209,29 @@ do -- land
|
|||||||
|
|
||||||
--- [Type of surface enumerator](https://wiki.hoggitworld.com/view/DCS_singleton_land)
|
--- [Type of surface enumerator](https://wiki.hoggitworld.com/view/DCS_singleton_land)
|
||||||
-- @type land.SurfaceType
|
-- @type land.SurfaceType
|
||||||
-- @field LAND
|
-- @field LAND Land=1
|
||||||
-- @field SHALLOW_WATER
|
-- @field SHALLOW_WATER Shallow water=2
|
||||||
-- @field WATER
|
-- @field WATER Water=3
|
||||||
-- @field ROAD
|
-- @field ROAD Road=4
|
||||||
-- @field RUNWAY
|
-- @field RUNWAY Runway=5
|
||||||
|
|
||||||
--- Returns altitude MSL of the point.
|
--- Returns the distance from sea level (y-axis) of a given vec2 point.
|
||||||
-- @function [parent=#land] getHeight
|
-- @function [parent=#land] getHeight
|
||||||
-- @param #Vec2 point point on the ground.
|
-- @param #Vec2 point Point on the ground.
|
||||||
-- @return #Distance
|
-- @return #number Height in meters.
|
||||||
|
|
||||||
|
--- Returns the surface height and depth of a point. Useful for checking if the path is deep enough to support a given ship.
|
||||||
|
-- Both values are positive. When checked over water at sea level the first value is always zero.
|
||||||
|
-- When checked over water at altitude, for example the reservoir of the Inguri Dam, the first value is the corresponding altitude the water level is at.
|
||||||
|
-- @function [parent=#land] getSurfaceHeightWithSeabed
|
||||||
|
-- @param #Vec2 point Position where to check.
|
||||||
|
-- @return #number Height in meters.
|
||||||
|
-- @return #number Depth in meters.
|
||||||
|
|
||||||
--- returns surface type at the given point.
|
--- Returns surface type at the given point.
|
||||||
-- @function [parent=#land] getSurfaceType
|
-- @function [parent=#land] getSurfaceType
|
||||||
-- @param #Vec2 point Point on the land.
|
-- @param #Vec2 point Point on the land.
|
||||||
-- @return #land.SurfaceType
|
-- @return #number Enumerator value from `land.SurfaceType` (LAND=1, SHALLOW_WATER=2, WATER=3, ROAD=4, RUNWAY=5)
|
||||||
|
|
||||||
--- [DCS Singleton land](https://wiki.hoggitworld.com/view/DCS_singleton_land)
|
--- [DCS Singleton land](https://wiki.hoggitworld.com/view/DCS_singleton_land)
|
||||||
land = {} --#land
|
land = {} --#land
|
||||||
@@ -306,6 +332,11 @@ do -- country
|
|||||||
-- @field Argentinia
|
-- @field Argentinia
|
||||||
-- @field Cyprus
|
-- @field Cyprus
|
||||||
-- @field Slovenia
|
-- @field Slovenia
|
||||||
|
-- @field BOLIVIA
|
||||||
|
-- @field GHANA
|
||||||
|
-- @field NIGERIA
|
||||||
|
-- @field PERU
|
||||||
|
-- @field ECUADOR
|
||||||
|
|
||||||
country = {} --#country
|
country = {} --#country
|
||||||
|
|
||||||
@@ -314,11 +345,11 @@ end -- country
|
|||||||
|
|
||||||
do -- Command
|
do -- Command
|
||||||
|
|
||||||
--- @type Command
|
-- @type Command
|
||||||
-- @field #string id
|
-- @field #string id
|
||||||
-- @field #Command.params params
|
-- @field #Command.params params
|
||||||
|
|
||||||
--- @type Command.params
|
-- @type Command.params
|
||||||
|
|
||||||
end -- Command
|
end -- Command
|
||||||
|
|
||||||
@@ -334,9 +365,23 @@ do -- coalition
|
|||||||
-- @field RED
|
-- @field RED
|
||||||
-- @field BLUE
|
-- @field BLUE
|
||||||
|
|
||||||
--- @function [parent=#coalition] getCountryCoalition
|
--- Get country coalition.
|
||||||
-- @param #number countryId
|
-- @function [parent=#coalition] getCountryCoalition
|
||||||
-- @return #number coalitionId
|
-- @param #number countryId Country ID.
|
||||||
|
-- @return #number coalitionId Coalition ID.
|
||||||
|
|
||||||
|
--- Dynamically spawns a group. See [hoggit](https://wiki.hoggitworld.com/view/DCS_func_addGroup)
|
||||||
|
-- @function [parent=#coalition] addGroup
|
||||||
|
-- @param #number countryId Id of the country.
|
||||||
|
-- @param #number groupCategory Group category. Set -1 for spawning FARPS.
|
||||||
|
-- @param #table groupData Group data table.
|
||||||
|
-- @return DCS#Group The spawned Group object.
|
||||||
|
|
||||||
|
--- Dynamically spawns a static object. See [hoggit](https://wiki.hoggitworld.com/view/DCS_func_addGroup)
|
||||||
|
-- @function [parent=#coalition] addStaticObject
|
||||||
|
-- @param #number countryId Id of the country.
|
||||||
|
-- @param #table groupData Group data table.
|
||||||
|
-- @return DCS#Static The spawned static object.
|
||||||
|
|
||||||
coalition = {} -- #coalition
|
coalition = {} -- #coalition
|
||||||
|
|
||||||
@@ -345,7 +390,7 @@ end -- coalition
|
|||||||
|
|
||||||
do -- Types
|
do -- Types
|
||||||
|
|
||||||
--- @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.
|
||||||
-- @field #number tankerType Type of refueling system: 0=boom, 1=probe.
|
-- @field #number tankerType Type of refueling system: 0=boom, 1=probe.
|
||||||
@@ -406,8 +451,8 @@ do -- Types
|
|||||||
--- Vec3 type is a 3D-vector.
|
--- Vec3 type is a 3D-vector.
|
||||||
-- DCS world has 3-dimensional coordinate system. DCS ground is an infinite plain.
|
-- DCS world has 3-dimensional coordinate system. DCS ground is an infinite plain.
|
||||||
-- @type Vec3
|
-- @type Vec3
|
||||||
-- @field #Distance x is directed to the north
|
-- @field #Distance x is directed to the North
|
||||||
-- @field #Distance z is directed to the east
|
-- @field #Distance z is directed to the East
|
||||||
-- @field #Distance y is directed up
|
-- @field #Distance y is directed up
|
||||||
|
|
||||||
--- Vec2 is a 2D-vector for the ground plane as a reference plane.
|
--- Vec2 is a 2D-vector for the ground plane as a reference plane.
|
||||||
@@ -442,16 +487,16 @@ do -- Types
|
|||||||
-- @type AttributeNameArray
|
-- @type AttributeNameArray
|
||||||
-- @list <#AttributeName>
|
-- @list <#AttributeName>
|
||||||
|
|
||||||
--- @type Zone
|
-- @type Zone
|
||||||
-- @field DCSVec3#Vec3 point
|
-- @field DCSVec3#Vec3 point
|
||||||
-- @field #number radius
|
-- @field #number radius
|
||||||
|
|
||||||
Zone = {}
|
Zone = {}
|
||||||
|
|
||||||
--- @type ModelTime
|
-- @type ModelTime
|
||||||
-- @extends #number
|
-- @extends #number
|
||||||
|
|
||||||
--- @type Time
|
-- @type Time
|
||||||
-- @extends #number
|
-- @extends #number
|
||||||
|
|
||||||
--- A task descriptor (internal structure for DCS World). See [https://wiki.hoggitworld.com/view/Category:Tasks](https://wiki.hoggitworld.com/view/Category:Tasks).
|
--- A task descriptor (internal structure for DCS World). See [https://wiki.hoggitworld.com/view/Category:Tasks](https://wiki.hoggitworld.com/view/Category:Tasks).
|
||||||
@@ -460,7 +505,7 @@ do -- Types
|
|||||||
-- @field #string id
|
-- @field #string id
|
||||||
-- @field #Task.param param
|
-- @field #Task.param param
|
||||||
|
|
||||||
--- @type Task.param
|
-- @type Task.param
|
||||||
|
|
||||||
--- List of @{#Task}
|
--- List of @{#Task}
|
||||||
-- @type TaskArray
|
-- @type TaskArray
|
||||||
@@ -507,7 +552,7 @@ do -- Object
|
|||||||
-- @field SCENERY
|
-- @field SCENERY
|
||||||
-- @field CARGO
|
-- @field CARGO
|
||||||
|
|
||||||
--- @type Object.Desc
|
-- @type Object.Desc
|
||||||
-- @extends #Desc
|
-- @extends #Desc
|
||||||
-- @field #number life initial life level
|
-- @field #number life initial life level
|
||||||
-- @field #Box3 box bounding box of collision geometry
|
-- @field #Box3 box bounding box of collision geometry
|
||||||
@@ -658,10 +703,11 @@ do -- Weapon
|
|||||||
|
|
||||||
--- Weapon.Category enum that stores weapon categories.
|
--- Weapon.Category enum that stores weapon categories.
|
||||||
-- @type Weapon.Category
|
-- @type Weapon.Category
|
||||||
-- @field SHELL
|
-- @field #number SHELL Shell.
|
||||||
-- @field MISSILE
|
-- @field #number MISSILE Missile
|
||||||
-- @field ROCKET
|
-- @field #number ROCKET Rocket.
|
||||||
-- @field BOMB
|
-- @field #number BOMB Bomb.
|
||||||
|
-- @field #number TORPEDO Torpedo.
|
||||||
|
|
||||||
|
|
||||||
--- Weapon.GuidanceType enum that stores guidance methods. Available only for guided weapon (Weapon.Category.MISSILE and some Weapon.Category.BOMB).
|
--- Weapon.GuidanceType enum that stores guidance methods. Available only for guided weapon (Weapon.Category.MISSILE and some Weapon.Category.BOMB).
|
||||||
@@ -763,11 +809,118 @@ do -- Airbase
|
|||||||
-- @function [parent=#Airbase] getDesc
|
-- @function [parent=#Airbase] getDesc
|
||||||
-- @param self
|
-- @param self
|
||||||
-- @return #Airbase.Desc
|
-- @return #Airbase.Desc
|
||||||
|
|
||||||
|
--- Returns the warehouse object associated with the airbase object. Can then be used to call the warehouse class functions to modify the contents of the warehouse.
|
||||||
|
-- @function [parent=#Airbase] getWarehouse
|
||||||
|
-- @param self
|
||||||
|
-- @return #Warehouse The DCS warehouse object of this airbase.
|
||||||
|
|
||||||
|
--- Enables or disables the airbase and FARP auto capture game mechanic where ownership of a base can change based on the presence of ground forces or the
|
||||||
|
-- default setting assigned in the editor.
|
||||||
|
-- @function [parent=#Airbase] autoCapture
|
||||||
|
-- @param self
|
||||||
|
-- @param #boolean setting `true` : enables autoCapture behavior, `false` : disables autoCapture behavior
|
||||||
|
|
||||||
|
--- Returns the current autoCapture setting for the passed base.
|
||||||
|
-- @function [parent=#Airbase] autoCaptureIsOn
|
||||||
|
-- @param self
|
||||||
|
-- @return #boolean `true` if autoCapture behavior is enabled and `false` otherwise.
|
||||||
|
|
||||||
|
--- Changes the passed airbase object's coalition to the set value. Must be used with Airbase.autoCapture to disable auto capturing of the base,
|
||||||
|
-- otherwise the base can revert back to a different coalition depending on the situation and built in game capture rules.
|
||||||
|
-- @function [parent=#Airbase] setCoalition
|
||||||
|
-- @param self
|
||||||
|
-- @param #number coa The new owner coalition: 0=neutra, 1=red, 2=blue.
|
||||||
|
|
||||||
|
--- Returns the wsType of every object that exists in DCS. A wsType is a table consisting of 4 entries indexed numerically.
|
||||||
|
-- It can be used to broadly categorize object types. The table can be broken down as: {mainCategory, subCat1, subCat2, index}
|
||||||
|
-- @function [parent=#Airbase] getResourceMap
|
||||||
|
-- @param self
|
||||||
|
-- @return #table wsType of every object that exists in DCS.
|
||||||
|
|
||||||
Airbase = {} --#Airbase
|
Airbase = {} --#Airbase
|
||||||
|
|
||||||
end -- Airbase
|
end -- Airbase
|
||||||
|
|
||||||
|
|
||||||
|
do -- Warehouse
|
||||||
|
|
||||||
|
--- [DCS Class Warehouse](https://wiki.hoggitworld.com/view/DCS_Class_Warehouse)
|
||||||
|
-- The warehouse class gives control over warehouses that exist in airbase objects. These warehouses can limit the aircraft, munitions, and fuel available to coalition aircraft.
|
||||||
|
-- @type Warehouse
|
||||||
|
|
||||||
|
|
||||||
|
--- Get a warehouse by passing its name.
|
||||||
|
-- @function [parent=#Warehouse] getByName
|
||||||
|
-- @param #string Name Name of the warehouse.
|
||||||
|
-- @return #Warehouse The warehouse object.
|
||||||
|
|
||||||
|
--- Adds the passed amount of a given item to the warehouse.
|
||||||
|
-- itemName is the typeName associated with the item: "weapons.missiles.AIM_54C_Mk47"
|
||||||
|
-- A wsType table can also be used, however the last digit with wsTypes has been known to change. {4, 4, 7, 322}
|
||||||
|
-- @function [parent=#Warehouse] addItem
|
||||||
|
-- @param self
|
||||||
|
-- @param #string itemName Name of the item.
|
||||||
|
-- @param #number count Number of items to add.
|
||||||
|
|
||||||
|
--- Returns the number of the passed type of item currently in a warehouse object.
|
||||||
|
-- @function [parent=#Warehouse] getItemCount
|
||||||
|
-- @param self
|
||||||
|
-- @param #string itemName Name of the item.
|
||||||
|
|
||||||
|
--- Sets the passed amount of a given item to the warehouse.
|
||||||
|
-- @function [parent=#Warehouse] setItem
|
||||||
|
-- @param self
|
||||||
|
-- @param #string itemName Name of the item.
|
||||||
|
-- @param #number count Number of items to add.
|
||||||
|
|
||||||
|
--- Removes the amount of the passed item from the warehouse.
|
||||||
|
-- @function [parent=#Warehouse] removeItem
|
||||||
|
-- @param self
|
||||||
|
-- @param #string itemName Name of the item.
|
||||||
|
-- @param #number count Number of items to be removed.
|
||||||
|
|
||||||
|
--- Adds the passed amount of a liquid fuel into the warehouse inventory.
|
||||||
|
-- @function [parent=#Warehouse] addLiquid
|
||||||
|
-- @param self
|
||||||
|
-- @param #number liquidType Type of liquid to add: 0=jetfuel, 1=aviation gasoline, 2=MW50, 3=Diesel.
|
||||||
|
-- @param #number count Amount of liquid to add.
|
||||||
|
|
||||||
|
--- Returns the amount of the passed liquid type within a given warehouse.
|
||||||
|
-- @function [parent=#Warehouse] getLiquidAmount
|
||||||
|
-- @param self
|
||||||
|
-- @param #number liquidType Type of liquid to add: 0=jetfuel, 1=aviation gasoline, 2=MW50, 3=Diesel.
|
||||||
|
-- @return #number Amount of liquid.
|
||||||
|
|
||||||
|
--- Sets the passed amount of a liquid fuel into the warehouse inventory.
|
||||||
|
-- @function [parent=#Warehouse] setLiquidAmount
|
||||||
|
-- @param self
|
||||||
|
-- @param #number liquidType Type of liquid to add: 0=jetfuel, 1=aviation gasoline, 2=MW50, 3=Diesel.
|
||||||
|
-- @param #number count Amount of liquid.
|
||||||
|
|
||||||
|
--- Removes the set amount of liquid from the inventory in a warehouse.
|
||||||
|
-- @function [parent=#Warehouse] setLiquidAmount
|
||||||
|
-- @param self
|
||||||
|
-- @param #number liquidType Type of liquid to add: 0=jetfuel, 1=aviation gasoline, 2=MW50, 3=Diesel.
|
||||||
|
-- @param #number count Amount of liquid.
|
||||||
|
|
||||||
|
--- Returns the airbase object associated with the warehouse object.
|
||||||
|
-- @function [parent=#Warehouse] getOwner
|
||||||
|
-- @param self
|
||||||
|
-- @return #Airbase The airbase object owning this warehouse.
|
||||||
|
|
||||||
|
--- Returns a full itemized list of everything currently in a warehouse. If a category is set to unlimited then the table will be returned empty.
|
||||||
|
-- Aircraft and weapons are indexed by strings. Liquids are indexed by number.
|
||||||
|
-- @function [parent=#Warehouse] getInventory
|
||||||
|
-- @param self
|
||||||
|
-- @param #string itemName Name of the item.
|
||||||
|
-- @return #table Itemized list of everything currently in a warehouse
|
||||||
|
|
||||||
|
|
||||||
|
Warehouse = {} --#Warehouse
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
do -- Spot
|
do -- Spot
|
||||||
|
|
||||||
--- [DCS Class Spot](https://wiki.hoggitworld.com/view/DCS_Class_Spot)
|
--- [DCS Class Spot](https://wiki.hoggitworld.com/view/DCS_Class_Spot)
|
||||||
@@ -830,7 +983,7 @@ do -- Spot
|
|||||||
end -- Spot
|
end -- Spot
|
||||||
|
|
||||||
do -- Controller
|
do -- Controller
|
||||||
--- Controller is an object that performs A.I.-routines. 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:
|
||||||
--
|
--
|
||||||
@@ -948,7 +1101,7 @@ end -- Controller
|
|||||||
|
|
||||||
do -- Unit
|
do -- 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.
|
||||||
-- @field #Unit.Category Category
|
-- @field #Unit.Category Category
|
||||||
@@ -980,8 +1133,8 @@ do -- Unit
|
|||||||
|
|
||||||
--- Enum that stores aircraft refueling system types.
|
--- Enum that stores aircraft refueling system types.
|
||||||
-- @type Unit.RefuelingSystem
|
-- @type Unit.RefuelingSystem
|
||||||
-- @field BOOM_AND_RECEPTACLE
|
-- @field BOOM_AND_RECEPTACLE Tanker with a boom.
|
||||||
-- @field PROBE_AND_DROGUE
|
-- @field PROBE_AND_DROGUE Tanker with a probe.
|
||||||
|
|
||||||
--- Enum that stores sensor types.
|
--- Enum that stores sensor types.
|
||||||
-- @type Unit.SensorType
|
-- @type Unit.SensorType
|
||||||
@@ -1063,15 +1216,18 @@ do -- Unit
|
|||||||
-- @field #Distance detectionDistanceHRM detection distance for RCS=1m^2 in high-resolution mapping mode, nil if radar has no HRM
|
-- @field #Distance detectionDistanceHRM detection distance for RCS=1m^2 in high-resolution mapping mode, nil if radar has no HRM
|
||||||
-- @field #Unit.Radar.detectionDistanceAir detectionDistanceAir detection distance for RCS=1m^2 airborne target, nil if radar doesn't support air search
|
-- @field #Unit.Radar.detectionDistanceAir detectionDistanceAir detection distance for RCS=1m^2 airborne target, nil if radar doesn't support air search
|
||||||
|
|
||||||
--- @type Unit.Radar.detectionDistanceAir
|
--- A radar.
|
||||||
|
-- @type Unit.Radar.detectionDistanceAir
|
||||||
-- @field #Unit.Radar.detectionDistanceAir.upperHemisphere upperHemisphere
|
-- @field #Unit.Radar.detectionDistanceAir.upperHemisphere upperHemisphere
|
||||||
-- @field #Unit.Radar.detectionDistanceAir.lowerHemisphere lowerHemisphere
|
-- @field #Unit.Radar.detectionDistanceAir.lowerHemisphere lowerHemisphere
|
||||||
|
|
||||||
--- @type Unit.Radar.detectionDistanceAir.upperHemisphere
|
--- A radar.
|
||||||
|
-- @type Unit.Radar.detectionDistanceAir.upperHemisphere
|
||||||
-- @field #Distance headOn
|
-- @field #Distance headOn
|
||||||
-- @field #Distance tailOn
|
-- @field #Distance tailOn
|
||||||
|
|
||||||
--- @type Unit.Radar.detectionDistanceAir.lowerHemisphere
|
--- A radar.
|
||||||
|
-- @type Unit.Radar.detectionDistanceAir.lowerHemisphere
|
||||||
-- @field #Distance headOn
|
-- @field #Distance headOn
|
||||||
-- @field #Distance tailOn
|
-- @field #Distance tailOn
|
||||||
|
|
||||||
@@ -1287,6 +1443,42 @@ do -- Group
|
|||||||
|
|
||||||
end -- Group
|
end -- Group
|
||||||
|
|
||||||
|
do -- StaticObject
|
||||||
|
|
||||||
|
--- Represents a static object.
|
||||||
|
-- @type StaticObject
|
||||||
|
-- @extends DCS#Object
|
||||||
|
|
||||||
|
--- Returns the static object.
|
||||||
|
-- @function [parent=#StaticObject] getByName
|
||||||
|
-- @param #string name Name of the static object.
|
||||||
|
-- @return #StaticObject
|
||||||
|
|
||||||
|
StaticObject = {} --#StaticObject
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
do --Event
|
||||||
|
|
||||||
|
--- Event structure. Note that present fields depend on type of event.
|
||||||
|
-- @type Event
|
||||||
|
-- @field #number id Event ID.
|
||||||
|
-- @field #number time Mission time in seconds.
|
||||||
|
-- @field DCS#Unit initiator Unit initiating the event.
|
||||||
|
-- @field DCS#Unit target Target unit.
|
||||||
|
-- @field DCS#Airbase place Airbase.
|
||||||
|
-- @field number subPlace Subplace. Unknown and often just 0.
|
||||||
|
-- @field #string weapon_name Weapoin name.
|
||||||
|
-- @field #number idx Mark ID.
|
||||||
|
-- @field #number coalition Coalition ID.
|
||||||
|
-- @field #number groupID Group ID, *e.g.* of group that added mark point.
|
||||||
|
-- @field #string text Text, *e.g.* of mark point.
|
||||||
|
-- @field DCS#Vec3 pos Position vector, *e.g.* of mark point.
|
||||||
|
-- @field #string comment Comment, *e.g.* LSO score.
|
||||||
|
|
||||||
|
Event={} --#Event
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
do -- AI
|
do -- AI
|
||||||
|
|
||||||
@@ -1337,22 +1529,26 @@ do -- AI
|
|||||||
-- @field IR_POINTER
|
-- @field IR_POINTER
|
||||||
-- @field LASER
|
-- @field LASER
|
||||||
|
|
||||||
--- @type AI.Task.WaypointType
|
---
|
||||||
|
-- @type AI.Task.WaypointType
|
||||||
-- @field TAKEOFF
|
-- @field TAKEOFF
|
||||||
-- @field TAKEOFF_PARKING
|
-- @field TAKEOFF_PARKING
|
||||||
-- @field TURNING_POINT
|
-- @field TURNING_POINT
|
||||||
-- @field TAKEOFF_PARKING_HOT
|
-- @field TAKEOFF_PARKING_HOT
|
||||||
-- @field LAND
|
-- @field LAND
|
||||||
|
|
||||||
--- @type AI.Task.TurnMethod
|
---
|
||||||
|
-- @type AI.Task.TurnMethod
|
||||||
-- @field FLY_OVER_POINT
|
-- @field FLY_OVER_POINT
|
||||||
-- @field FIN_POINT
|
-- @field FIN_POINT
|
||||||
|
|
||||||
--- @type AI.Task.AltitudeType
|
---
|
||||||
|
-- @type AI.Task.AltitudeType
|
||||||
-- @field BARO
|
-- @field BARO
|
||||||
-- @field RADIO
|
-- @field RADIO
|
||||||
|
|
||||||
--- @type AI.Task.VehicleFormation
|
---
|
||||||
|
-- @type AI.Task.VehicleFormation
|
||||||
-- @field OFF_ROAD
|
-- @field OFF_ROAD
|
||||||
-- @field ON_ROAD
|
-- @field ON_ROAD
|
||||||
-- @field RANK
|
-- @field RANK
|
||||||
@@ -1362,27 +1558,30 @@ do -- AI
|
|||||||
-- @field ECHELON_LEFT
|
-- @field ECHELON_LEFT
|
||||||
-- @field ECHELON_RIGHT
|
-- @field ECHELON_RIGHT
|
||||||
|
|
||||||
--- @type AI.Option
|
---
|
||||||
|
-- @type AI.Option
|
||||||
-- @field #AI.Option.Air Air
|
-- @field #AI.Option.Air Air
|
||||||
-- @field #AI.Option.Ground Ground
|
-- @field #AI.Option.Ground Ground
|
||||||
-- @field #AI.Option.Naval Naval
|
-- @field #AI.Option.Naval Naval
|
||||||
|
|
||||||
--- @type AI.Option.Air
|
---
|
||||||
|
-- @type AI.Option.Air
|
||||||
-- @field #AI.Option.Air.id id
|
-- @field #AI.Option.Air.id id
|
||||||
-- @field #AI.Option.Air.val val
|
-- @field #AI.Option.Air.val val
|
||||||
|
|
||||||
--- @type AI.Option.Ground
|
---
|
||||||
|
-- @type AI.Option.Ground
|
||||||
-- @field #AI.Option.Ground.id id
|
-- @field #AI.Option.Ground.id id
|
||||||
-- @field #AI.Option.Ground.val val
|
-- @field #AI.Option.Ground.val val
|
||||||
-- @field #AI.Option.Ground.mid mid
|
-- @field #AI.Option.Ground.mid mid
|
||||||
-- @field #AI.Option.Ground.mval mval
|
-- @field #AI.Option.Ground.mval mval
|
||||||
--
|
--
|
||||||
--- @type AI.Option.Naval
|
-- @type AI.Option.Naval
|
||||||
-- @field #AI.Option.Naval.id id
|
-- @field #AI.Option.Naval.id id
|
||||||
-- @field #AI.Option.Naval.val val
|
-- @field #AI.Option.Naval.val val
|
||||||
|
|
||||||
|
---
|
||||||
--- @type AI.Option.Air.id
|
-- @type AI.Option.Air.id
|
||||||
-- @field NO_OPTION
|
-- @field NO_OPTION
|
||||||
-- @field ROE
|
-- @field ROE
|
||||||
-- @field REACTION_ON_THREAT
|
-- @field REACTION_ON_THREAT
|
||||||
@@ -1404,73 +1603,61 @@ do -- AI
|
|||||||
-- @field OPTION_RADIO_USAGE_KILL
|
-- @field OPTION_RADIO_USAGE_KILL
|
||||||
-- @field JETT_TANKS_IF_EMPTY
|
-- @field JETT_TANKS_IF_EMPTY
|
||||||
-- @field FORCED_ATTACK
|
-- @field FORCED_ATTACK
|
||||||
|
|
||||||
--- @type AI.Option.Air.id.FORMATION
|
|
||||||
-- @field LINE_ABREAST
|
|
||||||
-- @field TRAIL
|
|
||||||
-- @field WEDGE
|
|
||||||
-- @field ECHELON_RIGHT
|
|
||||||
-- @field ECHELON_LEFT
|
|
||||||
-- @field FINGER_FOUR
|
|
||||||
-- @field SPREAD_FOUR
|
|
||||||
-- @field WW2_BOMBER_ELEMENT
|
|
||||||
-- @field WW2_BOMBER_ELEMENT_HEIGHT
|
|
||||||
-- @field WW2_FIGHTER_VIC
|
|
||||||
-- @field HEL_WEDGE
|
|
||||||
-- @field HEL_ECHELON
|
|
||||||
-- @field HEL_FRONT
|
|
||||||
-- @field HEL_COLUMN
|
|
||||||
-- @field COMBAT_BOX
|
|
||||||
-- @field JAVELIN_DOWN
|
|
||||||
|
|
||||||
|
---
|
||||||
--- @type AI.Option.Air.val
|
-- @type AI.Option.Air.val
|
||||||
-- @field #AI.Option.Air.val.ROE ROE
|
-- @field #AI.Option.Air.val.ROE ROE
|
||||||
-- @field #AI.Option.Air.val.REACTION_ON_THREAT REACTION_ON_THREAT
|
-- @field #AI.Option.Air.val.REACTION_ON_THREAT REACTION_ON_THREAT
|
||||||
-- @field #AI.Option.Air.val.RADAR_USING RADAR_USING
|
-- @field #AI.Option.Air.val.RADAR_USING RADAR_USING
|
||||||
-- @field #AI.Option.Air.val.FLARE_USING FLARE_USING
|
-- @field #AI.Option.Air.val.FLARE_USING FLARE_USING
|
||||||
|
|
||||||
--- @type AI.Option.Air.val.ROE
|
---
|
||||||
|
-- @type AI.Option.Air.val.ROE
|
||||||
-- @field WEAPON_FREE
|
-- @field WEAPON_FREE
|
||||||
-- @field OPEN_FIRE_WEAPON_FREE
|
-- @field OPEN_FIRE_WEAPON_FREE
|
||||||
-- @field OPEN_FIRE
|
-- @field OPEN_FIRE
|
||||||
-- @field RETURN_FIRE
|
-- @field RETURN_FIRE
|
||||||
-- @field WEAPON_HOLD
|
-- @field WEAPON_HOLD
|
||||||
|
|
||||||
--- @type AI.Option.Air.val.REACTION_ON_THREAT
|
---
|
||||||
|
-- @type AI.Option.Air.val.REACTION_ON_THREAT
|
||||||
-- @field NO_REACTION
|
-- @field NO_REACTION
|
||||||
-- @field PASSIVE_DEFENCE
|
-- @field PASSIVE_DEFENCE
|
||||||
-- @field EVADE_FIRE
|
-- @field EVADE_FIRE
|
||||||
-- @field BYPASS_AND_ESCAPE
|
-- @field BYPASS_AND_ESCAPE
|
||||||
-- @field ALLOW_ABORT_MISSION
|
-- @field ALLOW_ABORT_MISSION
|
||||||
|
|
||||||
--- @type AI.Option.Air.val.RADAR_USING
|
---
|
||||||
|
-- @type AI.Option.Air.val.RADAR_USING
|
||||||
-- @field NEVER
|
-- @field NEVER
|
||||||
-- @field FOR_ATTACK_ONLY
|
-- @field FOR_ATTACK_ONLY
|
||||||
-- @field FOR_SEARCH_IF_REQUIRED
|
-- @field FOR_SEARCH_IF_REQUIRED
|
||||||
-- @field FOR_CONTINUOUS_SEARCH
|
-- @field FOR_CONTINUOUS_SEARCH
|
||||||
|
|
||||||
--- @type AI.Option.Air.val.FLARE_USING
|
---
|
||||||
|
-- @type AI.Option.Air.val.FLARE_USING
|
||||||
-- @field NEVER
|
-- @field NEVER
|
||||||
-- @field AGAINST_FIRED_MISSILE
|
-- @field AGAINST_FIRED_MISSILE
|
||||||
-- @field WHEN_FLYING_IN_SAM_WEZ
|
-- @field WHEN_FLYING_IN_SAM_WEZ
|
||||||
-- @field WHEN_FLYING_NEAR_ENEMIES
|
-- @field WHEN_FLYING_NEAR_ENEMIES
|
||||||
|
|
||||||
--- @type AI.Option.Air.val.ECM_USING
|
---
|
||||||
|
-- @type AI.Option.Air.val.ECM_USING
|
||||||
-- @field NEVER_USE
|
-- @field NEVER_USE
|
||||||
-- @field USE_IF_ONLY_LOCK_BY_RADAR
|
-- @field USE_IF_ONLY_LOCK_BY_RADAR
|
||||||
-- @field USE_IF_DETECTED_LOCK_BY_RADAR
|
-- @field USE_IF_DETECTED_LOCK_BY_RADAR
|
||||||
-- @field ALWAYS_USE
|
-- @field ALWAYS_USE
|
||||||
|
|
||||||
--- @type AI.Option.Air.val.MISSILE_ATTACK
|
---
|
||||||
|
-- @type AI.Option.Air.val.MISSILE_ATTACK
|
||||||
-- @field MAX_RANGE
|
-- @field MAX_RANGE
|
||||||
-- @field NEZ_RANGE
|
-- @field NEZ_RANGE
|
||||||
-- @field HALF_WAY_RMAX_NEZ
|
-- @field HALF_WAY_RMAX_NEZ
|
||||||
-- @field TARGET_THREAT_EST
|
-- @field TARGET_THREAT_EST
|
||||||
-- @field RANDOM_RANGE
|
-- @field RANDOM_RANGE
|
||||||
|
|
||||||
|
---
|
||||||
--- @type AI.Option.Ground.id
|
-- @type AI.Option.Ground.id
|
||||||
-- @field NO_OPTION
|
-- @field NO_OPTION
|
||||||
-- @field ROE @{#AI.Option.Ground.val.ROE}
|
-- @field ROE @{#AI.Option.Ground.val.ROE}
|
||||||
-- @field FORMATION
|
-- @field FORMATION
|
||||||
@@ -1479,42 +1666,51 @@ do -- AI
|
|||||||
-- @field ENGAGE_AIR_WEAPONS
|
-- @field ENGAGE_AIR_WEAPONS
|
||||||
-- @field AC_ENGAGEMENT_RANGE_RESTRICTION
|
-- @field AC_ENGAGEMENT_RANGE_RESTRICTION
|
||||||
|
|
||||||
--- @type AI.Option.Ground.mid -- Moose added
|
---
|
||||||
|
-- @type AI.Option.Ground.mid -- Moose added
|
||||||
-- @field RESTRICT_AAA_MIN 27
|
-- @field RESTRICT_AAA_MIN 27
|
||||||
-- @field RESTRICT_AAA_MAX 29
|
-- @field RESTRICT_AAA_MAX 29
|
||||||
-- @field RESTRICT_TARGETS @{#AI.Option.Ground.mval.ENGAGE_TARGETS} 28
|
-- @field RESTRICT_TARGETS @{#AI.Option.Ground.mval.ENGAGE_TARGETS} 28
|
||||||
|
|
||||||
--- @type AI.Option.Ground.val
|
---
|
||||||
|
-- @type AI.Option.Ground.val
|
||||||
-- @field #AI.Option.Ground.val.ROE ROE
|
-- @field #AI.Option.Ground.val.ROE ROE
|
||||||
-- @field #AI.Option.Ground.val.ALARM_STATE ALARM_STATE
|
-- @field #AI.Option.Ground.val.ALARM_STATE ALARM_STATE
|
||||||
-- @field #AI.Option.Ground.val.ENGAGE_TARGETS RESTRICT_TARGETS
|
-- @field #AI.Option.Ground.val.ENGAGE_TARGETS RESTRICT_TARGETS
|
||||||
|
|
||||||
--- @type AI.Option.Ground.val.ROE
|
---
|
||||||
|
-- @type AI.Option.Ground.val.ROE
|
||||||
-- @field OPEN_FIRE
|
-- @field OPEN_FIRE
|
||||||
-- @field RETURN_FIRE
|
-- @field RETURN_FIRE
|
||||||
-- @field WEAPON_HOLD
|
-- @field WEAPON_HOLD
|
||||||
|
|
||||||
--- @type AI.Option.Ground.mval -- Moose added
|
---
|
||||||
|
-- @type AI.Option.Ground.mval -- Moose added
|
||||||
-- @field #AI.Option.Ground.mval.ENGAGE_TARGETS ENGAGE_TARGETS
|
-- @field #AI.Option.Ground.mval.ENGAGE_TARGETS ENGAGE_TARGETS
|
||||||
|
|
||||||
--- @type AI.Option.Ground.mval.ENGAGE_TARGETS -- Moose added
|
---
|
||||||
|
-- @type AI.Option.Ground.mval.ENGAGE_TARGETS -- Moose added
|
||||||
-- @field ANY_TARGET -- 0
|
-- @field ANY_TARGET -- 0
|
||||||
-- @field AIR_UNITS_ONLY -- 1
|
-- @field AIR_UNITS_ONLY -- 1
|
||||||
-- @field GROUND_UNITS_ONLY -- 2
|
-- @field GROUND_UNITS_ONLY -- 2
|
||||||
|
|
||||||
--- @type AI.Option.Ground.val.ALARM_STATE
|
---
|
||||||
|
-- @type AI.Option.Ground.val.ALARM_STATE
|
||||||
-- @field AUTO
|
-- @field AUTO
|
||||||
-- @field GREEN
|
-- @field GREEN
|
||||||
-- @field RED
|
-- @field RED
|
||||||
|
|
||||||
--- @type AI.Option.Naval.id
|
---
|
||||||
|
-- @type AI.Option.Naval.id
|
||||||
-- @field NO_OPTION
|
-- @field NO_OPTION
|
||||||
-- @field ROE
|
-- @field ROE
|
||||||
|
|
||||||
--- @type AI.Option.Naval.val
|
---
|
||||||
|
-- @type AI.Option.Naval.val
|
||||||
-- @field #AI.Option.Naval.val.ROE ROE
|
-- @field #AI.Option.Naval.val.ROE ROE
|
||||||
|
|
||||||
--- @type AI.Option.Naval.val.ROE
|
---
|
||||||
|
-- @type AI.Option.Naval.val.ROE
|
||||||
-- @field OPEN_FIRE
|
-- @field OPEN_FIRE
|
||||||
-- @field RETURN_FIRE
|
-- @field RETURN_FIRE
|
||||||
-- @field WEAPON_HOLD
|
-- @field WEAPON_HOLD
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **Functional** -- Monitor airbase traffic and regulate speed while taxiing.
|
--- **Functional** - Monitor airbase traffic and regulate speed while taxiing.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -10,9 +10,7 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions: None
|
||||||
--
|
|
||||||
-- [ABP - Airbase Police](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/ABP%20-%20Airbase%20Police)
|
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -20,13 +18,15 @@
|
|||||||
-- ### 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
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @module Functional.ATC_Ground
|
-- @module Functional.ATC_Ground
|
||||||
-- @image Air_Traffic_Control_Ground_Operations.JPG
|
-- @image Air_Traffic_Control_Ground_Operations.JPG
|
||||||
|
|
||||||
--- @type ATC_GROUND
|
---
|
||||||
|
-- @type ATC_GROUND
|
||||||
-- @field Core.Set#SET_CLIENT SetClient
|
-- @field Core.Set#SET_CLIENT SetClient
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
@@ -39,7 +39,8 @@ ATC_GROUND = {
|
|||||||
AirbaseNames = nil,
|
AirbaseNames = nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- @type ATC_GROUND.AirbaseNames
|
---
|
||||||
|
-- @type ATC_GROUND.AirbaseNames
|
||||||
-- @list <#string>
|
-- @list <#string>
|
||||||
|
|
||||||
|
|
||||||
@@ -51,7 +52,7 @@ function ATC_GROUND:New( Airbases, AirbaseList )
|
|||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, BASE:New() ) -- #ATC_GROUND
|
local self = BASE:Inherit( self, BASE:New() ) -- #ATC_GROUND
|
||||||
self:E( { self.ClassName, Airbases } )
|
self:T( { self.ClassName, Airbases } )
|
||||||
|
|
||||||
self.Airbases = Airbases
|
self.Airbases = Airbases
|
||||||
self.AirbaseList = AirbaseList
|
self.AirbaseList = AirbaseList
|
||||||
@@ -82,7 +83,7 @@ function ATC_GROUND:New( Airbases, AirbaseList )
|
|||||||
end
|
end
|
||||||
|
|
||||||
self.SetClient:ForEachClient(
|
self.SetClient:ForEachClient(
|
||||||
--- @param Wrapper.Client#CLIENT Client
|
-- @param Wrapper.Client#CLIENT Client
|
||||||
function( Client )
|
function( Client )
|
||||||
Client:SetState( self, "Speeding", false )
|
Client:SetState( self, "Speeding", false )
|
||||||
Client:SetState( self, "Warnings", 0)
|
Client:SetState( self, "Warnings", 0)
|
||||||
@@ -246,11 +247,11 @@ function ATC_GROUND:SetMaximumKickSpeedMiph( MaximumKickSpeedMiph, Airbase )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #ATC_GROUND self
|
-- @param #ATC_GROUND self
|
||||||
function ATC_GROUND:_AirbaseMonitor()
|
function ATC_GROUND:_AirbaseMonitor()
|
||||||
|
|
||||||
self.SetClient:ForEachClient(
|
self.SetClient:ForEachClient(
|
||||||
--- @param Wrapper.Client#CLIENT Client
|
-- @param Wrapper.Client#CLIENT Client
|
||||||
function( Client )
|
function( Client )
|
||||||
|
|
||||||
if Client:IsAlive() then
|
if Client:IsAlive() then
|
||||||
@@ -258,7 +259,7 @@ function ATC_GROUND:_AirbaseMonitor()
|
|||||||
local IsOnGround = Client:InAir() == false
|
local IsOnGround = Client:InAir() == false
|
||||||
|
|
||||||
for AirbaseID, AirbaseMeta in pairs( self.Airbases ) do
|
for AirbaseID, AirbaseMeta in pairs( self.Airbases ) do
|
||||||
self:E( AirbaseID, AirbaseMeta.KickSpeed )
|
self:T( AirbaseID, AirbaseMeta.KickSpeed )
|
||||||
|
|
||||||
if AirbaseMeta.Monitor == true and Client:IsInZone( AirbaseMeta.ZoneBoundary ) then
|
if AirbaseMeta.Monitor == true and Client:IsInZone( AirbaseMeta.ZoneBoundary ) then
|
||||||
|
|
||||||
@@ -271,7 +272,7 @@ function ATC_GROUND:_AirbaseMonitor()
|
|||||||
|
|
||||||
if IsOnGround then
|
if IsOnGround then
|
||||||
local Taxi = Client:GetState( self, "Taxi" )
|
local Taxi = Client:GetState( self, "Taxi" )
|
||||||
self:E( 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 " ..
|
||||||
@@ -331,7 +332,7 @@ function ATC_GROUND:_AirbaseMonitor()
|
|||||||
Client:SetState( self, "Warnings", SpeedingWarnings + 1 )
|
Client:SetState( self, "Warnings", SpeedingWarnings + 1 )
|
||||||
else
|
else
|
||||||
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
||||||
--- @param Wrapper.Client#CLIENT Client
|
-- @param Wrapper.Client#CLIENT Client
|
||||||
Client:Destroy()
|
Client:Destroy()
|
||||||
Client:SetState( self, "Speeding", false )
|
Client:SetState( self, "Speeding", false )
|
||||||
Client:SetState( self, "Warnings", 0 )
|
Client:SetState( self, "Warnings", 0 )
|
||||||
@@ -363,7 +364,7 @@ function ATC_GROUND:_AirbaseMonitor()
|
|||||||
Client:SetState( self, "OffRunwayWarnings", OffRunwayWarnings + 1 )
|
Client:SetState( self, "OffRunwayWarnings", OffRunwayWarnings + 1 )
|
||||||
else
|
else
|
||||||
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
||||||
--- @param Wrapper.Client#CLIENT Client
|
-- @param Wrapper.Client#CLIENT Client
|
||||||
Client:Destroy()
|
Client:Destroy()
|
||||||
Client:SetState( self, "IsOffRunway", false )
|
Client:SetState( self, "IsOffRunway", false )
|
||||||
Client:SetState( self, "OffRunwayWarnings", 0 )
|
Client:SetState( self, "OffRunwayWarnings", 0 )
|
||||||
@@ -424,13 +425,20 @@ ATC_GROUND_UNIVERSAL = {
|
|||||||
|
|
||||||
--- Creates a new ATC\_GROUND\_UNIVERSAL object. This works on any map.
|
--- Creates a new ATC\_GROUND\_UNIVERSAL object. This works on any map.
|
||||||
-- @param #ATC_GROUND_UNIVERSAL self
|
-- @param #ATC_GROUND_UNIVERSAL self
|
||||||
-- @param AirbaseList (Optional) A table of Airbase Names.
|
-- @param AirbaseList A table of Airbase Names. Leave empty to cover **all** airbases of the map.
|
||||||
-- @return #ATC_GROUND_UNIVERSAL self
|
-- @return #ATC_GROUND_UNIVERSAL self
|
||||||
|
-- @usage
|
||||||
|
-- -- define monitoring for one airbase
|
||||||
|
-- local atc=ATC_GROUND_UNIVERSAL:New({AIRBASE.Syria.Gecitkale})
|
||||||
|
-- -- set kick speed
|
||||||
|
-- atc:SetKickSpeed(UTILS.KnotsToMps(20))
|
||||||
|
-- -- start monitoring evey 10 secs
|
||||||
|
-- atc:Start(10)
|
||||||
function ATC_GROUND_UNIVERSAL:New(AirbaseList)
|
function ATC_GROUND_UNIVERSAL:New(AirbaseList)
|
||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, BASE:New() ) -- #ATC_GROUND
|
local self = BASE:Inherit( self, BASE:New() ) -- #ATC_GROUND
|
||||||
self:E( { self.ClassName } )
|
self:T( { self.ClassName } )
|
||||||
|
|
||||||
self.Airbases = {}
|
self.Airbases = {}
|
||||||
|
|
||||||
@@ -440,6 +448,13 @@ function ATC_GROUND_UNIVERSAL:New(AirbaseList)
|
|||||||
|
|
||||||
self.AirbaseList = AirbaseList
|
self.AirbaseList = AirbaseList
|
||||||
|
|
||||||
|
if not self.AirbaseList then
|
||||||
|
self.AirbaseList = {}
|
||||||
|
for _name,_ in pairs(_DATABASE.AIRBASES) do
|
||||||
|
self.AirbaseList[_name]=_name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
self.SetClient = SET_CLIENT:New():FilterCategories( "plane" ):FilterStart()
|
self.SetClient = SET_CLIENT:New():FilterCategories( "plane" ):FilterStart()
|
||||||
|
|
||||||
|
|
||||||
@@ -460,8 +475,9 @@ function ATC_GROUND_UNIVERSAL:New(AirbaseList)
|
|||||||
self.Airbases[AirbaseName].Monitor = true
|
self.Airbases[AirbaseName].Monitor = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
self.SetClient:ForEachClient(
|
self.SetClient:ForEachClient(
|
||||||
--- @param Wrapper.Client#CLIENT Client
|
-- @param Wrapper.Client#CLIENT Client
|
||||||
function( Client )
|
function( Client )
|
||||||
Client:SetState( self, "Speeding", false )
|
Client:SetState( self, "Speeding", false )
|
||||||
Client:SetState( self, "Warnings", 0)
|
Client:SetState( self, "Warnings", 0)
|
||||||
@@ -679,9 +695,10 @@ end
|
|||||||
-- @param #ATC_GROUND_UNIVERSAL self
|
-- @param #ATC_GROUND_UNIVERSAL self
|
||||||
-- @return #ATC_GROUND_UNIVERSAL self
|
-- @return #ATC_GROUND_UNIVERSAL self
|
||||||
function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
|
function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
|
||||||
|
self:I("_AirbaseMonitor")
|
||||||
self.SetClient:ForEachClient(
|
self.SetClient:ForEachClient(
|
||||||
--- @param Wrapper.Client#CLIENT Client
|
--- Nameless function
|
||||||
|
-- @param Wrapper.Client#CLIENT Client
|
||||||
function( Client )
|
function( Client )
|
||||||
|
|
||||||
if Client:IsAlive() then
|
if Client:IsAlive() then
|
||||||
@@ -689,7 +706,7 @@ function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
|
|||||||
local IsOnGround = Client:InAir() == false
|
local IsOnGround = Client:InAir() == false
|
||||||
|
|
||||||
for AirbaseID, AirbaseMeta in pairs( self.Airbases ) do
|
for AirbaseID, AirbaseMeta in pairs( self.Airbases ) do
|
||||||
self:E( AirbaseID, AirbaseMeta.KickSpeed )
|
self:T( AirbaseID, AirbaseMeta.KickSpeed )
|
||||||
|
|
||||||
if AirbaseMeta.Monitor == true and Client:IsInZone( AirbaseMeta.ZoneBoundary ) then
|
if AirbaseMeta.Monitor == true and Client:IsInZone( AirbaseMeta.ZoneBoundary ) then
|
||||||
|
|
||||||
@@ -706,7 +723,7 @@ function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
|
|||||||
|
|
||||||
if IsOnGround then
|
if IsOnGround then
|
||||||
local Taxi = Client:GetState( self, "Taxi" )
|
local Taxi = Client:GetState( self, "Taxi" )
|
||||||
self:E( 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 " ..
|
||||||
@@ -766,7 +783,7 @@ function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
|
|||||||
Client:SetState( self, "Warnings", SpeedingWarnings + 1 )
|
Client:SetState( self, "Warnings", SpeedingWarnings + 1 )
|
||||||
else
|
else
|
||||||
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
||||||
--- @param Wrapper.Client#CLIENT Client
|
-- @param Wrapper.Client#CLIENT Client
|
||||||
Client:Destroy()
|
Client:Destroy()
|
||||||
Client:SetState( self, "Speeding", false )
|
Client:SetState( self, "Speeding", false )
|
||||||
Client:SetState( self, "Warnings", 0 )
|
Client:SetState( self, "Warnings", 0 )
|
||||||
@@ -798,7 +815,7 @@ function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
|
|||||||
Client:SetState( self, "OffRunwayWarnings", OffRunwayWarnings + 1 )
|
Client:SetState( self, "OffRunwayWarnings", OffRunwayWarnings + 1 )
|
||||||
else
|
else
|
||||||
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
||||||
--- @param Wrapper.Client#CLIENT Client
|
-- @param Wrapper.Client#CLIENT Client
|
||||||
Client:Destroy()
|
Client:Destroy()
|
||||||
Client:SetState( self, "IsOffRunway", false )
|
Client:SetState( self, "IsOffRunway", false )
|
||||||
Client:SetState( self, "OffRunwayWarnings", 0 )
|
Client:SetState( self, "OffRunwayWarnings", 0 )
|
||||||
@@ -838,15 +855,16 @@ end
|
|||||||
|
|
||||||
--- Start SCHEDULER for ATC_GROUND_UNIVERSAL object.
|
--- Start SCHEDULER for ATC_GROUND_UNIVERSAL object.
|
||||||
-- @param #ATC_GROUND_UNIVERSAL self
|
-- @param #ATC_GROUND_UNIVERSAL self
|
||||||
-- @param RepeatScanSeconds Time in second for defining occurency of alerts.
|
-- @param RepeatScanSeconds Time in second for defining schedule of alerts.
|
||||||
-- @return #ATC_GROUND_UNIVERSAL self
|
-- @return #ATC_GROUND_UNIVERSAL self
|
||||||
function ATC_GROUND_UNIVERSAL:Start( RepeatScanSeconds )
|
function ATC_GROUND_UNIVERSAL:Start( RepeatScanSeconds )
|
||||||
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
||||||
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds )
|
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, RepeatScanSeconds )
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @type ATC_GROUND_CAUCASUS
|
---
|
||||||
|
-- @type ATC_GROUND_CAUCASUS
|
||||||
-- @extends #ATC_GROUND
|
-- @extends #ATC_GROUND
|
||||||
|
|
||||||
--- # ATC\_GROUND\_CAUCASUS, extends @{#ATC_GROUND_UNIVERSAL}
|
--- # ATC\_GROUND\_CAUCASUS, extends @{#ATC_GROUND_UNIVERSAL}
|
||||||
@@ -981,12 +999,12 @@ end
|
|||||||
-- @return nothing
|
-- @return nothing
|
||||||
function ATC_GROUND_CAUCASUS:Start( RepeatScanSeconds )
|
function ATC_GROUND_CAUCASUS:Start( RepeatScanSeconds )
|
||||||
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
||||||
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds )
|
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, RepeatScanSeconds )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
--- @type ATC_GROUND_NEVADA
|
-- @type ATC_GROUND_NEVADA
|
||||||
-- @extends #ATC_GROUND
|
-- @extends #ATC_GROUND
|
||||||
|
|
||||||
|
|
||||||
@@ -1120,11 +1138,11 @@ end
|
|||||||
-- @return nothing
|
-- @return nothing
|
||||||
function ATC_GROUND_NEVADA:Start( RepeatScanSeconds )
|
function ATC_GROUND_NEVADA:Start( RepeatScanSeconds )
|
||||||
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
||||||
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds )
|
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, RepeatScanSeconds )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---
|
||||||
--- @type ATC_GROUND_NORMANDY
|
-- @type ATC_GROUND_NORMANDY
|
||||||
-- @extends #ATC_GROUND
|
-- @extends #ATC_GROUND
|
||||||
|
|
||||||
|
|
||||||
@@ -1277,10 +1295,11 @@ end
|
|||||||
-- @return nothing
|
-- @return nothing
|
||||||
function ATC_GROUND_NORMANDY:Start( RepeatScanSeconds )
|
function ATC_GROUND_NORMANDY:Start( RepeatScanSeconds )
|
||||||
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
||||||
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds )
|
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, RepeatScanSeconds )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @type ATC_GROUND_PERSIANGULF
|
---
|
||||||
|
-- @type ATC_GROUND_PERSIANGULF
|
||||||
-- @extends #ATC_GROUND
|
-- @extends #ATC_GROUND
|
||||||
|
|
||||||
|
|
||||||
@@ -1419,11 +1438,11 @@ end
|
|||||||
-- @return nothing
|
-- @return nothing
|
||||||
function ATC_GROUND_PERSIANGULF:Start( RepeatScanSeconds )
|
function ATC_GROUND_PERSIANGULF:Start( RepeatScanSeconds )
|
||||||
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
||||||
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, 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
|
||||||
|
|
||||||
|
|
||||||
@@ -1517,7 +1536,7 @@ end
|
|||||||
-- * @{#ATC_GROUND.SetMaximumKickSpeedKmph}(): Set the maximum speed allowed at an airbase in kilometers per hour.
|
-- * @{#ATC_GROUND.SetMaximumKickSpeedKmph}(): Set the maximum speed allowed at an airbase in kilometers per hour.
|
||||||
-- * @{#ATC_GROUND.SetMaximumKickSpeedMiph}(): Set the maximum speed allowed at an airbase in miles per hour.
|
-- * @{#ATC_GROUND.SetMaximumKickSpeedMiph}(): Set the maximum speed allowed at an airbase in miles per hour.
|
||||||
--
|
--
|
||||||
---- @field #ATC_GROUND_MARIANAISLANDS
|
-- @field #ATC_GROUND_MARIANAISLANDS
|
||||||
ATC_GROUND_MARIANAISLANDS = {
|
ATC_GROUND_MARIANAISLANDS = {
|
||||||
ClassName = "ATC_GROUND_MARIANAISLANDS",
|
ClassName = "ATC_GROUND_MARIANAISLANDS",
|
||||||
}
|
}
|
||||||
@@ -1529,7 +1548,7 @@ ATC_GROUND_MARIANAISLANDS = {
|
|||||||
function ATC_GROUND_MARIANAISLANDS:New( AirbaseNames )
|
function ATC_GROUND_MARIANAISLANDS:New( AirbaseNames )
|
||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, ATC_GROUND_UNIVERSAL:New( self.Airbases, AirbaseNames ) )
|
local self = BASE:Inherit( self, ATC_GROUND_UNIVERSAL:New( AirbaseNames ) )
|
||||||
|
|
||||||
self:SetKickSpeedKmph( 50 )
|
self:SetKickSpeedKmph( 50 )
|
||||||
self:SetMaximumKickSpeedKmph( 150 )
|
self:SetMaximumKickSpeedKmph( 150 )
|
||||||
@@ -1543,5 +1562,5 @@ end
|
|||||||
-- @return nothing
|
-- @return nothing
|
||||||
function ATC_GROUND_MARIANAISLANDS:Start( RepeatScanSeconds )
|
function ATC_GROUND_MARIANAISLANDS:Start( RepeatScanSeconds )
|
||||||
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
||||||
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds )
|
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, RepeatScanSeconds )
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -25,12 +25,12 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **[funkyfranky](https://forums.eagle.ru/member.php?u=115026)**
|
-- ### Author: **funkyfranky**
|
||||||
--
|
--
|
||||||
-- ### Contributions: [FlightControl](https://forums.eagle.ru/member.php?u=89536)
|
-- ### Contributions: FlightControl
|
||||||
--
|
--
|
||||||
-- ====
|
-- ====
|
||||||
-- @module Functional.Arty
|
-- @module Functional.Artillery
|
||||||
-- @image Artillery.JPG
|
-- @image Artillery.JPG
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -103,12 +103,13 @@
|
|||||||
-- @field #number coalition The coalition of the arty group.
|
-- @field #number coalition The coalition of the arty group.
|
||||||
-- @field #boolean respawnafterdeath Respawn arty group after all units are dead.
|
-- @field #boolean respawnafterdeath Respawn arty group after all units are dead.
|
||||||
-- @field #number respawndelay Respawn delay in seconds.
|
-- @field #number respawndelay Respawn delay in seconds.
|
||||||
|
-- @field #number dtTrack Time interval in seconds for weapon tracking.
|
||||||
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
||||||
|
|
||||||
--- Enables mission designers easily to assign targets for artillery units. Since the implementation is based on a Finite State Model (FSM), the mission designer can
|
--- Enables mission designers easily to assign targets for artillery units. Since the implementation is based on a Finite State Model (FSM), the mission designer can
|
||||||
-- interact with the process at certain events or states.
|
-- interact with the process at certain events or states.
|
||||||
--
|
--
|
||||||
-- A new ARTY object can be created with the @{#ARTY.New}(*group*) contructor.
|
-- A new ARTY object can be created with the @{#ARTY.New}(*group*) constructor.
|
||||||
-- The parameter *group* has to be a MOOSE Group object and defines ARTY group.
|
-- The parameter *group* has to be a MOOSE Group object and defines ARTY group.
|
||||||
--
|
--
|
||||||
-- The ARTY FSM process can be started by the @{#ARTY.Start}() command.
|
-- The ARTY FSM process can be started by the @{#ARTY.Start}() command.
|
||||||
@@ -146,7 +147,7 @@
|
|||||||
-- When a new target is assigned via the @{#ARTY.AssignTargetCoord}() function (see below), the **NewTarget** event is triggered.
|
-- When a new target is assigned via the @{#ARTY.AssignTargetCoord}() function (see below), the **NewTarget** event is triggered.
|
||||||
--
|
--
|
||||||
-- ## Assigning Targets
|
-- ## Assigning Targets
|
||||||
-- Assigning targets is a central point of the ARTY class. Multiple targets can be assigned simultanioulsly and are put into a queue.
|
-- Assigning targets is a central point of the ARTY class. Multiple targets can be assigned simultaneously and are put into a queue.
|
||||||
-- Of course, targets can be added at any time during the mission. For example, once they are detected by a reconnaissance unit.
|
-- Of course, targets can be added at any time during the mission. For example, once they are detected by a reconnaissance unit.
|
||||||
--
|
--
|
||||||
-- In order to add a target, the function @{#ARTY.AssignTargetCoord}(*coord*, *prio*, *radius*, *nshells*, *maxengage*, *time*, *weapontype*, *name*) has to be used.
|
-- In order to add a target, the function @{#ARTY.AssignTargetCoord}(*coord*, *prio*, *radius*, *nshells*, *maxengage*, *time*, *weapontype*, *name*) has to be used.
|
||||||
@@ -161,7 +162,7 @@
|
|||||||
-- * *maxengage*: Number of times a target is engaged.
|
-- * *maxengage*: Number of times a target is engaged.
|
||||||
-- * *time*: Time of day the engagement is schedule in the format "hh:mm:ss" for hh=hours, mm=minutes, ss=seconds.
|
-- * *time*: Time of day the engagement is schedule in the format "hh:mm:ss" for hh=hours, mm=minutes, ss=seconds.
|
||||||
-- For example "10:15:35". In the case the attack will be executed at a quarter past ten in the morning at the day the mission started.
|
-- For example "10:15:35". In the case the attack will be executed at a quarter past ten in the morning at the day the mission started.
|
||||||
-- If the engagement should start on the following day the format can be specified as "10:15:35+1", where the +1 denots the following day.
|
-- If the engagement should start on the following day the format can be specified as "10:15:35+1", where the +1 denotes the following day.
|
||||||
-- This is useful for longer running missions or if the mission starts at 23:00 hours and the attack should be scheduled at 01:00 hours on the following day.
|
-- This is useful for longer running missions or if the mission starts at 23:00 hours and the attack should be scheduled at 01:00 hours on the following day.
|
||||||
-- Of course, later days are also possible by appending "+2", "+3", etc.
|
-- Of course, later days are also possible by appending "+2", "+3", etc.
|
||||||
-- **Note** that the time has to be given as a string. So the enclosing quotation marks "" are important.
|
-- **Note** that the time has to be given as a string. So the enclosing quotation marks "" are important.
|
||||||
@@ -179,7 +180,7 @@
|
|||||||
-- Let's first consider the case that none of the targets is scheduled to be executed at a certain time (*time*=nil).
|
-- Let's first consider the case that none of the targets is scheduled to be executed at a certain time (*time*=nil).
|
||||||
-- The ARTY group will first engage the target with higher priority (*prio*=10). After the engagement is finished, the target with lower priority is attacked.
|
-- The ARTY group will first engage the target with higher priority (*prio*=10). After the engagement is finished, the target with lower priority is attacked.
|
||||||
-- This is because the target with lower prio has been attacked one time less. After the attack on the lower priority task is finished and both targets
|
-- This is because the target with lower prio has been attacked one time less. After the attack on the lower priority task is finished and both targets
|
||||||
-- have been engaged equally often, the target with the higher priority is engaged again. This coninues until a target has engaged three times.
|
-- have been engaged equally often, the target with the higher priority is engaged again. This continues until a target has engaged three times.
|
||||||
-- Once the maximum number of engagements is reached, the target is deleted from the queue.
|
-- Once the maximum number of engagements is reached, the target is deleted from the queue.
|
||||||
--
|
--
|
||||||
-- In other words, the queue is first sorted with respect to the number of engagements and targets with the same number of engagements are sorted with
|
-- In other words, the queue is first sorted with respect to the number of engagements and targets with the same number of engagements are sorted with
|
||||||
@@ -190,7 +191,7 @@
|
|||||||
-- As mentioned above, targets can be engaged at a specific time of the day via the *time* parameter.
|
-- As mentioned above, targets can be engaged at a specific time of the day via the *time* parameter.
|
||||||
--
|
--
|
||||||
-- If the *time* parameter is specified for a target, the first engagement of that target will happen at that time of the day and not before.
|
-- If the *time* parameter is specified for a target, the first engagement of that target will happen at that time of the day and not before.
|
||||||
-- This also applies when multiple engagements are requested via the *maxengage* parameter. The first attack will not happen before the specifed time.
|
-- This also applies when multiple engagements are requested via the *maxengage* parameter. The first attack will not happen before the specified time.
|
||||||
-- When that timed attack is finished, the *time* parameter is deleted and the remaining engagements are carried out in the same manner as for untimed targets (described above).
|
-- When that timed attack is finished, the *time* parameter is deleted and the remaining engagements are carried out in the same manner as for untimed targets (described above).
|
||||||
--
|
--
|
||||||
-- Of course, it can happen that a scheduled task should be executed at a time, when another target is already under attack.
|
-- Of course, it can happen that a scheduled task should be executed at a time, when another target is already under attack.
|
||||||
@@ -201,7 +202,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Determining the Amount of Ammo
|
-- ## Determining the Amount of Ammo
|
||||||
--
|
--
|
||||||
-- In order to determin when a unit is out of ammo and possible initiate the rearming process it is necessary to know which types of weapons have to be counted.
|
-- In order to determine when a unit is out of ammo and possible initiate the rearming process it is necessary to know which types of weapons have to be counted.
|
||||||
-- For most artillery unit types, this is simple because they only have one type of weapon and hence ammunition.
|
-- For most artillery unit types, this is simple because they only have one type of weapon and hence ammunition.
|
||||||
--
|
--
|
||||||
-- However, there are more complex scenarios. For example, naval units carry a big arsenal of different ammunition types ranging from various cannon shell types
|
-- However, there are more complex scenarios. For example, naval units carry a big arsenal of different ammunition types ranging from various cannon shell types
|
||||||
@@ -217,7 +218,7 @@
|
|||||||
-- **Note** that the default parameters "weapons.shells", "weapons.nurs", "weapons.missiles" **should in priciple** capture all the corresponding ammo types.
|
-- **Note** that the default parameters "weapons.shells", "weapons.nurs", "weapons.missiles" **should in priciple** capture all the corresponding ammo types.
|
||||||
-- However, the logic searches for the string "weapon.missies" in the ammo type. Especially for missiles, this string is often not contained in the ammo type descriptor.
|
-- However, the logic searches for the string "weapon.missies" in the ammo type. Especially for missiles, this string is often not contained in the ammo type descriptor.
|
||||||
--
|
--
|
||||||
-- One way to determin which types of ammo the unit carries, one can use the debug mode of the arty class via @{#ARTY.SetDebugON}().
|
-- One way to determine which types of ammo the unit carries, one can use the debug mode of the arty class via @{#ARTY.SetDebugON}().
|
||||||
-- In debug mode, the all ammo types of the group are printed to the monitor as message and can be found in the DCS.log file.
|
-- In debug mode, the all ammo types of the group are printed to the monitor as message and can be found in the DCS.log file.
|
||||||
--
|
--
|
||||||
-- ## Employing Selected Weapons
|
-- ## Employing Selected Weapons
|
||||||
@@ -274,7 +275,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Simulated Weapons
|
-- ## Simulated Weapons
|
||||||
--
|
--
|
||||||
-- In addtion to the standard weapons a group has available some special weapon types that are not possible to use in the native DCS environment are simulated.
|
-- In addition to the standard weapons a group has available some special weapon types that are not possible to use in the native DCS environment are simulated.
|
||||||
--
|
--
|
||||||
-- ### Tactical Nukes
|
-- ### Tactical Nukes
|
||||||
--
|
--
|
||||||
@@ -283,30 +284,30 @@
|
|||||||
--
|
--
|
||||||
-- By default, they group does not have any nukes available. To give the group the ability the function @{#ARTY.SetTacNukeShells}(*n*) can be used.
|
-- By default, they group does not have any nukes available. To give the group the ability the function @{#ARTY.SetTacNukeShells}(*n*) can be used.
|
||||||
-- This supplies the group with *n* nuclear shells, where *n* is restricted to the number of conventional shells the group can carry.
|
-- This supplies the group with *n* nuclear shells, where *n* is restricted to the number of conventional shells the group can carry.
|
||||||
-- Note that the group must always have convenctional shells left in order to fire a nuclear shell.
|
-- Note that the group must always have conventional shells left in order to fire a nuclear shell.
|
||||||
--
|
--
|
||||||
-- The default explostion strength is 0.075 kilo tons TNT. The can be changed with the @{#ARTY.SetTacNukeWarhead}(*strength*), where *strength* is given in kilo tons TNT.
|
-- The default explosion strength is 0.075 kilo tons TNT. The can be changed with the @{#ARTY.SetTacNukeWarhead}(*strength*), where *strength* is given in kilo tons TNT.
|
||||||
--
|
--
|
||||||
-- ### Illumination Shells
|
-- ### Illumination Shells
|
||||||
--
|
--
|
||||||
-- ARTY groups that possess shells can fire shells with illumination bombs. First, the group needs to be equipped with this weapon. This is done by the
|
-- ARTY groups that possess shells can fire shells with illumination bombs. First, the group needs to be equipped with this weapon. This is done by the
|
||||||
-- function @{ARTY.SetIlluminationShells}(*n*, *power*), where *n* is the number of shells the group has available and *power* the illumination power in mega candela (mcd).
|
-- function @{#ARTY.SetIlluminationShells}(*n*, *power*), where *n* is the number of shells the group has available and *power* the illumination power in mega candela (mcd).
|
||||||
--
|
--
|
||||||
-- In order to execute an engagement with illumination shells one has to use the weapon type *ARTY.WeaponType.IlluminationShells* in the
|
-- In order to execute an engagement with illumination shells one has to use the weapon type *ARTY.WeaponType.IlluminationShells* in the
|
||||||
-- @{#ARTY.AssignTargetCoord}() function.
|
-- @{#ARTY.AssignTargetCoord}() function.
|
||||||
--
|
--
|
||||||
-- In the simulation, the explosive shell that is fired is destroyed once it gets close to the target point but before it can actually impact.
|
-- In the simulation, the explosive shell that is fired is destroyed once it gets close to the target point but before it can actually impact.
|
||||||
-- At this position an illumination bomb is triggered at a random altitude between 500 and 1000 meters. This interval can be set by the function
|
-- At this position an illumination bomb is triggered at a random altitude between 500 and 1000 meters. This interval can be set by the function
|
||||||
-- @{ARTY.SetIlluminationMinMaxAlt}(*minalt*, *maxalt*).
|
-- @{#ARTY.SetIlluminationMinMaxAlt}(*minalt*, *maxalt*).
|
||||||
--
|
--
|
||||||
-- ### Smoke Shells
|
-- ### Smoke Shells
|
||||||
--
|
--
|
||||||
-- In a similar way to illumination shells, ARTY groups can also employ smoke shells. The numer of smoke shells the group has available is set by the function
|
-- In a similar way to illumination shells, ARTY groups can also employ smoke shells. The number of smoke shells the group has available is set by the function
|
||||||
-- @{#ARTY.SetSmokeShells}(*n*, *color*), where *n* is the number of shells and *color* defines the smoke color. Default is SMOKECOLOR.Red.
|
-- @{#ARTY.SetSmokeShells}(*n*, *color*), where *n* is the number of shells and *color* defines the smoke color. Default is SMOKECOLOR.Red.
|
||||||
--
|
--
|
||||||
-- The weapon type to be used in the @{#ARTY.AssignTargetCoord}() function is *ARTY.WeaponType.SmokeShells*.
|
-- The weapon type to be used in the @{#ARTY.AssignTargetCoord}() function is *ARTY.WeaponType.SmokeShells*.
|
||||||
--
|
--
|
||||||
-- The explosive shell the group fired is destroyed shortly before its impact on the ground and smoke of the speficied color is triggered at that position.
|
-- The explosive shell the group fired is destroyed shortly before its impact on the ground and smoke of the specified color is triggered at that position.
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
-- ## Assignments via Markers on F10 Map
|
-- ## Assignments via Markers on F10 Map
|
||||||
@@ -320,15 +321,15 @@
|
|||||||
-- ### Target Assignments
|
-- ### Target Assignments
|
||||||
-- A new target can be assigned by writing **arty engage** in the marker text.
|
-- A new target can be assigned by writing **arty engage** in the marker text.
|
||||||
-- This is followed by a **comma separated list** of (optional) keywords and parameters.
|
-- This is followed by a **comma separated list** of (optional) keywords and parameters.
|
||||||
-- First, it is important to address the ARTY group or groups that should engage. This can be done in numrous ways. The keywords are *battery*, *alias*, *cluster*.
|
-- First, it is important to address the ARTY group or groups that should engage. This can be done in numerous ways. The keywords are *battery*, *alias*, *cluster*.
|
||||||
-- It is also possible to address all ARTY groups by the keyword *everyone* or *allbatteries*. These two can be used synonymously.
|
-- It is also possible to address all ARTY groups by the keyword *everyone* or *allbatteries*. These two can be used synonymously.
|
||||||
-- **Note that**, if no battery is assigned nothing will happen.
|
-- **Note that**, if no battery is assigned nothing will happen.
|
||||||
--
|
--
|
||||||
-- * *everyone* or *allbatteries* The target is assigned to all batteries.
|
-- * *everyone* or *allbatteries* The target is assigned to all batteries.
|
||||||
-- * *battery* Name of the ARTY group that the target is assigned to. Note that **the name is case sensitive** and has to be given in quotation marks. Default is all ARTY groups of the right coalition.
|
-- * *battery* Name of the ARTY group that the target is assigned to. Note that **the name is case sensitive** and has to be given in quotation marks. Default is all ARTY groups of the right coalition.
|
||||||
-- * *alias* Alias of the ARTY group that the target is assigned to. The alias is **case sensitive** and needs to be in quotation marks.
|
-- * *alias* Alias of the ARTY group that the target is assigned to. The alias is **case sensitive** and needs to be in quotation marks.
|
||||||
-- * *cluster* The cluster of ARTY groups that is addessed. Clusters can be defined by the function @{#ARTY.AddToCluster}(*clusters*). Names are **case sensitive** and need to be in quotation marks.
|
-- * *cluster* The cluster of ARTY groups that is addressed. Clusters can be defined by the function @{#ARTY.AddToCluster}(*clusters*). Names are **case sensitive** and need to be in quotation marks.
|
||||||
-- * *key* A number to authorize the target assignment. Only specifing the correct number will trigger an engagement.
|
-- * *key* A number to authorize the target assignment. Only specifying the correct number will trigger an engagement.
|
||||||
-- * *time* Time for which which the engagement is schedules, e.g. 08:42. Default is as soon as possible.
|
-- * *time* Time for which which the engagement is schedules, e.g. 08:42. Default is as soon as possible.
|
||||||
-- * *prio* Priority of the engagement as number between 1 (high prio) and 100 (low prio). Default is 50, i.e. medium priority.
|
-- * *prio* Priority of the engagement as number between 1 (high prio) and 100 (low prio). Default is 50, i.e. medium priority.
|
||||||
-- * *shots* Number of shots (shells, rockets or missiles) fired at each engagement. Default is 5.
|
-- * *shots* Number of shots (shells, rockets or missiles) fired at each engagement. Default is 5.
|
||||||
@@ -353,8 +354,8 @@
|
|||||||
-- arty engage, battery "Paladin Alpha", weapon nukes, shots 1, time 20:15
|
-- arty engage, battery "Paladin Alpha", weapon nukes, shots 1, time 20:15
|
||||||
-- arty engage, battery "Horwitzer 1", lldms 41:51:00N 41:47:58E
|
-- arty engage, battery "Horwitzer 1", lldms 41:51:00N 41:47:58E
|
||||||
--
|
--
|
||||||
-- Note that the keywords and parameters are *case insensitve*. Only exception are the battery, alias and cluster names.
|
-- Note that the keywords and parameters are *case insensitive*. Only exception are the battery, alias and cluster names.
|
||||||
-- These must be exactly the same as the names of the goups defined in the mission editor or the aliases and cluster names defined in the script.
|
-- These must be exactly the same as the names of the groups defined in the mission editor or the aliases and cluster names defined in the script.
|
||||||
--
|
--
|
||||||
-- ### Relocation Assignments
|
-- ### Relocation Assignments
|
||||||
--
|
--
|
||||||
@@ -363,11 +364,11 @@
|
|||||||
-- * *time* Time for which which the relocation/move is schedules, e.g. 08:42. Default is as soon as possible.
|
-- * *time* Time for which which the relocation/move is schedules, e.g. 08:42. Default is as soon as possible.
|
||||||
-- * *speed* The speed in km/h the group will drive at. Default is 70% of its max possible speed.
|
-- * *speed* The speed in km/h the group will drive at. Default is 70% of its max possible speed.
|
||||||
-- * *on road* Group will use mainly roads. Default is off, i.e. it will go in a straight line from its current position to the assigned coordinate.
|
-- * *on road* Group will use mainly roads. Default is off, i.e. it will go in a straight line from its current position to the assigned coordinate.
|
||||||
-- * *canceltarget* Group will cancel all running firing engagements and immidiately start to move. Default is that group will wait until is current assignment is over.
|
-- * *canceltarget* Group will cancel all running firing engagements and immediately start to move. Default is that group will wait until is current assignment is over.
|
||||||
-- * *battery* Name of the ARTY group that the relocation is assigned to.
|
-- * *battery* Name of the ARTY group that the relocation is assigned to.
|
||||||
-- * *alias* Alias of the ARTY group that the target is assigned to. The alias is **case sensitive** and needs to be in quotation marks.
|
-- * *alias* Alias of the ARTY group that the target is assigned to. The alias is **case sensitive** and needs to be in quotation marks.
|
||||||
-- * *cluster* The cluster of ARTY groups that is addessed. Clusters can be defined by the function @{#ARTY.AddToCluster}(*clusters*). Names are **case sensitive** and need to be in quotation marks.
|
-- * *cluster* The cluster of ARTY groups that is addressed. Clusters can be defined by the function @{#ARTY.AddToCluster}(*clusters*). Names are **case sensitive** and need to be in quotation marks.
|
||||||
-- * *key* A number to authorize the target assignment. Only specifing the correct number will trigger an engagement.
|
-- * *key* A number to authorize the target assignment. Only specifying the correct number will trigger an engagement.
|
||||||
-- * *lldms* Specify the coordinates in Lat/Long degrees, minutes and seconds format. The actual location of the marker is unimportant. The group will move to the coordinates given in the lldms keyword.
|
-- * *lldms* Specify the coordinates in Lat/Long degrees, minutes and seconds format. The actual location of the marker is unimportant. The group will move to the coordinates given in the lldms keyword.
|
||||||
-- Format is DD:MM:SS[N,S] DD:MM:SS[W,E]. See example below.
|
-- Format is DD:MM:SS[N,S] DD:MM:SS[W,E]. See example below.
|
||||||
-- * *readonly* Marker cannot be deleted by users any more. Hence, assignment cannot be cancelled by removing the marker.
|
-- * *readonly* Marker cannot be deleted by users any more. Hence, assignment cannot be cancelled by removing the marker.
|
||||||
@@ -410,12 +411,12 @@
|
|||||||
--
|
--
|
||||||
-- A few options can be set by marks. The corresponding keyword is **arty set**. This can be used to define the rearming place and group for a battery.
|
-- A few options can be set by marks. The corresponding keyword is **arty set**. This can be used to define the rearming place and group for a battery.
|
||||||
--
|
--
|
||||||
-- To set the reamring place of a group at the marker position type
|
-- To set the rearming place of a group at the marker position type
|
||||||
-- 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 M818"
|
||||||
-- Note that the name of the rearming group has to be given in quotation marks and spellt exactly as the group name defined in the mission editor.
|
-- 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
|
||||||
--
|
--
|
||||||
@@ -693,7 +694,7 @@ ARTY.db={
|
|||||||
|
|
||||||
--- Arty script version.
|
--- Arty script version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
ARTY.version="1.2.0"
|
ARTY.version="1.3.0"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -801,6 +802,9 @@ function ARTY:New(group, alias)
|
|||||||
else
|
else
|
||||||
self.ismobile=false
|
self.ismobile=false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Set track time interval.
|
||||||
|
self.dtTrack=0.2
|
||||||
|
|
||||||
-- Set speed to 0.7 of maximum.
|
-- Set speed to 0.7 of maximum.
|
||||||
self.Speed=self.SpeedMax * 0.7
|
self.Speed=self.SpeedMax * 0.7
|
||||||
@@ -1497,6 +1501,15 @@ function ARTY:SetStatusInterval(interval)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set time interval for weapon tracking.
|
||||||
|
-- @param #ARTY self
|
||||||
|
-- @param #number interval Time interval in seconds. Default 0.2 seconds.
|
||||||
|
-- @return self
|
||||||
|
function ARTY:SetTrackInterval(interval)
|
||||||
|
self.dtTrack=interval or 0.2
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Set time how it is waited a unit the first shot event happens. If no shot is fired after this time, the task to fire is aborted and the target removed.
|
--- Set time how it is waited a unit the first shot event happens. If no shot is fired after this time, the task to fire is aborted and the target removed.
|
||||||
-- @param #ARTY self
|
-- @param #ARTY self
|
||||||
-- @param #number waittime Time in seconds. Default 300 seconds.
|
-- @param #number waittime Time in seconds. Default 300 seconds.
|
||||||
@@ -2129,6 +2142,95 @@ end
|
|||||||
-- Event Handling
|
-- Event Handling
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
--- Function called during tracking of weapon.
|
||||||
|
-- @param Wrapper.Weapon#WEAPON weapon Weapon object.
|
||||||
|
-- @param #ARTY self ARTY object.
|
||||||
|
-- @param #ARTY.Target target Target of the weapon.
|
||||||
|
function ARTY._FuncTrack(weapon, self, target)
|
||||||
|
|
||||||
|
-- Coordinate and distance to target.
|
||||||
|
local _coord=weapon.coordinate
|
||||||
|
local _dist=_coord:Get2DDistance(target.coord)
|
||||||
|
local _destroyweapon=false
|
||||||
|
|
||||||
|
-- Debug
|
||||||
|
self:T3(self.lid..string.format("ARTY %s weapon to target dist = %d m", self.groupname,_dist))
|
||||||
|
|
||||||
|
if target.weapontype==ARTY.WeaponType.IlluminationShells then
|
||||||
|
|
||||||
|
-- Check if within distace.
|
||||||
|
if _dist<target.radius then
|
||||||
|
|
||||||
|
-- Get random coordinate within certain radius of the target.
|
||||||
|
local _cr=target.coord:GetRandomCoordinateInRadius(target.radius)
|
||||||
|
|
||||||
|
-- Get random altitude over target.
|
||||||
|
local _alt=_cr:GetLandHeight()+math.random(self.illuMinalt, self.illuMaxalt)
|
||||||
|
|
||||||
|
-- Adjust explosion height of coordinate.
|
||||||
|
local _ci=COORDINATE:New(_cr.x,_alt,_cr.z)
|
||||||
|
|
||||||
|
-- Create illumination flare.
|
||||||
|
_ci:IlluminationBomb(self.illuPower)
|
||||||
|
|
||||||
|
-- Destroy actual shell.
|
||||||
|
_destroyweapon=true
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif target.weapontype==ARTY.WeaponType.SmokeShells then
|
||||||
|
|
||||||
|
if _dist<target.radius then
|
||||||
|
|
||||||
|
-- Get random coordinate within a certain radius.
|
||||||
|
local _cr=_coord:GetRandomCoordinateInRadius(_data.target.radius)
|
||||||
|
|
||||||
|
-- Fire smoke at this coordinate.
|
||||||
|
_cr:Smoke(self.smokeColor)
|
||||||
|
|
||||||
|
-- Destroy actual shell.
|
||||||
|
_destroyweapon=true
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
if _destroyweapon then
|
||||||
|
|
||||||
|
self:T2(self.lid..string.format("ARTY %s destroying shell, stopping timer.", self.groupname))
|
||||||
|
|
||||||
|
-- Destroy weapon and stop timer.
|
||||||
|
weapon:Destroy()
|
||||||
|
|
||||||
|
-- No more tracking.
|
||||||
|
weapon.tracking=false
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Function called after impact of weapon.
|
||||||
|
-- @param Wrapper.Weapon#WEAPON weapon Weapon object.
|
||||||
|
-- @param #ARTY self ARTY object.
|
||||||
|
-- @param #ARTY.Target target Target of the weapon.
|
||||||
|
function ARTY._FuncImpact(weapon, self, target)
|
||||||
|
|
||||||
|
-- Debug info.
|
||||||
|
self:I(self.lid..string.format("ARTY %s weapon NOT ALIVE any more.", self.groupname))
|
||||||
|
|
||||||
|
-- Get impact coordinate.
|
||||||
|
local _impactcoord=weapon:GetImpactCoordinate()
|
||||||
|
|
||||||
|
-- Create a "nuclear" explosion and blast at the impact point.
|
||||||
|
if target.weapontype==ARTY.WeaponType.TacticalNukes then
|
||||||
|
self:T(self.lid..string.format("ARTY %s triggering nuclear explosion in one second.", self.groupname))
|
||||||
|
--SCHEDULER:New(nil, ARTY._NuclearBlast, {self,_impactcoord}, 1.0)
|
||||||
|
self:ScheduleOnce(1.0, ARTY._NuclearBlast, self, _impactcoord)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Eventhandler for shot event.
|
--- Eventhandler for shot event.
|
||||||
-- @param #ARTY self
|
-- @param #ARTY self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
@@ -2162,128 +2264,32 @@ function ARTY:OnEventShot(EventData)
|
|||||||
self:T(self.lid..text)
|
self:T(self.lid..text)
|
||||||
MESSAGE:New(text, 5):Clear():ToAllIf(self.report or self.Debug)
|
MESSAGE:New(text, 5):Clear():ToAllIf(self.report or self.Debug)
|
||||||
|
|
||||||
-- Last known position of the weapon fired.
|
|
||||||
local _lastpos={x=0, y=0, z=0}
|
|
||||||
|
|
||||||
--- Track the position of the weapon if it is supposed to model a tac nuke, illumination or smoke shell.
|
|
||||||
-- @param #table _weapon
|
|
||||||
local function _TrackWeapon(_data)
|
|
||||||
|
|
||||||
-- When the pcall status returns false the weapon has hit.
|
|
||||||
local _weaponalive,_currpos = pcall(
|
|
||||||
function()
|
|
||||||
return _data.weapon:getPoint()
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Debug
|
|
||||||
self:T3(self.lid..string.format("ARTY %s: Weapon still in air: %s", self.groupname, tostring(_weaponalive)))
|
|
||||||
|
|
||||||
-- Destroy weapon before impact.
|
|
||||||
local _destroyweapon=false
|
|
||||||
|
|
||||||
if _weaponalive then
|
|
||||||
|
|
||||||
-- Update last position.
|
|
||||||
_lastpos={x=_currpos.x, y=_currpos.y, z=_currpos.z}
|
|
||||||
|
|
||||||
-- Coordinate and distance to target.
|
|
||||||
local _coord=COORDINATE:NewFromVec3(_lastpos)
|
|
||||||
local _dist=_coord:Get2DDistance(_data.target.coord)
|
|
||||||
|
|
||||||
-- Debug
|
|
||||||
self:T3(self.lid..string.format("ARTY %s weapon to target dist = %d m", self.groupname,_dist))
|
|
||||||
|
|
||||||
if _data.target.weapontype==ARTY.WeaponType.IlluminationShells then
|
|
||||||
|
|
||||||
-- Check if within distace.
|
|
||||||
if _dist<_data.target.radius then
|
|
||||||
|
|
||||||
-- Get random coordinate within certain radius of the target.
|
|
||||||
local _cr=_data.target.coord:GetRandomCoordinateInRadius(_data.target.radius)
|
|
||||||
|
|
||||||
-- Get random altitude over target.
|
|
||||||
local _alt=_cr:GetLandHeight()+math.random(self.illuMinalt, self.illuMaxalt)
|
|
||||||
|
|
||||||
-- Adjust explosion height of coordinate.
|
|
||||||
local _ci=COORDINATE:New(_cr.x,_alt,_cr.z)
|
|
||||||
|
|
||||||
-- Create illumination flare.
|
|
||||||
_ci:IlluminationBomb(self.illuPower)
|
|
||||||
|
|
||||||
-- Destroy actual shell.
|
|
||||||
_destroyweapon=true
|
|
||||||
end
|
|
||||||
|
|
||||||
elseif _data.target.weapontype==ARTY.WeaponType.SmokeShells then
|
|
||||||
|
|
||||||
if _dist<_data.target.radius then
|
|
||||||
|
|
||||||
-- Get random coordinate within a certain radius.
|
|
||||||
local _cr=_coord:GetRandomCoordinateInRadius(_data.target.radius)
|
|
||||||
|
|
||||||
-- Fire smoke at this coordinate.
|
|
||||||
_cr:Smoke(self.smokeColor)
|
|
||||||
|
|
||||||
-- Destroy actual shell.
|
|
||||||
_destroyweapon=true
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
if _destroyweapon then
|
|
||||||
|
|
||||||
self:T2(self.lid..string.format("ARTY %s destroying shell, stopping timer.", self.groupname))
|
|
||||||
|
|
||||||
-- Destroy weapon and stop timer.
|
|
||||||
_data.weapon:destroy()
|
|
||||||
return nil
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
-- TODO: Make dt input parameter.
|
|
||||||
local dt=0.02
|
|
||||||
|
|
||||||
self:T3(self.lid..string.format("ARTY %s tracking weapon again in %.3f seconds", self.groupname, dt))
|
|
||||||
|
|
||||||
-- Check again in 0.05 seconds.
|
|
||||||
return timer.getTime() + dt
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
-- Get impact coordinate.
|
|
||||||
local _impactcoord=COORDINATE:NewFromVec3(_lastpos)
|
|
||||||
|
|
||||||
self:I(self.lid..string.format("ARTY %s weapon NOT ALIVE any more.", self.groupname))
|
|
||||||
|
|
||||||
-- Create a "nuclear" explosion and blast at the impact point.
|
|
||||||
if _data.target.weapontype==ARTY.WeaponType.TacticalNukes then
|
|
||||||
self:T(self.lid..string.format("ARTY %s triggering nuclear explosion in one second.", self.groupname))
|
|
||||||
SCHEDULER:New(nil, ARTY._NuclearBlast, {self,_impactcoord}, 1.0)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Stop timer.
|
|
||||||
return nil
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Start track the shell if we want to model a tactical nuke.
|
-- Start track the shell if we want to model a tactical nuke.
|
||||||
local _tracknuke = self.currentTarget.weapontype==ARTY.WeaponType.TacticalNukes and self.Nukes>0
|
local _tracknuke = self.currentTarget.weapontype==ARTY.WeaponType.TacticalNukes and self.Nukes>0
|
||||||
local _trackillu = self.currentTarget.weapontype==ARTY.WeaponType.IlluminationShells and self.Nillu>0
|
local _trackillu = self.currentTarget.weapontype==ARTY.WeaponType.IlluminationShells and self.Nillu>0
|
||||||
local _tracksmoke = self.currentTarget.weapontype==ARTY.WeaponType.SmokeShells and self.Nsmoke>0
|
local _tracksmoke = self.currentTarget.weapontype==ARTY.WeaponType.SmokeShells and self.Nsmoke>0
|
||||||
|
|
||||||
|
|
||||||
if _tracknuke or _trackillu or _tracksmoke then
|
if _tracknuke or _trackillu or _tracksmoke then
|
||||||
|
|
||||||
self:T(self.lid..string.format("ARTY %s: Tracking of weapon starts in two seconds.", self.groupname))
|
-- Debug info.
|
||||||
|
self:T(self.lid..string.format("ARTY %s: Tracking of weapon starts in two seconds.", self.groupname))
|
||||||
local _peter={}
|
|
||||||
_peter.weapon=EventData.weapon
|
-- Create a weapon object.
|
||||||
_peter.target=UTILS.DeepCopy(self.currentTarget)
|
local weapon=WEAPON:New(EventData.weapon)
|
||||||
|
|
||||||
timer.scheduleFunction(_TrackWeapon, _peter, timer.getTime() + 2.0)
|
-- Set time step for tracking.
|
||||||
|
weapon:SetTimeStepTrack(self.dtTrack)
|
||||||
|
|
||||||
|
-- Copy target. We need a copy because it might already be overwritten with the next target during flight of weapon.
|
||||||
|
local target=UTILS.DeepCopy(self.currentTarget)
|
||||||
|
|
||||||
|
-- Set callback functions.
|
||||||
|
weapon:SetFuncTrack(ARTY._FuncTrack, self, target)
|
||||||
|
weapon:SetFuncImpact(ARTY._FuncImpact, self, target)
|
||||||
|
|
||||||
|
-- Start tracking in 2 sec (arty ammo should fly a bit).
|
||||||
|
weapon:StartTrack(2)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Get current ammo.
|
-- Get current ammo.
|
||||||
@@ -3422,7 +3428,7 @@ function ARTY:onafterMove(Controllable, From, Event, To, move)
|
|||||||
-- Set current move.
|
-- Set current move.
|
||||||
self.currentMove=move
|
self.currentMove=move
|
||||||
|
|
||||||
-- Route group to coodinate.
|
-- Route group to coordinate.
|
||||||
self:_Move(self.Controllable, move.coord, move.speed, move.onroad)
|
self:_Move(self.Controllable, move.coord, move.speed, move.onroad)
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -3540,9 +3546,7 @@ end
|
|||||||
-- @param #string To To state.
|
-- @param #string To To state.
|
||||||
function ARTY:onafterRespawn(Controllable, From, Event, To)
|
function ARTY:onafterRespawn(Controllable, From, Event, To)
|
||||||
self:_EventFromTo("onafterRespawn", Event, From, To)
|
self:_EventFromTo("onafterRespawn", Event, From, To)
|
||||||
|
self:I("Respawning arty group")
|
||||||
env.info("FF Respawning arty group")
|
|
||||||
|
|
||||||
local group=self.Controllable --Wrapper.Group#GROUP
|
local group=self.Controllable --Wrapper.Group#GROUP
|
||||||
|
|
||||||
-- Respawn group.
|
-- Respawn group.
|
||||||
@@ -3931,9 +3935,10 @@ function ARTY:GetAmmo(display)
|
|||||||
return nammo, nshells, nrockets, nmissiles
|
return nammo, nshells, nrockets, nmissiles
|
||||||
end
|
end
|
||||||
|
|
||||||
for _,unit in pairs(units) do
|
for _,_unit in pairs(units) do
|
||||||
|
local unit=_unit --Wrapper.Unit#UNIT
|
||||||
|
|
||||||
if unit and unit:IsAlive() then
|
if unit then
|
||||||
|
|
||||||
-- Output.
|
-- Output.
|
||||||
local text=string.format("ARTY group %s - unit %s:\n", self.groupname, unit:GetName())
|
local text=string.format("ARTY group %s - unit %s:\n", self.groupname, unit:GetName())
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **Functional** -- Keep airbases clean of crashing or colliding airplanes, and kill missiles when being fired at airbases.
|
--- **Functional** - Keep airbases clean of crashing or colliding airplanes, and kill missiles when being fired at airbases.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [CLA - CleanUp Airbase](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CLA%20-%20CleanUp%20Airbase)
|
-- [CLA - CleanUp Airbase](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/CleanUp)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **Functional** -- Management of target **Designation**. Lase, smoke and illuminate targets.
|
--- **Functional** - Management of target **Designation**. Lase, smoke and illuminate targets.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -15,10 +15,12 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Additional Material:
|
||||||
--
|
--
|
||||||
-- [DES - Designation](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/DES%20-%20Designation)
|
-- * **Demo Missions:** [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Designate)
|
||||||
--
|
-- * **YouTube videos:** None
|
||||||
|
-- * **Guides:** None
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- Targets detected by recce will be communicated to a group of attacking players.
|
-- Targets detected by recce will be communicated to a group of attacking players.
|
||||||
@@ -48,7 +50,7 @@
|
|||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
-- A typical mission setup would require Recce (a @{Set} of Recce) to be detecting potential targets.
|
-- A typical mission setup would require Recce (a @{Core.Set} of Recce) to be detecting potential targets.
|
||||||
-- The DetectionObject will group the detected targets based on the detection method being used.
|
-- The DetectionObject will group the detected targets based on the detection method being used.
|
||||||
-- Possible detection methods could be by Area, by Type or by Unit.
|
-- Possible detection methods could be by Area, by Type or by Unit.
|
||||||
-- Each grouping will result in a **TargetGroup**, for terminology and clarity we will use this term throughout the document.
|
-- Each grouping will result in a **TargetGroup**, for terminology and clarity we will use this term throughout the document.
|
||||||
@@ -167,9 +169,9 @@
|
|||||||
--
|
--
|
||||||
-- ### Contributions:
|
-- ### Contributions:
|
||||||
--
|
--
|
||||||
-- * [**Ciribob**](https://forums.eagle.ru/member.php?u=112175): Showing the way how to lase targets + how laser codes work!!! Explained the autolase script.
|
-- * **Ciribob**: Showing the way how to lase targets + how laser codes work!!! Explained the autolase script.
|
||||||
-- * [**EasyEB**](https://forums.eagle.ru/member.php?u=112055): Ideas and Beta Testing
|
-- * **EasyEB**: Ideas and Beta Testing
|
||||||
-- * [**Wingthor**](https://forums.eagle.ru/member.php?u=123698): Beta Testing
|
-- * **Wingthor**: Beta Testing
|
||||||
--
|
--
|
||||||
-- ### Authors:
|
-- ### Authors:
|
||||||
--
|
--
|
||||||
@@ -276,7 +278,7 @@ do -- DESIGNATE
|
|||||||
-- # 7. Designate Menu Location for a Mission
|
-- # 7. Designate Menu Location for a Mission
|
||||||
--
|
--
|
||||||
-- You can make DESIGNATE work for a @{Tasking.Mission#MISSION} object. In this way, the designate menu will not appear in the root of the radio menu, but in the menu of the Mission.
|
-- You can make DESIGNATE work for a @{Tasking.Mission#MISSION} object. In this way, the designate menu will not appear in the root of the radio menu, but in the menu of the Mission.
|
||||||
-- Use the method @{#DESIGNATE.SetMission}() to set the @{Mission} object for the designate function.
|
-- Use the method @{#DESIGNATE.SetMission}() to set the @{Tasking.Mission} object for the designate function.
|
||||||
--
|
--
|
||||||
-- # 8. Status Report
|
-- # 8. Status Report
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **Functional** -- Models the detection of enemy units by FACs or RECCEs and group them according various methods.
|
--- **Functional** - Models the detection of enemy units by FACs or RECCEs and group them according various methods.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [DET - Detection](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/DET%20-%20Detection)
|
-- [DET - Detection](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/Functional/Detection)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -38,9 +38,10 @@
|
|||||||
-- @image Detection.JPG
|
-- @image Detection.JPG
|
||||||
|
|
||||||
do -- DETECTION_BASE
|
do -- DETECTION_BASE
|
||||||
|
|
||||||
--- @type DETECTION_BASE
|
---
|
||||||
-- @field Core.Set#SET_GROUP DetectionSetGroup The @{Set} of GROUPs in the Forward Air Controller role.
|
-- @type DETECTION_BASE
|
||||||
|
-- @field Core.Set#SET_GROUP DetectionSetGroup The @{Core.Set} of GROUPs in the Forward Air Controller role.
|
||||||
-- @field DCS#Distance DetectionRange The range till which targets are accepted to be detected.
|
-- @field DCS#Distance DetectionRange The range till which targets are accepted to be detected.
|
||||||
-- @field #DETECTION_BASE.DetectedObjects DetectedObjects The list of detected objects.
|
-- @field #DETECTION_BASE.DetectedObjects DetectedObjects The list of detected objects.
|
||||||
-- @field #table DetectedObjectsIdentified Map of the DetectedObjects identified.
|
-- @field #table DetectedObjectsIdentified Map of the DetectedObjects identified.
|
||||||
@@ -91,6 +92,11 @@ do -- DETECTION_BASE
|
|||||||
--
|
--
|
||||||
-- DetectionObject:FilterCategories( { Unit.Category.AIRPLANE, Unit.Category.HELICOPTER } )
|
-- DetectionObject:FilterCategories( { Unit.Category.AIRPLANE, Unit.Category.HELICOPTER } )
|
||||||
--
|
--
|
||||||
|
--
|
||||||
|
-- ## Radar Blur - use to make the radar less exact, e.g. for WWII scenarios
|
||||||
|
--
|
||||||
|
-- * @{#DETECTION_BASE.SetRadarBlur}(): Set the radar blur to be used.
|
||||||
|
--
|
||||||
-- ## **DETECTION_ derived classes** group the detected units into a **DetectedItems[]** list
|
-- ## **DETECTION_ derived classes** group the detected units into a **DetectedItems[]** list
|
||||||
--
|
--
|
||||||
-- DETECTION_BASE derived classes build a list called DetectedItems[], which is essentially a first later
|
-- DETECTION_BASE derived classes build a list called DetectedItems[], which is essentially a first later
|
||||||
@@ -268,11 +274,13 @@ do -- DETECTION_BASE
|
|||||||
DetectedItems = {},
|
DetectedItems = {},
|
||||||
DetectedItemsByIndex = {},
|
DetectedItemsByIndex = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
--- @type DETECTION_BASE.DetectedObjects
|
---
|
||||||
|
-- @type DETECTION_BASE.DetectedObjects
|
||||||
-- @list <#DETECTION_BASE.DetectedObject>
|
-- @list <#DETECTION_BASE.DetectedObject>
|
||||||
|
|
||||||
--- @type DETECTION_BASE.DetectedObject
|
---
|
||||||
|
-- @type DETECTION_BASE.DetectedObject
|
||||||
-- @field #string Name
|
-- @field #string Name
|
||||||
-- @field #boolean IsVisible
|
-- @field #boolean IsVisible
|
||||||
-- @field #boolean KnowType
|
-- @field #boolean KnowType
|
||||||
@@ -283,8 +291,9 @@ do -- DETECTION_BASE
|
|||||||
-- @field #number LastTime
|
-- @field #number LastTime
|
||||||
-- @field #boolean LastPos
|
-- @field #boolean LastPos
|
||||||
-- @field #number LastVelocity
|
-- @field #number LastVelocity
|
||||||
|
|
||||||
--- @type DETECTION_BASE.DetectedItems
|
---
|
||||||
|
-- @type DETECTION_BASE.DetectedItems
|
||||||
-- @list <#DETECTION_BASE.DetectedItem>
|
-- @list <#DETECTION_BASE.DetectedItem>
|
||||||
|
|
||||||
--- Detected item data structure.
|
--- Detected item data structure.
|
||||||
@@ -318,7 +327,7 @@ do -- DETECTION_BASE
|
|||||||
|
|
||||||
--- DETECTION constructor.
|
--- DETECTION constructor.
|
||||||
-- @param #DETECTION_BASE self
|
-- @param #DETECTION_BASE self
|
||||||
-- @param Core.Set#SET_GROUP DetectionSet The @{Set} of @{Group}s that is used to detect the units.
|
-- @param Core.Set#SET_GROUP DetectionSet The @{Core.Set} of @{Wrapper.Group}s that is used to detect the units.
|
||||||
-- @return #DETECTION_BASE self
|
-- @return #DETECTION_BASE self
|
||||||
function DETECTION_BASE:New( DetectionSet )
|
function DETECTION_BASE:New( DetectionSet )
|
||||||
|
|
||||||
@@ -474,7 +483,7 @@ do -- DETECTION_BASE
|
|||||||
-- @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.
|
||||||
-- @param #table DetectedItem The DetectedItem.
|
-- @param #DetectedItem DetectedItem The DetectedItem data structure.
|
||||||
|
|
||||||
self:AddTransition( "*", "Stop", "Stopped" )
|
self:AddTransition( "*", "Stop", "Stopped" )
|
||||||
|
|
||||||
@@ -522,7 +531,7 @@ do -- DETECTION_BASE
|
|||||||
|
|
||||||
do -- State Transition Handling
|
do -- State Transition Handling
|
||||||
|
|
||||||
--- @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.
|
||||||
-- @param #string To The To State string.
|
-- @param #string To The To State string.
|
||||||
@@ -530,7 +539,7 @@ do -- DETECTION_BASE
|
|||||||
self:__Detect( 1 )
|
self:__Detect( 1 )
|
||||||
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.
|
||||||
-- @param #string To The To State string.
|
-- @param #string To The To State string.
|
||||||
@@ -570,7 +579,7 @@ do -- DETECTION_BASE
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #DETECTION_BASE self
|
-- @param #DETECTION_BASE self
|
||||||
-- @param #number The amount of alive recce.
|
-- @param #number The amount of alive recce.
|
||||||
function DETECTION_BASE:CountAliveRecce()
|
function DETECTION_BASE:CountAliveRecce()
|
||||||
|
|
||||||
@@ -578,7 +587,7 @@ do -- DETECTION_BASE
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #DETECTION_BASE self
|
-- @param #DETECTION_BASE self
|
||||||
function DETECTION_BASE:ForEachAliveRecce( IteratorFunction, ... )
|
function DETECTION_BASE:ForEachAliveRecce( IteratorFunction, ... )
|
||||||
self:F2( arg )
|
self:F2( arg )
|
||||||
|
|
||||||
@@ -587,7 +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.
|
||||||
-- @param #string To The To State string.
|
-- @param #string To The To State string.
|
||||||
@@ -712,6 +721,31 @@ do -- DETECTION_BASE
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Calculate radar blur probability
|
||||||
|
|
||||||
|
if self.RadarBlur then
|
||||||
|
MESSAGE:New("Radar Blur",10):ToLogIf(self.debug):ToAllIf(self.verbose)
|
||||||
|
local minheight = self.RadarBlurMinHeight or 250 -- meters
|
||||||
|
local thresheight = self.RadarBlurThresHeight or 90 -- 10% chance to find a low flying group
|
||||||
|
local thresblur = self.RadarBlurThresBlur or 85 -- 25% chance to escape the radar overall
|
||||||
|
local dist = math.floor(Distance)
|
||||||
|
if dist <= self.RadarBlurClosing then
|
||||||
|
thresheight = (((dist*dist)/self.RadarBlurClosingSquare)*thresheight)
|
||||||
|
thresblur = (((dist*dist)/self.RadarBlurClosingSquare)*thresblur)
|
||||||
|
end
|
||||||
|
local fheight = math.floor(math.random(1,10000)/100)
|
||||||
|
local fblur = math.floor(math.random(1,10000)/100)
|
||||||
|
local unit = UNIT:FindByName(DetectedObjectName)
|
||||||
|
if unit and unit:IsAlive() then
|
||||||
|
local AGL = unit:GetAltitude(true)
|
||||||
|
MESSAGE:New("Unit "..DetectedObjectName.." is at "..math.floor(AGL).."m. Distance "..math.floor(Distance).."km.",10):ToLogIf(self.debug):ToAllIf(self.verbose)
|
||||||
|
MESSAGE:New(string.format("fheight = %d/%d | fblur = %d/%d",fheight,thresheight,fblur,thresblur),10):ToLogIf(self.debug):ToAllIf(self.verbose)
|
||||||
|
if fblur > thresblur then DetectionAccepted = false end
|
||||||
|
if AGL <= minheight and fheight < thresheight then DetectionAccepted = false end
|
||||||
|
MESSAGE:New("Detection Accepted = "..tostring(DetectionAccepted),10):ToLogIf(self.debug):ToAllIf(self.verbose)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Calculate additional probabilities
|
-- Calculate additional probabilities
|
||||||
|
|
||||||
if not self.DetectedObjects[DetectedObjectName] and TargetIsVisible and self.DistanceProbability then
|
if not self.DetectedObjects[DetectedObjectName] and TargetIsVisible and self.DistanceProbability then
|
||||||
@@ -1011,7 +1045,24 @@ do -- DETECTION_BASE
|
|||||||
return self
|
return self
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Method to make the radar detection less accurate, e.g. for WWII scenarios.
|
||||||
|
-- @param #DETECTION_BASE self
|
||||||
|
-- @param #number minheight Minimum flight height to be detected, in meters AGL (above ground)
|
||||||
|
-- @param #number thresheight Threshold to escape the radar if flying below minheight, defaults to 90 (90% escape chance)
|
||||||
|
-- @param #number thresblur Threshold to be detected by the radar overall, defaults to 85 (85% chance to be found)
|
||||||
|
-- @param #number closing Closing-in in km - the limit of km from which on it becomes increasingly difficult to escape radar detection if flying towards the radar position. Should be about 1/3 of the radar detection radius in kilometers, defaults to 20.
|
||||||
|
-- @return #DETECTION_BASE self
|
||||||
|
function DETECTION_BASE:SetRadarBlur(minheight,thresheight,thresblur,closing)
|
||||||
|
self.RadarBlur = true
|
||||||
|
self.RadarBlurMinHeight = minheight or 250 -- meters
|
||||||
|
self.RadarBlurThresHeight = thresheight or 90 -- 10% chance to find a low flying group
|
||||||
|
self.RadarBlurThresBlur = thresblur or 85 -- 25% chance to escape the radar overall
|
||||||
|
self.RadarBlurClosing = closing or 20 -- 20km
|
||||||
|
self.RadarBlurClosingSquare = self.RadarBlurClosing * self.RadarBlurClosing
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
do
|
do
|
||||||
@@ -1354,7 +1405,7 @@ do -- DETECTION_BASE
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
--- @param DCS#Unit FoundDCSUnit
|
-- @param DCS#Unit FoundDCSUnit
|
||||||
-- @param Wrapper.Group#GROUP ReportGroup
|
-- @param Wrapper.Group#GROUP ReportGroup
|
||||||
-- @param Core.Set#SET_GROUP ReportSetGroup
|
-- @param Core.Set#SET_GROUP ReportSetGroup
|
||||||
local FindNearByFriendlies = function( FoundDCSUnit, ReportGroupData )
|
local FindNearByFriendlies = function( FoundDCSUnit, ReportGroupData )
|
||||||
@@ -1419,7 +1470,7 @@ do -- DETECTION_BASE
|
|||||||
DetectedItem.PlayersNearBy = nil
|
DetectedItem.PlayersNearBy = nil
|
||||||
|
|
||||||
_DATABASE:ForEachPlayer(
|
_DATABASE:ForEachPlayer(
|
||||||
--- @param Wrapper.Unit#UNIT PlayerUnit
|
-- @param Wrapper.Unit#UNIT PlayerUnit
|
||||||
function( PlayerUnitName )
|
function( PlayerUnitName )
|
||||||
local PlayerUnit = UNIT:FindByName( PlayerUnitName )
|
local PlayerUnit = UNIT:FindByName( PlayerUnitName )
|
||||||
|
|
||||||
@@ -1975,14 +2026,15 @@ do -- DETECTION_BASE
|
|||||||
end
|
end
|
||||||
|
|
||||||
do -- DETECTION_UNITS
|
do -- DETECTION_UNITS
|
||||||
|
|
||||||
--- @type DETECTION_UNITS
|
---
|
||||||
|
-- @type DETECTION_UNITS
|
||||||
-- @field DCS#Distance DetectionRange The range till which targets are detected.
|
-- @field DCS#Distance DetectionRange The range till which targets are detected.
|
||||||
-- @extends Functional.Detection#DETECTION_BASE
|
-- @extends Functional.Detection#DETECTION_BASE
|
||||||
|
|
||||||
--- Will detect units within the battle zone.
|
--- Will detect units within the battle zone.
|
||||||
--
|
--
|
||||||
-- It will build a DetectedItems list filled with DetectedItems. Each DetectedItem will contain a field Set, which contains a @{Core.Set#SET_UNIT} containing ONE @{UNIT} object reference.
|
-- It will build a DetectedItems list filled with DetectedItems. Each DetectedItem will contain a field Set, which contains a @{Core.Set#SET_UNIT} containing ONE @{Wrapper.Unit#UNIT} object reference.
|
||||||
-- Beware that when the amount of units detected is large, the DetectedItems list will be large also.
|
-- Beware that when the amount of units detected is large, the DetectedItems list will be large also.
|
||||||
--
|
--
|
||||||
-- @field #DETECTION_UNITS
|
-- @field #DETECTION_UNITS
|
||||||
@@ -1993,7 +2045,7 @@ do -- DETECTION_UNITS
|
|||||||
|
|
||||||
--- DETECTION_UNITS constructor.
|
--- DETECTION_UNITS constructor.
|
||||||
-- @param Functional.Detection#DETECTION_UNITS self
|
-- @param Functional.Detection#DETECTION_UNITS self
|
||||||
-- @param Core.Set#SET_GROUP DetectionSetGroup The @{Set} of GROUPs in the Forward Air Controller role.
|
-- @param Core.Set#SET_GROUP DetectionSetGroup The @{Core.Set} of GROUPs in the Forward Air Controller role.
|
||||||
-- @return Functional.Detection#DETECTION_UNITS self
|
-- @return Functional.Detection#DETECTION_UNITS self
|
||||||
function DETECTION_UNITS:New( DetectionSetGroup )
|
function DETECTION_UNITS:New( DetectionSetGroup )
|
||||||
|
|
||||||
@@ -2231,13 +2283,14 @@ do -- DETECTION_UNITS
|
|||||||
end
|
end
|
||||||
|
|
||||||
do -- DETECTION_TYPES
|
do -- DETECTION_TYPES
|
||||||
|
|
||||||
--- @type DETECTION_TYPES
|
---
|
||||||
|
-- @type DETECTION_TYPES
|
||||||
-- @extends Functional.Detection#DETECTION_BASE
|
-- @extends Functional.Detection#DETECTION_BASE
|
||||||
|
|
||||||
--- Will detect units within the battle zone.
|
--- Will detect units within the battle zone.
|
||||||
-- It will build a DetectedItems[] list filled with DetectedItems, grouped by the type of units detected.
|
-- It will build a DetectedItems[] list filled with DetectedItems, grouped by the type of units detected.
|
||||||
-- Each DetectedItem will contain a field Set, which contains a @{Core.Set#SET_UNIT} containing ONE @{UNIT} object reference.
|
-- Each DetectedItem will contain a field Set, which contains a @{Core.Set#SET_UNIT} containing ONE @{Wrapper.Unit#UNIT} object reference.
|
||||||
-- Beware that when the amount of different types detected is large, the DetectedItems[] list will be large also.
|
-- Beware that when the amount of different types detected is large, the DetectedItems[] list will be large also.
|
||||||
--
|
--
|
||||||
-- @field #DETECTION_TYPES
|
-- @field #DETECTION_TYPES
|
||||||
@@ -2248,7 +2301,7 @@ do -- DETECTION_TYPES
|
|||||||
|
|
||||||
--- DETECTION_TYPES constructor.
|
--- DETECTION_TYPES constructor.
|
||||||
-- @param Functional.Detection#DETECTION_TYPES self
|
-- @param Functional.Detection#DETECTION_TYPES self
|
||||||
-- @param Core.Set#SET_GROUP DetectionSetGroup The @{Set} of GROUPs in the Recce role.
|
-- @param Core.Set#SET_GROUP DetectionSetGroup The @{Core.Set} of GROUPs in the Recce role.
|
||||||
-- @return Functional.Detection#DETECTION_TYPES self
|
-- @return Functional.Detection#DETECTION_TYPES self
|
||||||
function DETECTION_TYPES:New( DetectionSetGroup )
|
function DETECTION_TYPES:New( DetectionSetGroup )
|
||||||
|
|
||||||
@@ -2354,6 +2407,7 @@ do -- DETECTION_TYPES
|
|||||||
if not DetectedItem then
|
if not DetectedItem then
|
||||||
DetectedItem = self:AddDetectedItem( "TYPE", DetectedTypeName )
|
DetectedItem = self:AddDetectedItem( "TYPE", DetectedTypeName )
|
||||||
DetectedItem.TypeName = DetectedTypeName
|
DetectedItem.TypeName = DetectedTypeName
|
||||||
|
DetectedItem.Name = DetectedUnitName -- fix by @Nocke
|
||||||
end
|
end
|
||||||
|
|
||||||
DetectedItem.Set:AddUnit( DetectedUnit )
|
DetectedItem.Set:AddUnit( DetectedUnit )
|
||||||
@@ -2433,10 +2487,11 @@ do -- DETECTION_TYPES
|
|||||||
end
|
end
|
||||||
|
|
||||||
do -- DETECTION_AREAS
|
do -- DETECTION_AREAS
|
||||||
|
|
||||||
--- @type DETECTION_AREAS
|
---
|
||||||
|
-- @type DETECTION_AREAS
|
||||||
-- @field DCS#Distance DetectionZoneRange The range till which targets are grouped upon the first detected target.
|
-- @field DCS#Distance DetectionZoneRange The range till which targets are grouped upon the first detected target.
|
||||||
-- @field #DETECTION_BASE.DetectedItems DetectedItems A list of areas containing the set of @{Wrapper.Unit}s, @{Zone}s, the center @{Wrapper.Unit} within the zone, and ID of each area that was detected within a DetectionZoneRange.
|
-- @field #DETECTION_BASE.DetectedItems DetectedItems A list of areas containing the set of @{Wrapper.Unit}s, @{Core.Zone}s, the center @{Wrapper.Unit} within the zone, and ID of each area that was detected within a DetectionZoneRange.
|
||||||
-- @extends Functional.Detection#DETECTION_BASE
|
-- @extends Functional.Detection#DETECTION_BASE
|
||||||
|
|
||||||
--- Detect units within the battle zone for a list of @{Wrapper.Group}s detecting targets following (a) detection method(s),
|
--- Detect units within the battle zone for a list of @{Wrapper.Group}s detecting targets following (a) detection method(s),
|
||||||
@@ -2451,7 +2506,7 @@ do -- DETECTION_AREAS
|
|||||||
--
|
--
|
||||||
-- Retrieve the DetectedItems[].Set with the method @{Functional.Detection#DETECTION_BASE.GetDetectedSet}(). A @{Core.Set#SET_UNIT} object will be returned.
|
-- Retrieve the DetectedItems[].Set with the method @{Functional.Detection#DETECTION_BASE.GetDetectedSet}(). A @{Core.Set#SET_UNIT} object will be returned.
|
||||||
--
|
--
|
||||||
-- Retrieve the formed @{Zone@ZONE_UNIT}s as a result of the grouping the detected units within the DetectionZoneRange, use the method @{Functional.Detection#DETECTION_AREAS.GetDetectionZones}().
|
-- Retrieve the formed @{Core.Zone@ZONE_UNIT}s as a result of the grouping the detected units within the DetectionZoneRange, use the method @{Functional.Detection#DETECTION_AREAS.GetDetectionZones}().
|
||||||
-- To understand the amount of zones created, use the method @{Functional.Detection#DETECTION_AREAS.GetDetectionZoneCount}().
|
-- To understand the amount of zones created, use the method @{Functional.Detection#DETECTION_AREAS.GetDetectionZoneCount}().
|
||||||
-- If you want to obtain a specific zone from the DetectedZones, use the method @{Functional.Detection#DETECTION_AREAS.GetDetectionZoneByID}() with a given index.
|
-- If you want to obtain a specific zone from the DetectedZones, use the method @{Functional.Detection#DETECTION_AREAS.GetDetectionZoneByID}() with a given index.
|
||||||
--
|
--
|
||||||
@@ -2477,15 +2532,15 @@ do -- DETECTION_AREAS
|
|||||||
|
|
||||||
--- DETECTION_AREAS constructor.
|
--- DETECTION_AREAS constructor.
|
||||||
-- @param #DETECTION_AREAS self
|
-- @param #DETECTION_AREAS self
|
||||||
-- @param Core.Set#SET_GROUP DetectionSetGroup The @{Set} of GROUPs in the Forward Air Controller role.
|
-- @param Core.Set#SET_GROUP DetectionSetGroup The @{Core.Set} of GROUPs in the Forward Air Controller role.
|
||||||
-- @param DCS#Distance DetectionZoneRange The range till which targets are grouped upon the first detected target.
|
-- @param #number DetectionZoneRange The range in meters within which targets are grouped upon the first detected target. Default 5000m.
|
||||||
-- @return #DETECTION_AREAS
|
-- @return #DETECTION_AREAS
|
||||||
function DETECTION_AREAS:New( DetectionSetGroup, DetectionZoneRange )
|
function DETECTION_AREAS:New( DetectionSetGroup, DetectionZoneRange )
|
||||||
|
|
||||||
-- Inherits from DETECTION_BASE
|
-- Inherits from DETECTION_BASE
|
||||||
local self = BASE:Inherit( self, DETECTION_BASE:New( DetectionSetGroup ) )
|
local self = BASE:Inherit( self, DETECTION_BASE:New( DetectionSetGroup ) )
|
||||||
|
|
||||||
self.DetectionZoneRange = DetectionZoneRange
|
self.DetectionZoneRange = DetectionZoneRange or 5000
|
||||||
|
|
||||||
self._SmokeDetectedUnits = false
|
self._SmokeDetectedUnits = false
|
||||||
self._FlareDetectedUnits = false
|
self._FlareDetectedUnits = false
|
||||||
@@ -2498,7 +2553,7 @@ do -- DETECTION_AREAS
|
|||||||
|
|
||||||
--- Retrieve set of detected zones.
|
--- Retrieve set of detected zones.
|
||||||
-- @param #DETECTION_AREAS self
|
-- @param #DETECTION_AREAS self
|
||||||
-- @return Core.Set#SET_ZONE The @{Set} of ZONE_UNIT objects detected.
|
-- @return Core.Set#SET_ZONE The @{Core.Set} of ZONE_UNIT objects detected.
|
||||||
function DETECTION_AREAS:GetDetectionZones()
|
function DETECTION_AREAS:GetDetectionZones()
|
||||||
local zoneset = SET_ZONE:New()
|
local zoneset = SET_ZONE:New()
|
||||||
for _ID,_Item in pairs (self.DetectedItems) do
|
for _ID,_Item in pairs (self.DetectedItems) do
|
||||||
@@ -2960,7 +3015,7 @@ do -- DETECTION_AREAS
|
|||||||
|
|
||||||
-- DetectedSet:Flush( self )
|
-- DetectedSet:Flush( self )
|
||||||
|
|
||||||
DetectedSet:ForEachUnit( --- @param Wrapper.Unit#UNIT DetectedUnit
|
DetectedSet:ForEachUnit( -- @param Wrapper.Unit#UNIT DetectedUnit
|
||||||
function( DetectedUnit )
|
function( DetectedUnit )
|
||||||
if DetectedUnit:IsAlive() then
|
if DetectedUnit:IsAlive() then
|
||||||
-- self:T( "Detected Set #" .. DetectedItem.ID .. ":" .. DetectedUnit:GetName() )
|
-- self:T( "Detected Set #" .. DetectedItem.ID .. ":" .. DetectedUnit:GetName() )
|
||||||
@@ -2988,4 +3043,3 @@ do -- DETECTION_AREAS
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
|
--- **Functional** - Captures the class DETECTION_ZONES.
|
||||||
|
-- @module Functional.DetectionZones
|
||||||
|
-- @image MOOSE.JPG
|
||||||
|
|
||||||
do -- DETECTION_ZONES
|
do -- DETECTION_ZONES
|
||||||
|
|
||||||
--- @type DETECTION_ZONES
|
--- @type DETECTION_ZONES
|
||||||
-- @field DCS#Distance DetectionZoneRange The range till which targets are grouped upon the first detected target.
|
-- @field DCS#Distance DetectionZoneRange The range till which targets are grouped upon the first detected target.
|
||||||
-- @field #DETECTION_BASE.DetectedItems DetectedItems A list of areas containing the set of @{Wrapper.Unit}s, @{Zone}s, the center @{Wrapper.Unit} within the zone, and ID of each area that was detected within a DetectionZoneRange.
|
-- @field #DETECTION_BASE.DetectedItems DetectedItems A list of areas containing the set of @{Wrapper.Unit}s, @{Core.Zone}s, the center @{Wrapper.Unit} within the zone, and ID of each area that was detected within a DetectionZoneRange.
|
||||||
-- @extends Functional.Detection#DETECTION_BASE
|
-- @extends Functional.Detection#DETECTION_BASE
|
||||||
|
|
||||||
--- (old, to be revised ) Detect units within the battle zone for a list of @{Core.Zone}s detecting targets following (a) detection method(s),
|
--- (old, to be revised ) Detect units within the battle zone for a list of @{Core.Zone}s detecting targets following (a) detection method(s),
|
||||||
@@ -17,7 +21,7 @@ do -- DETECTION_ZONES
|
|||||||
--
|
--
|
||||||
-- Retrieve the DetectedItems[].Set with the method @{Functional.Detection#DETECTION_BASE.GetDetectedSet}(). A @{Core.Set#SET_UNIT} object will be returned.
|
-- Retrieve the DetectedItems[].Set with the method @{Functional.Detection#DETECTION_BASE.GetDetectedSet}(). A @{Core.Set#SET_UNIT} object will be returned.
|
||||||
--
|
--
|
||||||
-- Retrieve the formed @{Zone@ZONE_UNIT}s as a result of the grouping the detected units within the DetectionZoneRange, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZones}().
|
-- Retrieve the formed @{Core.Zone#ZONE_UNIT}s as a result of the grouping the detected units within the DetectionZoneRange, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZones}().
|
||||||
-- To understand the amount of zones created, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZoneCount}().
|
-- To understand the amount of zones created, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZoneCount}().
|
||||||
-- If you want to obtain a specific zone from the DetectedZones, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZone}() with a given index.
|
-- If you want to obtain a specific zone from the DetectedZones, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZone}() with a given index.
|
||||||
--
|
--
|
||||||
@@ -40,27 +44,27 @@ do -- DETECTION_ZONES
|
|||||||
ClassName = "DETECTION_ZONES",
|
ClassName = "DETECTION_ZONES",
|
||||||
DetectionZoneRange = nil,
|
DetectionZoneRange = nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
--- DETECTION_ZONES constructor.
|
--- DETECTION_ZONES constructor.
|
||||||
-- @param #DETECTION_ZONES self
|
-- @param #DETECTION_ZONES self
|
||||||
-- @param Core.Set#SET_ZONE DetectionSetZone The @{Set} of ZONE_RADIUS.
|
-- @param Core.Set#SET_ZONE DetectionSetZone The @{Core.Set} of ZONE_RADIUS.
|
||||||
-- @param DCS#Coalition.side DetectionCoalition The coalition of the detection.
|
-- @param DCS#Coalition.side DetectionCoalition The coalition of the detection.
|
||||||
-- @return #DETECTION_ZONES
|
-- @return #DETECTION_ZONES
|
||||||
function DETECTION_ZONES:New( DetectionSetZone, DetectionCoalition )
|
function DETECTION_ZONES:New( DetectionSetZone, DetectionCoalition )
|
||||||
|
|
||||||
-- Inherits from DETECTION_BASE
|
-- Inherits from DETECTION_BASE
|
||||||
local self = BASE:Inherit( self, DETECTION_BASE:New( DetectionSetZone ) ) -- #DETECTION_ZONES
|
local self = BASE:Inherit( self, DETECTION_BASE:New( DetectionSetZone ) ) -- #DETECTION_ZONES
|
||||||
|
|
||||||
self.DetectionSetZone = DetectionSetZone -- Core.Set#SET_ZONE
|
self.DetectionSetZone = DetectionSetZone -- Core.Set#SET_ZONE
|
||||||
self.DetectionCoalition = DetectionCoalition
|
self.DetectionCoalition = DetectionCoalition
|
||||||
|
|
||||||
self._SmokeDetectedUnits = false
|
self._SmokeDetectedUnits = false
|
||||||
self._FlareDetectedUnits = false
|
self._FlareDetectedUnits = false
|
||||||
self._SmokeDetectedZones = false
|
self._SmokeDetectedZones = false
|
||||||
self._FlareDetectedZones = false
|
self._FlareDetectedZones = false
|
||||||
self._BoundDetectedZones = false
|
self._BoundDetectedZones = false
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **Functional** -- Taking the lead of AI escorting your flight.
|
--- **Functional** - Taking the lead of AI escorting your flight.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -16,11 +16,13 @@
|
|||||||
-- * Escort tactical situation reporting.
|
-- * Escort tactical situation reporting.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Additional Material:
|
||||||
--
|
--
|
||||||
-- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/ESC%20-%20Escorting)
|
-- * **Demo Missions:** [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Escort)
|
||||||
--
|
-- * **YouTube videos:** None
|
||||||
|
-- * **Guides:** None
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- 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.
|
||||||
@@ -108,8 +110,8 @@
|
|||||||
-- @image Escorting.JPG
|
-- @image Escorting.JPG
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
--- @type ESCORT
|
-- @type ESCORT
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
-- @field Wrapper.Client#CLIENT EscortClient
|
-- @field Wrapper.Client#CLIENT EscortClient
|
||||||
-- @field Wrapper.Group#GROUP EscortGroup
|
-- @field Wrapper.Group#GROUP EscortGroup
|
||||||
@@ -252,7 +254,7 @@ end
|
|||||||
--- Set a Detection method for the EscortClient to be reported upon.
|
--- Set a Detection method for the EscortClient to be reported upon.
|
||||||
-- Detection methods are based on the derived classes from DETECTION_BASE.
|
-- Detection methods are based on the derived classes from DETECTION_BASE.
|
||||||
-- @param #ESCORT self
|
-- @param #ESCORT self
|
||||||
-- @param Function.Detection#DETECTION_BASE Detection
|
-- @param Functional.Detection#DETECTION_BASE Detection
|
||||||
function ESCORT:SetDetection( Detection )
|
function ESCORT:SetDetection( Detection )
|
||||||
|
|
||||||
self.Detection = Detection
|
self.Detection = Detection
|
||||||
@@ -600,7 +602,7 @@ function ESCORT:MenuReportTargets( Seconds )
|
|||||||
self.EscortMenuAttackNearbyTargets = MENU_GROUP:New( self.EscortClient:GetGroup(), "Attack targets", self.EscortMenu )
|
self.EscortMenuAttackNearbyTargets = MENU_GROUP:New( self.EscortClient:GetGroup(), "Attack targets", self.EscortMenu )
|
||||||
|
|
||||||
|
|
||||||
self.ReportTargetsScheduler = SCHEDULER:New( self, self._ReportTargetsScheduler, {}, 1, Seconds )
|
self.ReportTargetsScheduler, self.ReportTargetsSchedulerID = SCHEDULER:New( self, self._ReportTargetsScheduler, {}, 1, Seconds )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -693,7 +695,7 @@ function ESCORT:MenuResumeMission()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #MENUPARAM MenuParam
|
-- @param #MENUPARAM MenuParam
|
||||||
function ESCORT:_HoldPosition( OrbitGroup, OrbitHeight, OrbitSeconds )
|
function ESCORT:_HoldPosition( OrbitGroup, OrbitHeight, OrbitSeconds )
|
||||||
|
|
||||||
local EscortGroup = self.EscortGroup
|
local EscortGroup = self.EscortGroup
|
||||||
@@ -733,7 +735,7 @@ function ESCORT:_HoldPosition( OrbitGroup, OrbitHeight, OrbitSeconds )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #MENUPARAM MenuParam
|
-- @param #MENUPARAM MenuParam
|
||||||
function ESCORT:_JoinUpAndFollow( Distance )
|
function ESCORT:_JoinUpAndFollow( Distance )
|
||||||
|
|
||||||
local EscortGroup = self.EscortGroup
|
local EscortGroup = self.EscortGroup
|
||||||
@@ -766,7 +768,7 @@ function ESCORT:JoinUpAndFollow( EscortGroup, EscortClient, Distance )
|
|||||||
EscortGroup:MessageToClient( "Rejoining and Following at " .. Distance .. "!", 30, EscortClient )
|
EscortGroup:MessageToClient( "Rejoining and Following at " .. Distance .. "!", 30, EscortClient )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #MENUPARAM MenuParam
|
-- @param #MENUPARAM MenuParam
|
||||||
function ESCORT:_Flare( Color, Message )
|
function ESCORT:_Flare( Color, Message )
|
||||||
|
|
||||||
local EscortGroup = self.EscortGroup
|
local EscortGroup = self.EscortGroup
|
||||||
@@ -776,7 +778,7 @@ function ESCORT:_Flare( Color, Message )
|
|||||||
EscortGroup:MessageToClient( Message, 10, EscortClient )
|
EscortGroup:MessageToClient( Message, 10, EscortClient )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #MENUPARAM MenuParam
|
-- @param #MENUPARAM MenuParam
|
||||||
function ESCORT:_Smoke( Color, Message )
|
function ESCORT:_Smoke( Color, Message )
|
||||||
|
|
||||||
local EscortGroup = self.EscortGroup
|
local EscortGroup = self.EscortGroup
|
||||||
@@ -787,7 +789,7 @@ function ESCORT:_Smoke( Color, Message )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #MENUPARAM MenuParam
|
-- @param #MENUPARAM MenuParam
|
||||||
function ESCORT:_ReportNearbyTargetsNow()
|
function ESCORT:_ReportNearbyTargetsNow()
|
||||||
|
|
||||||
local EscortGroup = self.EscortGroup
|
local EscortGroup = self.EscortGroup
|
||||||
@@ -809,12 +811,12 @@ function ESCORT:_SwitchReportNearbyTargets( ReportTargets )
|
|||||||
self.ReportTargetsScheduler:Schedule( self, self._ReportTargetsScheduler, {}, 1, 30 )
|
self.ReportTargetsScheduler:Schedule( self, self._ReportTargetsScheduler, {}, 1, 30 )
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
routines.removeFunction( self.ReportTargetsScheduler )
|
self.ReportTargetsScheduler:Remove(self.ReportTargetsSchedulerID)
|
||||||
self.ReportTargetsScheduler = nil
|
self.ReportTargetsScheduler = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #MENUPARAM MenuParam
|
-- @param #MENUPARAM MenuParam
|
||||||
function ESCORT:_ScanTargets( ScanDuration )
|
function ESCORT:_ScanTargets( ScanDuration )
|
||||||
|
|
||||||
local EscortGroup = self.EscortGroup -- Wrapper.Group#GROUP
|
local EscortGroup = self.EscortGroup -- Wrapper.Group#GROUP
|
||||||
@@ -844,7 +846,7 @@ function ESCORT:_ScanTargets( ScanDuration )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param Wrapper.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function _Resume( EscortGroup )
|
function _Resume( EscortGroup )
|
||||||
env.info( '_Resume' )
|
env.info( '_Resume' )
|
||||||
|
|
||||||
@@ -856,7 +858,7 @@ function _Resume( EscortGroup )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #ESCORT self
|
-- @param #ESCORT self
|
||||||
-- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem
|
-- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem
|
||||||
function ESCORT:_AttackTarget( DetectedItem )
|
function ESCORT:_AttackTarget( DetectedItem )
|
||||||
|
|
||||||
@@ -877,7 +879,7 @@ function ESCORT:_AttackTarget( DetectedItem )
|
|||||||
local Tasks = {}
|
local Tasks = {}
|
||||||
|
|
||||||
DetectedSet:ForEachUnit(
|
DetectedSet:ForEachUnit(
|
||||||
--- @param Wrapper.Unit#UNIT DetectedUnit
|
-- @param Wrapper.Unit#UNIT DetectedUnit
|
||||||
function( DetectedUnit, Tasks )
|
function( DetectedUnit, Tasks )
|
||||||
if DetectedUnit:IsAlive() then
|
if DetectedUnit:IsAlive() then
|
||||||
Tasks[#Tasks+1] = EscortGroup:TaskAttackUnit( DetectedUnit )
|
Tasks[#Tasks+1] = EscortGroup:TaskAttackUnit( DetectedUnit )
|
||||||
@@ -900,7 +902,7 @@ function ESCORT:_AttackTarget( DetectedItem )
|
|||||||
local Tasks = {}
|
local Tasks = {}
|
||||||
|
|
||||||
DetectedSet:ForEachUnit(
|
DetectedSet:ForEachUnit(
|
||||||
--- @param Wrapper.Unit#UNIT DetectedUnit
|
-- @param Wrapper.Unit#UNIT DetectedUnit
|
||||||
function( DetectedUnit, Tasks )
|
function( DetectedUnit, Tasks )
|
||||||
if DetectedUnit:IsAlive() then
|
if DetectedUnit:IsAlive() then
|
||||||
Tasks[#Tasks+1] = EscortGroup:TaskFireAtPoint( DetectedUnit:GetVec2(), 50 )
|
Tasks[#Tasks+1] = EscortGroup:TaskFireAtPoint( DetectedUnit:GetVec2(), 50 )
|
||||||
@@ -921,7 +923,7 @@ function ESCORT:_AttackTarget( DetectedItem )
|
|||||||
end
|
end
|
||||||
|
|
||||||
---
|
---
|
||||||
--- @param #ESCORT self
|
-- @param #ESCORT self
|
||||||
-- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem
|
-- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem
|
||||||
function ESCORT:_AssistTarget( EscortGroupAttack, DetectedItem )
|
function ESCORT:_AssistTarget( EscortGroupAttack, DetectedItem )
|
||||||
|
|
||||||
@@ -939,7 +941,7 @@ function ESCORT:_AssistTarget( EscortGroupAttack, DetectedItem )
|
|||||||
local Tasks = {}
|
local Tasks = {}
|
||||||
|
|
||||||
DetectedSet:ForEachUnit(
|
DetectedSet:ForEachUnit(
|
||||||
--- @param Wrapper.Unit#UNIT DetectedUnit
|
-- @param Wrapper.Unit#UNIT DetectedUnit
|
||||||
function( DetectedUnit, Tasks )
|
function( DetectedUnit, Tasks )
|
||||||
if DetectedUnit:IsAlive() then
|
if DetectedUnit:IsAlive() then
|
||||||
Tasks[#Tasks+1] = EscortGroupAttack:TaskAttackUnit( DetectedUnit )
|
Tasks[#Tasks+1] = EscortGroupAttack:TaskAttackUnit( DetectedUnit )
|
||||||
@@ -961,7 +963,7 @@ function ESCORT:_AssistTarget( EscortGroupAttack, DetectedItem )
|
|||||||
local Tasks = {}
|
local Tasks = {}
|
||||||
|
|
||||||
DetectedSet:ForEachUnit(
|
DetectedSet:ForEachUnit(
|
||||||
--- @param Wrapper.Unit#UNIT DetectedUnit
|
-- @param Wrapper.Unit#UNIT DetectedUnit
|
||||||
function( DetectedUnit, Tasks )
|
function( DetectedUnit, Tasks )
|
||||||
if DetectedUnit:IsAlive() then
|
if DetectedUnit:IsAlive() then
|
||||||
Tasks[#Tasks+1] = EscortGroupAttack:TaskFireAtPoint( DetectedUnit:GetVec2(), 50 )
|
Tasks[#Tasks+1] = EscortGroupAttack:TaskFireAtPoint( DetectedUnit:GetVec2(), 50 )
|
||||||
@@ -981,7 +983,7 @@ function ESCORT:_AssistTarget( EscortGroupAttack, DetectedItem )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #MENUPARAM MenuParam
|
-- @param #MENUPARAM MenuParam
|
||||||
function ESCORT:_ROE( EscortROEFunction, EscortROEMessage )
|
function ESCORT:_ROE( EscortROEFunction, EscortROEMessage )
|
||||||
|
|
||||||
local EscortGroup = self.EscortGroup
|
local EscortGroup = self.EscortGroup
|
||||||
@@ -991,7 +993,7 @@ function ESCORT:_ROE( EscortROEFunction, EscortROEMessage )
|
|||||||
EscortGroup:MessageToClient( EscortROEMessage, 10, EscortClient )
|
EscortGroup:MessageToClient( EscortROEMessage, 10, EscortClient )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #MENUPARAM MenuParam
|
-- @param #MENUPARAM MenuParam
|
||||||
function ESCORT:_ROT( EscortROTFunction, EscortROTMessage )
|
function ESCORT:_ROT( EscortROTFunction, EscortROTMessage )
|
||||||
|
|
||||||
local EscortGroup = self.EscortGroup
|
local EscortGroup = self.EscortGroup
|
||||||
@@ -1001,7 +1003,7 @@ function ESCORT:_ROT( EscortROTFunction, EscortROTMessage )
|
|||||||
EscortGroup:MessageToClient( EscortROTMessage, 10, EscortClient )
|
EscortGroup:MessageToClient( EscortROTMessage, 10, EscortClient )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #MENUPARAM MenuParam
|
-- @param #MENUPARAM MenuParam
|
||||||
function ESCORT:_ResumeMission( WayPoint )
|
function ESCORT:_ResumeMission( WayPoint )
|
||||||
|
|
||||||
local EscortGroup = self.EscortGroup
|
local EscortGroup = self.EscortGroup
|
||||||
@@ -1036,7 +1038,7 @@ function ESCORT:RegisterRoute()
|
|||||||
return TaskPoints
|
return TaskPoints
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param Functional.Escort#ESCORT self
|
-- @param Functional.Escort#ESCORT self
|
||||||
function ESCORT:_FollowScheduler()
|
function ESCORT:_FollowScheduler()
|
||||||
self:F( { self.FollowDistance } )
|
self:F( { self.FollowDistance } )
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **Functional** - (R2.5) - Yet Another Missile Trainer.
|
--- **Functional** - Yet Another Missile Trainer.
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
-- Practice to evade missiles without being destroyed.
|
-- Practice to evade missiles without being destroyed.
|
||||||
@@ -20,12 +20,13 @@
|
|||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **funkyfranky**
|
-- ### Author: **funkyfranky**
|
||||||
-- @module Functional.FOX
|
-- @module Functional.Fox
|
||||||
-- @image Functional_FOX.png
|
-- @image Functional_FOX.png
|
||||||
|
|
||||||
--- FOX class.
|
--- FOX class.
|
||||||
-- @type FOX
|
-- @type FOX
|
||||||
-- @field #string ClassName Name of the class.
|
-- @field #string ClassName Name of the class.
|
||||||
|
-- @field #number verbose Verbosity level.
|
||||||
-- @field #boolean Debug Debug mode. Messages to all about status.
|
-- @field #boolean Debug Debug mode. Messages to all about status.
|
||||||
-- @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 #table menuadded Table of groups the menu was added for.
|
-- @field #table menuadded Table of groups the menu was added for.
|
||||||
@@ -57,7 +58,7 @@
|
|||||||
--
|
--
|
||||||
-- # The FOX Concept
|
-- # The FOX Concept
|
||||||
--
|
--
|
||||||
-- As you probably know [Fox](https://en.wikipedia.org/wiki/Fox_(code_word)) is a NATO brevity code for launching air-to-air munition. Therefore, the class name is not 100% accurate as this
|
-- As you probably know [Fox](https://en.wikipedia.org/wiki/Fox_\(code_word\)) is a NATO brevity code for launching air-to-air munition. Therefore, the class name is not 100% accurate as this
|
||||||
-- script handles air-to-air but also surface-to-air missiles.
|
-- script handles air-to-air but also surface-to-air missiles.
|
||||||
--
|
--
|
||||||
-- # Basic Script
|
-- # Basic Script
|
||||||
@@ -112,18 +113,14 @@
|
|||||||
-- -- Start missile trainer.
|
-- -- Start missile trainer.
|
||||||
-- fox:Start()
|
-- fox:Start()
|
||||||
--
|
--
|
||||||
-- # Fine Tuning
|
-- # Notes
|
||||||
--
|
|
||||||
-- Todo!
|
|
||||||
--
|
|
||||||
-- # Special Events
|
|
||||||
--
|
|
||||||
-- Todo!
|
|
||||||
--
|
--
|
||||||
|
-- The script needs to be running before you enter an airplane slot. If FOX is not available to you, go back to observers and then join a slot again.
|
||||||
--
|
--
|
||||||
-- @field #FOX
|
-- @field #FOX
|
||||||
FOX = {
|
FOX = {
|
||||||
ClassName = "FOX",
|
ClassName = "FOX",
|
||||||
|
verbose = 0,
|
||||||
Debug = false,
|
Debug = false,
|
||||||
lid = nil,
|
lid = nil,
|
||||||
menuadded = {},
|
menuadded = {},
|
||||||
@@ -168,7 +165,7 @@ FOX = {
|
|||||||
|
|
||||||
--- Missile data table.
|
--- Missile data table.
|
||||||
-- @type FOX.MissileData
|
-- @type FOX.MissileData
|
||||||
-- @field Wrapper.Unit#UNIT weapon Missile weapon unit.
|
-- @field DCS#Weapon weapon Missile weapon object.
|
||||||
-- @field #boolean active If true the missile is active.
|
-- @field #boolean active If true the missile is active.
|
||||||
-- @field #string missileType Type of missile.
|
-- @field #string missileType Type of missile.
|
||||||
-- @field #string missileName Name of missile.
|
-- @field #string missileName Name of missile.
|
||||||
@@ -185,6 +182,8 @@ FOX = {
|
|||||||
-- @field #string targetName Name of the target unit or "unknown".
|
-- @field #string targetName Name of the target unit or "unknown".
|
||||||
-- @field #string targetOrig Name of the "original" target, i.e. the one right after launched.
|
-- @field #string targetOrig Name of the "original" target, i.e. the one right after launched.
|
||||||
-- @field #FOX.PlayerData targetPlayer Player that was targeted or nil.
|
-- @field #FOX.PlayerData targetPlayer Player that was targeted or nil.
|
||||||
|
-- @field Core.Point#COORDINATE missileCoord Missile coordinate during tracking.
|
||||||
|
-- @field Wrapper.Weapon#WEAPON Weapon Weapon object.
|
||||||
|
|
||||||
--- Main radio menu on group level.
|
--- Main radio menu on group level.
|
||||||
-- @field #table MenuF10 Root menu table on group level.
|
-- @field #table MenuF10 Root menu table on group level.
|
||||||
@@ -196,7 +195,7 @@ FOX.MenuF10Root=nil
|
|||||||
|
|
||||||
--- FOX class version.
|
--- FOX class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
FOX.version="0.6.1"
|
FOX.version="0.8.0"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- ToDo list
|
-- ToDo list
|
||||||
@@ -492,7 +491,6 @@ end
|
|||||||
|
|
||||||
--- Disable F10 menu for all players.
|
--- Disable F10 menu for all players.
|
||||||
-- @param #FOX self
|
-- @param #FOX self
|
||||||
-- @param #boolean switch If true debug mode on. If false/nil debug mode off
|
|
||||||
-- @return #FOX self
|
-- @return #FOX self
|
||||||
function FOX:SetDisableF10Menu()
|
function FOX:SetDisableF10Menu()
|
||||||
|
|
||||||
@@ -501,6 +499,26 @@ function FOX:SetDisableF10Menu()
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Enable F10 menu for all players.
|
||||||
|
-- @param #FOX self
|
||||||
|
-- @return #FOX self
|
||||||
|
function FOX:SetEnableF10Menu()
|
||||||
|
|
||||||
|
self.menudisabled=false
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Set verbosity level.
|
||||||
|
-- @param #FOX self
|
||||||
|
-- @param #number VerbosityLevel Level of output (higher=more). Default 0.
|
||||||
|
-- @return #FOX self
|
||||||
|
function FOX:SetVerbosity(VerbosityLevel)
|
||||||
|
self.verbose=VerbosityLevel or 0
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Set default player setting for missile destruction.
|
--- Set default player setting for missile destruction.
|
||||||
-- @param #FOX self
|
-- @param #FOX self
|
||||||
-- @param #boolean switch If true missiles are destroyed. If false/nil missiles are not destroyed.
|
-- @param #boolean switch If true missiles are destroyed. If false/nil missiles are not destroyed.
|
||||||
@@ -596,7 +614,9 @@ function FOX:onafterStatus(From, Event, To)
|
|||||||
local clock=UTILS.SecondsToClock(time)
|
local clock=UTILS.SecondsToClock(time)
|
||||||
|
|
||||||
-- Status.
|
-- Status.
|
||||||
self:I(self.lid..string.format("Missile trainer status %s: %s", clock, fsmstate))
|
if self.verbose>=1 then
|
||||||
|
self:I(self.lid..string.format("Missile trainer status %s: %s", clock, fsmstate))
|
||||||
|
end
|
||||||
|
|
||||||
-- Check missile status.
|
-- Check missile status.
|
||||||
self:_CheckMissileStatus()
|
self:_CheckMissileStatus()
|
||||||
@@ -704,7 +724,9 @@ function FOX:_CheckMissileStatus()
|
|||||||
if #self.missiles==0 then
|
if #self.missiles==0 then
|
||||||
text=text.." none"
|
text=text.." none"
|
||||||
end
|
end
|
||||||
self:I(self.lid..text)
|
if self.verbose>=2 then
|
||||||
|
self:I(self.lid..text)
|
||||||
|
end
|
||||||
|
|
||||||
-- Remove inactive missiles.
|
-- Remove inactive missiles.
|
||||||
for i=#self.missiles,1,-1 do
|
for i=#self.missiles,1,-1 do
|
||||||
@@ -734,7 +756,7 @@ function FOX:_IsProtected(targetunit)
|
|||||||
if targetgroup then
|
if targetgroup then
|
||||||
local targetname=targetgroup:GetName()
|
local targetname=targetgroup:GetName()
|
||||||
|
|
||||||
for _,_group in pairs(self.protectedset:GetSetObjects()) do
|
for _,_group in pairs(self.protectedset:GetSet()) do
|
||||||
local group=_group --Wrapper.Group#GROUP
|
local group=_group --Wrapper.Group#GROUP
|
||||||
|
|
||||||
if group then
|
if group then
|
||||||
@@ -753,6 +775,277 @@ function FOX:_IsProtected(targetunit)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Function called from weapon tracking.
|
||||||
|
-- @param Wrapper.Weapon#WEAPON weapon Weapon object.
|
||||||
|
-- @param #FOX self FOX object.
|
||||||
|
-- @param #FOX.MissileData missile Fired missile
|
||||||
|
function FOX._FuncTrack(weapon, self, missile)
|
||||||
|
|
||||||
|
-- Missile coordinate.
|
||||||
|
local missileCoord= missile.missileCoord:UpdateFromVec3(weapon.vec3) --COORDINATE:NewFromVec3(_lastBombPos)
|
||||||
|
|
||||||
|
-- Missile velocity in m/s.
|
||||||
|
local missileVelocity=weapon:GetSpeed() --UTILS.VecNorm(_ordnance:getVelocity())
|
||||||
|
|
||||||
|
-- Update missile target if necessary.
|
||||||
|
self:GetMissileTarget(missile)
|
||||||
|
|
||||||
|
-- Target unit of the missile.
|
||||||
|
local target=nil --Wrapper.Unit#UNIT
|
||||||
|
|
||||||
|
if missile.targetUnit then
|
||||||
|
|
||||||
|
-----------------------------------
|
||||||
|
-- Missile has a specific target --
|
||||||
|
-----------------------------------
|
||||||
|
|
||||||
|
if missile.targetPlayer then
|
||||||
|
-- Target is a player.
|
||||||
|
if missile.targetPlayer.destroy==true then
|
||||||
|
target=missile.targetUnit
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- Check if unit is protected.
|
||||||
|
if self:_IsProtected(missile.targetUnit) then
|
||||||
|
target=missile.targetUnit
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
------------------------------------
|
||||||
|
-- Missile has NO specific target --
|
||||||
|
------------------------------------
|
||||||
|
|
||||||
|
-- TODO: This might cause a problem with wingman. Even if the shooter itself is excluded from the check, it's wingmen are not.
|
||||||
|
-- That would trigger the distance check right after missile launch if things to wrong.
|
||||||
|
--
|
||||||
|
-- Possible solutions:
|
||||||
|
-- * Time check: enable this check after X seconds after missile was fired. What is X?
|
||||||
|
-- * Coalition check. But would not work in training situations where blue on blue is valid!
|
||||||
|
-- * At least enable it for surface-to-air missiles.
|
||||||
|
|
||||||
|
local function _GetTarget(_unit)
|
||||||
|
local unit=_unit --Wrapper.Unit#UNIT
|
||||||
|
|
||||||
|
-- Player position.
|
||||||
|
local playerCoord=unit:GetCoordinate()
|
||||||
|
|
||||||
|
-- Distance.
|
||||||
|
local dist=missileCoord:Get3DDistance(playerCoord)
|
||||||
|
|
||||||
|
-- Update mindist if necessary. Only include players in range of missile + 50% safety margin.
|
||||||
|
if dist<=self.explosiondist then
|
||||||
|
return unit
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Distance to closest player.
|
||||||
|
local mindist=nil
|
||||||
|
|
||||||
|
-- Loop over players.
|
||||||
|
for _,_player in pairs(self.players) do
|
||||||
|
local player=_player --#FOX.PlayerData
|
||||||
|
|
||||||
|
-- Check that player was not the one who launched the missile.
|
||||||
|
if player.unitname~=missile.shooterName then
|
||||||
|
|
||||||
|
-- Player position.
|
||||||
|
local playerCoord=player.unit:GetCoordinate()
|
||||||
|
|
||||||
|
-- Distance.
|
||||||
|
local dist=missileCoord:Get3DDistance(playerCoord)
|
||||||
|
|
||||||
|
-- Distance from shooter to player.
|
||||||
|
local Dshooter2player=playerCoord:Get3DDistance(missile.shotCoord)
|
||||||
|
|
||||||
|
-- Update mindist if necessary. Only include players in range of missile + 50% safety margin.
|
||||||
|
if (mindist==nil or dist<mindist) and (Dshooter2player<=missile.missileRange*1.5 or dist<=self.explosiondist) then
|
||||||
|
mindist=dist
|
||||||
|
target=player.unit
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.protectedset then
|
||||||
|
|
||||||
|
-- Distance to closest protected unit.
|
||||||
|
mindist=nil
|
||||||
|
|
||||||
|
for _,_group in pairs(self.protectedset:GetSet()) do
|
||||||
|
local group=_group --Wrapper.Group#GROUP
|
||||||
|
for _,_unit in pairs(group:GetUnits()) do
|
||||||
|
local unit=_unit --Wrapper.Unit#UNIT
|
||||||
|
|
||||||
|
if unit and unit:IsAlive() then
|
||||||
|
|
||||||
|
-- Check that player was not the one who launched the missile.
|
||||||
|
if unit:GetName()~=missile.shooterName then
|
||||||
|
|
||||||
|
-- Player position.
|
||||||
|
local playerVec3=unit:GetVec3()
|
||||||
|
|
||||||
|
-- Distance.
|
||||||
|
local dist=missileCoord:Get3DDistance(playerVec3)
|
||||||
|
|
||||||
|
-- Distance from shooter to player.
|
||||||
|
local Dshooter2player=missile.shotCoord:Get3DDistance(playerVec3)
|
||||||
|
|
||||||
|
-- Update mindist if necessary. Only include players in range of missile + 50% safety margin.
|
||||||
|
if (mindist==nil or dist<mindist) and (Dshooter2player<=missile.missileRange*1.5 or dist<=self.explosiondist) then
|
||||||
|
mindist=dist
|
||||||
|
target=unit
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if target then
|
||||||
|
self:T(self.lid..string.format("Missile %s with NO explicit target got closest unit to missile as target %s. Dist=%s m", missile.missileType, target:GetName(), tostring(mindist)))
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check if missile has a valid target.
|
||||||
|
if target then
|
||||||
|
|
||||||
|
-- Target coordinate.
|
||||||
|
local targetVec3=target:GetVec3() --target:GetCoordinate()
|
||||||
|
|
||||||
|
-- Distance from missile to target.
|
||||||
|
local distance=missileCoord:Get3DDistance(targetVec3)
|
||||||
|
|
||||||
|
-- Distance missile to shooter.
|
||||||
|
local distShooter=nil
|
||||||
|
if missile.shooterUnit and missile.shooterUnit:IsAlive() then
|
||||||
|
distShooter=missileCoord:Get3DDistance(missile.shooterUnit:GetVec3())
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Debug output.
|
||||||
|
if self.Debug then
|
||||||
|
local bearing=missileCoord:HeadingTo(targetVec3)
|
||||||
|
local eta=distance/missileVelocity
|
||||||
|
-- Debug distance check.
|
||||||
|
self:I(self.lid..string.format("Missile %s Target %s: Distance = %.1f m, v=%.1f m/s, bearing=%03d°, ETA=%.1f sec", missile.missileType, target:GetName(), distance, missileVelocity, bearing, eta))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Distroy missile if it's getting too close.
|
||||||
|
local destroymissile=distance<=self.explosiondist
|
||||||
|
|
||||||
|
-- Check BIG missiles.
|
||||||
|
if self.explosiondist2 and distance<=self.explosiondist2 and not destroymissile then
|
||||||
|
destroymissile=missile.explosive>=self.bigmissilemass
|
||||||
|
end
|
||||||
|
|
||||||
|
-- If missile is 150 m from target ==> destroy missile if in safe zone.
|
||||||
|
if destroymissile and self:_CheckCoordSafe(targetVec3) then
|
||||||
|
|
||||||
|
-- Destroy missile.
|
||||||
|
self:I(self.lid..string.format("Destroying missile %s(%s) fired by %s aimed at %s [player=%s] at distance %.1f m",
|
||||||
|
missile.missileType, missile.missileName, missile.shooterName, target:GetName(), tostring(missile.targetPlayer~=nil), distance))
|
||||||
|
weapon:Destroy()
|
||||||
|
|
||||||
|
-- Missile is not active any more.
|
||||||
|
missile.active=false
|
||||||
|
|
||||||
|
-- Debug smoke.
|
||||||
|
if self.Debug then
|
||||||
|
missileCoord:SmokeRed()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Create event.
|
||||||
|
self:MissileDestroyed(missile)
|
||||||
|
|
||||||
|
-- Little explosion for the visual effect.
|
||||||
|
if self.explosionpower>0 and distance>50 and (distShooter==nil or (distShooter and distShooter>50)) then
|
||||||
|
missileCoord:Explosion(self.explosionpower)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Target was a player.
|
||||||
|
if missile.targetPlayer then
|
||||||
|
|
||||||
|
-- Message to target.
|
||||||
|
local text=string.format("Destroying missile. %s", self:_DeadText())
|
||||||
|
MESSAGE:New(text, 10):ToGroup(target:GetGroup())
|
||||||
|
|
||||||
|
-- Increase dead counter.
|
||||||
|
missile.targetPlayer.dead=missile.targetPlayer.dead+1
|
||||||
|
end
|
||||||
|
|
||||||
|
-- We could disable the tracking here but then the impact function would not be called.
|
||||||
|
--weapon.tracking=false
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
-- Time step.
|
||||||
|
local dt=1.0
|
||||||
|
if distance>50000 then
|
||||||
|
-- > 50 km
|
||||||
|
dt=self.dt50 --=5.0
|
||||||
|
elseif distance>10000 then
|
||||||
|
-- 10-50 km
|
||||||
|
dt=self.dt10 --=1.0
|
||||||
|
elseif distance>5000 then
|
||||||
|
-- 5-10 km
|
||||||
|
dt=self.dt05 --0.5
|
||||||
|
elseif distance>1000 then
|
||||||
|
-- 1-5 km
|
||||||
|
dt=self.dt01 --0.1
|
||||||
|
else
|
||||||
|
-- < 1 km
|
||||||
|
dt=self.dt00 --0.01
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Set time step.
|
||||||
|
weapon:SetTimeStepTrack(dt)
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
-- No current target.
|
||||||
|
self:T(self.lid..string.format("Missile %s(%s) fired by %s has no current target. Checking back in 0.1 sec.", missile.missileType, missile.missileName, missile.shooterName))
|
||||||
|
weapon:SetTimeStepTrack(0.1)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Callback function on impact or destroy otherwise.
|
||||||
|
-- @param Wrapper.Weapon#WEAPON weapon Weapon object.
|
||||||
|
-- @param #FOX self FOX object.
|
||||||
|
-- @param #FOX.MissileData missile Fired missile.
|
||||||
|
function FOX._FuncImpact(weapon, self, missile)
|
||||||
|
|
||||||
|
if missile.targetPlayer then
|
||||||
|
|
||||||
|
-- Get human player.
|
||||||
|
local player=missile.targetPlayer
|
||||||
|
|
||||||
|
-- Check for player and distance < 10 km.
|
||||||
|
if player and player.unit:IsAlive() then -- and missileCoord and player.unit:GetCoordinate():Get3DDistance(missileCoord)<10*1000 then
|
||||||
|
local text=string.format("Missile defeated. Well done, %s!", player.name)
|
||||||
|
MESSAGE:New(text, 10):ToClient(player.client)
|
||||||
|
|
||||||
|
-- Increase defeated counter.
|
||||||
|
player.defeated=player.defeated+1
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Missile is not active any more.
|
||||||
|
missile.active=false
|
||||||
|
|
||||||
|
--Terminate the timer.
|
||||||
|
self:T(FOX.lid..string.format("Terminating missile track timer."))
|
||||||
|
weapon.tracking=false
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
--- Missle launch event.
|
--- Missle launch event.
|
||||||
-- @param #FOX self
|
-- @param #FOX self
|
||||||
-- @param #string From From state.
|
-- @param #string From From state.
|
||||||
@@ -809,304 +1102,19 @@ function FOX:onafterMissileLaunch(From, Event, To, missile)
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Init missile position.
|
-- Set callback function for tracking.
|
||||||
local _lastBombPos = {x=0,y=0,z=0}
|
missile.Weapon:SetFuncTrack(FOX._FuncTrack, self, missile)
|
||||||
|
|
||||||
-- Missile coordinate.
|
-- Set callback function for impact.
|
||||||
local missileCoord = nil --Core.Point#COORDINATE
|
missile.Weapon:SetFuncImpact(FOX._FuncImpact, self, missile)
|
||||||
|
|
||||||
-- Target unit of the missile.
|
|
||||||
local target=nil --Wrapper.Unit#UNIT
|
|
||||||
|
|
||||||
--- Function monitoring the position of a bomb until impact.
|
|
||||||
local function trackMissile(_ordnance)
|
|
||||||
|
|
||||||
-- When the pcall returns a failure the weapon has hit.
|
|
||||||
local _status,_bombPos = pcall(
|
|
||||||
function()
|
|
||||||
return _ordnance:getPoint()
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Check if status is not nil. If so, we have a valid point.
|
|
||||||
if _status then
|
|
||||||
|
|
||||||
----------------------------------------------
|
|
||||||
-- Still in the air. Remember this position --
|
|
||||||
----------------------------------------------
|
|
||||||
|
|
||||||
-- Missile position.
|
|
||||||
_lastBombPos = {x=_bombPos.x, y=_bombPos.y, z=_bombPos.z}
|
|
||||||
|
|
||||||
-- Missile coordinate.
|
|
||||||
missileCoord=COORDINATE:NewFromVec3(_lastBombPos)
|
|
||||||
|
|
||||||
-- Missile velocity in m/s.
|
|
||||||
local missileVelocity=UTILS.VecNorm(_ordnance:getVelocity())
|
|
||||||
|
|
||||||
-- Update missile target if necessary.
|
|
||||||
self:GetMissileTarget(missile)
|
|
||||||
|
|
||||||
if missile.targetUnit then
|
|
||||||
|
|
||||||
-----------------------------------
|
|
||||||
-- Missile has a specific target --
|
|
||||||
-----------------------------------
|
|
||||||
|
|
||||||
if missile.targetPlayer then
|
|
||||||
-- Target is a player.
|
|
||||||
if missile.targetPlayer.destroy==true then
|
|
||||||
target=missile.targetUnit
|
|
||||||
end
|
|
||||||
else
|
|
||||||
-- Check if unit is protected.
|
|
||||||
if self:_IsProtected(missile.targetUnit) then
|
|
||||||
target=missile.targetUnit
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
------------------------------------
|
|
||||||
-- Missile has NO specific target --
|
|
||||||
------------------------------------
|
|
||||||
|
|
||||||
-- TODO: This might cause a problem with wingman. Even if the shooter itself is excluded from the check, it's wingmen are not.
|
|
||||||
-- That would trigger the distance check right after missile launch if things to wrong.
|
|
||||||
--
|
|
||||||
-- Possible solutions:
|
|
||||||
-- * Time check: enable this check after X seconds after missile was fired. What is X?
|
|
||||||
-- * Coalition check. But would not work in training situations where blue on blue is valid!
|
|
||||||
-- * At least enable it for surface-to-air missiles.
|
|
||||||
|
|
||||||
local function _GetTarget(_unit)
|
|
||||||
local unit=_unit --Wrapper.Unit#UNIT
|
|
||||||
|
|
||||||
-- Player position.
|
|
||||||
local playerCoord=unit:GetCoordinate()
|
|
||||||
|
|
||||||
-- Distance.
|
|
||||||
local dist=missileCoord:Get3DDistance(playerCoord)
|
|
||||||
|
|
||||||
-- Update mindist if necessary. Only include players in range of missile + 50% safety margin.
|
|
||||||
if dist<=self.explosiondist then
|
|
||||||
return unit
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Distance to closest player.
|
|
||||||
local mindist=nil
|
|
||||||
|
|
||||||
-- Loop over players.
|
|
||||||
for _,_player in pairs(self.players) do
|
|
||||||
local player=_player --#FOX.PlayerData
|
|
||||||
|
|
||||||
-- Check that player was not the one who launched the missile.
|
|
||||||
if player.unitname~=missile.shooterName then
|
|
||||||
|
|
||||||
-- Player position.
|
|
||||||
local playerCoord=player.unit:GetCoordinate()
|
|
||||||
|
|
||||||
-- Distance.
|
|
||||||
local dist=missileCoord:Get3DDistance(playerCoord)
|
|
||||||
|
|
||||||
-- Distance from shooter to player.
|
|
||||||
local Dshooter2player=playerCoord:Get3DDistance(missile.shotCoord)
|
|
||||||
|
|
||||||
-- Update mindist if necessary. Only include players in range of missile + 50% safety margin.
|
|
||||||
if (mindist==nil or dist<mindist) and (Dshooter2player<=missile.missileRange*1.5 or dist<=self.explosiondist) then
|
|
||||||
mindist=dist
|
|
||||||
target=player.unit
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if self.protectedset then
|
|
||||||
|
|
||||||
-- Distance to closest protected unit.
|
|
||||||
mindist=nil
|
|
||||||
|
|
||||||
for _,_group in pairs(self.protectedset:GetSet()) do
|
|
||||||
local group=_group --Wrapper.Group#GROUP
|
|
||||||
for _,_unit in pairs(group:GetUnits()) do
|
|
||||||
local unit=_unit --Wrapper.Unit#UNIT
|
|
||||||
|
|
||||||
if unit and unit:IsAlive() then
|
|
||||||
|
|
||||||
-- Check that player was not the one who launched the missile.
|
|
||||||
if unit:GetName()~=missile.shooterName then
|
|
||||||
|
|
||||||
-- Player position.
|
|
||||||
local playerCoord=unit:GetCoordinate()
|
|
||||||
|
|
||||||
-- Distance.
|
|
||||||
local dist=missileCoord:Get3DDistance(playerCoord)
|
|
||||||
|
|
||||||
-- Distance from shooter to player.
|
|
||||||
local Dshooter2player=playerCoord:Get3DDistance(missile.shotCoord)
|
|
||||||
|
|
||||||
-- Update mindist if necessary. Only include players in range of missile + 50% safety margin.
|
|
||||||
if (mindist==nil or dist<mindist) and (Dshooter2player<=missile.missileRange*1.5 or dist<=self.explosiondist) then
|
|
||||||
mindist=dist
|
|
||||||
target=unit
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if target then
|
|
||||||
self:T(self.lid..string.format("Missile %s with NO explicit target got closest unit to missile as target %s. Dist=%s m", missile.missileType, target:GetName(), tostring(mindist)))
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Check if missile has a valid target.
|
|
||||||
if target then
|
|
||||||
|
|
||||||
-- Target coordinate.
|
|
||||||
local targetCoord=target:GetCoordinate()
|
|
||||||
|
|
||||||
-- Distance from missile to target.
|
|
||||||
local distance=missileCoord:Get3DDistance(targetCoord)
|
|
||||||
|
|
||||||
-- Distance missile to shooter.
|
|
||||||
local distShooter=nil
|
|
||||||
if missile.shooterUnit and missile.shooterUnit:IsAlive() then
|
|
||||||
distShooter=missileCoord:Get3DDistance(missile.shooterUnit:GetCoordinate())
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Debug output.
|
|
||||||
if self.Debug then
|
|
||||||
local bearing=targetCoord:HeadingTo(missileCoord)
|
|
||||||
local eta=distance/missileVelocity
|
|
||||||
|
|
||||||
-- Debug distance check.
|
|
||||||
self:I(self.lid..string.format("Missile %s Target %s: Distance = %.1f m, v=%.1f m/s, bearing=%03d°, ETA=%.1f sec", missile.missileType, target:GetName(), distance, missileVelocity, bearing, eta))
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Distroy missile if it's getting too close.
|
|
||||||
local destroymissile=distance<=self.explosiondist
|
|
||||||
|
|
||||||
-- Check BIG missiles.
|
|
||||||
if self.explosiondist2 and distance<=self.explosiondist2 and not destroymissile then
|
|
||||||
destroymissile=missile.explosive>=self.bigmissilemass
|
|
||||||
end
|
|
||||||
|
|
||||||
-- If missile is 150 m from target ==> destroy missile if in safe zone.
|
|
||||||
if destroymissile and self:_CheckCoordSafe(targetCoord) then
|
|
||||||
|
|
||||||
-- Destroy missile.
|
|
||||||
self:I(self.lid..string.format("Destroying missile %s(%s) fired by %s aimed at %s [player=%s] at distance %.1f m",
|
|
||||||
missile.missileType, missile.missileName, missile.shooterName, target:GetName(), tostring(missile.targetPlayer~=nil), distance))
|
|
||||||
_ordnance:destroy()
|
|
||||||
|
|
||||||
-- Missile is not active any more.
|
|
||||||
missile.active=false
|
|
||||||
|
|
||||||
-- Debug smoke.
|
|
||||||
if self.Debug then
|
|
||||||
missileCoord:SmokeRed()
|
|
||||||
targetCoord:SmokeGreen()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Create event.
|
|
||||||
self:MissileDestroyed(missile)
|
|
||||||
|
|
||||||
-- Little explosion for the visual effect.
|
|
||||||
if self.explosionpower>0 and distance>50 and (distShooter==nil or (distShooter and distShooter>50)) then
|
|
||||||
missileCoord:Explosion(self.explosionpower)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Target was a player.
|
|
||||||
if missile.targetPlayer then
|
|
||||||
|
|
||||||
-- Message to target.
|
|
||||||
local text=string.format("Destroying missile. %s", self:_DeadText())
|
|
||||||
MESSAGE:New(text, 10):ToGroup(target:GetGroup())
|
|
||||||
|
|
||||||
-- Increase dead counter.
|
|
||||||
missile.targetPlayer.dead=missile.targetPlayer.dead+1
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Terminate timer.
|
|
||||||
return nil
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
-- Time step.
|
|
||||||
local dt=1.0
|
|
||||||
if distance>50000 then
|
|
||||||
-- > 50 km
|
|
||||||
dt=self.dt50 --=5.0
|
|
||||||
elseif distance>10000 then
|
|
||||||
-- 10-50 km
|
|
||||||
dt=self.dt10 --=1.0
|
|
||||||
elseif distance>5000 then
|
|
||||||
-- 5-10 km
|
|
||||||
dt=self.dt05 --0.5
|
|
||||||
elseif distance>1000 then
|
|
||||||
-- 1-5 km
|
|
||||||
dt=self.dt01 --0.1
|
|
||||||
else
|
|
||||||
-- < 1 km
|
|
||||||
dt=self.dt00 --0.01
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Check again in dt seconds.
|
|
||||||
return timer.getTime()+dt
|
|
||||||
end
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
-- Destroy missile.
|
|
||||||
self:T(self.lid..string.format("Missile %s(%s) fired by %s has no current target. Checking back in 0.1 sec.", missile.missileType, missile.missileName, missile.shooterName))
|
|
||||||
return timer.getTime()+0.1
|
|
||||||
|
|
||||||
-- No target ==> terminate timer.
|
|
||||||
--return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
-------------------------------------
|
|
||||||
-- Missile does not exist any more --
|
|
||||||
-------------------------------------
|
|
||||||
|
|
||||||
if target then
|
|
||||||
|
|
||||||
-- Get human player.
|
|
||||||
local player=self:_GetPlayerFromUnit(target)
|
|
||||||
|
|
||||||
-- Check for player and distance < 10 km.
|
|
||||||
if player and player.unit:IsAlive() then -- and missileCoord and player.unit:GetCoordinate():Get3DDistance(missileCoord)<10*1000 then
|
|
||||||
local text=string.format("Missile defeated. Well done, %s!", player.name)
|
|
||||||
MESSAGE:New(text, 10):ToClient(player.client)
|
|
||||||
|
|
||||||
-- Increase defeated counter.
|
|
||||||
player.defeated=player.defeated+1
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Missile is not active any more.
|
|
||||||
missile.active=false
|
|
||||||
|
|
||||||
--Terminate the timer.
|
|
||||||
self:T(FOX.lid..string.format("Terminating missile track timer."))
|
|
||||||
return nil
|
|
||||||
|
|
||||||
end -- _status check
|
|
||||||
|
|
||||||
end -- end function trackBomb
|
|
||||||
|
|
||||||
-- Weapon is not yet "alife" just yet. Start timer with a little delay.
|
-- Weapon is not yet "alife" just yet. Start timer with a little delay.
|
||||||
self:T(FOX.lid..string.format("Tracking of missile starts in 0.0001 seconds."))
|
self:T(FOX.lid..string.format("Tracking of missile starts in 0.0001 seconds."))
|
||||||
timer.scheduleFunction(trackMissile, missile.weapon, timer.getTime()+0.0001)
|
--timer.scheduleFunction(trackMissile, missile.weapon, timer.getTime()+0.0001)
|
||||||
|
missile.Weapon:StartTrack(0.0001)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1162,7 +1170,7 @@ function FOX:OnEventBirth(EventData)
|
|||||||
|
|
||||||
-- Add F10 radio menu for player.
|
-- Add F10 radio menu for player.
|
||||||
if not self.menudisabled then
|
if not self.menudisabled then
|
||||||
self:ScheduleOnce(0.1, FOX._AddF10Commands, self, _unitname)
|
self:ScheduleOnce(0.1, self._AddF10Commands, self, _unitName)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Player data.
|
-- Player data.
|
||||||
@@ -1237,30 +1245,29 @@ end
|
|||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function FOX:OnEventShot(EventData)
|
function FOX:OnEventShot(EventData)
|
||||||
self:T2({eventshot=EventData})
|
self:T2({eventshot=EventData})
|
||||||
|
|
||||||
|
-- Nil checks.
|
||||||
|
if EventData.Weapon==nil or EventData.IniDCSUnit==nil or EventData.weapon==nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if EventData.Weapon==nil then
|
-- Create a weapon object.
|
||||||
return
|
local weapon=WEAPON:New(EventData.weapon)
|
||||||
end
|
|
||||||
if EventData.IniDCSUnit==nil then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Weapon data.
|
-- Weapon data.
|
||||||
local _weapon = EventData.WeaponName
|
local _weapon = weapon:GetTypeName()
|
||||||
local _target = EventData.Weapon:getTarget()
|
local _target = EventData.Weapon:getTarget()
|
||||||
local _targetName = "unknown"
|
local _targetName = "unknown"
|
||||||
local _targetUnit = nil --Wrapper.Unit#UNIT
|
local _targetUnit = nil --Wrapper.Unit#UNIT
|
||||||
|
|
||||||
-- Weapon descriptor.
|
-- Weapon descriptor.
|
||||||
local desc=EventData.Weapon:getDesc()
|
local desc=weapon.desc
|
||||||
self:T2({desc=desc})
|
self:T2({desc=desc})
|
||||||
|
|
||||||
-- Weapon category: 0=Shell, 1=Missile, 2=Rocket, 3=BOMB
|
|
||||||
local weaponcategory=desc.category
|
|
||||||
|
|
||||||
-- Missile category: 1=AAM, 2=SAM, 6=OTHER
|
-- Missile category: 1=AAM, 2=SAM, 6=OTHER
|
||||||
local missilecategory=desc.missileCategory
|
local missilecategory=desc.missileCategory
|
||||||
|
|
||||||
|
-- Missile range.
|
||||||
local missilerange=nil
|
local missilerange=nil
|
||||||
if missilecategory then
|
if missilecategory then
|
||||||
missilerange=desc.rangeMaxAltMax
|
missilerange=desc.rangeMaxAltMax
|
||||||
@@ -1270,8 +1277,8 @@ function FOX:OnEventShot(EventData)
|
|||||||
self:T2(FOX.lid.."EVENT SHOT: FOX")
|
self:T2(FOX.lid.."EVENT SHOT: FOX")
|
||||||
self:T2(FOX.lid..string.format("EVENT SHOT: Ini unit = %s", tostring(EventData.IniUnitName)))
|
self:T2(FOX.lid..string.format("EVENT SHOT: Ini unit = %s", tostring(EventData.IniUnitName)))
|
||||||
self:T2(FOX.lid..string.format("EVENT SHOT: Ini group = %s", tostring(EventData.IniGroupName)))
|
self:T2(FOX.lid..string.format("EVENT SHOT: Ini group = %s", tostring(EventData.IniGroupName)))
|
||||||
self:T2(FOX.lid..string.format("EVENT SHOT: Weapon type = %s", tostring(_weapon)))
|
self:T2(FOX.lid..string.format("EVENT SHOT: Weapon type = %s", tostring(weapon:GetTypeName())))
|
||||||
self:T2(FOX.lid..string.format("EVENT SHOT: Weapon categ = %s", tostring(weaponcategory)))
|
self:T2(FOX.lid..string.format("EVENT SHOT: Weapon categ = %s", tostring(weapon:GetCategory())))
|
||||||
self:T2(FOX.lid..string.format("EVENT SHOT: Missil categ = %s", tostring(missilecategory)))
|
self:T2(FOX.lid..string.format("EVENT SHOT: Missil categ = %s", tostring(missilecategory)))
|
||||||
self:T2(FOX.lid..string.format("EVENT SHOT: Missil range = %s", tostring(missilerange)))
|
self:T2(FOX.lid..string.format("EVENT SHOT: Missil range = %s", tostring(missilerange)))
|
||||||
|
|
||||||
@@ -1283,7 +1290,7 @@ function FOX:OnEventShot(EventData)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Track missiles of type AAM=1, SAM=2 or OTHER=6
|
-- Track missiles of type AAM=1, SAM=2 or OTHER=6
|
||||||
local _track = weaponcategory==1 and missilecategory and (missilecategory==1 or missilecategory==2 or missilecategory==6)
|
local _track = weapon:IsMissile() and missilecategory and (missilecategory==1 or missilecategory==2 or missilecategory==6)
|
||||||
|
|
||||||
-- Only track missiles
|
-- Only track missiles
|
||||||
if _track then
|
if _track then
|
||||||
@@ -1292,6 +1299,7 @@ function FOX:OnEventShot(EventData)
|
|||||||
|
|
||||||
missile.active=true
|
missile.active=true
|
||||||
missile.weapon=EventData.weapon
|
missile.weapon=EventData.weapon
|
||||||
|
missile.Weapon=weapon
|
||||||
missile.missileType=_weapon
|
missile.missileType=_weapon
|
||||||
missile.missileRange=missilerange
|
missile.missileRange=missilerange
|
||||||
missile.missileName=EventData.weapon:getName()
|
missile.missileName=EventData.weapon:getName()
|
||||||
@@ -1304,6 +1312,7 @@ function FOX:OnEventShot(EventData)
|
|||||||
missile.fuseDist=desc.fuseDist
|
missile.fuseDist=desc.fuseDist
|
||||||
missile.explosive=desc.warhead.explosiveMass or desc.warhead.shapedExplosiveMass
|
missile.explosive=desc.warhead.explosiveMass or desc.warhead.shapedExplosiveMass
|
||||||
missile.targetOrig=missile.targetName
|
missile.targetOrig=missile.targetName
|
||||||
|
missile.missileCoord=COORDINATE:New(0,0,0)
|
||||||
|
|
||||||
-- Set missile target name, unit and player.
|
-- Set missile target name, unit and player.
|
||||||
self:GetMissileTarget(missile)
|
self:GetMissileTarget(missile)
|
||||||
@@ -1429,10 +1438,10 @@ function FOX:_AddF10Commands(_unitName)
|
|||||||
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
self:E(self.lid..string.format("ERROR: Could not find group or group ID in AddF10Menu() function. Unit name: %s.", _unitName))
|
self:E(self.lid..string.format("ERROR: Could not find group or group ID in AddF10Menu() function. Unit name: %s.", _unitName or "unknown"))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
self:E(self.lid..string.format("ERROR: Player unit does not exist in AddF10Menu() function. Unit name: %s.", _unitName))
|
self:E(self.lid..string.format("ERROR: Player unit does not exist in AddF10Menu() function. Unit name: %s.", _unitName or "unknown"))
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -1622,7 +1631,7 @@ end
|
|||||||
|
|
||||||
--- Check if a coordinate lies within a safe training zone.
|
--- Check if a coordinate lies within a safe training zone.
|
||||||
-- @param #FOX self
|
-- @param #FOX self
|
||||||
-- @param Core.Point#COORDINATE coord Coordinate to check.
|
-- @param Core.Point#COORDINATE coord Coordinate to check. Can also be a DCS#Vec3.
|
||||||
-- @return #boolean True if safe.
|
-- @return #boolean True if safe.
|
||||||
function FOX:_CheckCoordSafe(coord)
|
function FOX:_CheckCoordSafe(coord)
|
||||||
|
|
||||||
@@ -1634,7 +1643,9 @@ function FOX:_CheckCoordSafe(coord)
|
|||||||
-- Loop over all zones.
|
-- Loop over all zones.
|
||||||
for _,_zone in pairs(self.safezones) do
|
for _,_zone in pairs(self.safezones) do
|
||||||
local zone=_zone --Core.Zone#ZONE
|
local zone=_zone --Core.Zone#ZONE
|
||||||
local inzone=zone:IsCoordinateInZone(coord)
|
local Vec2={x=coord.x, y=coord.z}
|
||||||
|
local inzone=zone:IsVec2InZone(Vec2)
|
||||||
|
--local inzone=zone:IsCoordinateInZone(coord)
|
||||||
if inzone then
|
if inzone then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@@ -1645,7 +1656,7 @@ end
|
|||||||
|
|
||||||
--- Check if a coordinate lies within a launch zone.
|
--- Check if a coordinate lies within a launch zone.
|
||||||
-- @param #FOX self
|
-- @param #FOX self
|
||||||
-- @param Core.Point#COORDINATE coord Coordinate to check.
|
-- @param Core.Point#COORDINATE coord Coordinate to check. Can also be a DCS#Vec2.
|
||||||
-- @return #boolean True if in launch zone.
|
-- @return #boolean True if in launch zone.
|
||||||
function FOX:_CheckCoordLaunch(coord)
|
function FOX:_CheckCoordLaunch(coord)
|
||||||
|
|
||||||
@@ -1657,7 +1668,9 @@ function FOX:_CheckCoordLaunch(coord)
|
|||||||
-- Loop over all zones.
|
-- Loop over all zones.
|
||||||
for _,_zone in pairs(self.launchzones) do
|
for _,_zone in pairs(self.launchzones) do
|
||||||
local zone=_zone --Core.Zone#ZONE
|
local zone=_zone --Core.Zone#ZONE
|
||||||
local inzone=zone:IsCoordinateInZone(coord)
|
local Vec2={x=coord.x, y=coord.z}
|
||||||
|
local inzone=zone:IsVec2InZone(Vec2)
|
||||||
|
--local inzone=zone:IsCoordinateInZone(coord)
|
||||||
if inzone then
|
if inzone then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
--- **Functional** -- Modular, Automatic and Network capable Targeting and Interception System for Air Defenses
|
--- **Functional** - Modular, Automatic and Network capable Targeting and Interception System for Air Defenses.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- **MANTIS** - Moose derived Modular, Automatic and Network capable Targeting and Interception System
|
-- ## Features:
|
||||||
-- Controls a network of SAM sites. Uses detection to switch on the AA site closest to the enemy.
|
--
|
||||||
-- Automatic mode (default since 0.8) can set-up your SAM site network automatically for you.
|
-- * Moose derived Modular, Automatic and Network capable Targeting and Interception System.
|
||||||
-- Leverage evasiveness from SEAD, leverage attack range setting.
|
-- * Controls a network of SAM sites. Uses detection to switch on the AA site closest to the enemy.
|
||||||
|
-- * Automatic mode (default since 0.8) can set-up your SAM site network automatically for you.
|
||||||
|
-- * Leverage evasiveness from SEAD, leverage attack range setting.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- ### [MANTIS - Modular, Automatic and Network capable Targeting and Interception System](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/MTS%20-%20Mantis/MTS-010%20-%20Basic%20Mantis%20Demo)
|
-- ### [MANTIS - Modular, Automatic and Network capable Targeting and Interception System](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Mantis)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -20,7 +22,7 @@
|
|||||||
-- @module Functional.Mantis
|
-- @module Functional.Mantis
|
||||||
-- @image Functional.Mantis.jpg
|
-- @image Functional.Mantis.jpg
|
||||||
--
|
--
|
||||||
-- Date: Dec 2021
|
-- Last Update: Dec 2023
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
--- **MANTIS** class, extends Core.Base#BASE
|
--- **MANTIS** class, extends Core.Base#BASE
|
||||||
@@ -61,10 +63,11 @@
|
|||||||
|
|
||||||
--- *The worst thing that can happen to a good cause is, not to be skillfully attacked, but to be ineptly defended.* - Frédéric Bastiat
|
--- *The worst thing that can happen to a good cause is, not to be skillfully attacked, but to be ineptly defended.* - Frédéric Bastiat
|
||||||
--
|
--
|
||||||
-- Simple Class for a more intelligent Air Defense System
|
-- Moose class for a more intelligent Air Defense System
|
||||||
--
|
--
|
||||||
-- #MANTIS
|
-- # MANTIS
|
||||||
-- 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 since 0.8) can set-up your SAM site network automatically for you
|
||||||
-- * **Classic mode** behaves like before
|
-- * **Classic mode** behaves like before
|
||||||
@@ -91,7 +94,7 @@
|
|||||||
-- Known SAM types at the time of writing are:
|
-- Known SAM types at the time of writing are:
|
||||||
--
|
--
|
||||||
-- * Avenger
|
-- * Avenger
|
||||||
-- * Chaparrel
|
-- * Chaparral
|
||||||
-- * Hawk
|
-- * Hawk
|
||||||
-- * Linebacker
|
-- * Linebacker
|
||||||
-- * NASAMS
|
-- * NASAMS
|
||||||
@@ -100,9 +103,16 @@
|
|||||||
-- * Roland
|
-- * Roland
|
||||||
-- * Silkworm (though strictly speaking this is a surface to ship missile)
|
-- * Silkworm (though strictly speaking this is a surface to ship missile)
|
||||||
-- * SA-2, SA-3, SA-5, SA-6, SA-7, SA-8, SA-9, SA-10, SA-11, SA-13, SA-15, SA-19
|
-- * SA-2, SA-3, SA-5, SA-6, SA-7, SA-8, SA-9, SA-10, SA-11, SA-13, SA-15, SA-19
|
||||||
-- * and from HDS (see note below): SA-2, SA-3, SA-10B, SA-10C, SA-12, SA-17, SA-20A, SA-20B, SA-23, HQ-2
|
-- * From IDF mod: STUNNER IDFA, TAMIR IDFA (Note all caps!)
|
||||||
|
-- * From HDS (see note on HDS below): SA-2, SA-3, SA-10B, SA-10C, SA-12, SA-17, SA-20A, SA-20B, SA-23, HQ-2
|
||||||
--
|
--
|
||||||
-- Following the example started above, an SA-6 site group name should start with "Red SAM SA-6" then, or a blue Patriot installation with e.g. "Blue SAM Patriot".
|
-- * From SMA: RBS98M, RBS70, RBS90, RBS90M, RBS103A, RBS103B, RBS103AM, RBS103BM, Lvkv9040M
|
||||||
|
-- **NOTE** If you are using the Swedish Military Assets (SMA), please note that the **group name** for RBS-SAM types also needs to contain the keyword "SMA"
|
||||||
|
--
|
||||||
|
-- * From CH: 2S38, PantsirS1, PantsirS2, PGL-625, HQ-17A, M903PAC2, M903PAC3, TorM2, TorM2K, TorM2M, NASAMS3-AMRAAMER, NASAMS3-AIM9X2, C-RAM, PGZ-09, S350-9M100, S350-9M96D
|
||||||
|
-- **NOTE** If you are using the Military Assets by Currenthill (CH), please note that the **group name** for CH-SAM types also needs to contain the keyword "CHM"
|
||||||
|
--
|
||||||
|
-- Following the example started above, an SA-6 site group name should start with "Red SAM SA-6" then, or a blue Patriot installation with e.g. "Blue SAM Patriot".
|
||||||
-- **NOTE** If you are using the High-Digit-Sam Mod, please note that the **group name** for the following SAM types also needs to contain the keyword "HDS":
|
-- **NOTE** If you are using the High-Digit-Sam Mod, please note that the **group name** for the following SAM types also needs to contain the keyword "HDS":
|
||||||
--
|
--
|
||||||
-- * SA-2 (with V759 missile, e.g. "Red SAM SA-2 HDS")
|
-- * SA-2 (with V759 missile, e.g. "Red SAM SA-2 HDS")
|
||||||
@@ -211,7 +221,7 @@
|
|||||||
-- * grouping = 5000 (meters) - Detection (EWR) will group enemy flights to areas of 5km for tracking - `MANTIS:SetEWRGrouping(radius)`
|
-- * grouping = 5000 (meters) - Detection (EWR) will group enemy flights to areas of 5km for tracking - `MANTIS:SetEWRGrouping(radius)`
|
||||||
-- * detectinterval = 30 (seconds) - MANTIS will decide every 30 seconds which SAM to activate - `MANTIS:SetDetectInterval(interval)`
|
-- * detectinterval = 30 (seconds) - MANTIS will decide every 30 seconds which SAM to activate - `MANTIS:SetDetectInterval(interval)`
|
||||||
-- * engagerange = 95 (percent) - SAMs will only fire if flights are inside of a 95% radius of their max firerange - `MANTIS:SetSAMRange(range)`
|
-- * engagerange = 95 (percent) - SAMs will only fire if flights are inside of a 95% radius of their max firerange - `MANTIS:SetSAMRange(range)`
|
||||||
-- * dynamic = false - Group filtering is set to once, i.e. newly added groups will not be part of the setup by default - `MANTIS:New(name,samprefix,ewrprefix,hq,coaltion,dynamic)`
|
-- * dynamic = false - Group filtering is set to once, i.e. newly added groups will not be part of the setup by default - `MANTIS:New(name,samprefix,ewrprefix,hq,coalition,dynamic)`
|
||||||
-- * autorelocate = false - HQ and (mobile) EWR system will not relocate in random intervals between 30mins and 1 hour - `MANTIS:SetAutoRelocate(hq, ewr)`
|
-- * autorelocate = false - HQ and (mobile) EWR system will not relocate in random intervals between 30mins and 1 hour - `MANTIS:SetAutoRelocate(hq, ewr)`
|
||||||
-- * debug = false - Debugging reports on screen are set to off - `MANTIS:Debug(onoff)`
|
-- * debug = false - Debugging reports on screen are set to off - `MANTIS:Debug(onoff)`
|
||||||
--
|
--
|
||||||
@@ -355,7 +365,7 @@ MANTIS.SamData = {
|
|||||||
["SA-15"] = { Range=11, Blindspot=0, Height=6, Type="Short", Radar="Tor 9A331" },
|
["SA-15"] = { Range=11, Blindspot=0, Height=6, Type="Short", Radar="Tor 9A331" },
|
||||||
["SA-13"] = { Range=5, Blindspot=0, Height=3, Type="Short", Radar="Strela" },
|
["SA-13"] = { Range=5, Blindspot=0, Height=3, Type="Short", Radar="Strela" },
|
||||||
["Avenger"] = { Range=4, Blindspot=0, Height=3, Type="Short", Radar="Avenger" },
|
["Avenger"] = { Range=4, Blindspot=0, Height=3, Type="Short", Radar="Avenger" },
|
||||||
["Chaparrel"] = { 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="Short", Radar="Linebacker" },
|
||||||
["Silkworm"] = { Range=90, Blindspot=1, Height=0.2, Type="Long", Radar="Silkworm" },
|
["Silkworm"] = { Range=90, Blindspot=1, Height=0.2, Type="Long", Radar="Silkworm" },
|
||||||
-- units from HDS Mod, multi launcher options is tricky
|
-- units from HDS Mod, multi launcher options is tricky
|
||||||
@@ -364,6 +374,9 @@ MANTIS.SamData = {
|
|||||||
["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" },
|
||||||
|
["STUNNER IDFA"] = { Range=250, Blindspot=1, Height=45, Type="Long", Radar="DAVID_SLING_LN" },
|
||||||
}
|
}
|
||||||
|
|
||||||
--- SAM data HDS
|
--- SAM data HDS
|
||||||
@@ -387,6 +400,60 @@ MANTIS.SamDataHDS = {
|
|||||||
["HQ-2 HDS"] = { Range=50, Blindspot=6, Height=35, Type="Medium", Radar="HQ_2_Guideline_LN" },
|
["HQ-2 HDS"] = { Range=50, Blindspot=6, Height=35, Type="Medium", Radar="HQ_2_Guideline_LN" },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
--- SAM data SMA
|
||||||
|
-- @type MANTIS.SamDataSMA
|
||||||
|
-- @field #number Range Max firing range in km
|
||||||
|
-- @field #number Blindspot no-firing range (green circle)
|
||||||
|
-- @field #number Height Max firing height in km
|
||||||
|
-- @field #string Type #MANTIS.SamType of SAM, i.e. SHORT, MEDIUM or LONG (range)
|
||||||
|
-- @field #string Radar Radar typename on unit level (used as key)
|
||||||
|
MANTIS.SamDataSMA = {
|
||||||
|
-- units from SMA Mod (Sweedish Military Assets)
|
||||||
|
-- https://forum.dcs.world/topic/295202-swedish-military-assets-for-dcs-by-currenthill/
|
||||||
|
-- group name MUST contain SMA to ID launcher type correctly!
|
||||||
|
["RBS98M SMA"] = { Range=20, Blindspot=0, Height=8, Type="Short", Radar="RBS-98" },
|
||||||
|
["RBS70 SMA"] = { Range=8, Blindspot=0, Height=5.5, Type="Short", Radar="RBS-70" },
|
||||||
|
["RBS70M SMA"] = { Range=8, Blindspot=0, Height=5.5, Type="Short", Radar="BV410_RBS70" },
|
||||||
|
["RBS90 SMA"] = { Range=8, Blindspot=0, Height=5.5, Type="Short", Radar="RBS-90" },
|
||||||
|
["RBS90M SMA"] = { Range=8, Blindspot=0, Height=5.5, Type="Short", Radar="BV410_RBS90" },
|
||||||
|
["RBS103A SMA"] = { Range=150, Blindspot=3, Height=24.5, Type="Long", Radar="LvS-103_Lavett103_Rb103A" },
|
||||||
|
["RBS103B SMA"] = { Range=35, Blindspot=0, Height=36, Type="Medium", Radar="LvS-103_Lavett103_Rb103B" },
|
||||||
|
["RBS103AM SMA"] = { Range=150, Blindspot=3, Height=24.5, Type="Long", Radar="LvS-103_Lavett103_HX_Rb103A" },
|
||||||
|
["RBS103BM SMA"] = { Range=35, Blindspot=0, Height=36, Type="Medium", Radar="LvS-103_Lavett103_HX_Rb103B" },
|
||||||
|
["Lvkv9040M SMA"] = { Range=4, Blindspot=0, Height=2.5, Type="Short", Radar="LvKv9040" },
|
||||||
|
}
|
||||||
|
|
||||||
|
--- SAM data CH
|
||||||
|
-- @type MANTIS.SamDataCH
|
||||||
|
-- @field #number Range Max firing range in km
|
||||||
|
-- @field #number Blindspot no-firing range (green circle)
|
||||||
|
-- @field #number Height Max firing height in km
|
||||||
|
-- @field #string Type #MANTIS.SamType of SAM, i.e. SHORT, MEDIUM or LONG (range)
|
||||||
|
-- @field #string Radar Radar typename on unit level (used as key)
|
||||||
|
MANTIS.SamDataCH = {
|
||||||
|
-- units from CH (Military Assets by Currenthill)
|
||||||
|
-- https://www.currenthill.com/
|
||||||
|
-- group name MUST contain CHM to ID launcher type correctly!
|
||||||
|
["2S38 CH"] = { Range=8, Blindspot=0.5, Height=6, Type="Short", Radar="2S38" },
|
||||||
|
["PantsirS1 CH"] = { Range=20, Blindspot=1.2, Height=15, Type="Short", Radar="PantsirS1" },
|
||||||
|
["PantsirS2 CH"] = { Range=30, Blindspot=1.2, Height=18, Type="Medium", Radar="PantsirS2" },
|
||||||
|
["PGL-625 CH"] = { Range=10, Blindspot=0.5, Height=5, Type="Short", Radar="PGL_625" },
|
||||||
|
["HQ-17A CH"] = { Range=20, Blindspot=1.5, Height=10, Type="Short", Radar="HQ17A" },
|
||||||
|
["M903PAC2 CH"] = { Range=160, Blindspot=3, Height=24.5, Type="Long", Radar="MIM104_M903_PAC2" },
|
||||||
|
["M903PAC3 CH"] = { Range=120, Blindspot=1, Height=40, Type="Long", Radar="MIM104_M903_PAC3" },
|
||||||
|
["TorM2 CH"] = { Range=12, Blindspot=1, Height=10, Type="Short", Radar="TorM2" },
|
||||||
|
["TorM2K CH"] = { Range=12, Blindspot=1, Height=10, Type="Short", Radar="TorM2K" },
|
||||||
|
["TorM2M CH"] = { Range=16, Blindspot=1, Height=10, Type="Short", Radar="TorM2M" },
|
||||||
|
["NASAMS3-AMRAAMER CH"] = { Range=50, Blindspot=2, Height=35.7, Type="Medium", Radar="CH_NASAMS3_LN_AMRAAM_ER" },
|
||||||
|
["NASAMS3-AIM9X2 CH"] = { Range=20, Blindspot=0.2, Height=18, Type="Short", Radar="CH_NASAMS3_LN_AIM9X2" },
|
||||||
|
["C-RAM CH"] = { Range=2, Blindspot=0, Height=2, Type="Short", Radar="CH_Centurion_C_RAM" },
|
||||||
|
["PGZ-09 CH"] = { Range=4, Blindspot=0, Height=3, Type="Short", Radar="CH_PGZ09" },
|
||||||
|
["S350-9M100 CH"] = { Range=15, Blindspot=1.5, Height=8, Type="Short", Radar="CH_S350_50P6_9M100" },
|
||||||
|
["S350-9M96D CH"] = { Range=150, Blindspot=2.5, Height=30, Type="Long", Radar="CH_S350_50P6_9M96D" },
|
||||||
|
["LAV-AD CH"] = { Range=8, Blindspot=0.2, Height=4.8, Type="Short", Radar="CH_LAVAD" },
|
||||||
|
["HQ-22 CH"] = { Range=170, Blindspot=5, Height=27, Type="Long", Radar="CH_HQ22_LN" },
|
||||||
|
}
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- MANTIS System
|
-- MANTIS System
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@@ -398,11 +465,12 @@ do
|
|||||||
--@param #string samprefix Prefixes for the SAM groups from the ME, e.g. all groups starting with "Red Sam..."
|
--@param #string samprefix Prefixes for the SAM groups from the ME, e.g. all groups starting with "Red Sam..."
|
||||||
--@param #string ewrprefix Prefixes for the EWR groups from the ME, e.g. all groups starting with "Red EWR..."
|
--@param #string ewrprefix Prefixes for the EWR groups from the ME, e.g. all groups starting with "Red EWR..."
|
||||||
--@param #string hq Group name of your HQ (optional)
|
--@param #string hq Group name of your HQ (optional)
|
||||||
--@param #string coaltion Coalition side of your setup, e.g. "blue", "red" or "neutral"
|
--@param #string coalition Coalition side of your setup, e.g. "blue", "red" or "neutral"
|
||||||
--@param #boolean dynamic Use constant (true) filtering or just filter once (false, default) (optional)
|
--@param #boolean dynamic Use constant (true) filtering or just filter once (false, default) (optional)
|
||||||
--@param #string awacs Group name of your Awacs (optional)
|
--@param #string awacs Group name of your Awacs (optional)
|
||||||
--@param #boolean EmOnOff Make MANTIS switch Emissions on and off instead of changing the alarm state between RED and GREEN (optional)
|
--@param #boolean EmOnOff Make MANTIS switch Emissions on and off instead of changing the alarm state between RED and GREEN (optional)
|
||||||
--@param #number Padding For #SEAD - Extra number of seconds to add to radar switch-back-on time (optional)
|
--@param #number Padding For #SEAD - Extra number of seconds to add to radar switch-back-on time (optional)
|
||||||
|
--@param #table Zones 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
|
||||||
--@return #MANTIS self
|
--@return #MANTIS self
|
||||||
--@usage Start up your MANTIS with a basic setting
|
--@usage Start up your MANTIS with a basic setting
|
||||||
--
|
--
|
||||||
@@ -421,8 +489,12 @@ do
|
|||||||
-- mybluemantis = MANTIS:New("bluemantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs")
|
-- mybluemantis = MANTIS:New("bluemantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs")
|
||||||
-- mybluemantis:Start()
|
-- mybluemantis:Start()
|
||||||
--
|
--
|
||||||
function MANTIS:New(name,samprefix,ewrprefix,hq,coaltion,dynamic,awacs, EmOnOff, Padding)
|
function MANTIS:New(name,samprefix,ewrprefix,hq,coalition,dynamic,awacs, EmOnOff, Padding, Zones)
|
||||||
|
|
||||||
|
|
||||||
|
-- Inherit everything from BASE class.
|
||||||
|
local self = BASE:Inherit(self, FSM:New()) -- #MANTIS
|
||||||
|
|
||||||
-- DONE: Create some user functions for these
|
-- DONE: Create some user functions for these
|
||||||
-- DONE: Make HQ useful
|
-- DONE: Make HQ useful
|
||||||
-- DONE: Set SAMs to auto if EWR dies
|
-- DONE: Set SAMs to auto if EWR dies
|
||||||
@@ -434,7 +506,7 @@ do
|
|||||||
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
|
||||||
self.Coalition = coaltion or "red"
|
self.Coalition = coalition or "red"
|
||||||
self.SAM_Table = {}
|
self.SAM_Table = {}
|
||||||
self.SAM_Table_Long = {}
|
self.SAM_Table_Long = {}
|
||||||
self.SAM_Table_Medium = {}
|
self.SAM_Table_Medium = {}
|
||||||
@@ -482,6 +554,11 @@ do
|
|||||||
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
|
||||||
|
self.FilterZones = Zones
|
||||||
|
|
||||||
|
self.SkateZones = nil
|
||||||
|
self.SkateNumber = 3
|
||||||
|
self.shootandscoot = false
|
||||||
|
|
||||||
self.UseEmOnOff = true
|
self.UseEmOnOff = true
|
||||||
if EmOnOff == false then
|
if EmOnOff == false then
|
||||||
@@ -494,9 +571,6 @@ do
|
|||||||
self.advAwacs = false
|
self.advAwacs = false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Inherit everything from BASE class.
|
|
||||||
local self = BASE:Inherit(self, FSM:New()) -- #MANTIS
|
|
||||||
|
|
||||||
-- 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)
|
||||||
|
|
||||||
@@ -531,16 +605,23 @@ do
|
|||||||
|
|
||||||
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.EWR_Group = SET_GROUP:New():FilterPrefixes(self.ewr_templates):FilterCoalitions(self.Coalition)
|
||||||
|
|
||||||
|
if self.FilterZones then
|
||||||
|
self.SAM_Group:FilterZones(self.FilterZones)
|
||||||
|
end
|
||||||
|
|
||||||
if self.dynamic then
|
if self.dynamic then
|
||||||
-- Set SAM SET_GROUP
|
-- Set SAM SET_GROUP
|
||||||
self.SAM_Group = SET_GROUP:New():FilterPrefixes(self.SAM_Templates_Prefix):FilterCoalitions(self.Coalition):FilterStart()
|
self.SAM_Group:FilterStart()
|
||||||
-- Set EWR SET_GROUP
|
-- Set EWR SET_GROUP
|
||||||
self.EWR_Group = SET_GROUP:New():FilterPrefixes(self.ewr_templates):FilterCoalitions(self.Coalition):FilterStart()
|
self.EWR_Group:FilterStart()
|
||||||
else
|
else
|
||||||
-- Set SAM SET_GROUP
|
-- Set SAM SET_GROUP
|
||||||
self.SAM_Group = SET_GROUP:New():FilterPrefixes(self.SAM_Templates_Prefix):FilterCoalitions(self.Coalition):FilterOnce()
|
self.SAM_Group:FilterOnce()
|
||||||
-- Set EWR SET_GROUP
|
-- Set EWR SET_GROUP
|
||||||
self.EWR_Group = SET_GROUP:New():FilterPrefixes(self.ewr_templates):FilterCoalitions(self.Coalition):FilterOnce()
|
self.EWR_Group:FilterOnce()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- set up CC
|
-- set up CC
|
||||||
@@ -550,7 +631,7 @@ do
|
|||||||
|
|
||||||
-- TODO Version
|
-- TODO Version
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
self.version="0.8.8"
|
self.version="0.8.16"
|
||||||
self:I(string.format("***** Starting MANTIS Version %s *****", self.version))
|
self:I(string.format("***** Starting MANTIS Version %s *****", self.version))
|
||||||
|
|
||||||
--- FSM Functions ---
|
--- FSM Functions ---
|
||||||
@@ -714,6 +795,23 @@ do
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Add a SET_ZONE of zones for Shoot&Scoot - SHORAD units will move around
|
||||||
|
-- @param #MANTIS self
|
||||||
|
-- @param Core.Set#SET_ZONE ZoneSet Set of zones to be used. Units will move around to the next (random) zone between 100m and 3000m away.
|
||||||
|
-- @param #number Number Number of closest zones to be considered, defaults to 3.
|
||||||
|
-- @param #boolean Random If true, use a random coordinate inside the next zone to scoot to.
|
||||||
|
-- @param #string Formation Formation to use, defaults to "Cone". See mission editor dropdown for options.
|
||||||
|
-- @return #MANTIS self
|
||||||
|
function MANTIS:AddScootZones(ZoneSet, Number, Random, Formation)
|
||||||
|
self:T(self.lid .. " AddScootZones")
|
||||||
|
self.SkateZones = ZoneSet
|
||||||
|
self.SkateNumber = Number or 3
|
||||||
|
self.shootandscoot = true
|
||||||
|
self.ScootRandom = Random
|
||||||
|
self.ScootFormation = Formation or "Cone"
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Function to set accept and reject zones.
|
--- Function to set accept and reject zones.
|
||||||
-- @param #MANTIS self
|
-- @param #MANTIS self
|
||||||
-- @param #table AcceptZones Table of @{Core.Zone#ZONE} objects
|
-- @param #table AcceptZones Table of @{Core.Zone#ZONE} objects
|
||||||
@@ -820,7 +918,7 @@ do
|
|||||||
|
|
||||||
--- Function to get the HQ object for further use
|
--- Function to get the HQ object for further use
|
||||||
-- @param #MANTIS self
|
-- @param #MANTIS self
|
||||||
-- @return Wrapper.GROUP#GROUP The HQ #GROUP object or *nil* if it doesn't exist
|
-- @return Wrapper.Group#GROUP The HQ #GROUP object or *nil* if it doesn't exist
|
||||||
function MANTIS:GetCommandCenter()
|
function MANTIS:GetCommandCenter()
|
||||||
self:T(self.lid .. "GetCommandCenter")
|
self:T(self.lid .. "GetCommandCenter")
|
||||||
if self.HQ_CC then
|
if self.HQ_CC then
|
||||||
@@ -856,7 +954,7 @@ do
|
|||||||
|
|
||||||
--- Function to set the HQ object for further use
|
--- Function to set the HQ object for further use
|
||||||
-- @param #MANTIS self
|
-- @param #MANTIS self
|
||||||
-- @param Wrapper.GROUP#GROUP group The #GROUP object to be set as HQ
|
-- @param Wrapper.Group#GROUP group The #GROUP object to be set as HQ
|
||||||
function MANTIS:SetCommandCenter(group)
|
function MANTIS:SetCommandCenter(group)
|
||||||
self:T(self.lid .. "SetCommandCenter")
|
self:T(self.lid .. "SetCommandCenter")
|
||||||
local group = group or nil
|
local group = group or nil
|
||||||
@@ -918,7 +1016,7 @@ do
|
|||||||
|
|
||||||
--- Set using your own #INTEL_DLINK object instead of #DETECTION
|
--- Set using your own #INTEL_DLINK object instead of #DETECTION
|
||||||
-- @param #MANTIS self
|
-- @param #MANTIS self
|
||||||
-- @param Ops.Intelligence#INTEL_DLINK DLink The data link object to be used.
|
-- @param Ops.Intel#INTEL_DLINK DLink The data link object to be used.
|
||||||
function MANTIS:SetUsingDLink(DLink)
|
function MANTIS:SetUsingDLink(DLink)
|
||||||
self:T(self.lid .. "SetUsingDLink")
|
self:T(self.lid .. "SetUsingDLink")
|
||||||
self.DLink = true
|
self.DLink = true
|
||||||
@@ -1051,7 +1149,7 @@ do
|
|||||||
--self:T(self.lid.." Relocating HQ")
|
--self:T(self.lid.." Relocating HQ")
|
||||||
local text = self.lid.." Relocating HQ"
|
local text = self.lid.." Relocating HQ"
|
||||||
--local m= MESSAGE:New(text,10,"MANTIS"):ToAll()
|
--local m= MESSAGE:New(text,10,"MANTIS"):ToAll()
|
||||||
_hqgrp:RelocateGroundRandomInRadius(20,500,true,true)
|
_hqgrp:RelocateGroundRandomInRadius(20,500,true,true,nil,true)
|
||||||
end
|
end
|
||||||
--relocate EWR
|
--relocate EWR
|
||||||
-- TODO: maybe dependent on AlarmState? Observed: SA11 SR only relocates if no objects in reach
|
-- TODO: maybe dependent on AlarmState? Observed: SA11 SR only relocates if no objects in reach
|
||||||
@@ -1065,7 +1163,7 @@ do
|
|||||||
local text = self.lid.." Relocating EWR ".._grp:GetName()
|
local text = self.lid.." Relocating EWR ".._grp:GetName()
|
||||||
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(text) end
|
if self.verbose then self:I(text) end
|
||||||
_grp:RelocateGroundRandomInRadius(20,500,true,true)
|
_grp:RelocateGroundRandomInRadius(20,500,true,true,nil,true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1270,11 +1368,13 @@ do
|
|||||||
-- @param #MANTIS self
|
-- @param #MANTIS self
|
||||||
-- @param #string grpname Name of the group
|
-- @param #string grpname Name of the group
|
||||||
-- @param #boolean mod HDS mod flag
|
-- @param #boolean mod HDS mod flag
|
||||||
|
-- @param #boolean sma SMA mod flag
|
||||||
|
-- @param #boolean chm CH mod flag
|
||||||
-- @return #number range Max firing range
|
-- @return #number range Max firing range
|
||||||
-- @return #number height Max firing height
|
-- @return #number height Max firing height
|
||||||
-- @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)
|
function MANTIS:_GetSAMDataFromUnits(grpname,mod,sma,chm)
|
||||||
self:T(self.lid.."_GetSAMRangeFromUnits")
|
self:T(self.lid.."_GetSAMRangeFromUnits")
|
||||||
local found = false
|
local found = false
|
||||||
local range = self.checkradius
|
local range = self.checkradius
|
||||||
@@ -1287,8 +1387,12 @@ do
|
|||||||
local SAMData = self.SamData
|
local SAMData = self.SamData
|
||||||
if mod then
|
if mod then
|
||||||
SAMData = self.SamDataHDS
|
SAMData = self.SamDataHDS
|
||||||
|
elseif sma then
|
||||||
|
SAMData = self.SamDataSMA
|
||||||
|
elseif chm then
|
||||||
|
SAMData = self.SamDataCH
|
||||||
end
|
end
|
||||||
--self:I("Looking to auto-match for "..grpname)
|
--self:T("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())
|
||||||
@@ -1332,8 +1436,14 @@ do
|
|||||||
local blind = 0
|
local blind = 0
|
||||||
local found = false
|
local found = false
|
||||||
local HDSmod = false
|
local HDSmod = false
|
||||||
|
local SMAMod = false
|
||||||
|
local CHMod = false
|
||||||
if string.find(grpname,"HDS",1,true) then
|
if string.find(grpname,"HDS",1,true) then
|
||||||
HDSmod = true
|
HDSmod = true
|
||||||
|
elseif string.find(grpname,"SMA",1,true) then
|
||||||
|
SMAMod = true
|
||||||
|
elseif string.find(grpname,"CHM",1,true) then
|
||||||
|
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
|
||||||
@@ -1352,8 +1462,8 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- secondary filter if not found
|
-- secondary filter if not found
|
||||||
if (not found and self.automode) or HDSmod then
|
if (not found and self.automode) or HDSmod or SMAMod or CHMod then
|
||||||
range, height, type = self:_GetSAMDataFromUnits(grpname,HDSmod)
|
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
|
||||||
@@ -1701,6 +1811,10 @@ do
|
|||||||
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
|
||||||
|
self.Shorad.debug = self.debug
|
||||||
|
end
|
||||||
|
if self.shootandscoot and self.SkateZones and self.Shorad then
|
||||||
|
self.Shorad:AddScootZones(self.SkateZones,self.SkateNumber or 3,self.ScootRandom,self.ScootFormation)
|
||||||
end
|
end
|
||||||
self:__Status(-math.random(1,10))
|
self:__Status(-math.random(1,10))
|
||||||
return self
|
return self
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **Functional** -- Train missile defence and deflection.
|
--- **Functional** - Train missile defence and deflection.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [MIT - Missile Trainer](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/MIT%20-%20Missile%20Trainer)
|
-- [MIT - Missile Trainer](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/MissileTrainer)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -28,14 +28,14 @@
|
|||||||
-- * **Messages Off**: Disable all messages.
|
-- * **Messages Off**: Disable all messages.
|
||||||
-- * **Tracking**: Menu to configure missile tracking messages.
|
-- * **Tracking**: Menu to configure missile tracking messages.
|
||||||
-- * **To All**: Shows missile tracking messages to all players.
|
-- * **To All**: Shows missile tracking messages to all players.
|
||||||
-- * **To Target**: Shows missile tracking messages only to the player where the missile is targetted at.
|
-- * **To Target**: Shows missile tracking messages only to the player where the missile is targeted at.
|
||||||
-- * **Tracking On**: Show missile tracking messages.
|
-- * **Tracking On**: Show missile tracking messages.
|
||||||
-- * **Tracking Off**: Disable missile tracking messages.
|
-- * **Tracking Off**: Disable missile tracking messages.
|
||||||
-- * **Frequency Increase**: Increases the missile tracking message frequency with one second.
|
-- * **Frequency Increase**: Increases the missile tracking message frequency with one second.
|
||||||
-- * **Frequency Decrease**: Decreases the missile tracking message frequency with one second.
|
-- * **Frequency Decrease**: Decreases the missile tracking message frequency with one second.
|
||||||
-- * **Alerts**: Menu to configure alert messages.
|
-- * **Alerts**: Menu to configure alert messages.
|
||||||
-- * **To All**: Shows alert messages to all players.
|
-- * **To All**: Shows alert messages to all players.
|
||||||
-- * **To Target**: Shows alert messages only to the player where the missile is (was) targetted at.
|
-- * **To Target**: Shows alert messages only to the player where the missile is (was) targeted at.
|
||||||
-- * **Hits On**: Show missile hit alert messages.
|
-- * **Hits On**: Show missile hit alert messages.
|
||||||
-- * **Hits Off**: Disable missile hit alert messages.
|
-- * **Hits Off**: Disable missile hit alert messages.
|
||||||
-- * **Launches On**: Show missile launch messages.
|
-- * **Launches On**: Show missile launch messages.
|
||||||
@@ -50,6 +50,11 @@
|
|||||||
-- * **100 meter**: Destroys the missile when the distance to the aircraft is below or equal to 100 meter.
|
-- * **100 meter**: Destroys the missile when the distance to the aircraft is below or equal to 100 meter.
|
||||||
-- * **150 meter**: Destroys the missile when the distance to the aircraft is below or equal to 150 meter.
|
-- * **150 meter**: Destroys the missile when the distance to the aircraft is below or equal to 150 meter.
|
||||||
-- * **200 meter**: Destroys the missile when the distance to the aircraft is below or equal to 200 meter.
|
-- * **200 meter**: Destroys the missile when the distance to the aircraft is below or equal to 200 meter.
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
|
--
|
||||||
|
-- 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.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -67,8 +72,8 @@
|
|||||||
-- @module Functional.MissileTrainer
|
-- @module Functional.MissileTrainer
|
||||||
-- @image Missile_Trainer.JPG
|
-- @image Missile_Trainer.JPG
|
||||||
|
|
||||||
|
---
|
||||||
--- @type MISSILETRAINER
|
-- @type MISSILETRAINER
|
||||||
-- @field Core.Set#SET_CLIENT DBClients
|
-- @field Core.Set#SET_CLIENT DBClients
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
@@ -88,7 +93,7 @@
|
|||||||
-- A MISSILETRAINER object will behave differently based on the usage of initialization methods:
|
-- A MISSILETRAINER object will behave differently based on the usage of initialization methods:
|
||||||
--
|
--
|
||||||
-- * @{#MISSILETRAINER.InitMessagesOnOff}: Sets by default the display of any message to be ON or OFF.
|
-- * @{#MISSILETRAINER.InitMessagesOnOff}: Sets by default the display of any message to be ON or OFF.
|
||||||
-- * @{#MISSILETRAINER.InitTrackingToAll}: Sets by default the missile tracking report for all players or only for those missiles targetted to you.
|
-- * @{#MISSILETRAINER.InitTrackingToAll}: Sets by default the missile tracking report for all players or only for those missiles targeted to you.
|
||||||
-- * @{#MISSILETRAINER.InitTrackingOnOff}: Sets by default the display of missile tracking report to be ON or OFF.
|
-- * @{#MISSILETRAINER.InitTrackingOnOff}: Sets by default the display of missile tracking report to be ON or OFF.
|
||||||
-- * @{#MISSILETRAINER.InitTrackingFrequency}: Increases, decreases the missile tracking message display frequency with the provided time interval in seconds.
|
-- * @{#MISSILETRAINER.InitTrackingFrequency}: Increases, decreases the missile tracking message display frequency with the provided time interval in seconds.
|
||||||
-- * @{#MISSILETRAINER.InitAlertsToAll}: Sets by default the display of alerts to be shown to all players or only to you.
|
-- * @{#MISSILETRAINER.InitAlertsToAll}: Sets by default the display of alerts to be shown to all players or only to you.
|
||||||
@@ -97,6 +102,11 @@
|
|||||||
-- * @{#MISSILETRAINER.InitRangeOnOff}: Sets by default the display of range information of missiles ON of OFF.
|
-- * @{#MISSILETRAINER.InitRangeOnOff}: Sets by default the display of range information of missiles ON of OFF.
|
||||||
-- * @{#MISSILETRAINER.InitBearingOnOff}: Sets by default the display of bearing information of missiles ON of OFF.
|
-- * @{#MISSILETRAINER.InitBearingOnOff}: Sets by default the display of bearing information of missiles ON of OFF.
|
||||||
-- * @{#MISSILETRAINER.InitMenusOnOff}: Allows to configure the options through the radio menu.
|
-- * @{#MISSILETRAINER.InitMenusOnOff}: Allows to configure the options through the radio menu.
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
|
--
|
||||||
|
-- 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.
|
||||||
--
|
--
|
||||||
-- @field #MISSILETRAINER
|
-- @field #MISSILETRAINER
|
||||||
MISSILETRAINER = {
|
MISSILETRAINER = {
|
||||||
@@ -205,7 +215,7 @@ function MISSILETRAINER:New( Distance, Briefing )
|
|||||||
|
|
||||||
|
|
||||||
-- self.DB:ForEachClient(
|
-- self.DB:ForEachClient(
|
||||||
-- --- @param Wrapper.Client#CLIENT Client
|
-- -- @param Wrapper.Client#CLIENT Client
|
||||||
-- function( Client )
|
-- function( Client )
|
||||||
--
|
--
|
||||||
-- ... actions ...
|
-- ... actions ...
|
||||||
@@ -256,7 +266,7 @@ function MISSILETRAINER:InitMessagesOnOff( MessagesOnOff )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Sets by default the missile tracking report for all players or only for those missiles targetted to you.
|
--- Sets by default the missile tracking report for all players or only for those missiles targeted to you.
|
||||||
-- @param #MISSILETRAINER self
|
-- @param #MISSILETRAINER self
|
||||||
-- @param #boolean TrackingToAll true or false
|
-- @param #boolean TrackingToAll true or false
|
||||||
-- @return #MISSILETRAINER self
|
-- @return #MISSILETRAINER self
|
||||||
@@ -555,7 +565,7 @@ function MISSILETRAINER:_AddBearing( Client, TrainerWeapon )
|
|||||||
|
|
||||||
local DirectionVector = { x = PositionMissile.x - TargetVec3.x, y = PositionMissile.y - TargetVec3.y, z = PositionMissile.z - TargetVec3.z }
|
local DirectionVector = { x = PositionMissile.x - TargetVec3.x, y = PositionMissile.y - TargetVec3.y, z = PositionMissile.z - TargetVec3.z }
|
||||||
local DirectionRadians = math.atan2( DirectionVector.z, DirectionVector.x )
|
local DirectionRadians = math.atan2( DirectionVector.z, DirectionVector.x )
|
||||||
--DirectionRadians = DirectionRadians + routines.getNorthCorrection( PositionTarget )
|
|
||||||
if DirectionRadians < 0 then
|
if DirectionRadians < 0 then
|
||||||
DirectionRadians = DirectionRadians + 2 * math.pi
|
DirectionRadians = DirectionRadians + 2 * math.pi
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **Functional** -- Limit the movement of simulaneous moving ground vehicles.
|
--- **Functional** - Limit the movement of simulaneous moving ground vehicles.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -10,7 +10,8 @@
|
|||||||
-- @module Functional.Movement
|
-- @module Functional.Movement
|
||||||
-- @image MOOSE.JPG
|
-- @image MOOSE.JPG
|
||||||
|
|
||||||
--- @type MOVEMENT
|
---
|
||||||
|
-- @type MOVEMENT
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -30,23 +31,23 @@ MOVEMENT = {
|
|||||||
function MOVEMENT:New( MovePrefixes, MoveMaximum )
|
function MOVEMENT:New( MovePrefixes, MoveMaximum )
|
||||||
local self = BASE:Inherit( self, BASE:New() ) -- #MOVEMENT
|
local self = BASE:Inherit( self, BASE:New() ) -- #MOVEMENT
|
||||||
self:F( { MovePrefixes, MoveMaximum } )
|
self:F( { MovePrefixes, MoveMaximum } )
|
||||||
|
|
||||||
if type( MovePrefixes ) == 'table' then
|
if type( MovePrefixes ) == 'table' then
|
||||||
self.MovePrefixes = MovePrefixes
|
self.MovePrefixes = MovePrefixes
|
||||||
else
|
else
|
||||||
self.MovePrefixes = { MovePrefixes }
|
self.MovePrefixes = { MovePrefixes }
|
||||||
end
|
end
|
||||||
self.MoveCount = 0 -- The internal counter of the amount of Moveing the has happened since MoveStart.
|
self.MoveCount = 0 -- The internal counter of the amount of Moving the has happened since MoveStart.
|
||||||
self.MoveMaximum = MoveMaximum -- Contains the Maximum amount of units that are allowed to move...
|
self.MoveMaximum = MoveMaximum -- Contains the Maximum amount of units that are allowed to move.
|
||||||
self.AliveUnits = 0 -- Contains the counter how many units are currently alive
|
self.AliveUnits = 0 -- Contains the counter how many units are currently alive.
|
||||||
self.MoveUnits = {} -- Reflects if the Moving for this MovePrefixes is going to be scheduled or not.
|
self.MoveUnits = {} -- Reflects if the Moving for this MovePrefixes is going to be scheduled or not.
|
||||||
|
|
||||||
self:HandleEvent( EVENTS.Birth )
|
self:HandleEvent( EVENTS.Birth )
|
||||||
|
|
||||||
-- self:AddEvent( world.event.S_EVENT_BIRTH, self.OnBirth )
|
-- self:AddEvent( world.event.S_EVENT_BIRTH, self.OnBirth )
|
||||||
--
|
--
|
||||||
-- self:EnableEvents()
|
-- self:EnableEvents()
|
||||||
|
|
||||||
self:ScheduleStart()
|
self:ScheduleStart()
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -55,7 +56,6 @@ end
|
|||||||
--- Call this function to start the MOVEMENT scheduling.
|
--- Call this function to start the MOVEMENT scheduling.
|
||||||
function MOVEMENT:ScheduleStart()
|
function MOVEMENT:ScheduleStart()
|
||||||
self:F()
|
self:F()
|
||||||
--self.MoveFunction = routines.scheduleFunction( self._Scheduler, { self }, timer.getTime() + 1, 120 )
|
|
||||||
self.MoveFunction = SCHEDULER:New( self, self._Scheduler, {}, 1, 120 )
|
self.MoveFunction = SCHEDULER:New( self, self._Scheduler, {}, 1, 120 )
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ function MOVEMENT:ScheduleStop()
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Captures the birth events when new Units were spawned.
|
--- Captures the birth events when new Units were spawned.
|
||||||
-- @todo This method should become obsolete. The new @{DATABASE} class will handle the collection administration.
|
-- @todo This method should become obsolete. The global _DATABASE object (an instance of @{Core.Database#DATABASE}) will handle the collection administration.
|
||||||
-- @param #MOVEMENT self
|
-- @param #MOVEMENT self
|
||||||
-- @param Core.Event#EVENTDATA self
|
-- @param Core.Event#EVENTDATA self
|
||||||
function MOVEMENT:OnEventBirth( EventData )
|
function MOVEMENT:OnEventBirth( EventData )
|
||||||
@@ -86,14 +86,14 @@ function MOVEMENT:OnEventBirth( EventData )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
EventData.IniUnit:HandleEvent( EVENTS.DEAD, self.OnDeadOrCrash )
|
EventData.IniUnit:HandleEvent( EVENTS.DEAD, self.OnDeadOrCrash )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Captures the Dead or Crash events when Units crash or are destroyed.
|
--- Captures the Dead or Crash events when Units crash or are destroyed.
|
||||||
-- @todo This method should become obsolete. The new @{DATABASE} class will handle the collection administration.
|
-- @todo This method should become obsolete. The global _DATABASE object (an instance of @{Core.Database#DATABASE}) will handle the collection administration.
|
||||||
function MOVEMENT:OnDeadOrCrash( Event )
|
function MOVEMENT:OnDeadOrCrash( Event )
|
||||||
self:F( { Event } )
|
self:F( { Event } )
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **Functional** - Rudimentary ATC.
|
--- **Functional** - Basic ATC.
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
@@ -26,9 +26,9 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **[funkyfranky](https://forums.eagle.ru/member.php?u=115026)**
|
-- ### Author: **funkyfranky**
|
||||||
--
|
--
|
||||||
-- ### Contributions: [FlightControl](https://forums.eagle.ru/member.php?u=89536)
|
-- ### Contributions: FlightControl, Applevangelist
|
||||||
--
|
--
|
||||||
-- ====
|
-- ====
|
||||||
-- @module Functional.PseudoATC
|
-- @module Functional.PseudoATC
|
||||||
@@ -44,7 +44,8 @@
|
|||||||
-- @field #number mrefresh Interval in seconds after which the F10 menu is refreshed. E.g. by the closest airports. Default is 120 sec.
|
-- @field #number mrefresh Interval in seconds after which the F10 menu is refreshed. E.g. by the closest airports. Default is 120 sec.
|
||||||
-- @field #number talt Interval in seconds between reporting altitude until touchdown. Default 3 sec.
|
-- @field #number talt Interval in seconds between reporting altitude until touchdown. Default 3 sec.
|
||||||
-- @field #boolean chatty Display some messages on events like take-off and touchdown.
|
-- @field #boolean chatty Display some messages on events like take-off and touchdown.
|
||||||
-- @field #boolean eventsmoose If true, events are handled by MOOSE. If false, events are handled directly by DCS eventhandler.
|
-- @field #boolean eventsmoose [Deprecated] If true, events are handled by MOOSE. If false, events are handled directly by DCS eventhandler.
|
||||||
|
-- @field #boolean reportplayername If true, use playername not callsign on callouts
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
--- Adds some rudimentary ATC functionality via the radio menu.
|
--- Adds some rudimentary ATC functionality via the radio menu.
|
||||||
@@ -88,6 +89,7 @@ PSEUDOATC={
|
|||||||
talt=3,
|
talt=3,
|
||||||
chatty=true,
|
chatty=true,
|
||||||
eventsmoose=true,
|
eventsmoose=true,
|
||||||
|
reportplayername = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -98,13 +100,14 @@ PSEUDOATC.id="PseudoATC | "
|
|||||||
|
|
||||||
--- PSEUDOATC version.
|
--- PSEUDOATC version.
|
||||||
-- @field #number version
|
-- @field #number version
|
||||||
PSEUDOATC.version="0.9.2"
|
PSEUDOATC.version="0.10.5"
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- TODO list
|
-- TODO list
|
||||||
-- DONE: Add takeoff event.
|
-- DONE: Add takeoff event.
|
||||||
-- DONE: Add user functions.
|
-- DONE: Add user functions.
|
||||||
|
-- DONE: Refactor to use Moose event handling only
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -129,23 +132,14 @@ function PSEUDOATC:Start()
|
|||||||
self:F()
|
self:F()
|
||||||
|
|
||||||
-- Debug info
|
-- Debug info
|
||||||
self:E(PSEUDOATC.id.."Starting PseudoATC")
|
self:I(PSEUDOATC.id.."Starting PseudoATC")
|
||||||
|
|
||||||
-- Handle events.
|
-- Handle events.
|
||||||
if self.eventsmoose then
|
self:HandleEvent(EVENTS.Birth, self._OnBirth)
|
||||||
self:T(PSEUDOATC.id.."Events are handled by MOOSE.")
|
self:HandleEvent(EVENTS.Land, self._PlayerLanded)
|
||||||
self:HandleEvent(EVENTS.Birth, self._OnBirth)
|
self:HandleEvent(EVENTS.Takeoff, self._PlayerTakeOff)
|
||||||
self:HandleEvent(EVENTS.Land, self._PlayerLanded)
|
self:HandleEvent(EVENTS.PlayerLeaveUnit, self._PlayerLeft)
|
||||||
self:HandleEvent(EVENTS.Takeoff, self._PlayerTakeOff)
|
self:HandleEvent(EVENTS.Crash, self._PlayerLeft)
|
||||||
self:HandleEvent(EVENTS.PlayerLeaveUnit, self._PlayerLeft)
|
|
||||||
self:HandleEvent(EVENTS.Crash, self._PlayerLeft)
|
|
||||||
--self:HandleEvent(EVENTS.Ejection, self._PlayerLeft)
|
|
||||||
--self:HandleEvent(EVENTS.PilotDead, self._PlayerLeft)
|
|
||||||
else
|
|
||||||
self:T(PSEUDOATC.id.."Events are handled by DCS.")
|
|
||||||
-- Events are handled directly by DCS.
|
|
||||||
world.addEventHandler(self)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -183,6 +177,13 @@ function PSEUDOATC:SetMessageDuration(duration)
|
|||||||
self.mdur=duration or 30
|
self.mdur=duration or 30
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Use player name, not call sign, in callouts
|
||||||
|
-- @param #PSEUDOATC self
|
||||||
|
function PSEUDOATC:SetReportPlayername()
|
||||||
|
self.reportplayername = true
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Set time interval after which the F10 radio menu is refreshed.
|
--- Set time interval after which the F10 radio menu is refreshed.
|
||||||
-- @param #PSEUDOATC self
|
-- @param #PSEUDOATC self
|
||||||
-- @param #number interval Interval in seconds. Default is every 120 sec.
|
-- @param #number interval Interval in seconds. Default is every 120 sec.
|
||||||
@@ -190,7 +191,7 @@ function PSEUDOATC:SetMenuRefresh(interval)
|
|||||||
self.mrefresh=interval or 120
|
self.mrefresh=interval or 120
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Enable/disable event handling by MOOSE or DCS.
|
--- [Deprecated] Enable/disable event handling by MOOSE or DCS.
|
||||||
-- @param #PSEUDOATC self
|
-- @param #PSEUDOATC self
|
||||||
-- @param #boolean switch If true, events are handled by MOOSE (default). If false, events are handled directly by DCS.
|
-- @param #boolean switch If true, events are handled by MOOSE (default). If false, events are handled directly by DCS.
|
||||||
function PSEUDOATC:SetEventsMoose(switch)
|
function PSEUDOATC:SetEventsMoose(switch)
|
||||||
@@ -207,84 +208,6 @@ end
|
|||||||
-----------------------------------------------------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- Event Handling
|
-- Event Handling
|
||||||
|
|
||||||
--- Event handler for suppressed groups.
|
|
||||||
--@param #PSEUDOATC self
|
|
||||||
--@param #table Event Event data table. Holds event.id, event.initiator and event.target etc.
|
|
||||||
function PSEUDOATC:onEvent(Event)
|
|
||||||
if Event == nil or Event.initiator == nil or Unit.getByName(Event.initiator:getName()) == nil then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
local DCSiniunit = Event.initiator
|
|
||||||
local DCSplace = Event.place
|
|
||||||
local DCSsubplace = Event.subplace
|
|
||||||
|
|
||||||
local EventData={}
|
|
||||||
local _playerunit=nil
|
|
||||||
local _playername=nil
|
|
||||||
|
|
||||||
if Event.initiator then
|
|
||||||
EventData.IniUnitName = Event.initiator:getName()
|
|
||||||
EventData.IniDCSGroup = Event.initiator:getGroup()
|
|
||||||
EventData.IniGroupName = Event.initiator:getGroup():getName()
|
|
||||||
-- Get player unit and name. This returns nil,nil if the event was not fired by a player unit. And these are the only events we are interested in.
|
|
||||||
_playerunit, _playername = self:_GetPlayerUnitAndName(EventData.IniUnitName)
|
|
||||||
end
|
|
||||||
|
|
||||||
if Event.place then
|
|
||||||
EventData.Place=Event.place
|
|
||||||
EventData.PlaceName=Event.place:getName()
|
|
||||||
end
|
|
||||||
if Event.subplace then
|
|
||||||
EventData.SubPlace=Event.subplace
|
|
||||||
EventData.SubPlaceName=Event.subplace:getName()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Event info.
|
|
||||||
self:T3(PSEUDOATC.id..string.format("EVENT: Event in onEvent with ID = %s", tostring(Event.id)))
|
|
||||||
self:T3(PSEUDOATC.id..string.format("EVENT: Ini unit = %s" , tostring(EventData.IniUnitName)))
|
|
||||||
self:T3(PSEUDOATC.id..string.format("EVENT: Ini group = %s" , tostring(EventData.IniGroupName)))
|
|
||||||
self:T3(PSEUDOATC.id..string.format("EVENT: Ini player = %s" , tostring(_playername)))
|
|
||||||
self:T3(PSEUDOATC.id..string.format("EVENT: Place = %s" , tostring(EventData.PlaceName)))
|
|
||||||
self:T3(PSEUDOATC.id..string.format("EVENT: SubPlace = %s" , tostring(EventData.SubPlaceName)))
|
|
||||||
|
|
||||||
-- Event birth.
|
|
||||||
if Event.id == world.event.S_EVENT_BIRTH and _playername then
|
|
||||||
self:_OnBirth(EventData)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Event takeoff.
|
|
||||||
if Event.id == world.event.S_EVENT_TAKEOFF and _playername and EventData.Place then
|
|
||||||
self:_PlayerTakeOff(EventData)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Event land.
|
|
||||||
if Event.id == world.event.S_EVENT_LAND and _playername and EventData.Place then
|
|
||||||
self:_PlayerLanded(EventData)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Event player left unit
|
|
||||||
if Event.id == world.event.S_EVENT_PLAYER_LEAVE_UNIT and _playername then
|
|
||||||
self:_PlayerLeft(EventData)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Event crash ==> player left unit
|
|
||||||
if Event.id == world.event.S_EVENT_CRASH and _playername then
|
|
||||||
self:_PlayerLeft(EventData)
|
|
||||||
end
|
|
||||||
|
|
||||||
--[[
|
|
||||||
-- Event eject ==> player left unit
|
|
||||||
if Event.id == world.event.S_EVENT_EJECTION and _playername then
|
|
||||||
self:_PlayerLeft(EventData)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Event pilot dead ==> player left unit
|
|
||||||
if Event.id == world.event.S_EVENT_PILOT_DEAD and _playername then
|
|
||||||
self:_PlayerLeft(EventData)
|
|
||||||
end
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Function called my MOOSE event handler when a player enters a unit.
|
--- Function called my MOOSE event handler when a player enters a unit.
|
||||||
-- @param #PSEUDOATC self
|
-- @param #PSEUDOATC self
|
||||||
@@ -294,7 +217,9 @@ function PSEUDOATC:_OnBirth(EventData)
|
|||||||
|
|
||||||
-- Get unit and player.
|
-- Get unit and player.
|
||||||
local _unitName=EventData.IniUnitName
|
local _unitName=EventData.IniUnitName
|
||||||
local _unit, _playername=self:_GetPlayerUnitAndName(_unitName)
|
--local _unit, _playername=self:_GetPlayerUnitAndName(_unitName)
|
||||||
|
local _unit = EventData.IniUnit
|
||||||
|
local _playername = EventData.IniPlayerName
|
||||||
|
|
||||||
-- Check if a player entered.
|
-- Check if a player entered.
|
||||||
if _unit and _playername then
|
if _unit and _playername then
|
||||||
@@ -311,7 +236,10 @@ function PSEUDOATC:_PlayerLeft(EventData)
|
|||||||
|
|
||||||
-- Get unit and player.
|
-- Get unit and player.
|
||||||
local _unitName=EventData.IniUnitName
|
local _unitName=EventData.IniUnitName
|
||||||
local _unit, _playername=self:_GetPlayerUnitAndName(_unitName)
|
--local _unit, _playername=self:_GetPlayerUnitAndName(_unitName)
|
||||||
|
|
||||||
|
local _unit = EventData.IniUnit
|
||||||
|
local _playername = EventData.IniPlayerName
|
||||||
|
|
||||||
-- Check if a player left.
|
-- Check if a player left.
|
||||||
if _unit and _playername then
|
if _unit and _playername then
|
||||||
@@ -326,18 +254,16 @@ function PSEUDOATC:_PlayerLanded(EventData)
|
|||||||
self:F({EventData=EventData})
|
self:F({EventData=EventData})
|
||||||
|
|
||||||
-- Get unit, player and place.
|
-- Get unit, player and place.
|
||||||
local _unitName=EventData.IniUnitName
|
local _unitName=EventData.IniUnitName
|
||||||
local _unit, _playername=self:_GetPlayerUnitAndName(_unitName)
|
local _unit = EventData.IniUnit
|
||||||
|
local _playername = EventData.IniPlayerName
|
||||||
|
--local _unit, _playername=self:_GetPlayerUnitAndName(_unitName)
|
||||||
local _base=nil
|
local _base=nil
|
||||||
local _baseName=nil
|
local _baseName=nil
|
||||||
if EventData.place then
|
if EventData.place then
|
||||||
_base=EventData.place
|
_base=EventData.place
|
||||||
_baseName=EventData.place:getName()
|
_baseName=EventData.place:getName()
|
||||||
end
|
end
|
||||||
-- if EventData.subplace then
|
|
||||||
-- local _subPlace=EventData.subplace
|
|
||||||
-- local _subPlaceName=EventData.subplace:getName()
|
|
||||||
-- end
|
|
||||||
|
|
||||||
-- Call landed function.
|
-- Call landed function.
|
||||||
if _unit and _playername and _base then
|
if _unit and _playername and _base then
|
||||||
@@ -352,8 +278,10 @@ function PSEUDOATC:_PlayerTakeOff(EventData)
|
|||||||
self:F({EventData=EventData})
|
self:F({EventData=EventData})
|
||||||
|
|
||||||
-- Get unit, player and place.
|
-- Get unit, player and place.
|
||||||
local _unitName=EventData.IniUnitName
|
local _unitName=EventData.IniUnitName
|
||||||
local _unit,_playername=self:_GetPlayerUnitAndName(_unitName)
|
local _unit = EventData.IniUnit
|
||||||
|
local _playername = EventData.IniPlayerName
|
||||||
|
--local _unit,_playername=self:_GetPlayerUnitAndName(_unitName)
|
||||||
local _base=nil
|
local _base=nil
|
||||||
local _baseName=nil
|
local _baseName=nil
|
||||||
if EventData.place then
|
if EventData.place then
|
||||||
@@ -441,14 +369,15 @@ function PSEUDOATC:PlayerLanded(unit, place)
|
|||||||
local group=unit:GetGroup()
|
local group=unit:GetGroup()
|
||||||
local GID=group:GetID()
|
local GID=group:GetID()
|
||||||
local UID=unit:GetDCSObject():getID()
|
local UID=unit:GetDCSObject():getID()
|
||||||
local PlayerName=self.group[GID].player[UID].playername
|
local PlayerName = unit:GetPlayerName() or "Ghost"
|
||||||
local UnitName=self.group[GID].player[UID].unitname
|
local UnitName = unit:GetName() or "Ghostplane"
|
||||||
local GroupName=self.group[GID].player[UID].groupname
|
local GroupName = group:GetName() or "Ghostgroup"
|
||||||
|
if self.Debug then
|
||||||
-- Debug message.
|
-- Debug message.
|
||||||
local text=string.format("Player %s in unit %s of group %s (id=%d) landed at %s.", PlayerName, UnitName, GroupName, GID, place)
|
local text=string.format("Player %s in unit %s of group %s landed at %s.", PlayerName, UnitName, GroupName, place)
|
||||||
self:T(PSEUDOATC.id..text)
|
self:T(PSEUDOATC.id..text)
|
||||||
MESSAGE:New(text, 30):ToAllIf(self.Debug)
|
MESSAGE:New(text, 30):ToAllIf(self.Debug)
|
||||||
|
end
|
||||||
|
|
||||||
-- Stop altitude reporting timer if its activated.
|
-- Stop altitude reporting timer if its activated.
|
||||||
self:AltitudeTimerStop(GID,UID)
|
self:AltitudeTimerStop(GID,UID)
|
||||||
@@ -470,21 +399,22 @@ function PSEUDOATC:PlayerTakeOff(unit, place)
|
|||||||
|
|
||||||
-- Gather some information.
|
-- Gather some information.
|
||||||
local group=unit:GetGroup()
|
local group=unit:GetGroup()
|
||||||
local GID=group:GetID()
|
local PlayerName = unit:GetPlayerName() or "Ghost"
|
||||||
local UID=unit:GetDCSObject():getID()
|
local UnitName = unit:GetName() or "Ghostplane"
|
||||||
local PlayerName=self.group[GID].player[UID].playername
|
local GroupName = group:GetName() or "Ghostgroup"
|
||||||
local CallSign=self.group[GID].player[UID].callsign
|
local CallSign = unit:GetCallsign() or "Ghost11"
|
||||||
local UnitName=self.group[GID].player[UID].unitname
|
if self.Debug then
|
||||||
local GroupName=self.group[GID].player[UID].groupname
|
-- Debug message.
|
||||||
|
local text=string.format("Player %s in unit %s of group %s took off at %s.", PlayerName, UnitName, GroupName, place)
|
||||||
-- Debug message.
|
self:T(PSEUDOATC.id..text)
|
||||||
local text=string.format("Player %s in unit %s of group %s (id=%d) took off at %s.", PlayerName, UnitName, GroupName, GID, place)
|
MESSAGE:New(text, 30):ToAllIf(self.Debug)
|
||||||
self:T(PSEUDOATC.id..text)
|
end
|
||||||
MESSAGE:New(text, 30):ToAllIf(self.Debug)
|
|
||||||
|
|
||||||
-- Bye-Bye message.
|
-- Bye-Bye message.
|
||||||
if place and self.chatty then
|
if place and self.chatty then
|
||||||
local text=string.format("%s, %s, you are airborne. Have a safe trip!", place, CallSign)
|
local text=string.format("%s, %s, you are airborne. Have a safe trip!", place, CallSign)
|
||||||
|
if self.reportplayername then
|
||||||
|
text=string.format("%s, %s, you are airborne. Have a safe trip!", place, PlayerName)
|
||||||
|
end
|
||||||
MESSAGE:New(text, self.mdur):ToGroup(group)
|
MESSAGE:New(text, self.mdur):ToGroup(group)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -501,7 +431,7 @@ function PSEUDOATC:PlayerLeft(unit)
|
|||||||
local GID=group:GetID()
|
local GID=group:GetID()
|
||||||
local UID=unit:GetDCSObject():getID()
|
local UID=unit:GetDCSObject():getID()
|
||||||
|
|
||||||
if self.group[GID].player[UID] then
|
if self.group[GID] and self.group[GID].player and self.group[GID].player[UID] then
|
||||||
local PlayerName=self.group[GID].player[UID].playername
|
local PlayerName=self.group[GID].player[UID].playername
|
||||||
local CallSign=self.group[GID].player[UID].callsign
|
local CallSign=self.group[GID].player[UID].callsign
|
||||||
local UnitName=self.group[GID].player[UID].unitname
|
local UnitName=self.group[GID].player[UID].unitname
|
||||||
@@ -687,7 +617,9 @@ function PSEUDOATC:MenuWaypoints(GID, UID)
|
|||||||
-- Position of Waypoint
|
-- Position of Waypoint
|
||||||
local pos=COORDINATE:New(wp.x, wp.alt, wp.y)
|
local pos=COORDINATE:New(wp.x, wp.alt, wp.y)
|
||||||
local name=string.format("Waypoint %d", i-1)
|
local name=string.format("Waypoint %d", i-1)
|
||||||
|
if wp.name and wp.name ~= "" then
|
||||||
|
name = string.format("Waypoint %s",wp.name)
|
||||||
|
end
|
||||||
-- "F10/PseudoATC/Waypoints/Waypoint X"
|
-- "F10/PseudoATC/Waypoints/Waypoint X"
|
||||||
local submenu=missionCommands.addSubMenuForGroup(GID, name, self.group[GID].player[UID].menu_waypoints)
|
local submenu=missionCommands.addSubMenuForGroup(GID, name, self.group[GID].player[UID].menu_waypoints)
|
||||||
|
|
||||||
@@ -844,7 +776,8 @@ function PSEUDOATC:ReportHeight(GID, UID, dt, _clear)
|
|||||||
local position=unit:GetCoordinate()
|
local position=unit:GetCoordinate()
|
||||||
local height=get_AGL(position)
|
local height=get_AGL(position)
|
||||||
local callsign=unit:GetCallsign()
|
local callsign=unit:GetCallsign()
|
||||||
|
local PlayerName=self.group[GID].player[UID].playername
|
||||||
|
|
||||||
-- Settings.
|
-- Settings.
|
||||||
local settings=_DATABASE:GetPlayerSettings(self.group[GID].player[UID].playername) or _SETTINGS --Core.Settings#SETTINGS
|
local settings=_DATABASE:GetPlayerSettings(self.group[GID].player[UID].playername) or _SETTINGS --Core.Settings#SETTINGS
|
||||||
|
|
||||||
@@ -856,7 +789,9 @@ function PSEUDOATC:ReportHeight(GID, UID, dt, _clear)
|
|||||||
|
|
||||||
-- Message text.
|
-- Message text.
|
||||||
local _text=string.format("%s, your altitude is %s AGL.", callsign, Hs)
|
local _text=string.format("%s, your altitude is %s AGL.", callsign, Hs)
|
||||||
|
if self.reportplayername then
|
||||||
|
_text=string.format("%s, your altitude is %s AGL.", PlayerName, Hs)
|
||||||
|
end
|
||||||
-- Append flight level.
|
-- Append flight level.
|
||||||
if _clear==false then
|
if _clear==false then
|
||||||
_text=_text..string.format(" FL%03d.", position.y/30.48)
|
_text=_text..string.format(" FL%03d.", position.y/30.48)
|
||||||
@@ -901,7 +836,7 @@ function PSEUDOATC:AltitudeTimeStart(GID, UID)
|
|||||||
self:T(PSEUDOATC.id..string.format("Starting altitude report timer for player ID %d.", UID))
|
self:T(PSEUDOATC.id..string.format("Starting altitude report timer for player ID %d.", UID))
|
||||||
|
|
||||||
-- Start timer. Altitude is reported every ~3 seconds.
|
-- Start timer. Altitude is reported every ~3 seconds.
|
||||||
self.group[GID].player[UID].altimer, self.group[GID].player[UID].altimerid=SCHEDULER:New(nil, self.ReportHeight, {self, GID, UID, 0.1, true}, 1, 3)
|
self.group[GID].player[UID].altimer, self.group[GID].player[UID].altimerid=SCHEDULER:New(nil, self.ReportHeight, {self, GID, UID, 1, true}, 1, 3)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Stop/destroy DCS scheduler function for reporting altitude.
|
--- Stop/destroy DCS scheduler function for reporting altitude.
|
||||||
|
|||||||
@@ -33,25 +33,20 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Additional Material:
|
||||||
--
|
--
|
||||||
-- ### [RAT - Random Air Traffic](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/RAT%20-%20Random%20Air%20Traffic)
|
-- * **Demo Missions:** [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/RAT)
|
||||||
|
-- * **YouTube videos:** [Random Air Traffic](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl0u4Zxywtg-mx_ov4vi68CO)
|
||||||
|
-- * **Guides:** None
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # YouTube Channel
|
-- ### Author: **funkyfranky**
|
||||||
--
|
--
|
||||||
-- ### [MOOSE YouTube Channel](https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg)
|
-- ### Contributions: FlightControl
|
||||||
-- ### [MOOSE - RAT - Random Air Traffic](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl0u4Zxywtg-mx_ov4vi68CO)
|
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
-- @module Functional.RAT
|
||||||
-- ### Author: **[funkyfranky](https://forums.eagle.ru/member.php?u=115026)**
|
|
||||||
--
|
|
||||||
-- ### Contributions: [FlightControl](https://forums.eagle.ru/member.php?u=89536)
|
|
||||||
--
|
|
||||||
-- ===
|
|
||||||
-- @module Functional.Rat
|
|
||||||
-- @image RAT.JPG
|
-- @image RAT.JPG
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -170,7 +165,7 @@
|
|||||||
--
|
--
|
||||||
-- * A specific departure and/or destination airport can be chosen.
|
-- * A specific departure and/or destination airport can be chosen.
|
||||||
-- * Valid coalitions can be set, e.g. only red, blue or neutral, all three "colours".
|
-- * Valid coalitions can be set, e.g. only red, blue or neutral, all three "colours".
|
||||||
-- * It is possible to start in air within a zone defined in the mission editor or within a zone above an airport of the map.
|
-- * It is possible to start in air within a zone or within a zone above an airport of the map.
|
||||||
--
|
--
|
||||||
-- ## Flight Plan
|
-- ## Flight Plan
|
||||||
--
|
--
|
||||||
@@ -225,7 +220,7 @@
|
|||||||
--
|
--
|
||||||
-- * Landing: When an aircraft tries to land at an airport where it does not have a valid parking spot, it is immidiately despawned the moment its wheels touch the runway, i.e.
|
-- * Landing: When an aircraft tries to land at an airport where it does not have a valid parking spot, it is immidiately despawned the moment its wheels touch the runway, i.e.
|
||||||
-- when a landing event is triggered. This leads to the loss of the RAT aircraft. On possible way to circumvent the this problem is to let another RAT aircraft spawn at landing
|
-- when a landing event is triggered. This leads to the loss of the RAT aircraft. On possible way to circumvent the this problem is to let another RAT aircraft spawn at landing
|
||||||
-- and not when it shuts down its engines. See the @{RAT.RespawnAfterLanding}() function.
|
-- and not when it shuts down its engines. See the @{#RAT.RespawnAfterLanding}() function.
|
||||||
-- * Spawning: When a big aircraft is dynamically spawned on a small airbase a few things can go wrong. For example, it could be spawned at a parking spot with a shelter.
|
-- * Spawning: When a big aircraft is dynamically spawned on a small airbase a few things can go wrong. For example, it could be spawned at a parking spot with a shelter.
|
||||||
-- Or it could be damaged by a scenery object when it is taxiing out to the runway, or it could overlap with other aircraft on parking spots near by.
|
-- Or it could be damaged by a scenery object when it is taxiing out to the runway, or it could overlap with other aircraft on parking spots near by.
|
||||||
--
|
--
|
||||||
@@ -1179,13 +1174,13 @@ function RAT:SetTakeoffAir()
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set possible departure ports. This can be an airport or a zone defined in the mission editor.
|
--- Set possible departure ports. This can be an airport or a zone.
|
||||||
-- @param #RAT self
|
-- @param #RAT self
|
||||||
-- @param #string departurenames Name or table of names of departure airports or zones.
|
-- @param #string departurenames Name or table of names of departure airports or zones.
|
||||||
-- @return #RAT RAT self object.
|
-- @return #RAT RAT self object.
|
||||||
-- @usage RAT:SetDeparture("Sochi-Adler") will spawn RAT objects at Sochi-Adler airport.
|
-- @usage RAT:SetDeparture("Sochi-Adler") will spawn RAT objects at Sochi-Adler airport.
|
||||||
-- @usage RAT:SetDeparture({"Sochi-Adler", "Gudauta"}) will spawn RAT aircraft radomly at Sochi-Adler or Gudauta airport.
|
-- @usage RAT:SetDeparture({"Sochi-Adler", "Gudauta"}) will spawn RAT aircraft radomly at Sochi-Adler or Gudauta airport.
|
||||||
-- @usage RAT:SetDeparture({"Zone A", "Gudauta"}) will spawn RAT aircraft in air randomly within Zone A, which has to be defined in the mission editor, or within a zone around Gudauta airport. Note that this also requires RAT:takeoff("air") to be set.
|
-- @usage RAT:SetDeparture({"Zone A", "Gudauta"}) will spawn RAT aircraft in air randomly within Zone A, or within a zone around Gudauta airport. Note that this also requires RAT:takeoff("air") to be set.
|
||||||
function RAT:SetDeparture(departurenames)
|
function RAT:SetDeparture(departurenames)
|
||||||
self:F2(departurenames)
|
self:F2(departurenames)
|
||||||
|
|
||||||
@@ -2474,11 +2469,11 @@ end
|
|||||||
-- @param #RAT self
|
-- @param #RAT self
|
||||||
-- @param #number takeoff Takeoff type. Could also be air start.
|
-- @param #number takeoff Takeoff type. Could also be air start.
|
||||||
-- @param #number landing Landing type. Could also be a destination in air.
|
-- @param #number landing Landing type. Could also be a destination in air.
|
||||||
-- @param Wrapper.Airport#AIRBASE _departure (Optional) Departure airbase.
|
-- @param Wrapper.Airbase#AIRBASE _departure (Optional) Departure airbase.
|
||||||
-- @param Wrapper.Airport#AIRBASE _destination (Optional) Destination airbase.
|
-- @param Wrapper.Airbase#AIRBASE _destination (Optional) Destination airbase.
|
||||||
-- @param #table _waypoint Initial waypoint.
|
-- @param #table _waypoint Initial waypoint.
|
||||||
-- @return Wrapper.Airport#AIRBASE Departure airbase.
|
-- @return Wrapper.Airbase#AIRBASE Departure airbase.
|
||||||
-- @return Wrapper.Airport#AIRBASE Destination airbase.
|
-- @return Wrapper.Airbase#AIRBASE Destination airbase.
|
||||||
-- @return #table Table of flight plan waypoints.
|
-- @return #table Table of flight plan waypoints.
|
||||||
-- @return #nil If no valid departure or destination airport could be found.
|
-- @return #nil If no valid departure or destination airport could be found.
|
||||||
function RAT:_SetRoute(takeoff, landing, _departure, _destination, _waypoint)
|
function RAT:_SetRoute(takeoff, landing, _departure, _destination, _waypoint)
|
||||||
@@ -2537,7 +2532,7 @@ function RAT:_SetRoute(takeoff, landing, _departure, _destination, _waypoint)
|
|||||||
end
|
end
|
||||||
elseif self:_ZoneExists(_departure) then
|
elseif self:_ZoneExists(_departure) then
|
||||||
-- If it's not an airport, check whether it's a zone.
|
-- If it's not an airport, check whether it's a zone.
|
||||||
departure=ZONE:New(_departure)
|
departure=ZONE:FindByName(_departure)
|
||||||
else
|
else
|
||||||
local text=string.format("ERROR! Specified departure airport %s does not exist for %s.", _departure, self.alias)
|
local text=string.format("ERROR! Specified departure airport %s does not exist for %s.", _departure, self.alias)
|
||||||
self:E(RAT.id..text)
|
self:E(RAT.id..text)
|
||||||
@@ -2635,7 +2630,7 @@ function RAT:_SetRoute(takeoff, landing, _departure, _destination, _waypoint)
|
|||||||
end
|
end
|
||||||
|
|
||||||
elseif self:_ZoneExists(_destination) then
|
elseif self:_ZoneExists(_destination) then
|
||||||
destination=ZONE:New(_destination)
|
destination=ZONE:FindByName(_destination)
|
||||||
else
|
else
|
||||||
local text=string.format("ERROR: Specified destination airport/zone %s does not exist for %s!", _destination, self.alias)
|
local text=string.format("ERROR: Specified destination airport/zone %s does not exist for %s!", _destination, self.alias)
|
||||||
self:E(RAT.id.."ERROR: "..text)
|
self:E(RAT.id.."ERROR: "..text)
|
||||||
@@ -3142,7 +3137,7 @@ function RAT:_PickDeparture(takeoff)
|
|||||||
end
|
end
|
||||||
elseif self:_ZoneExists(name) then
|
elseif self:_ZoneExists(name) then
|
||||||
if takeoff==RAT.wp.air then
|
if takeoff==RAT.wp.air then
|
||||||
dep=ZONE:New(name)
|
dep=ZONE:FindByName(name)
|
||||||
else
|
else
|
||||||
self:E(RAT.id..string.format("ERROR! Takeoff is not in air. Cannot use %s as departure.", name))
|
self:E(RAT.id..string.format("ERROR! Takeoff is not in air. Cannot use %s as departure.", name))
|
||||||
end
|
end
|
||||||
@@ -3254,7 +3249,7 @@ function RAT:_PickDestination(departure, q, minrange, maxrange, random, landing)
|
|||||||
end
|
end
|
||||||
elseif self:_ZoneExists(name) then
|
elseif self:_ZoneExists(name) then
|
||||||
if landing==RAT.wp.air then
|
if landing==RAT.wp.air then
|
||||||
dest=ZONE:New(name)
|
dest=ZONE:FindByName(name)
|
||||||
else
|
else
|
||||||
self:E(RAT.id..string.format("ERROR! Landing is not in air. Cannot use zone %s as destination!", name))
|
self:E(RAT.id..string.format("ERROR! Landing is not in air. Cannot use zone %s as destination!", name))
|
||||||
end
|
end
|
||||||
@@ -3483,7 +3478,7 @@ function RAT:Status(message, forID)
|
|||||||
-- Get group.
|
-- Get group.
|
||||||
local group=ratcraft.group --Wrapper.Group#GROUP
|
local group=ratcraft.group --Wrapper.Group#GROUP
|
||||||
|
|
||||||
if group and group:IsAlive() then
|
if group and group:IsAlive() and (group:GetCoordinate() or group:GetVec3()) then
|
||||||
nalive=nalive+1
|
nalive=nalive+1
|
||||||
|
|
||||||
-- Gather some information.
|
-- Gather some information.
|
||||||
@@ -3491,8 +3486,11 @@ function RAT:Status(message, forID)
|
|||||||
local life=self:_GetLife(group)
|
local life=self:_GetLife(group)
|
||||||
local fuel=group:GetFuel()*100.0
|
local fuel=group:GetFuel()*100.0
|
||||||
local airborne=group:InAir()
|
local airborne=group:InAir()
|
||||||
local coords=group:GetCoordinate()
|
local coords=group:GetCoordinate() or group:GetVec3()
|
||||||
local alt=coords.y
|
local alt=1000
|
||||||
|
if coords then
|
||||||
|
alt=coords.y or 1000
|
||||||
|
end
|
||||||
--local vel=group:GetVelocityKMH()
|
--local vel=group:GetVelocityKMH()
|
||||||
local departure=ratcraft.departure:GetName()
|
local departure=ratcraft.departure:GetName()
|
||||||
local destination=ratcraft.destination:GetName()
|
local destination=ratcraft.destination:GetName()
|
||||||
@@ -4602,7 +4600,7 @@ function RAT:_TaskHolding(P1, Altitude, Speed, Duration)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Function which is called after passing every waypoint. Info on waypoint is given and special functions are executed.
|
--- Function which is called after passing every waypoint. Info on waypoint is given and special functions are executed.
|
||||||
-- @param Core.Group#GROUP group Group of aircraft.
|
-- @param Wrapper.Group#GROUP group Group of aircraft.
|
||||||
-- @param #RAT rat RAT object.
|
-- @param #RAT rat RAT object.
|
||||||
-- @param #number wp Waypoint index. Running number of the waypoints. Determines the actions to be executed.
|
-- @param #number wp Waypoint index. Running number of the waypoints. Determines the actions to be executed.
|
||||||
function RAT._WaypointFunction(group, rat, wp)
|
function RAT._WaypointFunction(group, rat, wp)
|
||||||
@@ -4927,12 +4925,12 @@ function RAT:_AirportExists(name)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Test if a trigger zone defined in the mission editor exists.
|
--- Test if a zone exists.
|
||||||
-- @param #RAT self
|
-- @param #RAT self
|
||||||
-- @param #string name
|
-- @param #string name
|
||||||
-- @return #boolean True if zone exsits, false otherwise.
|
-- @return #boolean True if zone exsits, false otherwise.
|
||||||
function RAT:_ZoneExists(name)
|
function RAT:_ZoneExists(name)
|
||||||
local z=trigger.misc.getZone(name)
|
local z=ZONE:FindByName(name) --trigger.misc.getZone(name) as suggested by @Viking on MOOSE discord #rat
|
||||||
if z then
|
if z then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@@ -5443,7 +5441,7 @@ function RAT:_ModifySpawnTemplate(waypoints, livery, spawnplace, departure, take
|
|||||||
SpawnTemplate.units[UnitID]["onboard_num"] = string.format("%s%d%02d", self.onboardnum, (self.SpawnIndex-1)%10, (self.onboardnum0-1)+UnitID)
|
SpawnTemplate.units[UnitID]["onboard_num"] = string.format("%s%d%02d", self.onboardnum, (self.SpawnIndex-1)%10, (self.onboardnum0-1)+UnitID)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Modify coaltion and country of template.
|
-- Modify coalition and country of template.
|
||||||
SpawnTemplate.CoalitionID=self.coalition
|
SpawnTemplate.CoalitionID=self.coalition
|
||||||
if self.country then
|
if self.country then
|
||||||
SpawnTemplate.CountryID=self.country
|
SpawnTemplate.CountryID=self.country
|
||||||
@@ -5490,7 +5488,7 @@ function RAT:_ATCInit(airports_map)
|
|||||||
if not RAT.ATC.init then
|
if not RAT.ATC.init then
|
||||||
local text
|
local text
|
||||||
text="Starting RAT ATC.\nSimultanious = "..RAT.ATC.Nclearance.."\n".."Delay = "..RAT.ATC.delay
|
text="Starting RAT ATC.\nSimultanious = "..RAT.ATC.Nclearance.."\n".."Delay = "..RAT.ATC.delay
|
||||||
BASE:T(RAT.id..text)
|
BASE:T(RAT.id..text)
|
||||||
RAT.ATC.init=true
|
RAT.ATC.init=true
|
||||||
for _,ap in pairs(airports_map) do
|
for _,ap in pairs(airports_map) do
|
||||||
local name=ap:GetName()
|
local name=ap:GetName()
|
||||||
@@ -5671,6 +5669,9 @@ function RAT:_ATCClearForLanding(airport, flight)
|
|||||||
|
|
||||||
-- Debug message.
|
-- Debug message.
|
||||||
local text1=string.format("ATC %s: Flight %s cleared for landing (flag=%d).", airport, flight, flagvalue)
|
local text1=string.format("ATC %s: Flight %s cleared for landing (flag=%d).", airport, flight, flagvalue)
|
||||||
|
if string.find(flight,"#") then
|
||||||
|
flight = string.match(flight,"^(.+)#")
|
||||||
|
end
|
||||||
local text2=string.format("ATC %s: Flight %s you are cleared for landing.", airport, flight)
|
local text2=string.format("ATC %s: Flight %s you are cleared for landing.", airport, flight)
|
||||||
BASE:T( RAT.id..text1)
|
BASE:T( RAT.id..text1)
|
||||||
MESSAGE:New(text2, 10):ToAllIf(RAT.ATC.messages)
|
MESSAGE:New(text2, 10):ToAllIf(RAT.ATC.messages)
|
||||||
@@ -5713,6 +5714,9 @@ function RAT:_ATCFlightLanded(name)
|
|||||||
local text1=string.format("ATC %s: Flight %s landed. Tholding = %i:%02d, Tfinal = %i:%02d.", dest, name, Thold/60, Thold%60, Tfinal/60, Tfinal%60)
|
local text1=string.format("ATC %s: Flight %s landed. Tholding = %i:%02d, Tfinal = %i:%02d.", dest, name, Thold/60, Thold%60, Tfinal/60, Tfinal%60)
|
||||||
local text2=string.format("ATC %s: Number of flights still on final %d.", dest, RAT.ATC.airport[dest].Nonfinal)
|
local text2=string.format("ATC %s: Number of flights still on final %d.", dest, RAT.ATC.airport[dest].Nonfinal)
|
||||||
local text3=string.format("ATC %s: Traffic report: Number of planes landed in total %d. Flights/hour = %3.2f.", dest, RAT.ATC.airport[dest].traffic, TrafficPerHour)
|
local text3=string.format("ATC %s: Traffic report: Number of planes landed in total %d. Flights/hour = %3.2f.", dest, RAT.ATC.airport[dest].traffic, TrafficPerHour)
|
||||||
|
if string.find(name,"#") then
|
||||||
|
name = string.match(name,"^(.+)#")
|
||||||
|
end
|
||||||
local text4=string.format("ATC %s: Flight %s landed. Welcome to %s.", dest, name, dest)
|
local text4=string.format("ATC %s: Flight %s landed. Welcome to %s.", dest, name, dest)
|
||||||
BASE:T(RAT.id..text1)
|
BASE:T(RAT.id..text1)
|
||||||
BASE:T(RAT.id..text2)
|
BASE:T(RAT.id..text2)
|
||||||
@@ -5826,6 +5830,7 @@ RATMANAGER={
|
|||||||
rat={},
|
rat={},
|
||||||
name={},
|
name={},
|
||||||
alive={},
|
alive={},
|
||||||
|
planned={},
|
||||||
min={},
|
min={},
|
||||||
nrat=0,
|
nrat=0,
|
||||||
ntot=nil,
|
ntot=nil,
|
||||||
@@ -5874,6 +5879,7 @@ function RATMANAGER:Add(ratobject,min)
|
|||||||
|
|
||||||
self.rat[self.nrat]=ratobject
|
self.rat[self.nrat]=ratobject
|
||||||
self.alive[self.nrat]=0
|
self.alive[self.nrat]=0
|
||||||
|
self.planned[self.nrat]=0
|
||||||
self.name[self.nrat]=ratobject.alias
|
self.name[self.nrat]=ratobject.alias
|
||||||
self.min[self.nrat]=min or 1
|
self.min[self.nrat]=min or 1
|
||||||
|
|
||||||
@@ -6014,11 +6020,25 @@ function RATMANAGER:_Manage()
|
|||||||
for i=1,self.nrat do
|
for i=1,self.nrat do
|
||||||
for j=1,N[i] do
|
for j=1,N[i] do
|
||||||
time=time+self.dTspawn
|
time=time+self.dTspawn
|
||||||
SCHEDULER:New(nil, RAT._SpawnWithRoute, {self.rat[i]}, time)
|
self.planned[i]=self.planned[i]+1
|
||||||
|
SCHEDULER:New(nil, RATMANAGER._Spawn, {self, i}, time)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Instantly starts the RAT manager and spawns the initial random number RAT groups for each RAT object.
|
||||||
|
-- @param #RATMANAGER self
|
||||||
|
-- @param #RATMANAGER RATMANAGER self object.
|
||||||
|
-- @param #number i Index.
|
||||||
|
function RATMANAGER:_Spawn(i)
|
||||||
|
|
||||||
|
local rat=self.rat[i] --#RAT
|
||||||
|
|
||||||
|
rat:_SpawnWithRoute()
|
||||||
|
self.planned[i]=self.planned[i]-1
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
--- Counts the number of alive RAT objects.
|
--- Counts the number of alive RAT objects.
|
||||||
-- @param #RATMANAGER self
|
-- @param #RATMANAGER self
|
||||||
function RATMANAGER:_Count()
|
function RATMANAGER:_Count()
|
||||||
@@ -6047,7 +6067,7 @@ function RATMANAGER:_Count()
|
|||||||
ntotal=ntotal+n
|
ntotal=ntotal+n
|
||||||
|
|
||||||
-- Debug output.
|
-- Debug output.
|
||||||
local text=string.format("Number of alive groups of %s = %d", self.name[i], n)
|
local text=string.format("Number of alive groups of %s = %d, planned=%d", self.name[i], n, self.planned[i])
|
||||||
self:T(RATMANAGER.id..text)
|
self:T(RATMANAGER.id..text)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -6077,9 +6097,10 @@ function RATMANAGER:_RollDice(nrat,ntot,min,alive)
|
|||||||
local M={}
|
local M={}
|
||||||
local P={}
|
local P={}
|
||||||
for i=1,nrat do
|
for i=1,nrat do
|
||||||
|
local a=alive[i]+self.planned[i]
|
||||||
N[#N+1]=0
|
N[#N+1]=0
|
||||||
M[#M+1]=math.max(alive[i], min[i])
|
M[#M+1]=math.max(a, min[i])
|
||||||
P[#P+1]=math.max(min[i]-alive[i],0)
|
P[#P+1]=math.max(min[i]-a,0)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Min/max group arrays.
|
-- Min/max group arrays.
|
||||||
@@ -6096,7 +6117,7 @@ function RATMANAGER:_RollDice(nrat,ntot,min,alive)
|
|||||||
-- Number of new groups to be added.
|
-- Number of new groups to be added.
|
||||||
local nnew=ntot
|
local nnew=ntot
|
||||||
for i=1,nrat do
|
for i=1,nrat do
|
||||||
nnew=nnew-alive[i]
|
nnew=nnew-alive[i]-self.planned[i]
|
||||||
end
|
end
|
||||||
|
|
||||||
for i=1,nrat-1 do
|
for i=1,nrat-1 do
|
||||||
@@ -6128,7 +6149,7 @@ function RATMANAGER:_RollDice(nrat,ntot,min,alive)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Debug info
|
-- Debug info
|
||||||
self:T3(string.format("RATMANAGER: i=%d, alive=%d, min=%d, mini=%d, maxi=%d, add=%d, sumN=%d, sumP=%d", j, alive[j], min[j], mini[j], maxi[j], N[j],sN, sP))
|
self:T3(string.format("RATMANAGER: i=%d, alive=%d, planned=%d, min=%d, mini=%d, maxi=%d, add=%d, sumN=%d, sumP=%d", j, alive[j], self.planned[i], min[j], mini[j], maxi[j], N[j],sN, sP))
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -6143,7 +6164,7 @@ function RATMANAGER:_RollDice(nrat,ntot,min,alive)
|
|||||||
-- Debug info
|
-- Debug info
|
||||||
local text=RATMANAGER.id.."\n"
|
local text=RATMANAGER.id.."\n"
|
||||||
for i=1,nrat do
|
for i=1,nrat do
|
||||||
text=text..string.format("%s: i=%d, alive=%d, min=%d, mini=%d, maxi=%d, add=%d\n", self.name[i], i, alive[i], min[i], mini[i], maxi[i], N[i])
|
text=text..string.format("%s: i=%d, alive=%d, planned=%d, min=%d, mini=%d, maxi=%d, add=%d\n", self.name[i], i, alive[i], self.planned[i], min[i], mini[i], maxi[i], N[i])
|
||||||
end
|
end
|
||||||
text=text..string.format("Total # of groups to add = %d", sum(N, done))
|
text=text..string.format("Total # of groups to add = %d", sum(N, done))
|
||||||
self:T(text)
|
self:T(text)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
|||||||
--- **Functional** - Administer the scoring of player achievements, and create a CSV file logging the scoring events for use at team or squadron websites.
|
--- **Functional** - Administer the scoring of player achievements, file and log the scoring events for use at websites.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -12,14 +12,14 @@
|
|||||||
-- * Score the hits and destroys of units.
|
-- * Score the hits and destroys of units.
|
||||||
-- * Score the hits and destroys of statics.
|
-- * Score the hits and destroys of statics.
|
||||||
-- * Score the hits and destroys of scenery.
|
-- * Score the hits and destroys of scenery.
|
||||||
-- * Log scores into a CSV file.
|
-- * (optional) Log scores into a CSV file.
|
||||||
-- * Connect to a remote server using JSON and IP.
|
-- * Connect to a remote server using JSON and IP.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [SCO - Scoring](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SCO%20-%20Scoring)
|
-- [SCO - Scoring](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Scoring)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
-- and creates a CSV file logging the scoring events and results for use at team or squadron websites.
|
-- and creates a CSV file logging the scoring events and results for use at team or squadron websites.
|
||||||
--
|
--
|
||||||
-- SCORING automatically calculates the threat level of the objects hit and destroyed by players,
|
-- SCORING automatically calculates the threat level of the objects hit and destroyed by players,
|
||||||
-- which can be @{Wrapper.Unit}, @{Static) and @{Scenery} objects.
|
-- which can be @{Wrapper.Unit}, @{Wrapper.Static) and @{Scenery} objects.
|
||||||
--
|
--
|
||||||
-- Positive score points are granted when enemy or neutral targets are destroyed.
|
-- Positive score points are granted when enemy or neutral targets are destroyed.
|
||||||
-- Negative score points or penalties are given when a friendly target is hit or destroyed.
|
-- Negative score points or penalties are given when a friendly target is hit or destroyed.
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
-- Various @{Zone}s can be defined for which scores are also granted when objects in that @{Zone} are destroyed.
|
-- Various @{Core.Zone}s can be defined for which scores are also granted when objects in that @{Core.Zone} are destroyed.
|
||||||
-- This is **specifically useful** to designate **scenery targets on the map** that will generate points when destroyed.
|
-- This is **specifically useful** to designate **scenery targets on the map** that will generate points when destroyed.
|
||||||
--
|
--
|
||||||
-- With a small change in MissionScripting.lua, the scoring results can also be logged in a **CSV file**.
|
-- With a small change in MissionScripting.lua, the scoring results can also be logged in a **CSV file**.
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
--
|
--
|
||||||
-- * **Wingthor (TAW)**: Testing & Advice.
|
-- * **Wingthor (TAW)**: Testing & Advice.
|
||||||
-- * **Dutch-Baron (TAW)**: Testing & Advice.
|
-- * **Dutch-Baron (TAW)**: Testing & Advice.
|
||||||
-- * **[Whisper](http://forums.eagle.ru/member.php?u=3829): Testing and Advice.
|
-- * **Whisper**: Testing and Advice.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -115,7 +115,7 @@
|
|||||||
--
|
--
|
||||||
-- Special targets can be set that will give extra scores to the players when these are destroyed.
|
-- Special targets can be set that will give extra scores to the players when these are destroyed.
|
||||||
-- Use the methods @{#SCORING.AddUnitScore}() and @{#SCORING.RemoveUnitScore}() to specify a special additional score for a specific @{Wrapper.Unit}s.
|
-- Use the methods @{#SCORING.AddUnitScore}() and @{#SCORING.RemoveUnitScore}() to specify a special additional score for a specific @{Wrapper.Unit}s.
|
||||||
-- Use the methods @{#SCORING.AddStaticScore}() and @{#SCORING.RemoveStaticScore}() to specify a special additional score for a specific @{Static}s.
|
-- Use the methods @{#SCORING.AddStaticScore}() and @{#SCORING.RemoveStaticScore}() to specify a special additional score for a specific @{Wrapper.Static}s.
|
||||||
-- Use the method @{#SCORING.SetGroupGroup}() to specify a special additional score for a specific @{Wrapper.Group}s.
|
-- Use the method @{#SCORING.SetGroupGroup}() to specify a special additional score for a specific @{Wrapper.Group}s.
|
||||||
--
|
--
|
||||||
-- local Scoring = SCORING:New( "Scoring File" )
|
-- local Scoring = SCORING:New( "Scoring File" )
|
||||||
@@ -131,11 +131,11 @@
|
|||||||
-- # Define destruction zones that will give extra scores:
|
-- # Define destruction zones that will give extra scores:
|
||||||
--
|
--
|
||||||
-- Define zones of destruction. Any object destroyed within the zone of the given category will give extra points.
|
-- Define zones of destruction. Any object destroyed within the zone of the given category will give extra points.
|
||||||
-- Use the method @{#SCORING.AddZoneScore}() to add a @{Zone} for additional scoring.
|
-- Use the method @{#SCORING.AddZoneScore}() to add a @{Core.Zone} for additional scoring.
|
||||||
-- Use the method @{#SCORING.RemoveZoneScore}() to remove a @{Zone} for additional scoring.
|
-- Use the method @{#SCORING.RemoveZoneScore}() to remove a @{Core.Zone} for additional scoring.
|
||||||
-- There are interesting variations that can be achieved with this functionality. For example, if the @{Zone} is a @{Core.Zone#ZONE_UNIT},
|
-- There are interesting variations that can be achieved with this functionality. For example, if the @{Core.Zone} is a @{Core.Zone#ZONE_UNIT},
|
||||||
-- then the zone is a moving zone, and anything destroyed within that @{Zone} will generate points.
|
-- then the zone is a moving zone, and anything destroyed within that @{Core.Zone} will generate points.
|
||||||
-- The other implementation could be to designate a scenery target (a building) in the mission editor surrounded by a @{Zone},
|
-- The other implementation could be to designate a scenery target (a building) in the mission editor surrounded by a @{Core.Zone},
|
||||||
-- just large enough around that building.
|
-- just large enough around that building.
|
||||||
--
|
--
|
||||||
-- # Add extra Goal scores upon an event or a condition:
|
-- # Add extra Goal scores upon an event or a condition:
|
||||||
@@ -225,6 +225,8 @@ SCORING = {
|
|||||||
ClassName = "SCORING",
|
ClassName = "SCORING",
|
||||||
ClassID = 0,
|
ClassID = 0,
|
||||||
Players = {},
|
Players = {},
|
||||||
|
AutoSave = true,
|
||||||
|
version = "1.17.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
local _SCORINGCoalition = {
|
local _SCORINGCoalition = {
|
||||||
@@ -274,9 +276,15 @@ function SCORING:New( GameName )
|
|||||||
self:SetMessagesZone( true )
|
self:SetMessagesZone( true )
|
||||||
|
|
||||||
-- Scales
|
-- Scales
|
||||||
|
|
||||||
self:SetScaleDestroyScore( 10 )
|
self:SetScaleDestroyScore( 10 )
|
||||||
self:SetScaleDestroyPenalty( 30 )
|
self:SetScaleDestroyPenalty( 30 )
|
||||||
|
|
||||||
|
-- Hitting a target multiple times before destoying it should not result in a higger score
|
||||||
|
-- Multiple hits is typically a results of bombs/missles missing their target but still inflict some spash damage
|
||||||
|
-- Making this configurable to anyone can enable this anyway if they want
|
||||||
|
self:SetScoreIncrementOnHit(0)
|
||||||
|
|
||||||
-- Default fratricide penalty level (maximum penalty that can be assigned to a player before he gets kicked).
|
-- Default fratricide penalty level (maximum penalty that can be assigned to a player before he gets kicked).
|
||||||
self:SetFratricide( self.ScaleDestroyPenalty * 3 )
|
self:SetFratricide( self.ScaleDestroyPenalty * 3 )
|
||||||
self.penaltyonfratricide = true
|
self.penaltyonfratricide = true
|
||||||
@@ -306,6 +314,7 @@ function SCORING:New( GameName )
|
|||||||
end )
|
end )
|
||||||
|
|
||||||
-- Create the CSV file.
|
-- Create the CSV file.
|
||||||
|
self.AutoSave = true
|
||||||
self:OpenCSV( GameName )
|
self:OpenCSV( GameName )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -373,11 +382,11 @@ function SCORING:RemoveUnitScore( ScoreUnit )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Add a @{Static} for additional scoring when the @{Static} is destroyed.
|
--- Add a @{Wrapper.Static} for additional scoring when the @{Wrapper.Static} is destroyed.
|
||||||
-- Note that if there was already a @{Static} declared within the scoring with the same name,
|
-- Note that if there was already a @{Wrapper.Static} declared within the scoring with the same name,
|
||||||
-- then the old @{Static} will be replaced with the new @{Static}.
|
-- then the old @{Wrapper.Static} will be replaced with the new @{Wrapper.Static}.
|
||||||
-- @param #SCORING self
|
-- @param #SCORING self
|
||||||
-- @param Wrapper.Static#UNIT ScoreStatic The @{Static} for which the Score needs to be given.
|
-- @param Wrapper.Static#UNIT ScoreStatic The @{Wrapper.Static} for which the Score needs to be given.
|
||||||
-- @param #number Score The Score value.
|
-- @param #number Score The Score value.
|
||||||
-- @return #SCORING
|
-- @return #SCORING
|
||||||
function SCORING:AddStaticScore( ScoreStatic, Score )
|
function SCORING:AddStaticScore( ScoreStatic, Score )
|
||||||
@@ -389,9 +398,9 @@ function SCORING:AddStaticScore( ScoreStatic, Score )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Removes a @{Static} for additional scoring when the @{Static} is destroyed.
|
--- Removes a @{Wrapper.Static} for additional scoring when the @{Wrapper.Static} is destroyed.
|
||||||
-- @param #SCORING self
|
-- @param #SCORING self
|
||||||
-- @param Wrapper.Static#UNIT ScoreStatic The @{Static} for which the Score needs to be given.
|
-- @param Wrapper.Static#UNIT ScoreStatic The @{Wrapper.Static} for which the Score needs to be given.
|
||||||
-- @return #SCORING
|
-- @return #SCORING
|
||||||
function SCORING:RemoveStaticScore( ScoreStatic )
|
function SCORING:RemoveStaticScore( ScoreStatic )
|
||||||
|
|
||||||
@@ -419,11 +428,11 @@ function SCORING:AddScoreGroup( ScoreGroup, Score )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Add a @{Zone} to define additional scoring when any object is destroyed in that zone.
|
--- Add a @{Core.Zone} to define additional scoring when any object is destroyed in that zone.
|
||||||
-- Note that if a @{Zone} with the same name is already within the scoring added, the @{Zone} (type) and Score will be replaced!
|
-- Note that if a @{Core.Zone} with the same name is already within the scoring added, the @{Core.Zone} (type) and Score will be replaced!
|
||||||
-- This allows for a dynamic destruction zone evolution within your mission.
|
-- This allows for a dynamic destruction zone evolution within your mission.
|
||||||
-- @param #SCORING self
|
-- @param #SCORING self
|
||||||
-- @param Core.Zone#ZONE_BASE ScoreZone The @{Zone} which defines the destruction score perimeters.
|
-- @param Core.Zone#ZONE_BASE ScoreZone The @{Core.Zone} which defines the destruction score perimeters.
|
||||||
-- Note that a zone can be a polygon or a moving zone.
|
-- Note that a zone can be a polygon or a moving zone.
|
||||||
-- @param #number Score The Score value.
|
-- @param #number Score The Score value.
|
||||||
-- @return #SCORING
|
-- @return #SCORING
|
||||||
@@ -438,11 +447,11 @@ function SCORING:AddZoneScore( ScoreZone, Score )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Remove a @{Zone} for additional scoring.
|
--- Remove a @{Core.Zone} for additional scoring.
|
||||||
-- The scoring will search if any @{Zone} is added with the given name, and will remove that zone from the scoring.
|
-- The scoring will search if any @{Core.Zone} is added with the given name, and will remove that zone from the scoring.
|
||||||
-- This allows for a dynamic destruction zone evolution within your mission.
|
-- This allows for a dynamic destruction zone evolution within your mission.
|
||||||
-- @param #SCORING self
|
-- @param #SCORING self
|
||||||
-- @param Core.Zone#ZONE_BASE ScoreZone The @{Zone} which defines the destruction score perimeters.
|
-- @param Core.Zone#ZONE_BASE ScoreZone The @{Core.Zone} which defines the destruction score perimeters.
|
||||||
-- Note that a zone can be a polygon or a moving zone.
|
-- Note that a zone can be a polygon or a moving zone.
|
||||||
-- @return #SCORING
|
-- @return #SCORING
|
||||||
function SCORING:RemoveZoneScore( ScoreZone )
|
function SCORING:RemoveZoneScore( ScoreZone )
|
||||||
@@ -464,6 +473,16 @@ function SCORING:SetMessagesHit( OnOff )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Configure to increment score after a target has been hit.
|
||||||
|
-- @param #SCORING self
|
||||||
|
-- @param #number score amount of point to inclement score on each hit
|
||||||
|
-- @return #SCORING
|
||||||
|
function SCORING:SetScoreIncrementOnHit( score )
|
||||||
|
|
||||||
|
self.ScoreIncrementOnHit = score
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- If to send messages after a target has been hit.
|
--- If to send messages after a target has been hit.
|
||||||
-- @param #SCORING self
|
-- @param #SCORING self
|
||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
@@ -657,7 +676,7 @@ function SCORING:_AddPlayerFromUnit( UnitData )
|
|||||||
self.Players[PlayerName].Penalty = self.Players[PlayerName].Penalty + self.CoalitionChangePenalty or 50
|
self.Players[PlayerName].Penalty = self.Players[PlayerName].Penalty + self.CoalitionChangePenalty or 50
|
||||||
self.Players[PlayerName].PenaltyCoalition = self.Players[PlayerName].PenaltyCoalition + 1
|
self.Players[PlayerName].PenaltyCoalition = self.Players[PlayerName].PenaltyCoalition + 1
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' changed coalition from " .. _SCORINGCoalition[self.Players[PlayerName].UnitCoalition] .. " to " .. _SCORINGCoalition[UnitCoalition] ..
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' changed coalition from " .. _SCORINGCoalition[self.Players[PlayerName].UnitCoalition] .. " to " .. _SCORINGCoalition[UnitCoalition] ..
|
||||||
"(changed " .. self.Players[PlayerName].PenaltyCoalition .. " times the coalition). ".. self.CoalitionChangePenalty .."Penalty points added.",
|
"(changed " .. self.Players[PlayerName].PenaltyCoalition .. " times the coalition). ".. self.CoalitionChangePenalty .." penalty points added.",
|
||||||
MESSAGE.Type.Information
|
MESSAGE.Type.Information
|
||||||
):ToAll()
|
):ToAll()
|
||||||
self:ScoreCSV( PlayerName, "", "COALITION_PENALTY", 1, -1*self.CoalitionChangePenalty, self.Players[PlayerName].UnitName, _SCORINGCoalition[self.Players[PlayerName].UnitCoalition], _SCORINGCategory[self.Players[PlayerName].UnitCategory], self.Players[PlayerName].UnitType,
|
self:ScoreCSV( PlayerName, "", "COALITION_PENALTY", 1, -1*self.CoalitionChangePenalty, self.Players[PlayerName].UnitName, _SCORINGCoalition[self.Players[PlayerName].UnitCoalition], _SCORINGCategory[self.Players[PlayerName].UnitCategory], self.Players[PlayerName].UnitType,
|
||||||
@@ -713,11 +732,11 @@ function SCORING:AddGoalScorePlayer( PlayerName, GoalTag, Text, Score )
|
|||||||
PlayerData.Goals[GoalTag] = PlayerData.Goals[GoalTag] or { Score = 0 }
|
PlayerData.Goals[GoalTag] = PlayerData.Goals[GoalTag] or { Score = 0 }
|
||||||
PlayerData.Goals[GoalTag].Score = PlayerData.Goals[GoalTag].Score + Score
|
PlayerData.Goals[GoalTag].Score = PlayerData.Goals[GoalTag].Score + Score
|
||||||
PlayerData.Score = PlayerData.Score + Score
|
PlayerData.Score = PlayerData.Score + Score
|
||||||
|
if Text then
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. Text,
|
MESSAGE:NewType( self.DisplayMessagePrefix .. Text,
|
||||||
MESSAGE.Type.Information )
|
MESSAGE.Type.Information )
|
||||||
:ToAll()
|
:ToAll()
|
||||||
|
end
|
||||||
self:ScoreCSV( PlayerName, "", "GOAL_" .. string.upper( GoalTag ), 1, Score, nil )
|
self:ScoreCSV( PlayerName, "", "GOAL_" .. string.upper( GoalTag ), 1, Score, nil )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -736,7 +755,7 @@ function SCORING:AddGoalScore( PlayerUnit, GoalTag, Text, Score )
|
|||||||
|
|
||||||
local PlayerName = PlayerUnit:GetPlayerName()
|
local PlayerName = PlayerUnit:GetPlayerName()
|
||||||
|
|
||||||
self:F( { PlayerUnit.UnitName, PlayerName, GoalTag, Text, Score } )
|
self:T2( { PlayerUnit.UnitName, PlayerName, GoalTag, Text, Score } )
|
||||||
|
|
||||||
-- PlayerName can be nil, if the Unit with the player crashed or due to another reason.
|
-- PlayerName can be nil, if the Unit with the player crashed or due to another reason.
|
||||||
if PlayerName then
|
if PlayerName then
|
||||||
@@ -745,11 +764,12 @@ function SCORING:AddGoalScore( PlayerUnit, GoalTag, Text, Score )
|
|||||||
PlayerData.Goals[GoalTag] = PlayerData.Goals[GoalTag] or { Score = 0 }
|
PlayerData.Goals[GoalTag] = PlayerData.Goals[GoalTag] or { Score = 0 }
|
||||||
PlayerData.Goals[GoalTag].Score = PlayerData.Goals[GoalTag].Score + Score
|
PlayerData.Goals[GoalTag].Score = PlayerData.Goals[GoalTag].Score + Score
|
||||||
PlayerData.Score = PlayerData.Score + Score
|
PlayerData.Score = PlayerData.Score + Score
|
||||||
|
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. Text,
|
if Text then
|
||||||
|
MESSAGE:NewType( self.DisplayMessagePrefix .. Text,
|
||||||
MESSAGE.Type.Information )
|
MESSAGE.Type.Information )
|
||||||
:ToAll()
|
:ToAll()
|
||||||
|
end
|
||||||
self:ScoreCSV( PlayerName, "", "GOAL_" .. string.upper( GoalTag ), 1, Score, PlayerUnit:GetName() )
|
self:ScoreCSV( PlayerName, "", "GOAL_" .. string.upper( GoalTag ), 1, Score, PlayerUnit:GetName() )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -782,11 +802,12 @@ function SCORING:_AddMissionTaskScore( Mission, PlayerUnit, Text, Score )
|
|||||||
|
|
||||||
PlayerData.Score = self.Players[PlayerName].Score + Score
|
PlayerData.Score = self.Players[PlayerName].Score + Score
|
||||||
PlayerData.Mission[MissionName].ScoreTask = self.Players[PlayerName].Mission[MissionName].ScoreTask + Score
|
PlayerData.Mission[MissionName].ScoreTask = self.Players[PlayerName].Mission[MissionName].ScoreTask + Score
|
||||||
|
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. Mission:GetText() .. " : " .. Text .. " Score: " .. Score,
|
if Text then
|
||||||
MESSAGE.Type.Information )
|
MESSAGE:NewType( self.DisplayMessagePrefix .. Mission:GetText() .. " : " .. Text .. " Score: " .. Score,
|
||||||
:ToAll()
|
MESSAGE.Type.Information )
|
||||||
|
:ToAll()
|
||||||
|
end
|
||||||
self:ScoreCSV( PlayerName, "", "TASK_" .. MissionName:gsub( ' ', '_' ), 1, Score, PlayerUnit:GetName() )
|
self:ScoreCSV( PlayerName, "", "TASK_" .. MissionName:gsub( ' ', '_' ), 1, Score, PlayerUnit:GetName() )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -818,9 +839,11 @@ function SCORING:_AddMissionGoalScore( Mission, PlayerName, Text, Score )
|
|||||||
|
|
||||||
PlayerData.Score = self.Players[PlayerName].Score + Score
|
PlayerData.Score = self.Players[PlayerName].Score + Score
|
||||||
PlayerData.Mission[MissionName].ScoreTask = self.Players[PlayerName].Mission[MissionName].ScoreTask + Score
|
PlayerData.Mission[MissionName].ScoreTask = self.Players[PlayerName].Mission[MissionName].ScoreTask + Score
|
||||||
|
|
||||||
MESSAGE:NewType( string.format( "%s%s: %s! Player %s receives %d score!", self.DisplayMessagePrefix, Mission:GetText(), Text, PlayerName, Score ), MESSAGE.Type.Information ):ToAll()
|
if Text then
|
||||||
|
MESSAGE:NewType( string.format( "%s%s: %s! Player %s receives %d score!", self.DisplayMessagePrefix, Mission:GetText(), Text, PlayerName, Score ), MESSAGE.Type.Information ):ToAll()
|
||||||
|
end
|
||||||
|
|
||||||
self:ScoreCSV( PlayerName, "", "TASK_" .. MissionName:gsub( ' ', '_' ), 1, Score )
|
self:ScoreCSV( PlayerName, "", "TASK_" .. MissionName:gsub( ' ', '_' ), 1, Score )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -845,11 +868,12 @@ function SCORING:_AddMissionScore( Mission, Text, Score )
|
|||||||
|
|
||||||
PlayerData.Score = PlayerData.Score + Score
|
PlayerData.Score = PlayerData.Score + Score
|
||||||
PlayerData.Mission[MissionName].ScoreMission = PlayerData.Mission[MissionName].ScoreMission + Score
|
PlayerData.Mission[MissionName].ScoreMission = PlayerData.Mission[MissionName].ScoreMission + Score
|
||||||
|
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' has " .. Text .. " in " .. Mission:GetText() .. ". " .. Score .. " mission score!",
|
if Text then
|
||||||
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' has " .. Text .. " in " .. Mission:GetText() .. ". " .. Score .. " mission score!",
|
||||||
MESSAGE.Type.Information )
|
MESSAGE.Type.Information )
|
||||||
:ToAll()
|
:ToAll()
|
||||||
|
end
|
||||||
self:ScoreCSV( PlayerName, "", "MISSION_" .. MissionName:gsub( ' ', '_' ), 1, Score )
|
self:ScoreCSV( PlayerName, "", "MISSION_" .. MissionName:gsub( ' ', '_' ), 1, Score )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -871,10 +895,13 @@ end
|
|||||||
function SCORING:OnEventBirth( Event )
|
function SCORING:OnEventBirth( Event )
|
||||||
|
|
||||||
if Event.IniUnit then
|
if Event.IniUnit then
|
||||||
|
Event.IniUnit.ThreatLevel, Event.IniUnit.ThreatType = Event.IniUnit:GetThreatLevel()
|
||||||
if Event.IniObjectCategory == 1 then
|
if Event.IniObjectCategory == 1 then
|
||||||
local PlayerName = Event.IniUnit:GetPlayerName()
|
local PlayerName = Event.IniUnit:GetPlayerName()
|
||||||
|
Event.IniUnit.BirthTime = timer.getTime()
|
||||||
if PlayerName then
|
if PlayerName then
|
||||||
self:_AddPlayerFromUnit( Event.IniUnit )
|
self:_AddPlayerFromUnit( Event.IniUnit )
|
||||||
|
self.Players[PlayerName].PlayerKills = 0
|
||||||
self:SetScoringMenu( Event.IniGroup )
|
self:SetScoringMenu( Event.IniGroup )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1003,8 +1030,19 @@ function SCORING:_EventOnHit( Event )
|
|||||||
PlayerHit.PenaltyHit = PlayerHit.PenaltyHit or 0
|
PlayerHit.PenaltyHit = PlayerHit.PenaltyHit or 0
|
||||||
PlayerHit.TimeStamp = PlayerHit.TimeStamp or 0
|
PlayerHit.TimeStamp = PlayerHit.TimeStamp or 0
|
||||||
PlayerHit.UNIT = PlayerHit.UNIT or TargetUNIT
|
PlayerHit.UNIT = PlayerHit.UNIT or TargetUNIT
|
||||||
PlayerHit.ThreatLevel, PlayerHit.ThreatType = PlayerHit.UNIT:GetThreatLevel()
|
-- After an instant kill we can't compute the thread level anymore. To fix this we compute at OnEventBirth
|
||||||
|
if PlayerHit.UNIT.ThreatType == nil then
|
||||||
|
PlayerHit.ThreatLevel, PlayerHit.ThreatType = PlayerHit.UNIT:GetThreatLevel()
|
||||||
|
-- if this fails for some reason, set a good default value
|
||||||
|
if PlayerHit.ThreatType == nil then
|
||||||
|
PlayerHit.ThreatLevel = 1
|
||||||
|
PlayerHit.ThreatType = "Unknown"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
PlayerHit.ThreatLevel = PlayerHit.UNIT.ThreatLevel
|
||||||
|
PlayerHit.ThreatType = PlayerHit.UNIT.ThreatType
|
||||||
|
end
|
||||||
|
|
||||||
-- Only grant hit scores if there was more than one second between the last hit.
|
-- Only grant hit scores if there was more than one second between the last hit.
|
||||||
if timer.getTime() - PlayerHit.TimeStamp > 1 then
|
if timer.getTime() - PlayerHit.TimeStamp > 1 then
|
||||||
PlayerHit.TimeStamp = timer.getTime()
|
PlayerHit.TimeStamp = timer.getTime()
|
||||||
@@ -1019,27 +1057,28 @@ function SCORING:_EventOnHit( Event )
|
|||||||
|
|
||||||
if InitCoalition then -- A coalition object was hit.
|
if InitCoalition then -- A coalition object was hit.
|
||||||
if InitCoalition == TargetCoalition then
|
if InitCoalition == TargetCoalition then
|
||||||
Player.Penalty = Player.Penalty + 10
|
local Penalty = 10
|
||||||
PlayerHit.Penalty = PlayerHit.Penalty + 10
|
Player.Penalty = Player.Penalty + Penalty
|
||||||
|
PlayerHit.Penalty = PlayerHit.Penalty + Penalty
|
||||||
PlayerHit.PenaltyHit = PlayerHit.PenaltyHit + 1
|
PlayerHit.PenaltyHit = PlayerHit.PenaltyHit + 1
|
||||||
|
|
||||||
if TargetPlayerName ~= nil then -- It is a player hitting another player ...
|
if TargetPlayerName ~= nil then -- It is a player hitting another player ...
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit friendly player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.PenaltyHit .. " times. " ..
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit friendly player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.PenaltyHit .. " times. " ..
|
||||||
"Penalty: -" .. PlayerHit.Penalty .. ". Score Total:" .. Player.Score - Player.Penalty,
|
"Penalty: -" .. Penalty .. ". Score Total:" .. Player.Score - Player.Penalty,
|
||||||
MESSAGE.Type.Update )
|
MESSAGE.Type.Update )
|
||||||
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
||||||
else
|
else
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit friendly target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.PenaltyHit .. " times. " ..
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit friendly target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.PenaltyHit .. " times. " ..
|
||||||
"Penalty: -" .. PlayerHit.Penalty .. ". Score Total:" .. Player.Score - Player.Penalty,
|
"Penalty: -" .. Penalty .. ". Score Total:" .. Player.Score - Player.Penalty,
|
||||||
MESSAGE.Type.Update )
|
MESSAGE.Type.Update )
|
||||||
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
||||||
end
|
end
|
||||||
self:ScoreCSV( InitPlayerName, TargetPlayerName, "HIT_PENALTY", 1, -10, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
self:ScoreCSV( InitPlayerName, TargetPlayerName, "HIT_PENALTY", 1, -10, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
||||||
else
|
else
|
||||||
Player.Score = Player.Score + 1
|
Player.Score = Player.Score + self.ScoreIncrementOnHit
|
||||||
PlayerHit.Score = PlayerHit.Score + 1
|
PlayerHit.Score = PlayerHit.Score + self.ScoreIncrementOnHit
|
||||||
PlayerHit.ScoreHit = PlayerHit.ScoreHit + 1
|
PlayerHit.ScoreHit = PlayerHit.ScoreHit + 1
|
||||||
if TargetPlayerName ~= nil then -- It is a player hitting another player ...
|
if TargetPlayerName ~= nil then -- It is a player hitting another player ...
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit enemy player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.ScoreHit .. " times. " ..
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit enemy player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.ScoreHit .. " times. " ..
|
||||||
@@ -1102,7 +1141,18 @@ function SCORING:_EventOnHit( Event )
|
|||||||
PlayerHit.PenaltyHit = PlayerHit.PenaltyHit or 0
|
PlayerHit.PenaltyHit = PlayerHit.PenaltyHit or 0
|
||||||
PlayerHit.TimeStamp = PlayerHit.TimeStamp or 0
|
PlayerHit.TimeStamp = PlayerHit.TimeStamp or 0
|
||||||
PlayerHit.UNIT = PlayerHit.UNIT or TargetUNIT
|
PlayerHit.UNIT = PlayerHit.UNIT or TargetUNIT
|
||||||
PlayerHit.ThreatLevel, PlayerHit.ThreatType = PlayerHit.UNIT:GetThreatLevel()
|
-- After an instant kill we can't compute the thread level anymore. To fix this we compute at OnEventBirth
|
||||||
|
if PlayerHit.UNIT.ThreatType == nil then
|
||||||
|
PlayerHit.ThreatLevel, PlayerHit.ThreatType = PlayerHit.UNIT:GetThreatLevel()
|
||||||
|
-- if this fails for some reason, set a good default value
|
||||||
|
if PlayerHit.ThreatType == nil then
|
||||||
|
PlayerHit.ThreatLevel = 1
|
||||||
|
PlayerHit.ThreatType = "Unknown"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
PlayerHit.ThreatLevel = PlayerHit.UNIT.ThreatLevel
|
||||||
|
PlayerHit.ThreatType = PlayerHit.UNIT.ThreatType
|
||||||
|
end
|
||||||
|
|
||||||
-- Only grant hit scores if there was more than one second between the last hit.
|
-- Only grant hit scores if there was more than one second between the last hit.
|
||||||
if timer.getTime() - PlayerHit.TimeStamp > 1 then
|
if timer.getTime() - PlayerHit.TimeStamp > 1 then
|
||||||
@@ -1113,25 +1163,26 @@ function SCORING:_EventOnHit( Event )
|
|||||||
if InitCoalition then -- A coalition object was hit, probably a static.
|
if InitCoalition then -- A coalition object was hit, probably a static.
|
||||||
if InitCoalition == TargetCoalition then
|
if InitCoalition == TargetCoalition then
|
||||||
-- TODO: Penalty according scale
|
-- TODO: Penalty according scale
|
||||||
Player.Penalty = Player.Penalty + 10 --* self.ScaleDestroyPenalty
|
local Penalty = 10
|
||||||
PlayerHit.Penalty = PlayerHit.Penalty + 10 --* self.ScaleDestroyPenalty
|
Player.Penalty = Player.Penalty + Penalty --* self.ScaleDestroyPenalty
|
||||||
|
PlayerHit.Penalty = PlayerHit.Penalty + Penalty --* self.ScaleDestroyPenalty
|
||||||
PlayerHit.PenaltyHit = PlayerHit.PenaltyHit + 1 * self.ScaleDestroyPenalty
|
PlayerHit.PenaltyHit = PlayerHit.PenaltyHit + 1 * self.ScaleDestroyPenalty
|
||||||
|
|
||||||
MESSAGE
|
MESSAGE
|
||||||
:NewType( self.DisplayMessagePrefix .. "Player '" .. Event.WeaponPlayerName .. "' hit friendly target " ..
|
:NewType( self.DisplayMessagePrefix .. "Player '" .. Event.WeaponPlayerName .. "' hit friendly target " ..
|
||||||
TargetUnitCategory .. " ( " .. TargetType .. " ) " ..
|
TargetUnitCategory .. " ( " .. TargetType .. " ) " ..
|
||||||
"Penalty: -" .. PlayerHit.Penalty .. " = " .. Player.Score - Player.Penalty,
|
"Penalty: -" .. Penalty .. " = " .. Player.Score - Player.Penalty,
|
||||||
MESSAGE.Type.Update
|
MESSAGE.Type.Update
|
||||||
)
|
)
|
||||||
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( Event.WeaponCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( Event.WeaponCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
||||||
self:ScoreCSV( Event.WeaponPlayerName, TargetPlayerName, "HIT_PENALTY", 1, -10, Event.WeaponName, Event.WeaponCoalition, Event.WeaponCategory, Event.WeaponTypeName, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
self:ScoreCSV( Event.WeaponPlayerName, TargetPlayerName, "HIT_PENALTY", 1, -10, Event.WeaponName, Event.WeaponCoalition, Event.WeaponCategory, Event.WeaponTypeName, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
||||||
else
|
else
|
||||||
Player.Score = Player.Score + 1
|
Player.Score = Player.Score + self.ScoreIncrementOnHit
|
||||||
PlayerHit.Score = PlayerHit.Score + 1
|
PlayerHit.Score = PlayerHit.Score + self.ScoreIncrementOnHit
|
||||||
PlayerHit.ScoreHit = PlayerHit.ScoreHit + 1
|
PlayerHit.ScoreHit = PlayerHit.ScoreHit + 1
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. Event.WeaponPlayerName .. "' hit enemy target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " ..
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. Event.WeaponPlayerName .. "' hit enemy target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " ..
|
||||||
"Score: +" .. PlayerHit.Score .. " = " .. Player.Score - Player.Penalty,
|
"Score: " .. PlayerHit.Score .. ". Score Total:" .. Player.Score - Player.Penalty,
|
||||||
MESSAGE.Type.Update )
|
MESSAGE.Type.Update )
|
||||||
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( Event.WeaponCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( Event.WeaponCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
||||||
@@ -1209,7 +1260,7 @@ function SCORING:_EventOnDeadOrCrash( Event )
|
|||||||
local Destroyed = false
|
local Destroyed = false
|
||||||
|
|
||||||
-- What is the player destroying?
|
-- What is the player destroying?
|
||||||
if Player and Player.Hit and Player.Hit[TargetCategory] and Player.Hit[TargetCategory][TargetUnitName] and Player.Hit[TargetCategory][TargetUnitName].TimeStamp ~= 0 then -- Was there a hit for this unit for this player before registered???
|
if Player and Player.Hit and Player.Hit[TargetCategory] and Player.Hit[TargetCategory][TargetUnitName] and Player.Hit[TargetCategory][TargetUnitName].TimeStamp ~= 0 and (TargetUnit.BirthTime == nil or Player.Hit[TargetCategory][TargetUnitName].TimeStamp > TargetUnit.BirthTime) then -- Was there a hit for this unit for this player before registered???
|
||||||
|
|
||||||
local TargetThreatLevel = Player.Hit[TargetCategory][TargetUnitName].ThreatLevel
|
local TargetThreatLevel = Player.Hit[TargetCategory][TargetUnitName].ThreatLevel
|
||||||
local TargetThreatType = Player.Hit[TargetCategory][TargetUnitName].ThreatType
|
local TargetThreatType = Player.Hit[TargetCategory][TargetUnitName].ThreatType
|
||||||
@@ -1236,15 +1287,20 @@ function SCORING:_EventOnDeadOrCrash( Event )
|
|||||||
TargetDestroy.Penalty = TargetDestroy.Penalty + ThreatPenalty
|
TargetDestroy.Penalty = TargetDestroy.Penalty + ThreatPenalty
|
||||||
TargetDestroy.PenaltyDestroy = TargetDestroy.PenaltyDestroy + 1
|
TargetDestroy.PenaltyDestroy = TargetDestroy.PenaltyDestroy + 1
|
||||||
|
|
||||||
|
|
||||||
|
self:OnKillPvP(Player, TargetPlayerName, true, TargetThreatLevel, Player.ThreatLevel, ThreatPenalty)
|
||||||
|
|
||||||
if Player.HitPlayers[TargetPlayerName] then -- A player destroyed another player
|
if Player.HitPlayers[TargetPlayerName] then -- A player destroyed another player
|
||||||
|
self:OnKillPvP(Player, TargetPlayerName, true)
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed friendly player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed friendly player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
||||||
"Penalty: -" .. TargetDestroy.Penalty .. " = " .. Player.Score - Player.Penalty,
|
"Penalty: -" .. ThreatPenalty .. " = " .. Player.Score - Player.Penalty,
|
||||||
MESSAGE.Type.Information )
|
MESSAGE.Type.Information )
|
||||||
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
|
||||||
else
|
else
|
||||||
|
self:OnKillPvE(Player, TargetUnitName, true, TargetThreatLevel, Player.ThreatLevel, ThreatPenalty)
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed friendly target " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed friendly target " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
||||||
"Penalty: -" .. TargetDestroy.Penalty .. " = " .. Player.Score - Player.Penalty,
|
"Penalty: -" .. ThreatPenalty .. " = " .. Player.Score - Player.Penalty,
|
||||||
MESSAGE.Type.Information )
|
MESSAGE.Type.Information )
|
||||||
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
|
||||||
@@ -1265,14 +1321,21 @@ function SCORING:_EventOnDeadOrCrash( Event )
|
|||||||
TargetDestroy.Score = TargetDestroy.Score + ThreatScore
|
TargetDestroy.Score = TargetDestroy.Score + ThreatScore
|
||||||
TargetDestroy.ScoreDestroy = TargetDestroy.ScoreDestroy + 1
|
TargetDestroy.ScoreDestroy = TargetDestroy.ScoreDestroy + 1
|
||||||
if Player.HitPlayers[TargetPlayerName] then -- A player destroyed another player
|
if Player.HitPlayers[TargetPlayerName] then -- A player destroyed another player
|
||||||
|
if Player.PlayerKills ~= nil then
|
||||||
|
Player.PlayerKills = Player.PlayerKills + 1
|
||||||
|
else
|
||||||
|
Player.PlayerKills = 1
|
||||||
|
end
|
||||||
|
self:OnKillPvP(Player, TargetPlayerName, false, TargetThreatLevel, Player.ThreatLevel, ThreatScore)
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed enemy player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed enemy player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
||||||
"Score: +" .. TargetDestroy.Score .. " = " .. Player.Score - Player.Penalty,
|
"Score: +" .. ThreatScore .. " = " .. Player.Score - Player.Penalty,
|
||||||
MESSAGE.Type.Information )
|
MESSAGE.Type.Information )
|
||||||
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
|
||||||
else
|
else
|
||||||
|
self:OnKillPvE(Player, TargetUnitName, false, TargetThreatLevel, Player.ThreatLevel, ThreatScore)
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed enemy " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed enemy " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
||||||
"Score: +" .. TargetDestroy.Score .. " = " .. Player.Score - Player.Penalty,
|
"Score: +" .. ThreatScore .. " = " .. Player.Score - Player.Penalty,
|
||||||
MESSAGE.Type.Information )
|
MESSAGE.Type.Information )
|
||||||
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
|
||||||
@@ -1383,7 +1446,7 @@ function SCORING:ReportDetailedPlayerHits( PlayerName )
|
|||||||
Penalty = Penalty + UnitData.Penalty
|
Penalty = Penalty + UnitData.Penalty
|
||||||
PenaltyHit = UnitData.PenaltyHit
|
PenaltyHit = UnitData.PenaltyHit
|
||||||
end
|
end
|
||||||
local ScoreMessageHit = string.format( "%s:%d ", CategoryName, Score - Penalty )
|
local ScoreMessageHit = string.format( "%s: %d ", CategoryName, Score - Penalty )
|
||||||
self:T( ScoreMessageHit )
|
self:T( ScoreMessageHit )
|
||||||
ScoreMessageHits = ScoreMessageHits .. ScoreMessageHit
|
ScoreMessageHits = ScoreMessageHits .. ScoreMessageHit
|
||||||
PlayerScore = PlayerScore + Score
|
PlayerScore = PlayerScore + Score
|
||||||
@@ -1439,7 +1502,7 @@ function SCORING:ReportDetailedPlayerDestroys( PlayerName )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local ScoreMessageDestroy = string.format( " %s:%d ", CategoryName, Score - Penalty )
|
local ScoreMessageDestroy = string.format( " %s: %d ", CategoryName, Score - Penalty )
|
||||||
self:T( ScoreMessageDestroy )
|
self:T( ScoreMessageDestroy )
|
||||||
ScoreMessageDestroys = ScoreMessageDestroys .. ScoreMessageDestroy
|
ScoreMessageDestroys = ScoreMessageDestroys .. ScoreMessageDestroy
|
||||||
|
|
||||||
@@ -1730,9 +1793,9 @@ function SCORING:SecondsToClock( sSeconds )
|
|||||||
-- return nil;
|
-- return nil;
|
||||||
return "00:00:00";
|
return "00:00:00";
|
||||||
else
|
else
|
||||||
nHours = string.format( "%02.f", math.floor( nSeconds / 3600 ) );
|
local nHours = string.format( "%02.f", math.floor( nSeconds / 3600 ) );
|
||||||
nMins = string.format( "%02.f", math.floor( nSeconds / 60 - (nHours * 60) ) );
|
local nMins = string.format( "%02.f", math.floor( nSeconds / 60 - (nHours * 60) ) );
|
||||||
nSecs = string.format( "%02.f", math.floor( nSeconds - nHours * 3600 - nMins * 60 ) );
|
local nSecs = string.format( "%02.f", math.floor( nSeconds - nHours * 3600 - nMins * 60 ) );
|
||||||
return nHours .. ":" .. nMins .. ":" .. nSecs
|
return nHours .. ":" .. nMins .. ":" .. nSecs
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1748,7 +1811,7 @@ end
|
|||||||
function SCORING:OpenCSV( ScoringCSV )
|
function SCORING:OpenCSV( ScoringCSV )
|
||||||
self:F( ScoringCSV )
|
self:F( ScoringCSV )
|
||||||
|
|
||||||
if lfs and io and os then
|
if lfs and io and os and self.AutoSave then
|
||||||
if ScoringCSV then
|
if ScoringCSV then
|
||||||
self.ScoringCSV = ScoringCSV
|
self.ScoringCSV = ScoringCSV
|
||||||
local fdir = lfs.writedir() .. [[Logs\]] .. self.ScoringCSV .. " " .. os.date( "%Y-%m-%d %H-%M-%S" ) .. ".csv"
|
local fdir = lfs.writedir() .. [[Logs\]] .. self.ScoringCSV .. " " .. os.date( "%Y-%m-%d %H-%M-%S" ) .. ".csv"
|
||||||
@@ -1828,7 +1891,7 @@ function SCORING:ScoreCSV( PlayerName, TargetPlayerName, ScoreType, ScoreTimes,
|
|||||||
TargetUnitType = TargetUnitType or ""
|
TargetUnitType = TargetUnitType or ""
|
||||||
TargetUnitName = TargetUnitName or ""
|
TargetUnitName = TargetUnitName or ""
|
||||||
|
|
||||||
if lfs and io and os then
|
if lfs and io and os and self.AutoSave then
|
||||||
self.CSVFile:write(
|
self.CSVFile:write(
|
||||||
'"' .. self.GameName .. '"' .. ',' ..
|
'"' .. self.GameName .. '"' .. ',' ..
|
||||||
'"' .. self.RunTime .. '"' .. ',' ..
|
'"' .. self.RunTime .. '"' .. ',' ..
|
||||||
@@ -1852,9 +1915,43 @@ function SCORING:ScoreCSV( PlayerName, TargetPlayerName, ScoreType, ScoreTimes,
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Close CSV file
|
||||||
|
-- @param #SCORING self
|
||||||
|
-- @return #SCORING self
|
||||||
function SCORING:CloseCSV()
|
function SCORING:CloseCSV()
|
||||||
if lfs and io and os then
|
if lfs and io and os and self.AutoSave then
|
||||||
self.CSVFile:close()
|
self.CSVFile:close()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Registers a score for a player.
|
||||||
|
-- @param #SCORING self
|
||||||
|
-- @param #boolean OnOff Switch saving to CSV on = true or off = false
|
||||||
|
-- @return #SCORING self
|
||||||
|
function SCORING:SwitchAutoSave(OnOff)
|
||||||
|
self.AutoSave = OnOff
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Handles the event when one player kill another player
|
||||||
|
-- @param #SCORING self
|
||||||
|
-- @param #PLAYER Player the ataching player
|
||||||
|
-- @param #string TargetPlayerName the name of the killed player
|
||||||
|
-- @param #bool IsTeamKill true if this kill was a team kill
|
||||||
|
-- @param #number TargetThreatLevel Thread level of the target
|
||||||
|
-- @param #number PlayerThreatLevelThread level of the player
|
||||||
|
-- @param #number Score The score based on both threat levels
|
||||||
|
function SCORING:OnKillPvP(Player, TargetPlayerName, IsTeamKill, TargetThreatLevel, PlayerThreatLevel, Score)
|
||||||
|
|
||||||
|
end
|
||||||
|
--- Handles the event when one player kill another player
|
||||||
|
-- @param #SCORING self
|
||||||
|
-- @param #PLAYER Player the ataching player
|
||||||
|
-- @param #string TargetUnitName the name of the killed unit
|
||||||
|
-- @param #bool IsTeamKill true if this kill was a team kill
|
||||||
|
-- @param #number TargetThreatLevel Thread level of the target
|
||||||
|
-- @param #number PlayerThreatLevelThread level of the player
|
||||||
|
-- @param #number Score The score based on both threat levels
|
||||||
|
function SCORING:OnKillPvE(Player, TargetUnitName, IsTeamKill, TargetThreatLevel, PlayerThreatLevel, Score)
|
||||||
|
|
||||||
|
end
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **Functional** -- Make SAM sites execute evasive and defensive behaviour when being fired upon.
|
--- **Functional** - Make SAM sites evasive and execute defensive behaviour when being fired upon.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -13,13 +13,13 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [SEV - SEAD Evasion](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SEV%20-%20SEAD%20Evasion)
|
-- [SEV - SEAD Evasion](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Sead)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Authors: **FlightControl**, **applevangelist**
|
-- ### Authors: **applevangelist**, **FlightControl**
|
||||||
--
|
--
|
||||||
-- Last Update: Feb 2022
|
-- Last Update: Dec 2023
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
--
|
--
|
||||||
-- This class is very easy to use. Just setup a SEAD object by using @{#SEAD.New}() and SAMs will evade and take defensive action when being fired upon.
|
-- This class is very easy to use. Just setup a SEAD object by using @{#SEAD.New}() and SAMs will evade and take defensive action when being fired upon.
|
||||||
-- Once a HARM attack is detected, 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, SEAD will shut down the radars of the attacked SAM site and take evasive action by moving the SAM
|
||||||
-- vehicles around (*if* they are drivable, that is). There's a component of randomness in detection and evasion, which is based on the
|
-- vehicles around (*if* they are driveable, that is). There's a component of randomness in detection and evasion, which is based on the
|
||||||
-- skill set of the SAM set (the higher the skill, the more likely). When a missile is fired from far away, the SAM will stay active for a
|
-- skill set of the SAM set (the higher the skill, the more likely). When a missile is fired from far away, the SAM will stay active for a
|
||||||
-- period of time to stay defensive, before it takes evasive actions.
|
-- period of time to stay defensive, before it takes evasive actions.
|
||||||
--
|
--
|
||||||
@@ -66,7 +66,6 @@ SEAD = {
|
|||||||
-- @field Harms
|
-- @field Harms
|
||||||
SEAD.Harms = {
|
SEAD.Harms = {
|
||||||
["AGM_88"] = "AGM_88",
|
["AGM_88"] = "AGM_88",
|
||||||
["AGM_45"] = "AGM_45",
|
|
||||||
["AGM_122"] = "AGM_122",
|
["AGM_122"] = "AGM_122",
|
||||||
["AGM_84"] = "AGM_84",
|
["AGM_84"] = "AGM_84",
|
||||||
["AGM_45"] = "AGM_45",
|
["AGM_45"] = "AGM_45",
|
||||||
@@ -80,6 +79,7 @@ SEAD = {
|
|||||||
["BGM_109"] = "BGM_109",
|
["BGM_109"] = "BGM_109",
|
||||||
["AGM_154"] = "AGM_154",
|
["AGM_154"] = "AGM_154",
|
||||||
["HY-2"] = "HY-2",
|
["HY-2"] = "HY-2",
|
||||||
|
["ADM_141A"] = "ADM_141A",
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Missile enumerators - from DCS ME and Wikipedia
|
--- Missile enumerators - from DCS ME and Wikipedia
|
||||||
@@ -100,6 +100,7 @@ SEAD = {
|
|||||||
["BGM_109"] = {460, 0.705}, --in-game ~465kn
|
["BGM_109"] = {460, 0.705}, --in-game ~465kn
|
||||||
["AGM_154"] = {130, 0.61},
|
["AGM_154"] = {130, 0.61},
|
||||||
["HY-2"] = {90,1},
|
["HY-2"] = {90,1},
|
||||||
|
["ADM_141A"] = {126,0.6},
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Creates the main object which is handling defensive actions for SA sites or moving SA vehicles.
|
--- Creates the main object which is handling defensive actions for SA sites or moving SA vehicles.
|
||||||
@@ -143,7 +144,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.3")
|
self:I("*** SEAD - Started Version 0.4.6")
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -203,7 +204,7 @@ function SEAD:SwitchEmissions(Switch)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Add an object to call back when going evasive.
|
--- Set an object to call back when going evasive.
|
||||||
-- @param #SEAD self
|
-- @param #SEAD self
|
||||||
-- @param #table Object The object to call. Needs to have object functions as follows:
|
-- @param #table Object The object to call. Needs to have object functions as follows:
|
||||||
-- `:SeadSuppressionPlanned(Group, Name, SuppressionStartTime, SuppressionEndTime)`
|
-- `:SeadSuppressionPlanned(Group, Name, SuppressionStartTime, SuppressionEndTime)`
|
||||||
@@ -348,8 +349,9 @@ end
|
|||||||
-- @param #string SEADWeaponName
|
-- @param #string SEADWeaponName
|
||||||
-- @param Wrapper.Group#GROUP SEADGroup Attacker Group
|
-- @param Wrapper.Group#GROUP SEADGroup Attacker Group
|
||||||
-- @param #number timeoffset Offset for tti calc
|
-- @param #number timeoffset Offset for tti calc
|
||||||
|
-- @param Wrapper.Weapon#WEAPON Weapon
|
||||||
-- @return #SEAD self
|
-- @return #SEAD self
|
||||||
function SEAD:onafterManageEvasion(From,Event,To,_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,timeoffset)
|
function SEAD:onafterManageEvasion(From,Event,To,_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,timeoffset,Weapon)
|
||||||
local timeoffset = timeoffset or 0
|
local timeoffset = timeoffset or 0
|
||||||
if _targetskill == "Random" then -- when skill is random, choose a skill
|
if _targetskill == "Random" then -- when skill is random, choose a skill
|
||||||
local Skills = { "Average", "Good", "High", "Excellent" }
|
local Skills = { "Average", "Good", "High", "Excellent" }
|
||||||
@@ -369,9 +371,13 @@ function SEAD:onafterManageEvasion(From,Event,To,_targetskill,_targetgroup,SEADP
|
|||||||
local reach = 10
|
local reach = 10
|
||||||
if hit then
|
if hit then
|
||||||
local wpndata = SEAD.HarmData[data]
|
local wpndata = SEAD.HarmData[data]
|
||||||
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
|
||||||
|
wpnspeed = Weapon:GetSpeed()
|
||||||
|
self:T(string.format("*** SEAD - Weapon Speed from WEAPON: %f m/s",wpnspeed))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
-- time to impact
|
-- time to impact
|
||||||
local _tti = math.floor(_distance / wpnspeed) - timeoffset -- estimated impact time
|
local _tti = math.floor(_distance / wpnspeed) - timeoffset -- estimated impact time
|
||||||
@@ -395,7 +401,7 @@ function SEAD:onafterManageEvasion(From,Event,To,_targetskill,_targetgroup,SEADP
|
|||||||
grp:EnableEmission(false)
|
grp:EnableEmission(false)
|
||||||
end
|
end
|
||||||
grp:OptionAlarmStateGreen() -- needed else we cannot move around
|
grp:OptionAlarmStateGreen() -- needed else we cannot move around
|
||||||
grp:RelocateGroundRandomInRadius(20,300,false,false,"Diamond")
|
grp:RelocateGroundRandomInRadius(20,300,false,false,"Diamond",true)
|
||||||
if self.UseCallBack then
|
if self.UseCallBack then
|
||||||
local object = self.CallBack
|
local object = self.CallBack
|
||||||
object:SeadSuppressionStart(grp,name,attacker)
|
object:SeadSuppressionStart(grp,name,attacker)
|
||||||
@@ -405,7 +411,7 @@ function SEAD:onafterManageEvasion(From,Event,To,_targetskill,_targetgroup,SEADP
|
|||||||
local function SuppressionStop(args)
|
local function SuppressionStop(args)
|
||||||
self:T(string.format("*** SEAD - %s Radar On",args[2]))
|
self:T(string.format("*** SEAD - %s Radar On",args[2]))
|
||||||
local grp = args[1] -- Wrapper.Group#GROUP
|
local grp = args[1] -- Wrapper.Group#GROUP
|
||||||
local name = args[2] -- #string Group Nam
|
local name = args[2] -- #string Group Name
|
||||||
if self.UseEmissionsOnOff then
|
if self.UseEmissionsOnOff then
|
||||||
grp:EnableEmission(true)
|
grp:EnableEmission(true)
|
||||||
end
|
end
|
||||||
@@ -424,7 +430,7 @@ function SEAD:onafterManageEvasion(From,Event,To,_targetskill,_targetgroup,SEADP
|
|||||||
if _tti > 600 then delay = _tti - 90 end -- shot from afar, 600 is default shorad ontime
|
if _tti > 600 then delay = _tti - 90 end -- shot from afar, 600 is default shorad ontime
|
||||||
|
|
||||||
local SuppressionStartTime = timer.getTime() + delay
|
local SuppressionStartTime = timer.getTime() + delay
|
||||||
local SuppressionEndTime = timer.getTime() + _tti + self.Padding
|
local SuppressionEndTime = timer.getTime() + delay + _tti + self.Padding + delay
|
||||||
local _targetgroupname = _targetgroup:GetName()
|
local _targetgroupname = _targetgroup:GetName()
|
||||||
if not self.SuppressedGroups[_targetgroupname] then
|
if not self.SuppressedGroups[_targetgroupname] then
|
||||||
self:T(string.format("*** SEAD - %s | Parameters TTI %ds | Switch-Off in %ds",_targetgroupname,_tti,delay))
|
self:T(string.format("*** SEAD - %s | Parameters TTI %ds | Switch-Off in %ds",_targetgroupname,_tti,delay))
|
||||||
@@ -457,6 +463,9 @@ function SEAD:HandleEventShot( EventData )
|
|||||||
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 -- return weapon type
|
||||||
|
|
||||||
|
local WeaponWrapper = WEAPON:New(EventData.Weapon)
|
||||||
|
--local SEADWeaponSpeed = WeaponWrapper:GetSpeed() -- mps
|
||||||
|
|
||||||
self:T( "*** SEAD - Missile Launched = " .. SEADWeaponName)
|
self:T( "*** SEAD - Missile Launched = " .. SEADWeaponName)
|
||||||
--self:T({ SEADWeapon })
|
--self:T({ SEADWeapon })
|
||||||
|
|
||||||
@@ -475,7 +484,7 @@ function SEAD:HandleEventShot( EventData )
|
|||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
local targetcat = _target:getCategory() -- Identify category
|
local targetcat = Object.getCategory(_target) -- Identify category
|
||||||
local _targetUnit = nil -- Wrapper.Unit#UNIT
|
local _targetUnit = nil -- Wrapper.Unit#UNIT
|
||||||
local _targetgroup = nil -- Wrapper.Group#GROUP
|
local _targetgroup = nil -- Wrapper.Group#GROUP
|
||||||
self:T(string.format("*** Targetcat = %d",targetcat))
|
self:T(string.format("*** Targetcat = %d",targetcat))
|
||||||
@@ -513,7 +522,11 @@ function SEAD:HandleEventShot( EventData )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if SEADGroupFound == true then -- yes we are being attacked
|
if SEADGroupFound == true then -- yes we are being attacked
|
||||||
self:ManageEvasion(_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup)
|
if string.find(SEADWeaponName,"ADM_141",1,true) then
|
||||||
|
self:__ManageEvasion(2,_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,0,WeaponWrapper)
|
||||||
|
else
|
||||||
|
self:ManageEvasion(_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,0,WeaponWrapper)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
|
|||||||
@@ -1,15 +1,17 @@
|
|||||||
--- **Functional** -- Short Range Air Defense System
|
--- **Functional** - Short Range Air Defense System.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
|
--
|
||||||
|
-- ## Features:
|
||||||
--
|
--
|
||||||
-- **SHORAD** - Short Range Air Defense System
|
-- * Short Range Air Defense System
|
||||||
-- Controls a network of short range air/missile defense groups.
|
-- * Controls a network of short range air/missile defense groups.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- ### [SHORAD - Short Range Air Defense](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SRD%20-%20SHORAD%20Defense)
|
-- ### [SHORAD - Short Range Air Defense](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Shorad)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -19,6 +21,7 @@
|
|||||||
-- @image Functional.Shorad.jpg
|
-- @image Functional.Shorad.jpg
|
||||||
--
|
--
|
||||||
-- Date: Nov 2021
|
-- Date: Nov 2021
|
||||||
|
-- Last Update: Nov 2023
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
--- **SHORAD** class, extends Core.Base#BASE
|
--- **SHORAD** class, extends Core.Base#BASE
|
||||||
@@ -37,8 +40,15 @@
|
|||||||
-- @field #boolean DefendHarms Default true, intercept incoming HARMS
|
-- @field #boolean DefendHarms Default true, intercept incoming HARMS
|
||||||
-- @field #boolean DefendMavs Default true, intercept incoming AG-Missiles
|
-- @field #boolean DefendMavs Default true, intercept incoming AG-Missiles
|
||||||
-- @field #number DefenseLowProb Default 70, minimum detection limit
|
-- @field #number DefenseLowProb Default 70, minimum detection limit
|
||||||
-- @field #number DefenseHighProb Default 90, maximim detection limit
|
-- @field #number DefenseHighProb Default 90, maximum detection limit
|
||||||
-- @field #boolean UseEmOnOff Decide if we are using Emission on/off (default) or AlarmState red/green.
|
-- @field #boolean UseEmOnOff Decide if we are using Emission on/off (default) or AlarmState red/green
|
||||||
|
-- @field #boolean shootandscoot If true, shoot and scoot between zones
|
||||||
|
-- @field #number SkateNumber Number of zones to consider
|
||||||
|
-- @field Core.Set#SET_ZONE SkateZones Zones in this set are considered
|
||||||
|
-- @field #number minscootdist Min distance of the next zone
|
||||||
|
-- @field #number maxscootdist Max distance of the next zone
|
||||||
|
-- @field #boolean scootrandomcoord If true, use a random coordinate in the zone and not the center
|
||||||
|
-- @field #string scootformation Formation to take for scooting, e.g. "Vee" or "Cone"
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
|
|
||||||
@@ -71,14 +81,15 @@
|
|||||||
--
|
--
|
||||||
-- `myshorad = SHORAD:New("RedShorad", "Red SHORAD", SamSet, 25000, 600, "red")`
|
-- `myshorad = SHORAD:New("RedShorad", "Red SHORAD", SamSet, 25000, 600, "red")`
|
||||||
--
|
--
|
||||||
-- ## Customize options
|
-- ## Customization options
|
||||||
--
|
--
|
||||||
-- * SHORAD:SwitchDebug(debug)
|
-- * myshorad:SwitchDebug(debug)
|
||||||
-- * SHORAD:SwitchHARMDefense(onoff)
|
-- * myshorad:SwitchHARMDefense(onoff)
|
||||||
-- * SHORAD:SwitchAGMDefense(onoff)
|
-- * myshorad:SwitchAGMDefense(onoff)
|
||||||
-- * SHORAD:SetDefenseLimits(low,high)
|
-- * myshorad:SetDefenseLimits(low,high)
|
||||||
-- * SHORAD:SetActiveTimer(seconds)
|
-- * myshorad:SetActiveTimer(seconds)
|
||||||
-- * SHORAD:SetDefenseRadius(meters)
|
-- * myshorad:SetDefenseRadius(meters)
|
||||||
|
-- * myshorad:AddScootZones(ZoneSet,Number,Random,Formation)
|
||||||
--
|
--
|
||||||
-- @field #SHORAD
|
-- @field #SHORAD
|
||||||
SHORAD = {
|
SHORAD = {
|
||||||
@@ -97,7 +108,13 @@ SHORAD = {
|
|||||||
DefendMavs = true,
|
DefendMavs = true,
|
||||||
DefenseLowProb = 70,
|
DefenseLowProb = 70,
|
||||||
DefenseHighProb = 90,
|
DefenseHighProb = 90,
|
||||||
UseEmOnOff = false,
|
UseEmOnOff = true,
|
||||||
|
shootandscoot = false,
|
||||||
|
SkateNumber = 3,
|
||||||
|
SkateZones = nil,
|
||||||
|
minscootdist = 100,
|
||||||
|
minscootdist = 3000,
|
||||||
|
scootrandomcoord = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@@ -110,7 +127,6 @@ do
|
|||||||
-- @field Harms
|
-- @field Harms
|
||||||
SHORAD.Harms = {
|
SHORAD.Harms = {
|
||||||
["AGM_88"] = "AGM_88",
|
["AGM_88"] = "AGM_88",
|
||||||
["AGM_45"] = "AGM_45",
|
|
||||||
["AGM_122"] = "AGM_122",
|
["AGM_122"] = "AGM_122",
|
||||||
["AGM_84"] = "AGM_84",
|
["AGM_84"] = "AGM_84",
|
||||||
["AGM_45"] = "AGM_45",
|
["AGM_45"] = "AGM_45",
|
||||||
@@ -121,6 +137,8 @@ do
|
|||||||
["X_25"] = "X_25",
|
["X_25"] = "X_25",
|
||||||
["X_31"] = "X_31",
|
["X_31"] = "X_31",
|
||||||
["Kh25"] = "Kh25",
|
["Kh25"] = "Kh25",
|
||||||
|
["HY-2"] = "HY-2",
|
||||||
|
["ADM_141A"] = "ADM_141A",
|
||||||
}
|
}
|
||||||
|
|
||||||
--- TODO complete list?
|
--- TODO complete list?
|
||||||
@@ -132,7 +150,6 @@ do
|
|||||||
["Kh29"] = "Kh29",
|
["Kh29"] = "Kh29",
|
||||||
["Kh31"] = "Kh31",
|
["Kh31"] = "Kh31",
|
||||||
["Kh66"] = "Kh66",
|
["Kh66"] = "Kh66",
|
||||||
--["BGM_109"] = "BGM_109",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Instantiates a new SHORAD object
|
--- Instantiates a new SHORAD object
|
||||||
@@ -144,7 +161,7 @@ do
|
|||||||
-- @param #number ActiveTimer Determines how many seconds the systems stay on red alert after wake-up call
|
-- @param #number ActiveTimer Determines how many seconds the systems stay on red alert after wake-up call
|
||||||
-- @param #string Coalition Coalition, i.e. "blue", "red", or "neutral"
|
-- @param #string Coalition Coalition, i.e. "blue", "red", or "neutral"
|
||||||
-- @param #boolean UseEmOnOff Use Emissions On/Off rather than Alarm State Red/Green (default: use Emissions switch)
|
-- @param #boolean UseEmOnOff Use Emissions On/Off rather than Alarm State Red/Green (default: use Emissions switch)
|
||||||
-- @retunr #SHORAD self
|
-- @return #SHORAD self
|
||||||
function SHORAD:New(Name, ShoradPrefix, Samset, Radius, ActiveTimer, Coalition, UseEmOnOff)
|
function SHORAD:New(Name, ShoradPrefix, Samset, Radius, ActiveTimer, Coalition, UseEmOnOff)
|
||||||
local self = BASE:Inherit( self, FSM:New() )
|
local self = BASE:Inherit( self, FSM:New() )
|
||||||
self:T({Name, ShoradPrefix, Samset, Radius, ActiveTimer, Coalition})
|
self:T({Name, ShoradPrefix, Samset, Radius, ActiveTimer, Coalition})
|
||||||
@@ -163,8 +180,9 @@ do
|
|||||||
self.DefendMavs = true
|
self.DefendMavs = true
|
||||||
self.DefenseLowProb = 70 -- probability to detect a missile shot, low margin
|
self.DefenseLowProb = 70 -- probability to detect a missile shot, low margin
|
||||||
self.DefenseHighProb = 90 -- probability to detect a missile shot, high margin
|
self.DefenseHighProb = 90 -- probability to detect a missile shot, high margin
|
||||||
self.UseEmOnOff = UseEmOnOff or false -- Decide if we are using Emission on/off (default) or AlarmState red/green
|
self.UseEmOnOff = true -- Decide if we are using Emission on/off (default) or AlarmState red/green
|
||||||
self:I("*** SHORAD - Started Version 0.3.1")
|
if UseEmOnOff == false then self.UseEmOnOff = UseEmOnOff end
|
||||||
|
self:I("*** SHORAD - Started Version 0.3.4")
|
||||||
-- Set the string id for output to DCS.log file.
|
-- Set the string id for output to DCS.log file.
|
||||||
self.lid=string.format("SHORAD %s | ", self.name)
|
self.lid=string.format("SHORAD %s | ", self.name)
|
||||||
self:_InitState()
|
self:_InitState()
|
||||||
@@ -174,12 +192,14 @@ do
|
|||||||
self:SetStartState("Running")
|
self:SetStartState("Running")
|
||||||
self:AddTransition("*", "WakeUpShorad", "*")
|
self:AddTransition("*", "WakeUpShorad", "*")
|
||||||
self:AddTransition("*", "CalculateHitZone", "*")
|
self:AddTransition("*", "CalculateHitZone", "*")
|
||||||
|
self:AddTransition("*", "ShootAndScoot", "*")
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Initially set all groups to alarm state GREEN
|
--- Initially set all groups to alarm state GREEN
|
||||||
-- @param #SHORAD self
|
-- @param #SHORAD self
|
||||||
|
-- @return #SHORAD self
|
||||||
function SHORAD:_InitState()
|
function SHORAD:_InitState()
|
||||||
self:T(self.lid .. " _InitState")
|
self:T(self.lid .. " _InitState")
|
||||||
local table = {}
|
local table = {}
|
||||||
@@ -203,21 +223,40 @@ do
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Add a SET_ZONE of zones for Shoot&Scoot
|
||||||
|
-- @param #SHORAD self
|
||||||
|
-- @param Core.Set#SET_ZONE ZoneSet Set of zones to be used. Units will move around to the next (random) zone between 100m and 3000m away.
|
||||||
|
-- @param #number Number Number of closest zones to be considered, defaults to 3.
|
||||||
|
-- @param #boolean Random If true, use a random coordinate inside the next zone to scoot to.
|
||||||
|
-- @param #string Formation Formation to use, defaults to "Cone". See mission editor dropdown for options.
|
||||||
|
-- @return #SHORAD self
|
||||||
|
function SHORAD:AddScootZones(ZoneSet, Number, Random, Formation)
|
||||||
|
self:T(self.lid .. " AddScootZones")
|
||||||
|
self.SkateZones = ZoneSet
|
||||||
|
self.SkateNumber = Number or 3
|
||||||
|
self.shootandscoot = true
|
||||||
|
self.scootrandomcoord = Random
|
||||||
|
self.scootformation = Formation or "Cone"
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Switch debug state on
|
--- Switch debug state on
|
||||||
-- @param #SHORAD self
|
-- @param #SHORAD self
|
||||||
-- @param #boolean debug Switch debug on (true) or off (false)
|
-- @param #boolean debug Switch debug on (true) or off (false)
|
||||||
|
-- @return #SHORAD self
|
||||||
function SHORAD:SwitchDebug(onoff)
|
function SHORAD:SwitchDebug(onoff)
|
||||||
self:T( { onoff } )
|
self:T( { onoff } )
|
||||||
if onoff then
|
if onoff then
|
||||||
self:SwitchDebugOn()
|
self:SwitchDebugOn()
|
||||||
else
|
else
|
||||||
self.SwitchDebugOff()
|
self:SwitchDebugOff()
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Switch debug state on
|
--- Switch debug state on
|
||||||
-- @param #SHORAD self
|
-- @param #SHORAD self
|
||||||
|
-- @return #SHORAD self
|
||||||
function SHORAD:SwitchDebugOn()
|
function SHORAD:SwitchDebugOn()
|
||||||
self.debug = true
|
self.debug = true
|
||||||
--tracing
|
--tracing
|
||||||
@@ -228,6 +267,7 @@ do
|
|||||||
|
|
||||||
--- Switch debug state off
|
--- Switch debug state off
|
||||||
-- @param #SHORAD self
|
-- @param #SHORAD self
|
||||||
|
-- @return #SHORAD self
|
||||||
function SHORAD:SwitchDebugOff()
|
function SHORAD:SwitchDebugOff()
|
||||||
self.debug = false
|
self.debug = false
|
||||||
BASE:TraceOff()
|
BASE:TraceOff()
|
||||||
@@ -237,6 +277,7 @@ do
|
|||||||
--- Switch defense for HARMs
|
--- Switch defense for HARMs
|
||||||
-- @param #SHORAD self
|
-- @param #SHORAD self
|
||||||
-- @param #boolean onoff
|
-- @param #boolean onoff
|
||||||
|
-- @return #SHORAD self
|
||||||
function SHORAD:SwitchHARMDefense(onoff)
|
function SHORAD:SwitchHARMDefense(onoff)
|
||||||
self:T( { onoff } )
|
self:T( { onoff } )
|
||||||
local onoff = onoff or true
|
local onoff = onoff or true
|
||||||
@@ -247,6 +288,7 @@ do
|
|||||||
--- Switch defense for AGMs
|
--- Switch defense for AGMs
|
||||||
-- @param #SHORAD self
|
-- @param #SHORAD self
|
||||||
-- @param #boolean onoff
|
-- @param #boolean onoff
|
||||||
|
-- @return #SHORAD self
|
||||||
function SHORAD:SwitchAGMDefense(onoff)
|
function SHORAD:SwitchAGMDefense(onoff)
|
||||||
self:T( { onoff } )
|
self:T( { onoff } )
|
||||||
local onoff = onoff or true
|
local onoff = onoff or true
|
||||||
@@ -258,6 +300,7 @@ do
|
|||||||
-- @param #SHORAD self
|
-- @param #SHORAD self
|
||||||
-- @param #number low Minimum detection limit, integer 1-100
|
-- @param #number low Minimum detection limit, integer 1-100
|
||||||
-- @param #number high Maximum detection limit integer 1-100
|
-- @param #number high Maximum detection limit integer 1-100
|
||||||
|
-- @return #SHORAD self
|
||||||
function SHORAD:SetDefenseLimits(low,high)
|
function SHORAD:SetDefenseLimits(low,high)
|
||||||
self:T( { low, high } )
|
self:T( { low, high } )
|
||||||
local low = low or 70
|
local low = low or 70
|
||||||
@@ -276,6 +319,7 @@ do
|
|||||||
--- Set the number of seconds a SHORAD site will stay active
|
--- Set the number of seconds a SHORAD site will stay active
|
||||||
-- @param #SHORAD self
|
-- @param #SHORAD self
|
||||||
-- @param #number seconds Number of seconds systems stay active
|
-- @param #number seconds Number of seconds systems stay active
|
||||||
|
-- @return #SHORAD self
|
||||||
function SHORAD:SetActiveTimer(seconds)
|
function SHORAD:SetActiveTimer(seconds)
|
||||||
self:T(self.lid .. " SetActiveTimer")
|
self:T(self.lid .. " SetActiveTimer")
|
||||||
local timer = seconds or 600
|
local timer = seconds or 600
|
||||||
@@ -289,6 +333,7 @@ do
|
|||||||
--- Set the number of meters for the SHORAD defense zone
|
--- Set the number of meters for the SHORAD defense zone
|
||||||
-- @param #SHORAD self
|
-- @param #SHORAD self
|
||||||
-- @param #number meters Radius of the defense search zone in meters. #SHORADs in this range around a targeted group will go active
|
-- @param #number meters Radius of the defense search zone in meters. #SHORADs in this range around a targeted group will go active
|
||||||
|
-- @return #SHORAD self
|
||||||
function SHORAD:SetDefenseRadius(meters)
|
function SHORAD:SetDefenseRadius(meters)
|
||||||
self:T(self.lid .. " SetDefenseRadius")
|
self:T(self.lid .. " SetDefenseRadius")
|
||||||
local radius = meters or 20000
|
local radius = meters or 20000
|
||||||
@@ -302,6 +347,7 @@ do
|
|||||||
--- Set using Emission on/off instead of changing alarm state
|
--- Set using Emission on/off instead of changing alarm state
|
||||||
-- @param #SHORAD self
|
-- @param #SHORAD self
|
||||||
-- @param #boolean switch Decide if we are changing alarm state or AI state
|
-- @param #boolean switch Decide if we are changing alarm state or AI state
|
||||||
|
-- @return #SHORAD self
|
||||||
function SHORAD:SetUsingEmOnOff(switch)
|
function SHORAD:SetUsingEmOnOff(switch)
|
||||||
self:T(self.lid .. " SetUsingEmOnOff")
|
self:T(self.lid .. " SetUsingEmOnOff")
|
||||||
self.UseEmOnOff = switch or false
|
self.UseEmOnOff = switch or false
|
||||||
@@ -373,11 +419,11 @@ do
|
|||||||
local shorad = self.Groupset
|
local shorad = self.Groupset
|
||||||
local shoradset = shorad:GetAliveSet() --#table
|
local shoradset = shorad:GetAliveSet() --#table
|
||||||
local returnname = false
|
local returnname = false
|
||||||
|
--local TDiff = 1
|
||||||
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
|
returnname = true
|
||||||
--_groups:RelocateGroundRandomInRadius(7,100,false,false) -- be a bit evasive
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return returnname
|
return returnname
|
||||||
@@ -424,6 +470,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
|
||||||
|
-- @return #SHORAD self
|
||||||
-- @usage Use this function to integrate with other systems, example
|
-- @usage Use this function to integrate with other systems, example
|
||||||
--
|
--
|
||||||
-- local SamSet = SET_GROUP:New():FilterPrefixes("Blue SAM"):FilterCoalitions("blue"):FilterStart()
|
-- local SamSet = SET_GROUP:New():FilterPrefixes("Blue SAM"):FilterCoalitions("blue"):FilterStart()
|
||||||
@@ -450,28 +497,35 @@ do
|
|||||||
local targetzone = ZONE_RADIUS:New("Shorad",targetvec2,Radius) -- create a defense zone to check
|
local targetzone = ZONE_RADIUS:New("Shorad",targetvec2,Radius) -- create a defense zone to check
|
||||||
local groupset = self.Groupset --Core.Set#SET_GROUP
|
local groupset = self.Groupset --Core.Set#SET_GROUP
|
||||||
local shoradset = groupset:GetAliveSet() --#table
|
local shoradset = groupset:GetAliveSet() --#table
|
||||||
|
|
||||||
-- local function to switch off shorad again
|
-- local function to switch off shorad again
|
||||||
local function SleepShorad(group)
|
local function SleepShorad(group)
|
||||||
local groupname = group:GetName()
|
if group and group:IsAlive() then
|
||||||
self.ActiveGroups[groupname] = nil
|
local groupname = group:GetName()
|
||||||
if self.UseEmOnOff then
|
self.ActiveGroups[groupname] = nil
|
||||||
group:EnableEmission(false)
|
if self.UseEmOnOff then
|
||||||
--group:SetAIOff()
|
group:EnableEmission(false)
|
||||||
else
|
else
|
||||||
group:OptionAlarmStateGreen()
|
group:OptionAlarmStateGreen()
|
||||||
|
end
|
||||||
|
local text = string.format("Sleeping SHORAD %s", 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
|
||||||
end
|
end
|
||||||
local text = string.format("Sleeping SHORAD %s", group:GetName())
|
|
||||||
self:T(text)
|
|
||||||
local m = MESSAGE:New(text,10,"SHORAD"):ToAllIf(self.debug)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- go through set and find the one(s) to activate
|
-- go through set and find the one(s) to activate
|
||||||
|
local TDiff = 4
|
||||||
for _,_group in pairs (shoradset) do
|
for _,_group in pairs (shoradset) do
|
||||||
if _group:IsAnyInZone(targetzone) then
|
if _group:IsAnyInZone(targetzone) then
|
||||||
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)
|
||||||
if self.UseEmOnOff then
|
if self.UseEmOnOff then
|
||||||
--_group:SetAIOn()
|
|
||||||
_group:EnableEmission(true)
|
_group:EnableEmission(true)
|
||||||
end
|
end
|
||||||
_group:OptionAlarmStateRed()
|
_group:OptionAlarmStateRed()
|
||||||
@@ -479,91 +533,132 @@ do
|
|||||||
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
|
||||||
timer.scheduleFunction(SleepShorad, _group, endtime)
|
self.ActiveGroups[groupname].Timer = TIMER:New(SleepShorad,_group):Start(endtime)
|
||||||
|
--Shoot and Scoot
|
||||||
|
if self.shootandscoot then
|
||||||
|
self:__ShootAndScoot(TDiff,_group)
|
||||||
|
TDiff=TDiff+1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- (Internal) Calculate hit zone of an AGM-88
|
--- (Internal) Calculate hit zone of an AGM-88
|
||||||
-- @param #SHORAD self
|
-- @param #SHORAD self
|
||||||
-- @param #table SEADWeapon DCS.Weapon object
|
-- @param #table SEADWeapon DCS.Weapon object
|
||||||
-- @param Core.Point#COORDINATE pos0 Position of the plane when it fired
|
-- @param Core.Point#COORDINATE pos0 Position of the plane when it fired
|
||||||
-- @param #number height Height when the missile was fired
|
-- @param #number height Height when the missile was fired
|
||||||
-- @param Wrapper.Group#GROUP SEADGroup Attacker group
|
-- @param Wrapper.Group#GROUP SEADGroup Attacker group
|
||||||
-- @return #SHORAD self
|
-- @return #SHORAD self
|
||||||
function SHORAD:onafterCalculateHitZone(From,Event,To,SEADWeapon,pos0,height,SEADGroup)
|
function SHORAD:onafterCalculateHitZone(From,Event,To,SEADWeapon,pos0,height,SEADGroup)
|
||||||
self:T("**** Calculating hit zone")
|
self:T("**** Calculating hit zone")
|
||||||
if SEADWeapon and SEADWeapon:isExist() then
|
if SEADWeapon and SEADWeapon:isExist() then
|
||||||
--local pos = SEADWeapon:getPoint()
|
--local pos = SEADWeapon:getPoint()
|
||||||
|
|
||||||
|
-- postion and height
|
||||||
|
local position = SEADWeapon:getPosition()
|
||||||
|
local mheight = height
|
||||||
|
-- heading
|
||||||
|
local wph = math.atan2(position.x.z, position.x.x)
|
||||||
|
if wph < 0 then
|
||||||
|
wph=wph+2*math.pi
|
||||||
|
end
|
||||||
|
wph=math.deg(wph)
|
||||||
|
|
||||||
|
-- velocity
|
||||||
|
local wpndata = SEAD.HarmData["AGM_88"]
|
||||||
|
local mveloc = math.floor(wpndata[2] * 340.29)
|
||||||
|
local c1 = (2*mheight*9.81)/(mveloc^2)
|
||||||
|
local c2 = (mveloc^2) / 9.81
|
||||||
|
local Ropt = c2 * math.sqrt(c1+1)
|
||||||
|
if height <= 5000 then
|
||||||
|
Ropt = Ropt * 0.72
|
||||||
|
elseif height <= 7500 then
|
||||||
|
Ropt = Ropt * 0.82
|
||||||
|
elseif height <= 10000 then
|
||||||
|
Ropt = Ropt * 0.87
|
||||||
|
elseif height <= 12500 then
|
||||||
|
Ropt = Ropt * 0.98
|
||||||
|
end
|
||||||
|
|
||||||
|
-- look at a couple of zones across the trajectory
|
||||||
|
for n=1,3 do
|
||||||
|
local dist = Ropt - ((n-1)*20000)
|
||||||
|
local predpos= pos0:Translate(dist,wph)
|
||||||
|
if predpos then
|
||||||
|
|
||||||
-- postion and height
|
local targetzone = ZONE_RADIUS:New("Target Zone",predpos:GetVec2(),20000)
|
||||||
local position = SEADWeapon:getPosition()
|
|
||||||
local mheight = height
|
if self.debug then
|
||||||
-- heading
|
predpos:MarkToAll(string.format("height=%dm | heading=%d | velocity=%ddeg | Ropt=%dm",mheight,wph,mveloc,Ropt),false)
|
||||||
local wph = math.atan2(position.x.z, position.x.x)
|
targetzone:DrawZone(coalition.side.BLUE,{0,0,1},0.2,nil,nil,3,true)
|
||||||
if wph < 0 then
|
end
|
||||||
wph=wph+2*math.pi
|
|
||||||
end
|
local seadset = self.Groupset
|
||||||
wph=math.deg(wph)
|
local tgtcoord = targetzone:GetRandomPointVec2()
|
||||||
|
local tgtgrp = seadset:FindNearestGroupFromPointVec2(tgtcoord)
|
||||||
-- velocity
|
local _targetgroup = nil
|
||||||
local wpndata = SEAD.HarmData["AGM_88"]
|
local _targetgroupname = "none"
|
||||||
local mveloc = math.floor(wpndata[2] * 340.29)
|
local _targetskill = "Random"
|
||||||
local c1 = (2*mheight*9.81)/(mveloc^2)
|
if tgtgrp and tgtgrp:IsAlive() then
|
||||||
local c2 = (mveloc^2) / 9.81
|
_targetgroup = tgtgrp
|
||||||
local Ropt = c2 * math.sqrt(c1+1)
|
_targetgroupname = tgtgrp:GetName() -- group name
|
||||||
if height <= 5000 then
|
_targetskill = tgtgrp:GetUnit(1):GetSkill()
|
||||||
Ropt = Ropt * 0.72
|
self:T("*** Found Target = ".. _targetgroupname)
|
||||||
elseif height <= 7500 then
|
self:WakeUpShorad(_targetgroupname, self.Radius, self.ActiveTimer, Object.Category.UNIT)
|
||||||
Ropt = Ropt * 0.82
|
end
|
||||||
elseif height <= 10000 then
|
end
|
||||||
Ropt = Ropt * 0.87
|
end
|
||||||
elseif height <= 12500 then
|
|
||||||
Ropt = Ropt * 0.98
|
|
||||||
end
|
end
|
||||||
|
return self
|
||||||
-- look at a couple of zones across the trajectory
|
end
|
||||||
for n=1,3 do
|
|
||||||
local dist = Ropt - ((n-1)*20000)
|
|
||||||
local predpos= pos0:Translate(dist,wph)
|
|
||||||
if predpos then
|
|
||||||
|
|
||||||
local targetzone = ZONE_RADIUS:New("Target Zone",predpos:GetVec2(),20000)
|
--- (Internal) Shoot and Scoot
|
||||||
|
-- @param #SHORAD self
|
||||||
if self.debug then
|
-- @param #string From
|
||||||
predpos:MarkToAll(string.format("height=%dm | heading=%d | velocity=%ddeg | Ropt=%dm",mheight,wph,mveloc,Ropt),false)
|
-- @param #string Event
|
||||||
targetzone:DrawZone(coalition.side.BLUE,{0,0,1},0.2,nil,nil,3,true)
|
-- @param #string To
|
||||||
end
|
-- @param Wrapper.Group#GROUP Shorad Shorad group
|
||||||
|
-- @return #SHORAD self
|
||||||
local seadset = self.Groupset
|
function SHORAD:onafterShootAndScoot(From,Event,To,Shorad)
|
||||||
local tgtcoord = targetzone:GetRandomPointVec2()
|
self:T( { From,Event,To } )
|
||||||
local tgtgrp = seadset:FindNearestGroupFromPointVec2(tgtcoord)
|
local possibleZones = {}
|
||||||
local _targetgroup = nil
|
local mindist = self.minscootdist or 100
|
||||||
local _targetgroupname = "none"
|
local maxdist = self.maxscootdist or 3000
|
||||||
local _targetskill = "Random"
|
if Shorad and Shorad:IsAlive() then
|
||||||
if tgtgrp and tgtgrp:IsAlive() then
|
local NowCoord = Shorad:GetCoordinate()
|
||||||
_targetgroup = tgtgrp
|
for _,_zone in pairs(self.SkateZones.Set) do
|
||||||
_targetgroupname = tgtgrp:GetName() -- group name
|
local zone = _zone -- Core.Zone#ZONE_RADIUS
|
||||||
_targetskill = tgtgrp:GetUnit(1):GetSkill()
|
local dist = NowCoord:Get2DDistance(zone:GetCoordinate())
|
||||||
self:T("*** Found Target = ".. _targetgroupname)
|
if dist >= mindist and dist <= maxdist then
|
||||||
self:WakeUpShorad(_targetgroupname, self.Radius, self.ActiveTimer, Object.Category.UNIT)
|
possibleZones[#possibleZones+1] = zone
|
||||||
|
if #possibleZones == self.SkateNumber then break end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
if #possibleZones > 0 and Shorad:GetVelocityKMH() < 2 then
|
||||||
|
local rand = math.floor(math.random(1,#possibleZones*1000)/1000+0.5)
|
||||||
|
if rand == 0 then rand = 1 end
|
||||||
|
self:T(self.lid .. " ShootAndScoot to zone "..rand)
|
||||||
|
local ToCoordinate = possibleZones[rand]:GetCoordinate()
|
||||||
|
if self.scootrandomcoord then
|
||||||
|
ToCoordinate = possibleZones[rand]:GetRandomCoordinate(nil,nil,{land.SurfaceType.LAND,land.SurfaceType.ROAD})
|
||||||
|
end
|
||||||
|
local formation = self.scootformation or "Cone"
|
||||||
|
Shorad:RouteGroundTo(ToCoordinate,20,formation,1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return self
|
||||||
end
|
end
|
||||||
return self
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Main function - work on the EventData
|
--- Main function - work on the EventData
|
||||||
-- @param #SHORAD self
|
-- @param #SHORAD self
|
||||||
-- @param Core.Event#EVENTDATA EventData The event details table data set
|
-- @param Core.Event#EVENTDATA EventData The event details table data set
|
||||||
|
-- @return #SHORAD self
|
||||||
function SHORAD:HandleEventShot( EventData )
|
function SHORAD:HandleEventShot( EventData )
|
||||||
self:T( { EventData } )
|
self:T( { EventData } )
|
||||||
self:T(self.lid .. " HandleEventShot")
|
self:T(self.lid .. " HandleEventShot")
|
||||||
--local ShootingUnit = EventData.IniDCSUnit
|
|
||||||
--local ShootingUnitName = EventData.IniDCSUnitName
|
|
||||||
local ShootingWeapon = EventData.Weapon -- Identify the weapon fired
|
local ShootingWeapon = EventData.Weapon -- Identify the weapon fired
|
||||||
local ShootingWeaponName = EventData.WeaponName -- return weapon type
|
local ShootingWeaponName = EventData.WeaponName -- return weapon type
|
||||||
-- get firing coalition
|
-- get firing coalition
|
||||||
@@ -594,27 +689,18 @@ end
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
local targetcat = targetdata:getCategory() -- Identify category
|
local targetcat = Object.getCategory(targetdata) -- Identify category
|
||||||
self:T(string.format("Target Category (3=STATIC, 1=UNIT)= %s",tostring(targetcat)))
|
self:T(string.format("Target Category (3=STATIC, 1=UNIT)= %s",tostring(targetcat)))
|
||||||
self:T({targetdata})
|
self:T({targetdata})
|
||||||
local targetunit = nil
|
local targetunit = nil
|
||||||
if targetcat == Object.Category.UNIT then -- UNIT
|
if targetcat == Object.Category.UNIT then -- UNIT
|
||||||
targetunit = UNIT:Find(targetdata)
|
targetunit = UNIT:Find(targetdata)
|
||||||
elseif targetcat == Object.Category.STATIC then -- STATIC
|
elseif targetcat == Object.Category.STATIC then -- STATIC
|
||||||
--self:T("Static Target Data")
|
|
||||||
--self:T({targetdata:isExist()})
|
|
||||||
--self:T({targetdata:getPoint()})
|
|
||||||
local tgtcoord = COORDINATE:NewFromVec3(targetdata:getPoint())
|
local tgtcoord = COORDINATE:NewFromVec3(targetdata:getPoint())
|
||||||
--tgtcoord:MarkToAll("Missile Target",true)
|
local tgtgrp1 = self.Samset:FindNearestGroupFromPointVec2(tgtcoord)
|
||||||
|
|
||||||
local tgtgrp1 = self.Samset:FindNearestGroupFromPointVec2(tgtcoord)
|
|
||||||
local tgtcoord1 = tgtgrp1:GetCoordinate()
|
local tgtcoord1 = tgtgrp1:GetCoordinate()
|
||||||
--tgtcoord1:MarkToAll("Close target SAM",true)
|
|
||||||
|
|
||||||
local tgtgrp2 = self.Groupset:FindNearestGroupFromPointVec2(tgtcoord)
|
local tgtgrp2 = self.Groupset:FindNearestGroupFromPointVec2(tgtcoord)
|
||||||
local tgtcoord2 = tgtgrp2:GetCoordinate()
|
local tgtcoord2 = tgtgrp2:GetCoordinate()
|
||||||
--tgtcoord2:MarkToAll("Close target SHORAD",true)
|
|
||||||
|
|
||||||
local dist1 = tgtcoord:Get2DDistance(tgtcoord1)
|
local dist1 = tgtcoord:Get2DDistance(tgtcoord1)
|
||||||
local dist2 = tgtcoord:Get2DDistance(tgtcoord2)
|
local dist2 = tgtcoord:Get2DDistance(tgtcoord2)
|
||||||
|
|
||||||
@@ -626,10 +712,8 @@ end
|
|||||||
targetcat = Object.Category.UNIT
|
targetcat = Object.Category.UNIT
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--local targetunitname = Unit.getName(targetdata) -- Unit name
|
|
||||||
if targetunit and targetunit:IsAlive() then
|
if targetunit and targetunit:IsAlive() then
|
||||||
local targetunitname = targetunit:GetName()
|
local targetunitname = targetunit:GetName()
|
||||||
--local targetgroup = Unit.getGroup(Weapon.getTarget(ShootingWeapon)) --targeted group
|
|
||||||
local targetgroup = nil
|
local targetgroup = nil
|
||||||
local targetgroupname = "none"
|
local targetgroupname = "none"
|
||||||
if targetcat == Object.Category.UNIT then
|
if targetcat == Object.Category.UNIT then
|
||||||
@@ -647,7 +731,6 @@ end
|
|||||||
self:T( text )
|
self:T( text )
|
||||||
local m = MESSAGE:New(text,10,"Info"):ToAllIf(self.debug)
|
local m = MESSAGE:New(text,10,"Info"):ToAllIf(self.debug)
|
||||||
-- check if we or a SAM site are the target
|
-- check if we or a SAM site are the target
|
||||||
--local TargetGroup = EventData.TgtGroup -- Wrapper.Group#GROUP
|
|
||||||
local shotatus = self:_CheckShotAtShorad(targetgroupname) --#boolean
|
local shotatus = self:_CheckShotAtShorad(targetgroupname) --#boolean
|
||||||
local shotatsams = self:_CheckShotAtSams(targetgroupname) --#boolean
|
local shotatsams = self:_CheckShotAtSams(targetgroupname) --#boolean
|
||||||
-- if being shot at, find closest SHORADs to activate
|
-- if being shot at, find closest SHORADs to activate
|
||||||
@@ -664,4 +747,4 @@ end
|
|||||||
end
|
end
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- SHORAD end
|
-- SHORAD end
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
|
|||||||
@@ -33,9 +33,9 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **[funkyfranky](https://forums.eagle.ru/member.php?u=115026)**
|
-- ### Author: **funkyfranky**
|
||||||
--
|
--
|
||||||
-- ### Contributions: [FlightControl](https://forums.eagle.ru/member.php?u=89536)
|
-- ### Contributions: FlightControl
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -85,6 +85,7 @@
|
|||||||
-- @field #boolean eventmoose If true, events are handled by MOOSE. If false, events are handled directly by DCS eventhandler. Default true.
|
-- @field #boolean eventmoose If true, events are handled by MOOSE. If false, events are handled directly by DCS eventhandler. Default true.
|
||||||
-- @field Core.Zone#ZONE BattleZone
|
-- @field Core.Zone#ZONE BattleZone
|
||||||
-- @field #boolean AutoEngage
|
-- @field #boolean AutoEngage
|
||||||
|
-- @field #table waypoints Waypoints of the group as defined in the ME.
|
||||||
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
||||||
--
|
--
|
||||||
|
|
||||||
@@ -265,6 +266,7 @@ SUPPRESSION={
|
|||||||
DefaultAlarmState = "Auto",
|
DefaultAlarmState = "Auto",
|
||||||
DefaultROE = "Weapon Free",
|
DefaultROE = "Weapon Free",
|
||||||
eventmoose = true,
|
eventmoose = true,
|
||||||
|
waypoints = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Enumerator of possible rules of engagement.
|
--- Enumerator of possible rules of engagement.
|
||||||
@@ -295,7 +297,7 @@ SUPPRESSION.MenuF10=nil
|
|||||||
|
|
||||||
--- PSEUDOATC version.
|
--- PSEUDOATC version.
|
||||||
-- @field #number version
|
-- @field #number version
|
||||||
SUPPRESSION.version="0.9.3"
|
SUPPRESSION.version="0.9.4"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -309,7 +311,7 @@ SUPPRESSION.version="0.9.3"
|
|||||||
--- Creates a new AI_suppression object.
|
--- Creates a new AI_suppression object.
|
||||||
-- @param #SUPPRESSION self
|
-- @param #SUPPRESSION self
|
||||||
-- @param Wrapper.Group#GROUP group The GROUP object for which suppression should be applied.
|
-- @param Wrapper.Group#GROUP group The GROUP object for which suppression should be applied.
|
||||||
-- @return #SUPPRESSION SUPPRESSION object or *nil* if group does not exist or is not a ground group.
|
-- @return #SUPPRESSION self
|
||||||
function SUPPRESSION:New(group)
|
function SUPPRESSION:New(group)
|
||||||
|
|
||||||
-- Inherits from FSM_CONTROLLABLE
|
-- Inherits from FSM_CONTROLLABLE
|
||||||
@@ -320,7 +322,7 @@ function SUPPRESSION:New(group)
|
|||||||
self.lid=string.format("SUPPRESSION %s | ", tostring(group:GetName()))
|
self.lid=string.format("SUPPRESSION %s | ", tostring(group:GetName()))
|
||||||
self:T(self.lid..string.format("SUPPRESSION version %s. Activating suppressive fire for group %s", SUPPRESSION.version, group:GetName()))
|
self:T(self.lid..string.format("SUPPRESSION version %s. Activating suppressive fire for group %s", SUPPRESSION.version, group:GetName()))
|
||||||
else
|
else
|
||||||
self:E(self.lid.."SUPPRESSION | Requested group does not exist! (Has to be a MOOSE group.)")
|
self:E("SUPPRESSION | Requested group does not exist! (Has to be a MOOSE group)")
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1186,6 +1188,16 @@ function SUPPRESSION:onafterFightBack(Controllable, From, Event, To)
|
|||||||
-- Set ROE and alarm state back to default.
|
-- Set ROE and alarm state back to default.
|
||||||
self:_SetROE()
|
self:_SetROE()
|
||||||
self:_SetAlarmState()
|
self:_SetAlarmState()
|
||||||
|
|
||||||
|
local group=Controllable --Wrapper.Group#GROUP
|
||||||
|
|
||||||
|
local Waypoints = group:GetTemplateRoutePoints()
|
||||||
|
|
||||||
|
-- env.info("FF waypoints",showMessageBox)
|
||||||
|
-- self:I(Waypoints)
|
||||||
|
|
||||||
|
group:Route(Waypoints, 5)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -1251,7 +1263,7 @@ function SUPPRESSION:onafterFallBack(Controllable, From, Event, To, AttackUnit)
|
|||||||
self:_SetROE(SUPPRESSION.ROE.Hold)
|
self:_SetROE(SUPPRESSION.ROE.Hold)
|
||||||
|
|
||||||
-- Set alarm state to GREEN and let the unit run away.
|
-- Set alarm state to GREEN and let the unit run away.
|
||||||
self:_SetAlarmState(SUPPRESSION.AlarmState.Green)
|
self:_SetAlarmState(SUPPRESSION.AlarmState.Auto)
|
||||||
|
|
||||||
-- Make the group run away.
|
-- Make the group run away.
|
||||||
self:_Run(Coord, self.Speed, self.Formation, self.FallbackWait)
|
self:_Run(Coord, self.Speed, self.Formation, self.FallbackWait)
|
||||||
@@ -1537,7 +1549,7 @@ end
|
|||||||
-- @param #SUPPRESSION self
|
-- @param #SUPPRESSION self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function SUPPRESSION:_OnEventHit(EventData)
|
function SUPPRESSION:_OnEventHit(EventData)
|
||||||
self:F(EventData)
|
self:F3(EventData)
|
||||||
|
|
||||||
local GroupNameSelf=self.Controllable:GetName()
|
local GroupNameSelf=self.Controllable:GetName()
|
||||||
local GroupNameTgt=EventData.TgtGroupName
|
local GroupNameTgt=EventData.TgtGroupName
|
||||||
@@ -1676,15 +1688,15 @@ end
|
|||||||
function SUPPRESSION:_Run(fin, speed, formation, wait)
|
function SUPPRESSION:_Run(fin, speed, formation, wait)
|
||||||
|
|
||||||
speed=speed or 20
|
speed=speed or 20
|
||||||
formation=formation or "Off road"
|
formation=formation or ENUMS.Formation.Vehicle.OffRoad
|
||||||
wait=wait or 30
|
wait=wait or 30
|
||||||
|
|
||||||
local group=self.Controllable -- Wrapper.Controllable#CONTROLLABLE
|
local group=self.Controllable -- Wrapper.Group#GROUP
|
||||||
|
|
||||||
if group and group:IsAlive() then
|
if group and group:IsAlive() then
|
||||||
|
|
||||||
-- Clear all tasks.
|
-- Clear all tasks.
|
||||||
group:ClearTasks()
|
--group:ClearTasks()
|
||||||
|
|
||||||
-- Current coordinates of group.
|
-- Current coordinates of group.
|
||||||
local ini=group:GetCoordinate()
|
local ini=group:GetCoordinate()
|
||||||
@@ -1694,57 +1706,18 @@ function SUPPRESSION:_Run(fin, speed, formation, wait)
|
|||||||
|
|
||||||
-- Heading from ini to fin.
|
-- Heading from ini to fin.
|
||||||
local heading=self:_Heading(ini, fin)
|
local heading=self:_Heading(ini, fin)
|
||||||
|
|
||||||
-- Number of waypoints.
|
|
||||||
local nx
|
|
||||||
if dist <= 50 then
|
|
||||||
nx=2
|
|
||||||
elseif dist <= 100 then
|
|
||||||
nx=3
|
|
||||||
elseif dist <= 500 then
|
|
||||||
nx=4
|
|
||||||
else
|
|
||||||
nx=5
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Number of intermediate waypoints.
|
|
||||||
local dx=dist/(nx-1)
|
|
||||||
|
|
||||||
-- Waypoint and task arrays.
|
-- Waypoint and task arrays.
|
||||||
local wp={}
|
local wp={}
|
||||||
local tasks={}
|
local tasks={}
|
||||||
|
|
||||||
-- First waypoint is the current position of the group.
|
-- First waypoint is the current position of the group.
|
||||||
wp[1]=ini:WaypointGround(speed, formation)
|
wp[1]=ini:WaypointGround(speed, formation)
|
||||||
tasks[1]=group:TaskFunction("SUPPRESSION._Passing_Waypoint", self, 1, false)
|
|
||||||
|
|
||||||
if self.Debug then
|
if self.Debug then
|
||||||
local MarkerID=ini:MarkToAll(string.format("Waypoing %d of group %s (initial)", #wp, self.Controllable:GetName()))
|
local MarkerID=ini:MarkToAll(string.format("Waypoing %d of group %s (initial)", #wp, self.Controllable:GetName()))
|
||||||
end
|
end
|
||||||
|
|
||||||
self:T2(self.lid..string.format("Number of waypoints %d", nx))
|
|
||||||
for i=1,nx-2 do
|
|
||||||
|
|
||||||
local x=dx*i
|
|
||||||
local coord=ini:Translate(x, heading)
|
|
||||||
|
|
||||||
wp[#wp+1]=coord:WaypointGround(speed, formation)
|
|
||||||
tasks[#tasks+1]=group:TaskFunction("SUPPRESSION._Passing_Waypoint", self, #wp, false)
|
|
||||||
|
|
||||||
self:T2(self.lid..string.format("%d x = %4.1f", i, x))
|
|
||||||
if self.Debug then
|
|
||||||
local MarkerID=coord:MarkToAll(string.format("Waypoing %d of group %s", #wp, self.Controllable:GetName()))
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
self:T2(self.lid..string.format("Total distance: %4.1f", dist))
|
|
||||||
|
|
||||||
-- Final waypoint.
|
|
||||||
wp[#wp+1]=fin:WaypointGround(speed, formation)
|
|
||||||
if self.Debug then
|
|
||||||
local MarkerID=fin:MarkToAll(string.format("Waypoing %d of group %s (final)", #wp, self.Controllable:GetName()))
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Task to hold.
|
-- Task to hold.
|
||||||
local ConditionWait=group:TaskCondition(nil, nil, nil, nil, wait, nil)
|
local ConditionWait=group:TaskCondition(nil, nil, nil, nil, wait, nil)
|
||||||
local TaskHold = group:TaskHold()
|
local TaskHold = group:TaskHold()
|
||||||
@@ -1753,25 +1726,15 @@ function SUPPRESSION:_Run(fin, speed, formation, wait)
|
|||||||
local TaskComboFin = {}
|
local TaskComboFin = {}
|
||||||
TaskComboFin[#TaskComboFin+1] = group:TaskFunction("SUPPRESSION._Passing_Waypoint", self, #wp, true)
|
TaskComboFin[#TaskComboFin+1] = group:TaskFunction("SUPPRESSION._Passing_Waypoint", self, #wp, true)
|
||||||
TaskComboFin[#TaskComboFin+1] = group:TaskControlled(TaskHold, ConditionWait)
|
TaskComboFin[#TaskComboFin+1] = group:TaskControlled(TaskHold, ConditionWait)
|
||||||
|
|
||||||
-- Add final task.
|
|
||||||
tasks[#tasks+1]=group:TaskCombo(TaskComboFin)
|
|
||||||
|
|
||||||
-- Original waypoints of the group.
|
|
||||||
local Waypoints = group:GetTemplateRoutePoints()
|
|
||||||
|
|
||||||
-- New points are added to the default route.
|
-- Final waypoint.
|
||||||
for i,p in ipairs(wp) do
|
wp[#wp+1]=fin:WaypointGround(speed, formation, TaskComboFin)
|
||||||
table.insert(Waypoints, i, wp[i])
|
if self.Debug then
|
||||||
end
|
local MarkerID=fin:MarkToAll(string.format("Waypoing %d of group %s (final)", #wp, self.Controllable:GetName()))
|
||||||
|
end
|
||||||
-- Set task for all waypoints.
|
|
||||||
for i,wp in ipairs(Waypoints) do
|
|
||||||
group:SetTaskWaypoint(Waypoints[i], tasks[i])
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Submit task and route group along waypoints.
|
-- Submit task and route group along waypoints.
|
||||||
group:Route(Waypoints)
|
group:Route(wp)
|
||||||
|
|
||||||
else
|
else
|
||||||
self:E(self.lid..string.format("ERROR: Group is not alive!"))
|
self:E(self.lid..string.format("ERROR: Group is not alive!"))
|
||||||
@@ -1790,7 +1753,7 @@ function SUPPRESSION._Passing_Waypoint(group, Fsm, i, final)
|
|||||||
local text=string.format("Group %s passing waypoint %d (final=%s)", group:GetName(), i, tostring(final))
|
local text=string.format("Group %s passing waypoint %d (final=%s)", group:GetName(), i, tostring(final))
|
||||||
MESSAGE:New(text,10):ToAllIf(Fsm.Debug)
|
MESSAGE:New(text,10):ToAllIf(Fsm.Debug)
|
||||||
if Fsm.Debug then
|
if Fsm.Debug then
|
||||||
env.info(self.lid..text)
|
env.info(Fsm.lid..text)
|
||||||
end
|
end
|
||||||
|
|
||||||
if final then
|
if final then
|
||||||
@@ -1891,7 +1854,7 @@ function SUPPRESSION:_GetLife()
|
|||||||
|
|
||||||
local groupstrength=#units/self.IniGroupStrength*100
|
local groupstrength=#units/self.IniGroupStrength*100
|
||||||
|
|
||||||
self.T2(self.lid..string.format("Group %s _GetLife nunits = %d", self.Controllable:GetName(), #units))
|
self:T2(self.lid..string.format("Group %s _GetLife nunits = %d", self.Controllable:GetName(), #units))
|
||||||
|
|
||||||
for _,unit in pairs(units) do
|
for _,unit in pairs(units) do
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@
|
|||||||
-- @field #number respawndelay Delay before respawn in seconds.
|
-- @field #number respawndelay Delay before respawn in seconds.
|
||||||
-- @field #number runwaydestroyed Time stamp timer.getAbsTime() when the runway was destroyed.
|
-- @field #number runwaydestroyed Time stamp timer.getAbsTime() when the runway was destroyed.
|
||||||
-- @field #number runwayrepairtime Time in seconds until runway will be repaired after it was destroyed. Default is 3600 sec (one hour).
|
-- @field #number runwayrepairtime Time in seconds until runway will be repaired after it was destroyed. Default is 3600 sec (one hour).
|
||||||
-- @field Ops.FlightControl#FLIGHTCONTROL flightcontrol Flight control of this warehouse.
|
-- @field OPS.FlightControl#FLIGHTCONTROL flightcontrol Flight control of this warehouse.
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
--- Have your assets at the right place at the right time - or not!
|
--- Have your assets at the right place at the right time - or not!
|
||||||
@@ -302,8 +302,8 @@
|
|||||||
--
|
--
|
||||||
-- Initial Spawn states is as follows:
|
-- Initial Spawn states is as follows:
|
||||||
-- GROUND: ROE, "Return Fire" Alarm, "Green"
|
-- GROUND: ROE, "Return Fire" Alarm, "Green"
|
||||||
-- AIR: ROE, "Return Fire" Reaction to Threat, "Passive Defense"
|
-- AIR: ROE, "Return Fire" Reaction to Threat, "Passive Defense"
|
||||||
-- NAVAL ROE, "Return Fire" Alarm,"N/A"
|
-- NAVAL ROE, "Return Fire" Alarm,"N/A"
|
||||||
--
|
--
|
||||||
-- A request can be added by the @{#WAREHOUSE.AddRequest}(*warehouse*, *AssetDescriptor*, *AssetDescriptorValue*, *nAsset*, *TransportType*, *nTransport*, *Prio*, *Assignment*) function.
|
-- A request can be added by the @{#WAREHOUSE.AddRequest}(*warehouse*, *AssetDescriptor*, *AssetDescriptorValue*, *nAsset*, *TransportType*, *nTransport*, *Prio*, *Assignment*) function.
|
||||||
-- The parameters are
|
-- The parameters are
|
||||||
@@ -742,7 +742,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Save Assets
|
-- ## Save Assets
|
||||||
--
|
--
|
||||||
-- Saving asset data to file is achieved by the @{WAREHOUSE.Save}(*path*, *filename*) function. The parameter *path* specifies the path on the file system where the
|
-- Saving asset data to file is achieved by the @{#WAREHOUSE.Save}(*path*, *filename*) function. The parameter *path* specifies the path on the file system where the
|
||||||
-- warehouse data is saved. If you do not specify a path, the file is saved your the DCS installation root directory.
|
-- warehouse data is saved. If you do not specify a path, the file is saved your the DCS installation root directory.
|
||||||
-- The parameter *filename* is optional and defines the name of the saved file. By default this is automatically created from the warehouse id and name, for example
|
-- The parameter *filename* is optional and defines the name of the saved file. By default this is automatically created from the warehouse id and name, for example
|
||||||
-- "Warehouse-1234_Batumi.txt".
|
-- "Warehouse-1234_Batumi.txt".
|
||||||
@@ -753,13 +753,13 @@
|
|||||||
--
|
--
|
||||||
-- ### Automatic Save at Mission End
|
-- ### Automatic Save at Mission End
|
||||||
--
|
--
|
||||||
-- The assets can be saved automatically when the mission is ended via the @{WAREHOUSE.SetSaveOnMissionEnd}(*path*, *filename*) function, i.e.
|
-- The assets can be saved automatically when the mission is ended via the @{#WAREHOUSE.SetSaveOnMissionEnd}(*path*, *filename*) function, i.e.
|
||||||
--
|
--
|
||||||
-- warehouseBatumi:SetSaveOnMissionEnd("D:\\My Warehouse Data\\")
|
-- warehouseBatumi:SetSaveOnMissionEnd("D:\\My Warehouse Data\\")
|
||||||
--
|
--
|
||||||
-- ## Load Assets
|
-- ## Load Assets
|
||||||
--
|
--
|
||||||
-- Loading assets data from file is achieved by the @{WAREHOUSE.Load}(*path*, *filename*) function. The parameter *path* specifies the path on the file system where the
|
-- Loading assets data from file is achieved by the @{#WAREHOUSE.Load}(*path*, *filename*) function. The parameter *path* specifies the path on the file system where the
|
||||||
-- warehouse data is loaded from. If you do not specify a path, the file is loaded from your the DCS installation root directory.
|
-- warehouse data is loaded from. If you do not specify a path, the file is loaded from your the DCS installation root directory.
|
||||||
-- The parameter *filename* is optional and defines the name of the file to load. By default this is automatically generated from the warehouse id and name, for example
|
-- The parameter *filename* is optional and defines the name of the file to load. By default this is automatically generated from the warehouse id and name, for example
|
||||||
-- "Warehouse-1234_Batumi.txt".
|
-- "Warehouse-1234_Batumi.txt".
|
||||||
@@ -1274,7 +1274,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Example 13: Battlefield Air Interdiction
|
-- ## Example 13: Battlefield Air Interdiction
|
||||||
--
|
--
|
||||||
-- This example show how to couple the WAREHOUSE class with the @{AI.AI_Bai} class.
|
-- This example show how to couple the WAREHOUSE class with the @{AI.AI_BAI} class.
|
||||||
-- Four enemy targets have been located at the famous Kobuleti X. All three available Viggen 2-ship flights are assigned to kill at least one of the BMPs to complete their mission.
|
-- Four enemy targets have been located at the famous Kobuleti X. All three available Viggen 2-ship flights are assigned to kill at least one of the BMPs to complete their mission.
|
||||||
--
|
--
|
||||||
-- -- Start Warehouse at Kobuleti.
|
-- -- Start Warehouse at Kobuleti.
|
||||||
@@ -1798,7 +1798,7 @@ _WAREHOUSEDB = {
|
|||||||
|
|
||||||
--- Warehouse class version.
|
--- Warehouse class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
WAREHOUSE.version="1.0.2"
|
WAREHOUSE.version="1.0.2a"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO: Warehouse todo list.
|
-- TODO: Warehouse todo list.
|
||||||
@@ -2647,6 +2647,13 @@ function WAREHOUSE:SetWarehouseZone(zone)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Get the warehouse zone.
|
||||||
|
-- @param #WAREHOUSE self
|
||||||
|
-- @return Core.Zone#ZONE The warehouse zone.
|
||||||
|
function WAREHOUSE:GetWarehouseZone()
|
||||||
|
return self.zone
|
||||||
|
end
|
||||||
|
|
||||||
--- Set auto defence on. When the warehouse is under attack, all ground assets are spawned automatically and will defend the warehouse zone.
|
--- Set auto defence on. When the warehouse is under attack, all ground assets are spawned automatically and will defend the warehouse zone.
|
||||||
-- @param #WAREHOUSE self
|
-- @param #WAREHOUSE self
|
||||||
-- @return #WAREHOUSE self
|
-- @return #WAREHOUSE self
|
||||||
@@ -3609,9 +3616,10 @@ function WAREHOUSE:onafterStatus(From, Event, To)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Print queue after processing requests.
|
-- Print queue after processing requests.
|
||||||
self:_PrintQueue(self.queue, "Queue waiting")
|
if self.verbosity > 2 then
|
||||||
self:_PrintQueue(self.pending, "Queue pending")
|
self:_PrintQueue(self.queue, "Queue waiting")
|
||||||
|
self:_PrintQueue(self.pending, "Queue pending")
|
||||||
|
end
|
||||||
-- Check fuel for all assets.
|
-- Check fuel for all assets.
|
||||||
--self:_CheckFuel()
|
--self:_CheckFuel()
|
||||||
|
|
||||||
@@ -4094,9 +4102,9 @@ function WAREHOUSE:_RegisterAsset(group, ngroups, forceattribute, forcecargobay,
|
|||||||
-- Get the size of an object.
|
-- Get the size of an object.
|
||||||
local function _GetObjectSize(DCSdesc)
|
local function _GetObjectSize(DCSdesc)
|
||||||
if DCSdesc.box then
|
if DCSdesc.box then
|
||||||
local x=DCSdesc.box.max.x+math.abs(DCSdesc.box.min.x) --length
|
local x=DCSdesc.box.max.x-DCSdesc.box.min.x --length
|
||||||
local y=DCSdesc.box.max.y+math.abs(DCSdesc.box.min.y) --height
|
local y=DCSdesc.box.max.y-DCSdesc.box.min.y --height
|
||||||
local z=DCSdesc.box.max.z+math.abs(DCSdesc.box.min.z) --width
|
local z=DCSdesc.box.max.z-DCSdesc.box.min.z --width
|
||||||
return math.max(x,z), x , y, z
|
return math.max(x,z), x , y, z
|
||||||
end
|
end
|
||||||
return 0,0,0,0
|
return 0,0,0,0
|
||||||
@@ -4554,7 +4562,8 @@ function WAREHOUSE:onafterRequest(From, Event, To, Request)
|
|||||||
self:_ErrorMessage("ERROR: Cargo transport by train not supported yet!")
|
self:_ErrorMessage("ERROR: Cargo transport by train not supported yet!")
|
||||||
return
|
return
|
||||||
|
|
||||||
elseif Request.transporttype==WAREHOUSE.TransportType.SHIP or Request.transporttype==WAREHOUSE.TransportType.NAVALCARRIER then
|
elseif Request.transporttype==WAREHOUSE.TransportType.SHIP or Request.transporttype==WAREHOUSE.TransportType.NAVALCARRIER
|
||||||
|
or Request.transporttype==WAREHOUSE.TransportType.ARMEDSHIP or Request.transporttype==WAREHOUSE.TransportType.WARSHIP then
|
||||||
|
|
||||||
-- Spawn Ship in port zone
|
-- Spawn Ship in port zone
|
||||||
spawngroup=self:_SpawnAssetGroundNaval(_alias, _assetitem, Request, self.portzone)
|
spawngroup=self:_SpawnAssetGroundNaval(_alias, _assetitem, Request, self.portzone)
|
||||||
@@ -5490,8 +5499,13 @@ function WAREHOUSE:onafterAssetDead(From, Event, To, asset, request)
|
|||||||
---
|
---
|
||||||
|
|
||||||
-- Remove dead group from cargo group set.
|
-- Remove dead group from cargo group set.
|
||||||
request.cargogroupset:Remove(groupname, NoTriggerEvent)
|
if request.cargogroupset then
|
||||||
self:T(self.lid..string.format("Removed selfpropelled cargo %s: ncargo=%d.", groupname, request.cargogroupset:Count()))
|
-- cargogroupset was nil for user case. Difficult to reproduce so we add a nil check.
|
||||||
|
request.cargogroupset:Remove(groupname, NoTriggerEvent)
|
||||||
|
self:T(self.lid..string.format("Removed selfpropelled cargo %s: ncargo=%d.", groupname, request.cargogroupset:Count()))
|
||||||
|
else
|
||||||
|
self:E(self.lid..string.format("ERROR: cargogroupset is nil for request ID=%s!", tostring(request.uid)))
|
||||||
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
@@ -5810,6 +5824,7 @@ function WAREHOUSE:_SpawnAssetRequest(Request)
|
|||||||
-- Now we try to find all parking spots for all cargo groups in advance. Due to the for loop, the parking spots do not get updated while spawning.
|
-- Now we try to find all parking spots for all cargo groups in advance. Due to the for loop, the parking spots do not get updated while spawning.
|
||||||
local Parking={}
|
local Parking={}
|
||||||
if Request.cargocategory==Group.Category.AIRPLANE or Request.cargocategory==Group.Category.HELICOPTER then
|
if Request.cargocategory==Group.Category.AIRPLANE or Request.cargocategory==Group.Category.HELICOPTER then
|
||||||
|
--TODO: Check for airstart. Should be a request property.
|
||||||
Parking=self:_FindParkingForAssets(self.airbase, cargoassets) or {}
|
Parking=self:_FindParkingForAssets(self.airbase, cargoassets) or {}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -5821,62 +5836,65 @@ function WAREHOUSE:_SpawnAssetRequest(Request)
|
|||||||
|
|
||||||
-- Get stock item.
|
-- Get stock item.
|
||||||
local asset=cargoassets[i] --#WAREHOUSE.Assetitem
|
local asset=cargoassets[i] --#WAREHOUSE.Assetitem
|
||||||
|
|
||||||
|
if not asset.spawned then
|
||||||
|
|
||||||
-- Set asset status to not spawned until we capture its birth event.
|
-- Set asset status to not spawned until we capture its birth event.
|
||||||
asset.spawned=false
|
asset.iscargo=true
|
||||||
asset.iscargo=true
|
|
||||||
|
-- Set request ID.
|
||||||
-- Set request ID.
|
asset.rid=Request.uid
|
||||||
asset.rid=Request.uid
|
|
||||||
|
-- Spawn group name.
|
||||||
-- Spawn group name.
|
local _alias=asset.spawngroupname
|
||||||
local _alias=asset.spawngroupname
|
|
||||||
|
--Request add asset by id.
|
||||||
--Request add asset by id.
|
Request.assets[asset.uid]=asset
|
||||||
Request.assets[asset.uid]=asset
|
|
||||||
|
-- Spawn an asset group.
|
||||||
-- Spawn an asset group.
|
local _group=nil --Wrapper.Group#GROUP
|
||||||
local _group=nil --Wrapper.Group#GROUP
|
if asset.category==Group.Category.GROUND then
|
||||||
if asset.category==Group.Category.GROUND then
|
|
||||||
|
-- Spawn ground troops.
|
||||||
-- Spawn ground troops.
|
|
||||||
_group=self:_SpawnAssetGroundNaval(_alias, asset, Request, self.spawnzone, Request.lateActivation)
|
|
||||||
|
|
||||||
elseif asset.category==Group.Category.AIRPLANE or asset.category==Group.Category.HELICOPTER then
|
|
||||||
|
|
||||||
-- Spawn air units.
|
|
||||||
if Parking[asset.uid] then
|
|
||||||
_group=self:_SpawnAssetAircraft(_alias, asset, Request, Parking[asset.uid], UnControlled, Request.lateActivation)
|
|
||||||
else
|
|
||||||
_group=self:_SpawnAssetAircraft(_alias, asset, Request, nil, UnControlled, Request.lateActivation)
|
|
||||||
end
|
|
||||||
|
|
||||||
elseif asset.category==Group.Category.TRAIN then
|
|
||||||
|
|
||||||
-- Spawn train.
|
|
||||||
if self.rail then
|
|
||||||
--TODO: Rail should only get one asset because they would spawn on top!
|
|
||||||
|
|
||||||
-- Spawn naval assets.
|
|
||||||
_group=self:_SpawnAssetGroundNaval(_alias, asset, Request, self.spawnzone, Request.lateActivation)
|
_group=self:_SpawnAssetGroundNaval(_alias, asset, Request, self.spawnzone, Request.lateActivation)
|
||||||
|
|
||||||
|
elseif asset.category==Group.Category.AIRPLANE or asset.category==Group.Category.HELICOPTER then
|
||||||
|
|
||||||
|
-- Spawn air units.
|
||||||
|
if Parking[asset.uid] then
|
||||||
|
_group=self:_SpawnAssetAircraft(_alias, asset, Request, Parking[asset.uid], UnControlled, Request.lateActivation)
|
||||||
|
else
|
||||||
|
_group=self:_SpawnAssetAircraft(_alias, asset, Request, nil, UnControlled, Request.lateActivation)
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif asset.category==Group.Category.TRAIN then
|
||||||
|
|
||||||
|
-- Spawn train.
|
||||||
|
if self.rail then
|
||||||
|
--TODO: Rail should only get one asset because they would spawn on top!
|
||||||
|
|
||||||
|
-- Spawn naval assets.
|
||||||
|
_group=self:_SpawnAssetGroundNaval(_alias, asset, Request, self.spawnzone, Request.lateActivation)
|
||||||
|
end
|
||||||
|
|
||||||
|
--self:E(self.lid.."ERROR: Spawning of TRAIN assets not possible yet!")
|
||||||
|
|
||||||
|
elseif asset.category==Group.Category.SHIP then
|
||||||
|
|
||||||
|
-- Spawn naval assets.
|
||||||
|
_group=self:_SpawnAssetGroundNaval(_alias, asset, Request, self.portzone, Request.lateActivation)
|
||||||
|
|
||||||
|
else
|
||||||
|
self:E(self.lid.."ERROR: Unknown asset category!")
|
||||||
end
|
end
|
||||||
|
|
||||||
--self:E(self.lid.."ERROR: Spawning of TRAIN assets not possible yet!")
|
-- Trigger event.
|
||||||
|
if _group then
|
||||||
elseif asset.category==Group.Category.SHIP then
|
self:__AssetSpawned(0.01, _group, asset, Request)
|
||||||
|
end
|
||||||
-- Spawn naval assets.
|
|
||||||
_group=self:_SpawnAssetGroundNaval(_alias, asset, Request, self.portzone, Request.lateActivation)
|
|
||||||
|
|
||||||
else
|
|
||||||
self:E(self.lid.."ERROR: Unknown asset category!")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Trigger event.
|
|
||||||
if _group then
|
|
||||||
self:__AssetSpawned(0.01, _group, asset, Request)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -6069,7 +6087,9 @@ function WAREHOUSE:_SpawnAssetAircraft(alias, asset, request, parking, uncontrol
|
|||||||
end
|
end
|
||||||
|
|
||||||
if self.Debug then
|
if self.Debug then
|
||||||
coord:MarkToAll(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)
|
||||||
|
env.info(text)
|
||||||
end
|
end
|
||||||
|
|
||||||
unit.x=coord.x
|
unit.x=coord.x
|
||||||
@@ -6657,7 +6677,13 @@ function WAREHOUSE:_OnEventCrashOrDead(EventData)
|
|||||||
self:Destroyed()
|
self:Destroyed()
|
||||||
end
|
end
|
||||||
if self.airbase and self.airbasename and self.airbasename==EventData.IniUnitName then
|
if self.airbase and self.airbasename and self.airbasename==EventData.IniUnitName then
|
||||||
self:RunwayDestroyed()
|
if self:IsRunwayOperational() then
|
||||||
|
-- Trigger RunwayDestroyed event (only if it is not destroyed already)
|
||||||
|
self:RunwayDestroyed()
|
||||||
|
else
|
||||||
|
-- Reset the time stamp.
|
||||||
|
self.runwaydestroyed=timer.getAbsTime()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -6747,7 +6773,7 @@ function WAREHOUSE:_UnitDead(deadunit, deadgroup, request)
|
|||||||
-- Dont trigger a Remove event for the group sets.
|
-- Dont trigger a Remove event for the group sets.
|
||||||
local NoTriggerEvent=true
|
local NoTriggerEvent=true
|
||||||
|
|
||||||
if not request.transporttype==WAREHOUSE.TransportType.SELFPROPELLED then
|
if request.transporttype~=WAREHOUSE.TransportType.SELFPROPELLED then
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Complicated case: Dead unit could be:
|
-- Complicated case: Dead unit could be:
|
||||||
@@ -6814,7 +6840,7 @@ function WAREHOUSE:_OnEventBaseCaptured(EventData)
|
|||||||
self:AirbaseRecaptured(NewCoalitionAirbase)
|
self:AirbaseRecaptured(NewCoalitionAirbase)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- Captured airbase belongs to this warehouse but was captured by other coaltion.
|
-- Captured airbase belongs to this warehouse but was captured by other coalition.
|
||||||
if NewCoalitionAirbase ~= self:GetCoalition() then
|
if NewCoalitionAirbase ~= self:GetCoalition() then
|
||||||
self:AirbaseCaptured(NewCoalitionAirbase)
|
self:AirbaseCaptured(NewCoalitionAirbase)
|
||||||
end
|
end
|
||||||
@@ -7007,7 +7033,7 @@ function WAREHOUSE:_CheckRequestConsistancy(queue)
|
|||||||
|
|
||||||
-- Request from enemy coalition?
|
-- Request from enemy coalition?
|
||||||
if self:GetCoalition()~=request.warehouse:GetCoalition() then
|
if self:GetCoalition()~=request.warehouse:GetCoalition() then
|
||||||
self:E(self.lid..string.format("ERROR: INVALID request. Requesting warehouse is of wrong coaltion! Own coalition %s != %s of requesting warehouse.", self:GetCoalitionName(), request.warehouse:GetCoalitionName()))
|
self:E(self.lid..string.format("ERROR: INVALID request. Requesting warehouse is of wrong coalition! Own coalition %s != %s of requesting warehouse.", self:GetCoalitionName(), request.warehouse:GetCoalitionName()))
|
||||||
valid=false
|
valid=false
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -7374,29 +7400,52 @@ function WAREHOUSE:_CheckRequestNow(request)
|
|||||||
local _transports
|
local _transports
|
||||||
local _assetattribute
|
local _assetattribute
|
||||||
local _assetcategory
|
local _assetcategory
|
||||||
|
local _assetairstart=false
|
||||||
|
|
||||||
-- Check if at least one (cargo) asset is available.
|
-- Check if at least one (cargo) asset is available.
|
||||||
if _nassets>0 then
|
if _nassets>0 then
|
||||||
|
|
||||||
|
local asset=_assets[1] --#WAREHOUSE.Assetitem
|
||||||
|
|
||||||
-- Get the attibute of the requested asset.
|
-- Get the attibute of the requested asset.
|
||||||
_assetattribute=_assets[1].attribute
|
_assetattribute=_assets[1].attribute
|
||||||
_assetcategory=_assets[1].category
|
_assetcategory=_assets[1].category
|
||||||
|
_assetairstart=_assets[1].takeoffType and _assets[1].takeoffType==COORDINATE.WaypointType.TurningPoint or false
|
||||||
|
|
||||||
-- Check available parking for air asset units.
|
-- Check available parking for air asset units.
|
||||||
if _assetcategory==Group.Category.AIRPLANE or _assetcategory==Group.Category.HELICOPTER then
|
if _assetcategory==Group.Category.AIRPLANE or _assetcategory==Group.Category.HELICOPTER then
|
||||||
|
|
||||||
if self.airbase and self.airbase:GetCoalition()==self:GetCoalition() then
|
if self.airbase and self.airbase:GetCoalition()==self:GetCoalition() then
|
||||||
|
|
||||||
if self:IsRunwayOperational() then
|
-- Check if DCS warehouse of airbase has enough assets
|
||||||
|
if self.airbase.storage then
|
||||||
local Parking=self:_FindParkingForAssets(self.airbase,_assets)
|
local nS=self.airbase.storage:GetAmount(asset.unittype)
|
||||||
|
local nA=asset.nunits*request.nasset -- Number of units requested
|
||||||
--if Parking==nil and not (self.category==Airbase.Category.HELIPAD) then
|
if nS<nA then
|
||||||
if Parking==nil then
|
local text=string.format("Warehouse %s: Request denied! DCS Warehouse has only %d assets of type %s ==> NOT enough to spawn the requested %d asset units (%d groups)",
|
||||||
local text=string.format("Warehouse %s: Request denied! Not enough free parking spots for all requested assets at the moment.", self.alias)
|
self.alias, nS, asset.unittype, nA, request.nasset)
|
||||||
self:_InfoMessage(text, 5)
|
self:_InfoMessage(text, 5)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
if self:IsRunwayOperational() or _assetairstart then
|
||||||
|
|
||||||
|
if _assetairstart then
|
||||||
|
-- Airstart no need to check parking
|
||||||
|
else
|
||||||
|
|
||||||
|
-- Check parking.
|
||||||
|
local Parking=self:_FindParkingForAssets(self.airbase,_assets)
|
||||||
|
|
||||||
|
-- No parking?
|
||||||
|
if Parking==nil then
|
||||||
|
local text=string.format("Warehouse %s: Request denied! Not enough free parking spots for all requested assets at the moment.", self.alias)
|
||||||
|
self:_InfoMessage(text, 5)
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
-- Runway destroyed.
|
-- Runway destroyed.
|
||||||
@@ -7496,6 +7545,9 @@ function WAREHOUSE:_CheckRequestNow(request)
|
|||||||
self:_InfoMessage(text, 5)
|
self:_InfoMessage(text, 5)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
elseif _assetcategory==Group.Category.AIRPLANE or _assetcategory==Group.Category.HELICOPTER then
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -7836,7 +7888,7 @@ function WAREHOUSE:_GetTerminal(_attribute, _category)
|
|||||||
-- Default terminal is "large".
|
-- Default terminal is "large".
|
||||||
local _terminal=AIRBASE.TerminalType.OpenBig
|
local _terminal=AIRBASE.TerminalType.OpenBig
|
||||||
|
|
||||||
if _attribute==WAREHOUSE.Attribute.AIR_FIGHTER then
|
if _attribute==WAREHOUSE.Attribute.AIR_FIGHTER or _attribute==WAREHOUSE.Attribute.AIR_UAV then
|
||||||
-- Fighter ==> small.
|
-- Fighter ==> small.
|
||||||
_terminal=AIRBASE.TerminalType.FighterAircraft
|
_terminal=AIRBASE.TerminalType.FighterAircraft
|
||||||
elseif _attribute==WAREHOUSE.Attribute.AIR_BOMBER or _attribute==WAREHOUSE.Attribute.AIR_TRANSPORTPLANE or _attribute==WAREHOUSE.Attribute.AIR_TANKER or _attribute==WAREHOUSE.Attribute.AIR_AWACS then
|
elseif _attribute==WAREHOUSE.Attribute.AIR_BOMBER or _attribute==WAREHOUSE.Attribute.AIR_TRANSPORTPLANE or _attribute==WAREHOUSE.Attribute.AIR_TANKER or _attribute==WAREHOUSE.Attribute.AIR_AWACS then
|
||||||
@@ -7969,93 +8021,123 @@ function WAREHOUSE:_FindParkingForAssets(airbase, assets)
|
|||||||
-- Loop over all assets that need a parking psot.
|
-- Loop over all assets that need a parking psot.
|
||||||
for _,asset in pairs(assets) do
|
for _,asset in pairs(assets) do
|
||||||
local _asset=asset --#WAREHOUSE.Assetitem
|
local _asset=asset --#WAREHOUSE.Assetitem
|
||||||
|
|
||||||
-- Get terminal type of this asset
|
|
||||||
local terminaltype=asset.terminalType or self:_GetTerminal(asset.attribute, self:GetAirbaseCategory())
|
|
||||||
|
|
||||||
-- Asset specific parking.
|
|
||||||
parking[_asset.uid]={}
|
|
||||||
|
|
||||||
-- Loop over all units - each one needs a spot.
|
|
||||||
for i=1,_asset.nunits do
|
|
||||||
|
|
||||||
-- Asset name
|
if not _asset.spawned then
|
||||||
local assetname=_asset.spawngroupname.."-"..tostring(i)
|
|
||||||
|
|
||||||
-- Loop over all parking spots.
|
|
||||||
local gotit=false
|
|
||||||
for _,_parkingspot in pairs(parkingdata) do
|
|
||||||
local parkingspot=_parkingspot --Wrapper.Airbase#AIRBASE.ParkingSpot
|
|
||||||
|
|
||||||
-- Check correct terminal type for asset. We don't want helos in shelters etc.
|
|
||||||
if AIRBASE._CheckTerminalType(parkingspot.TerminalType, terminaltype) and self:_CheckParkingValid(parkingspot) and self:_CheckParkingAsset(parkingspot, asset) and airbase:_CheckParkingLists(parkingspot.TerminalID) then
|
|
||||||
|
|
||||||
-- Coordinate of the parking spot.
|
|
||||||
local _spot=parkingspot.Coordinate -- Core.Point#COORDINATE
|
|
||||||
local _termid=parkingspot.TerminalID
|
|
||||||
local free=true
|
|
||||||
local problem=nil
|
|
||||||
|
|
||||||
-- Loop over all obstacles.
|
|
||||||
for _,obstacle in pairs(obstacles) do
|
|
||||||
|
|
||||||
-- Check if aircraft overlaps with any obstacle.
|
|
||||||
local dist=_spot:Get2DDistance(obstacle.coord)
|
|
||||||
local safe=_overlap(_asset.size, obstacle.size, dist)
|
|
||||||
|
|
||||||
-- Spot is blocked.
|
|
||||||
if not safe then
|
|
||||||
self:T3(self.lid..string.format("FF asset=%s (id=%d): spot id=%d dist=%.1fm is NOT SAFE", assetname, _asset.uid, _termid, dist))
|
|
||||||
free=false
|
|
||||||
problem=obstacle
|
|
||||||
problem.dist=dist
|
|
||||||
break
|
|
||||||
else
|
|
||||||
--env.info(string.format("FF asset=%s (id=%d): spot id=%d dist=%.1fm is SAFE", assetname, _asset.uid, _termid, dist))
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Check if spot is free
|
|
||||||
if free then
|
|
||||||
|
|
||||||
-- Add parkingspot for this asset unit.
|
|
||||||
table.insert(parking[_asset.uid], parkingspot)
|
|
||||||
|
|
||||||
-- Debug
|
|
||||||
self:T(self.lid..string.format("Parking spot %d is free for asset %s [id=%d]!", _termid, assetname, _asset.uid))
|
|
||||||
|
|
||||||
-- Add the unit as obstacle so that this spot will not be available for the next unit.
|
|
||||||
table.insert(obstacles, {coord=_spot, size=_asset.size, name=assetname, type="asset"})
|
|
||||||
|
|
||||||
gotit=true
|
|
||||||
break
|
|
||||||
|
|
||||||
|
-- Get terminal type of this asset
|
||||||
|
local terminaltype=asset.terminalType or self:_GetTerminal(asset.attribute, self:GetAirbaseCategory())
|
||||||
|
|
||||||
|
-- Asset specific parking.
|
||||||
|
parking[_asset.uid]={}
|
||||||
|
|
||||||
|
-- Loop over all units - each one needs a spot.
|
||||||
|
for i=1,_asset.nunits do
|
||||||
|
|
||||||
|
-- Asset name
|
||||||
|
local assetname=_asset.spawngroupname.."-"..tostring(i)
|
||||||
|
|
||||||
|
-- Loop over all parking spots.
|
||||||
|
local gotit=false
|
||||||
|
for _,_parkingspot in pairs(parkingdata) do
|
||||||
|
local parkingspot=_parkingspot --Wrapper.Airbase#AIRBASE.ParkingSpot
|
||||||
|
|
||||||
|
-- Parking valid?
|
||||||
|
local valid=true
|
||||||
|
|
||||||
|
if asset.parkingIDs then
|
||||||
|
-- If asset has assigned parking spots, we take these no matter what.
|
||||||
|
valid=self:_CheckParkingAsset(parkingspot, asset)
|
||||||
else
|
else
|
||||||
|
|
||||||
-- Debug output for occupied spots.
|
-- Valid terminal type depending on attribute.
|
||||||
if self.Debug then
|
local validTerminal=AIRBASE._CheckTerminalType(parkingspot.TerminalType, terminaltype)
|
||||||
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)
|
-- Valid parking list.
|
||||||
self:I(self.lid..text)
|
local validParking=self:_CheckParkingValid(parkingspot)
|
||||||
coord:MarkToAll(string.format(text))
|
|
||||||
else
|
-- Black and white list.
|
||||||
self:T(self.lid..string.format("Parking spot %d is occupied or not big enough!", _termid))
|
local validBWlist=airbase:_CheckParkingLists(parkingspot.TerminalID)
|
||||||
end
|
|
||||||
|
-- Debug info.
|
||||||
|
--env.info(string.format("FF validTerminal = %s", tostring(validTerminal)))
|
||||||
|
--env.info(string.format("FF validParking = %s", tostring(validParking)))
|
||||||
|
--env.info(string.format("FF validBWlist = %s", tostring(validBWlist)))
|
||||||
|
|
||||||
|
-- Check if all are true
|
||||||
|
valid=validTerminal and validParking and validBWlist
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
|
||||||
self:T2(self.lid..string.format("Terminal ID=%d: type=%s not supported", parkingspot.TerminalID, parkingspot.TerminalType))
|
-- Check correct terminal type for asset. We don't want helos in shelters etc.
|
||||||
end -- check terminal type
|
if valid then
|
||||||
end -- loop over parking spots
|
|
||||||
|
-- Coordinate of the parking spot.
|
||||||
-- No parking spot for at least one asset :(
|
local _spot=parkingspot.Coordinate -- Core.Point#COORDINATE
|
||||||
if not gotit then
|
local _termid=parkingspot.TerminalID
|
||||||
self:I(self.lid..string.format("WARNING: No free parking spot for asset %s [id=%d]", assetname, _asset.uid))
|
local free=true
|
||||||
return nil
|
local problem=nil
|
||||||
end
|
|
||||||
end -- loop over asset units
|
-- Loop over all obstacles.
|
||||||
|
for _,obstacle in pairs(obstacles) do
|
||||||
|
|
||||||
|
-- Check if aircraft overlaps with any obstacle.
|
||||||
|
local dist=_spot:Get2DDistance(obstacle.coord)
|
||||||
|
local safe=_overlap(_asset.size, obstacle.size, dist)
|
||||||
|
|
||||||
|
-- Spot is blocked.
|
||||||
|
if not safe then
|
||||||
|
self:T3(self.lid..string.format("FF asset=%s (id=%d): spot id=%d dist=%.1fm is NOT SAFE", assetname, _asset.uid, _termid, dist))
|
||||||
|
free=false
|
||||||
|
problem=obstacle
|
||||||
|
problem.dist=dist
|
||||||
|
break
|
||||||
|
else
|
||||||
|
--env.info(string.format("FF asset=%s (id=%d): spot id=%d dist=%.1fm is SAFE", assetname, _asset.uid, _termid, dist))
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check if spot is free
|
||||||
|
if free then
|
||||||
|
|
||||||
|
-- Add parkingspot for this asset unit.
|
||||||
|
table.insert(parking[_asset.uid], parkingspot)
|
||||||
|
|
||||||
|
-- Debug
|
||||||
|
self:T(self.lid..string.format("Parking spot %d is free for asset %s [id=%d]!", _termid, assetname, _asset.uid))
|
||||||
|
|
||||||
|
-- Add the unit as obstacle so that this spot will not be available for the next unit.
|
||||||
|
table.insert(obstacles, {coord=_spot, size=_asset.size, name=assetname, type="asset"})
|
||||||
|
|
||||||
|
gotit=true
|
||||||
|
break
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
-- Debug output for occupied spots.
|
||||||
|
if self.Debug then
|
||||||
|
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)
|
||||||
|
self:I(self.lid..text)
|
||||||
|
coord:MarkToAll(string.format(text))
|
||||||
|
else
|
||||||
|
self:T(self.lid..string.format("Parking spot %d is occupied or not big enough!", _termid))
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
self:T2(self.lid..string.format("Terminal ID=%d: type=%s not supported", parkingspot.TerminalID, parkingspot.TerminalType))
|
||||||
|
end -- check terminal type
|
||||||
|
end -- loop over parking spots
|
||||||
|
|
||||||
|
-- No parking spot for at least one asset :(
|
||||||
|
if not gotit then
|
||||||
|
self:I(self.lid..string.format("WARNING: No free parking spot for asset %s [id=%d]", assetname, _asset.uid))
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
end -- loop over asset units
|
||||||
|
end -- Asset spawned check
|
||||||
end -- loop over asset groups
|
end -- loop over asset groups
|
||||||
|
|
||||||
return parking
|
return parking
|
||||||
@@ -8171,7 +8253,7 @@ end
|
|||||||
-- @return #number Request ID.
|
-- @return #number Request ID.
|
||||||
function WAREHOUSE:_GetIDsFromGroupName(groupname)
|
function WAREHOUSE:_GetIDsFromGroupName(groupname)
|
||||||
|
|
||||||
---@param #string text The text to analyse.
|
-- @param #string text The text to analyse.
|
||||||
local function analyse(text)
|
local function analyse(text)
|
||||||
|
|
||||||
-- Get rid of #0001 tail from spawn.
|
-- Get rid of #0001 tail from spawn.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **Functional** -- Models the process to zone guarding and capturing.
|
--- **Functional** - Models the process to zone guarding and capturing.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [CAZ - Capture Zones](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CAZ%20-%20Capture%20Zones)
|
-- [CAZ - Capture Zones](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/ZoneCaptureCoalition)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -68,9 +68,9 @@ do -- ZONE_CAPTURE_COALITION
|
|||||||
--
|
--
|
||||||
-- In order to use ZONE_CAPTURE_COALITION, you need to:
|
-- In order to use ZONE_CAPTURE_COALITION, you need to:
|
||||||
--
|
--
|
||||||
-- * Create a @{Zone} object from one of the ZONE_ classes.
|
-- * Create a @{Core.Zone} object from one of the ZONE_ classes.
|
||||||
-- Note that ZONE_POLYGON_ classes are not yet functional.
|
-- The functional ZONE_ classses are those derived from a ZONE_RADIUS.
|
||||||
-- The only functional ZONE_ classses are those derived from a ZONE_RADIUS.
|
-- In order to use a ZONE_POLYGON, hand over the **GROUP name** of a late activated group forming a polygon with it's waypoints.
|
||||||
-- * Set the state of the zone. Most of the time, Guarded would be the initial state.
|
-- * Set the state of the zone. Most of the time, Guarded would be the initial state.
|
||||||
-- * Start the zone capturing **monitoring process**.
|
-- * Start the zone capturing **monitoring process**.
|
||||||
-- This will check the presence of friendly and/or enemy units within the zone and will transition the state of the zone when the tactical situation changed.
|
-- This will check the presence of friendly and/or enemy units within the zone and will transition the state of the zone when the tactical situation changed.
|
||||||
@@ -363,8 +363,8 @@ do -- ZONE_CAPTURE_COALITION
|
|||||||
|
|
||||||
--- ZONE_CAPTURE_COALITION Constructor.
|
--- ZONE_CAPTURE_COALITION Constructor.
|
||||||
-- @param #ZONE_CAPTURE_COALITION self
|
-- @param #ZONE_CAPTURE_COALITION self
|
||||||
-- @param Core.Zone#ZONE Zone A @{Zone} object with the goal to be achieved.
|
-- @param Core.Zone#ZONE Zone A @{Core.Zone} object with the goal to be achieved. Alternatively, can be handed as the name of late activated group describing a @{Core.Zone#ZONE_POLYGON} with its waypoints.
|
||||||
-- @param DCSCoalition.DCSCoalition#coalition Coalition The initial coalition owning the zone.
|
-- @param #number Coalition The initial coalition owning the zone.
|
||||||
-- @param #table UnitCategories Table of unit categories. See [DCS Class Unit](https://wiki.hoggitworld.com/view/DCS_Class_Unit). Default {Unit.Category.GROUND_UNIT}.
|
-- @param #table UnitCategories Table of unit categories. See [DCS Class Unit](https://wiki.hoggitworld.com/view/DCS_Class_Unit). Default {Unit.Category.GROUND_UNIT}.
|
||||||
-- @param #table ObjectCategories Table of unit categories. See [DCS Class Object](https://wiki.hoggitworld.com/view/DCS_Class_Object). Default {Object.Category.UNIT, Object.Category.STATIC}, i.e. all UNITS and STATICS.
|
-- @param #table ObjectCategories Table of unit categories. See [DCS Class Object](https://wiki.hoggitworld.com/view/DCS_Class_Object). Default {Object.Category.UNIT, Object.Category.STATIC}, i.e. all UNITS and STATICS.
|
||||||
-- @return #ZONE_CAPTURE_COALITION
|
-- @return #ZONE_CAPTURE_COALITION
|
||||||
@@ -715,7 +715,7 @@ do -- ZONE_CAPTURE_COALITION
|
|||||||
|
|
||||||
local UnitHit = EventData.TgtUnit
|
local UnitHit = EventData.TgtUnit
|
||||||
|
|
||||||
if UnitHit.ClassName ~= "SCENERY" then
|
if UnitHit and UnitHit.ClassName ~= "SCENERY" then
|
||||||
-- Check if unit is inside the capture zone and that it is of the defending coalition.
|
-- Check if unit is inside the capture zone and that it is of the defending coalition.
|
||||||
if UnitHit and UnitHit:IsInZone(self) and UnitHit:GetCoalition()==self.Coalition then
|
if UnitHit and UnitHit:IsInZone(self) and UnitHit:GetCoalition()==self.Coalition then
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **Functional (WIP)** -- Base class that models processes to achieve goals involving a Zone.
|
--- **Functional** - Base class that models processes to achieve goals involving a Zone.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
-- ### Contributions: **funkyfranky**
|
-- ### Contributions: **funkyfranky**, **Applevangelist**
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -26,7 +26,6 @@ do -- Zone
|
|||||||
-- @field #boolean SmokeZone If true, smoke zone.
|
-- @field #boolean SmokeZone If true, smoke zone.
|
||||||
-- @extends Core.Zone#ZONE_RADIUS
|
-- @extends Core.Zone#ZONE_RADIUS
|
||||||
|
|
||||||
|
|
||||||
--- Models processes that have a Goal with a defined achievement involving a Zone.
|
--- Models processes that have a Goal with a defined achievement involving a Zone.
|
||||||
-- Derived classes implement the ways how the achievements can be realized.
|
-- Derived classes implement the ways how the achievements can be realized.
|
||||||
--
|
--
|
||||||
@@ -53,21 +52,26 @@ do -- Zone
|
|||||||
SmokeColor = nil,
|
SmokeColor = nil,
|
||||||
SmokeZone = nil,
|
SmokeZone = nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- ZONE_GOAL Constructor.
|
--- ZONE_GOAL Constructor.
|
||||||
-- @param #ZONE_GOAL self
|
-- @param #ZONE_GOAL self
|
||||||
-- @param Core.Zone#ZONE_RADIUS Zone A @{Zone} object with the goal to be achieved.
|
-- @param Core.Zone#ZONE_RADIUS Zone A @{Core.Zone} object with the goal to be achieved. Alternatively, can be handed as the name of late activated group describing a ZONE_POLYGON with its waypoints.
|
||||||
-- @return #ZONE_GOAL
|
-- @return #ZONE_GOAL
|
||||||
function ZONE_GOAL:New( Zone )
|
function ZONE_GOAL:New( Zone )
|
||||||
|
|
||||||
local self = BASE:Inherit( self, ZONE_RADIUS:New( Zone:GetName(), Zone:GetVec2(), Zone:GetRadius() ) ) -- #ZONE_GOAL
|
|
||||||
self:F( { Zone = Zone } )
|
|
||||||
|
|
||||||
|
BASE:I({Zone=Zone})
|
||||||
|
local self = BASE:Inherit( self, BASE:New())
|
||||||
|
if type(Zone) == "string" then
|
||||||
|
self = BASE:Inherit( self, ZONE_POLYGON:NewFromGroupName(Zone) )
|
||||||
|
else
|
||||||
|
self = BASE:Inherit( self, ZONE_RADIUS:New( Zone:GetName(), Zone:GetVec2(), Zone:GetRadius() ) ) -- #ZONE_GOAL
|
||||||
|
self:F( { Zone = Zone } )
|
||||||
|
end
|
||||||
-- Goal object.
|
-- Goal object.
|
||||||
self.Goal = GOAL:New()
|
self.Goal = GOAL:New()
|
||||||
|
|
||||||
self.SmokeTime = nil
|
self.SmokeTime = nil
|
||||||
|
|
||||||
-- Set smoke ON.
|
-- Set smoke ON.
|
||||||
self:SetSmokeZone(true)
|
self:SetSmokeZone(true)
|
||||||
|
|
||||||
@@ -81,7 +85,7 @@ do -- Zone
|
|||||||
-- @function [parent=#ZONE_GOAL] __DestroyedUnit
|
-- @function [parent=#ZONE_GOAL] __DestroyedUnit
|
||||||
-- @param #ZONE_GOAL self
|
-- @param #ZONE_GOAL self
|
||||||
-- @param #number delay Delay in seconds.
|
-- @param #number delay Delay in seconds.
|
||||||
|
|
||||||
--- DestroyedUnit Handler OnAfter for ZONE_GOAL
|
--- DestroyedUnit Handler OnAfter for ZONE_GOAL
|
||||||
-- @function [parent=#ZONE_GOAL] OnAfterDestroyedUnit
|
-- @function [parent=#ZONE_GOAL] OnAfterDestroyedUnit
|
||||||
-- @param #ZONE_GOAL self
|
-- @param #ZONE_GOAL self
|
||||||
@@ -93,15 +97,15 @@ do -- Zone
|
|||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the Zone.
|
--- Get the Zone.
|
||||||
-- @param #ZONE_GOAL self
|
-- @param #ZONE_GOAL self
|
||||||
-- @return #ZONE_GOAL
|
-- @return #ZONE_GOAL
|
||||||
function ZONE_GOAL:GetZone()
|
function ZONE_GOAL:GetZone()
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Get the name of the Zone.
|
--- Get the name of the Zone.
|
||||||
-- @param #ZONE_GOAL self
|
-- @param #ZONE_GOAL self
|
||||||
-- @return #string
|
-- @return #string
|
||||||
@@ -109,7 +113,6 @@ do -- Zone
|
|||||||
return self:GetName()
|
return self:GetName()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Activate smoking of zone with the color or the current owner.
|
--- Activate smoking of zone with the color or the current owner.
|
||||||
-- @param #ZONE_GOAL self
|
-- @param #ZONE_GOAL self
|
||||||
-- @param #boolean switch If *true* or *nil* activate smoke. If *false* or *nil*, no smoke.
|
-- @param #boolean switch If *true* or *nil* activate smoke. If *false* or *nil*, no smoke.
|
||||||
@@ -131,11 +134,10 @@ do -- Zone
|
|||||||
-- @param DCS#SMOKECOLOR.Color SmokeColor
|
-- @param DCS#SMOKECOLOR.Color SmokeColor
|
||||||
function ZONE_GOAL:Smoke( SmokeColor )
|
function ZONE_GOAL:Smoke( SmokeColor )
|
||||||
self:F( { SmokeColor = SmokeColor} )
|
self:F( { SmokeColor = SmokeColor} )
|
||||||
|
|
||||||
self.SmokeColor = SmokeColor
|
self.SmokeColor = SmokeColor
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Flare the zone boundary.
|
--- Flare the zone boundary.
|
||||||
-- @param #ZONE_GOAL self
|
-- @param #ZONE_GOAL self
|
||||||
-- @param DCS#SMOKECOLOR.Color FlareColor
|
-- @param DCS#SMOKECOLOR.Color FlareColor
|
||||||
@@ -143,7 +145,6 @@ do -- Zone
|
|||||||
self:FlareZone( FlareColor, 30)
|
self:FlareZone( FlareColor, 30)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- When started, check the Smoke and the Zone status.
|
--- When started, check the Smoke and the Zone status.
|
||||||
-- @param #ZONE_GOAL self
|
-- @param #ZONE_GOAL self
|
||||||
function ZONE_GOAL:onafterGuard()
|
function ZONE_GOAL:onafterGuard()
|
||||||
@@ -155,17 +156,16 @@ do -- Zone
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Check status Smoke.
|
--- Check status Smoke.
|
||||||
-- @param #ZONE_GOAL self
|
-- @param #ZONE_GOAL self
|
||||||
function ZONE_GOAL:StatusSmoke()
|
function ZONE_GOAL:StatusSmoke()
|
||||||
self:F({self.SmokeTime, self.SmokeColor})
|
self:F({self.SmokeTime, self.SmokeColor})
|
||||||
|
|
||||||
if self.SmokeZone then
|
if self.SmokeZone then
|
||||||
|
|
||||||
-- Current time.
|
-- Current time.
|
||||||
local CurrentTime = timer.getTime()
|
local CurrentTime = timer.getTime()
|
||||||
|
|
||||||
-- Restart smoke every 5 min.
|
-- Restart smoke every 5 min.
|
||||||
if self.SmokeTime == nil or self.SmokeTime + 300 <= CurrentTime then
|
if self.SmokeTime == nil or self.SmokeTime + 300 <= CurrentTime then
|
||||||
if self.SmokeColor then
|
if self.SmokeColor then
|
||||||
@@ -173,11 +173,10 @@ do -- Zone
|
|||||||
self.SmokeTime = CurrentTime
|
self.SmokeTime = CurrentTime
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
--- @param #ZONE_GOAL self
|
--- @param #ZONE_GOAL self
|
||||||
-- @param Core.Event#EVENTDATA EventData Event data table.
|
-- @param Core.Event#EVENTDATA EventData Event data table.
|
||||||
@@ -185,38 +184,37 @@ do -- Zone
|
|||||||
self:F( { "EventDead", EventData } )
|
self:F( { "EventDead", EventData } )
|
||||||
|
|
||||||
self:F( { EventData.IniUnit } )
|
self:F( { EventData.IniUnit } )
|
||||||
|
|
||||||
if EventData.IniDCSUnit then
|
if EventData.IniDCSUnit then
|
||||||
|
|
||||||
local Vec3 = EventData.IniDCSUnit:getPosition().p
|
local Vec3 = EventData.IniDCSUnit:getPosition().p
|
||||||
self:F( { Vec3 = Vec3 } )
|
self:F( { Vec3 = Vec3 } )
|
||||||
|
|
||||||
if Vec3 and self:IsVec3InZone(Vec3) then
|
if Vec3 and self:IsVec3InZone(Vec3) then
|
||||||
|
|
||||||
local PlayerHits = _DATABASE.HITS[EventData.IniUnitName]
|
local PlayerHits = _DATABASE.HITS[EventData.IniUnitName]
|
||||||
|
|
||||||
if PlayerHits then
|
if PlayerHits then
|
||||||
|
|
||||||
for PlayerName, PlayerHit in pairs( PlayerHits.Players or {} ) do
|
for PlayerName, PlayerHit in pairs( PlayerHits.Players or {} ) do
|
||||||
self.Goal:AddPlayerContribution( PlayerName )
|
self.Goal:AddPlayerContribution( PlayerName )
|
||||||
self:DestroyedUnit( EventData.IniUnitName, PlayerName )
|
self:DestroyedUnit( EventData.IniUnitName, PlayerName )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Activate the event UnitDestroyed to be fired when a unit is destroyed in the zone.
|
--- Activate the event UnitDestroyed to be fired when a unit is destroyed in the zone.
|
||||||
-- @param #ZONE_GOAL self
|
-- @param #ZONE_GOAL self
|
||||||
function ZONE_GOAL:MonitorDestroyedUnits()
|
function ZONE_GOAL:MonitorDestroyedUnits()
|
||||||
|
|
||||||
self:HandleEvent( EVENTS.Dead, self.__Destroyed )
|
self:HandleEvent( EVENTS.Dead, self.__Destroyed )
|
||||||
self:HandleEvent( EVENTS.Crash, self.__Destroyed )
|
self:HandleEvent( EVENTS.Crash, self.__Destroyed )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
--- **Functional (WIP)** -- Base class that models processes to achieve goals involving a Zone and Cargo.
|
--- **Functional** - Base class that models processes to achieve goals involving a Zone and Cargo.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ZONE_GOAL_CARGO models processes that have a Goal with a defined achievement involving a Zone and Cargo.
|
-- ZONE_GOAL_CARGO models processes that have a Goal with a defined achievement involving a Zone and Cargo.
|
||||||
-- Derived classes implement the ways how the achievements can be realized.
|
-- Derived classes implement the ways how the achievements can be realized.
|
||||||
|
--
|
||||||
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
@@ -55,8 +60,8 @@ do -- ZoneGoal
|
|||||||
|
|
||||||
--- ZONE_GOAL_CARGO Constructor.
|
--- ZONE_GOAL_CARGO Constructor.
|
||||||
-- @param #ZONE_GOAL_CARGO self
|
-- @param #ZONE_GOAL_CARGO self
|
||||||
-- @param Core.Zone#ZONE Zone A @{Zone} object with the goal to be achieved.
|
-- @param Core.Zone#ZONE Zone A @{Core.Zone} object with the goal to be achieved.
|
||||||
-- @param DCSCoalition.DCSCoalition#coalition Coalition The initial coalition owning the zone.
|
-- @param #number Coalition The initial coalition owning the zone.
|
||||||
-- @return #ZONE_GOAL_CARGO
|
-- @return #ZONE_GOAL_CARGO
|
||||||
function ZONE_GOAL_CARGO:New( Zone, Coalition )
|
function ZONE_GOAL_CARGO:New( Zone, Coalition )
|
||||||
|
|
||||||
@@ -254,7 +259,7 @@ do -- ZoneGoal
|
|||||||
|
|
||||||
--- Set the owning coalition of the zone.
|
--- Set the owning coalition of the zone.
|
||||||
-- @param #ZONE_GOAL_CARGO self
|
-- @param #ZONE_GOAL_CARGO self
|
||||||
-- @param DCSCoalition.DCSCoalition#coalition Coalition
|
-- @param #number Coalition
|
||||||
function ZONE_GOAL_CARGO:SetCoalition( Coalition )
|
function ZONE_GOAL_CARGO:SetCoalition( Coalition )
|
||||||
self.Coalition = Coalition
|
self.Coalition = Coalition
|
||||||
end
|
end
|
||||||
@@ -262,7 +267,7 @@ do -- ZoneGoal
|
|||||||
|
|
||||||
--- Get the owning coalition of the zone.
|
--- Get the owning coalition of the zone.
|
||||||
-- @param #ZONE_GOAL_CARGO self
|
-- @param #ZONE_GOAL_CARGO self
|
||||||
-- @return DCSCoalition.DCSCoalition#coalition Coalition.
|
-- @return #number Coalition.
|
||||||
function ZONE_GOAL_CARGO:GetCoalition()
|
function ZONE_GOAL_CARGO:GetCoalition()
|
||||||
return self.Coalition
|
return self.Coalition
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- **Functional (WIP)** -- Base class that models processes to achieve goals involving a Zone for a Coalition.
|
--- **Functional** - Base class that models processes to achieve goals involving a Zone for a Coalition.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -53,8 +53,8 @@ do -- ZoneGoal
|
|||||||
|
|
||||||
--- ZONE_GOAL_COALITION Constructor.
|
--- ZONE_GOAL_COALITION Constructor.
|
||||||
-- @param #ZONE_GOAL_COALITION self
|
-- @param #ZONE_GOAL_COALITION self
|
||||||
-- @param Core.Zone#ZONE Zone A @{Zone} object with the goal to be achieved.
|
-- @param Core.Zone#ZONE Zone A @{Core.Zone} object with the goal to be achieved.
|
||||||
-- @param DCSCoalition.DCSCoalition#coalition Coalition The initial coalition owning the zone. Default coalition.side.NEUTRAL.
|
-- @param #number Coalition The initial coalition owning the zone. Default coalition.side.NEUTRAL.
|
||||||
-- @param #table UnitCategories Table of unit categories. See [DCS Class Unit](https://wiki.hoggitworld.com/view/DCS_Class_Unit). Default {Unit.Category.GROUND_UNIT}.
|
-- @param #table UnitCategories Table of unit categories. See [DCS Class Unit](https://wiki.hoggitworld.com/view/DCS_Class_Unit). Default {Unit.Category.GROUND_UNIT}.
|
||||||
-- @return #ZONE_GOAL_COALITION
|
-- @return #ZONE_GOAL_COALITION
|
||||||
function ZONE_GOAL_COALITION:New( Zone, Coalition, UnitCategories )
|
function ZONE_GOAL_COALITION:New( Zone, Coalition, UnitCategories )
|
||||||
@@ -80,7 +80,7 @@ do -- ZoneGoal
|
|||||||
|
|
||||||
--- Set the owning coalition of the zone.
|
--- Set the owning coalition of the zone.
|
||||||
-- @param #ZONE_GOAL_COALITION self
|
-- @param #ZONE_GOAL_COALITION self
|
||||||
-- @param DCSCoalition.DCSCoalition#coalition Coalition The coalition ID, e.g. *coalition.side.RED*.
|
-- @param #number Coalition The coalition ID, e.g. *coalition.side.RED*.
|
||||||
-- @return #ZONE_GOAL_COALITION
|
-- @return #ZONE_GOAL_COALITION
|
||||||
function ZONE_GOAL_COALITION:SetCoalition( Coalition )
|
function ZONE_GOAL_COALITION:SetCoalition( Coalition )
|
||||||
self.PreviousCoalition = self.Coalition or Coalition
|
self.PreviousCoalition = self.Coalition or Coalition
|
||||||
@@ -120,14 +120,14 @@ do -- ZoneGoal
|
|||||||
|
|
||||||
--- Get the owning coalition of the zone.
|
--- Get the owning coalition of the zone.
|
||||||
-- @param #ZONE_GOAL_COALITION self
|
-- @param #ZONE_GOAL_COALITION self
|
||||||
-- @return DCSCoalition.DCSCoalition#coalition Coalition.
|
-- @return #number Coalition.
|
||||||
function ZONE_GOAL_COALITION:GetCoalition()
|
function ZONE_GOAL_COALITION:GetCoalition()
|
||||||
return self.Coalition
|
return self.Coalition
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the previous coalition, i.e. the one owning the zone before the current one.
|
--- Get the previous coalition, i.e. the one owning the zone before the current one.
|
||||||
-- @param #ZONE_GOAL_COALITION self
|
-- @param #ZONE_GOAL_COALITION self
|
||||||
-- @return DCSCoalition.DCSCoalition#coalition Coalition.
|
-- @return #number Coalition.
|
||||||
function ZONE_GOAL_COALITION:GetPreviousCoalition()
|
function ZONE_GOAL_COALITION:GetPreviousCoalition()
|
||||||
return self.PreviousCoalition
|
return self.PreviousCoalition
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -22,25 +22,37 @@ _DATABASE:_RegisterAirbases()
|
|||||||
|
|
||||||
--- Check if os etc is available.
|
--- Check if os etc is available.
|
||||||
BASE:I("Checking de-sanitization of os, io and lfs:")
|
BASE:I("Checking de-sanitization of os, io and lfs:")
|
||||||
local __na=false
|
local __na = false
|
||||||
if os then
|
if os then
|
||||||
BASE:I("- os available")
|
BASE:I("- os available")
|
||||||
else
|
else
|
||||||
BASE:I("- os NOT available! Some functions may not work.")
|
BASE:I("- os NOT available! Some functions may not work.")
|
||||||
__na=true
|
__na = true
|
||||||
end
|
end
|
||||||
if io then
|
if io then
|
||||||
BASE:I("- io available")
|
BASE:I("- io available")
|
||||||
else
|
else
|
||||||
BASE:I("- io NOT available! Some functions may not work.")
|
BASE:I("- io NOT available! Some functions may not work.")
|
||||||
__na=true
|
__na = true
|
||||||
end
|
end
|
||||||
if lfs then
|
if lfs then
|
||||||
BASE:I("- lfs available")
|
BASE:I("- lfs available")
|
||||||
else
|
else
|
||||||
BASE:I("- lfs NOT available! Some functions may not work.")
|
BASE:I("- lfs NOT available! Some functions may not work.")
|
||||||
__na=true
|
__na = true
|
||||||
end
|
end
|
||||||
if __na then
|
if __na then
|
||||||
BASE:I("Check <DCS install folder>/Scripts/MissionScripting.lua and comment out the lines with sanitizeModule(''). Use at your own risk!)")
|
BASE:I("Check <DCS install folder>/Scripts/MissionScripting.lua and comment out the lines with sanitizeModule(''). Use at your own risk!)")
|
||||||
end
|
end
|
||||||
|
BASE.ServerName = "Unknown"
|
||||||
|
if lfs and loadfile then
|
||||||
|
local serverfile = lfs.writedir() .. 'Config/serverSettings.lua'
|
||||||
|
if UTILS.FileExists(serverfile) then
|
||||||
|
loadfile(serverfile)()
|
||||||
|
if cfg and cfg.name then
|
||||||
|
BASE.ServerName = cfg.name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
BASE.ServerName = BASE.ServerName or "Unknown"
|
||||||
|
BASE:I("Server Name: " .. tostring(BASE.ServerName))
|
||||||
|
end
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user