mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Compare commits
2519 Commits
kk/usergui
...
2.9.6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
84857d2a32 | ||
|
|
cc17027a7a | ||
|
|
02db5ba532 | ||
|
|
fc52e06318 | ||
|
|
0f5f2658a6 | ||
|
|
27d36f3e0d | ||
|
|
9ce1b90eb1 | ||
|
|
38c19b1442 | ||
|
|
d3419d218a | ||
|
|
2f34526c55 | ||
|
|
f9dcc9d95c | ||
|
|
ebc355ee6a | ||
|
|
a0b49fbd67 | ||
|
|
ae213c4cf1 | ||
|
|
8dea86b921 | ||
|
|
44003a8fda | ||
|
|
b883bb1e62 | ||
|
|
db35a67bd7 | ||
|
|
1bfc98fa99 | ||
|
|
efb687cbb5 | ||
|
|
668f12391e | ||
|
|
dfaccd6aa5 | ||
|
|
2220f1829f | ||
|
|
76fde11f47 | ||
|
|
bc5946c76e | ||
|
|
1f041a8acf | ||
|
|
892cb90d62 | ||
|
|
3d7172fdf7 | ||
|
|
3fa3644e1e | ||
|
|
28411d2093 | ||
|
|
26deaca166 | ||
|
|
1346317ad9 | ||
|
|
e11bb71c2d | ||
|
|
95baed1aac | ||
|
|
3b364c7650 | ||
|
|
2a4e242eb2 | ||
|
|
39471212d3 | ||
|
|
8b2237d183 | ||
|
|
6c1a4f1e0d | ||
|
|
abc26b1e5c | ||
|
|
b338f486e5 | ||
|
|
b761078c18 | ||
|
|
202d649085 | ||
|
|
616690391c | ||
|
|
e1e0095d9b | ||
|
|
465c395294 | ||
|
|
a8cbf81851 | ||
|
|
0e78e9c92b | ||
|
|
7c4d640690 | ||
|
|
73bddddba4 | ||
|
|
833206a3b5 | ||
|
|
743baac945 | ||
|
|
0764d076db | ||
|
|
504aa19c03 | ||
|
|
9a3effd063 | ||
|
|
d4a49ae68b | ||
|
|
ca1018f80b | ||
|
|
b9bd8d88a9 | ||
|
|
21412e0061 | ||
|
|
5761e11157 | ||
|
|
7d3f1235e7 | ||
|
|
473001c95b | ||
|
|
532cc0b4df | ||
|
|
08fb4e3736 | ||
|
|
6b7e66efa5 | ||
|
|
18fd587ab0 | ||
|
|
5fd8139f00 | ||
|
|
ac68744deb | ||
|
|
cec02bc44f | ||
|
|
a924a0b641 | ||
|
|
ee15b04142 | ||
|
|
2c67a66d88 | ||
|
|
1fdb3b7daa | ||
|
|
181ed6046e | ||
|
|
ba14330281 | ||
|
|
4c890d18d1 | ||
|
|
2eb4118d56 | ||
|
|
67d53034df | ||
|
|
b4d1118c88 | ||
|
|
dcc15afb89 | ||
|
|
a5632ec3a4 | ||
|
|
0804a3567a | ||
|
|
ef8c71d27c | ||
|
|
879ea847e9 | ||
|
|
be3c418919 | ||
|
|
be3db86470 | ||
|
|
67b43e2c68 | ||
|
|
577fefab3a | ||
|
|
2ad111dd50 | ||
|
|
2c749bf5c9 | ||
|
|
24eaa7441c | ||
|
|
523375c765 | ||
|
|
ac42b56b8e | ||
|
|
82f4c9d526 | ||
|
|
5b8416d5fd | ||
|
|
874fa7ad69 | ||
|
|
2205100942 | ||
|
|
801475e146 | ||
|
|
d7ee243a00 | ||
|
|
a105ddba3d | ||
|
|
70c29de695 | ||
|
|
d5ceabadb0 | ||
|
|
8bd39b41f4 | ||
|
|
b263cddc07 | ||
|
|
a712d74e2e | ||
|
|
613d33d731 | ||
|
|
c7e694dfb8 | ||
|
|
d6c9195555 | ||
|
|
50298e4109 | ||
|
|
1253e241ff | ||
|
|
3389d3284a | ||
|
|
b10819220c | ||
|
|
244abe2bbb | ||
|
|
4b1a1cbcff | ||
|
|
378e76e45b | ||
|
|
f7f28877da | ||
|
|
e3d2dec91f | ||
|
|
470c4ef13c | ||
|
|
241b31fcec | ||
|
|
3dd069d7d6 | ||
|
|
77c4fd7696 | ||
|
|
aca4e4d7ca | ||
|
|
dcd278e2a1 | ||
|
|
2f81fcb0c0 | ||
|
|
8cf11de774 | ||
|
|
b62f2afd8d | ||
|
|
176bd0eb8b | ||
|
|
70ee6a1121 | ||
|
|
10edd2f9d0 | ||
|
|
408321decf | ||
|
|
11acb578f6 | ||
|
|
383eff4cd6 | ||
|
|
6cda61c9dd | ||
|
|
4d8abe7f57 | ||
|
|
c6bb7c8bbd | ||
|
|
bd3042410b | ||
|
|
7c9cf96d2e | ||
|
|
ef30bd36a5 | ||
|
|
5286926609 | ||
|
|
ab14fbd11c | ||
|
|
5bde0c7605 | ||
|
|
4f2d8144e9 | ||
|
|
cb61177252 | ||
|
|
736204d163 | ||
|
|
1e15509001 | ||
|
|
cca6b0cf55 | ||
|
|
bfa8719ec3 | ||
|
|
fd0e6053ee | ||
|
|
f99eac0de4 | ||
|
|
89b06fb7a6 | ||
|
|
3652376d42 | ||
|
|
3d1207a079 | ||
|
|
3953f0e7fc | ||
|
|
3e727f7777 | ||
|
|
5621579b5e | ||
|
|
091083b5aa | ||
|
|
b0d0fb9ae1 | ||
|
|
57ce6bcec2 | ||
|
|
7a1cfa9fe3 | ||
|
|
71b5492903 | ||
|
|
5ff4d84a9a | ||
|
|
c71d0ed7cf | ||
|
|
d64dadd9a9 | ||
|
|
370bfc893d | ||
|
|
0f30f3b1a0 | ||
|
|
50e55e1df2 | ||
|
|
51911d3292 | ||
|
|
bff60bdb69 | ||
|
|
219353faad | ||
|
|
4c4ecccb01 | ||
|
|
0e1cbe45b9 | ||
|
|
aac3f64638 | ||
|
|
34937c2cf6 | ||
|
|
74c19f1058 | ||
|
|
42ca05af57 | ||
|
|
1cbdafda65 | ||
|
|
960746245f | ||
|
|
595b9132e8 | ||
|
|
4b50d8f16f | ||
|
|
c320f1a0a7 | ||
|
|
82b5269040 | ||
|
|
45aebff48e | ||
|
|
80bf992806 | ||
|
|
f2e22579ed | ||
|
|
2dc908d926 | ||
|
|
1f9725530f | ||
|
|
d3e6b0366b | ||
|
|
1545add510 | ||
|
|
c85f575888 | ||
|
|
9f8428c7ba | ||
|
|
5eef138507 | ||
|
|
8c6c1e481b | ||
|
|
14d6085b69 | ||
|
|
d13173e336 | ||
|
|
ced01a993d | ||
|
|
fa80f0a162 | ||
|
|
02e59b23c5 | ||
|
|
80b2b26018 | ||
|
|
e3f523d648 | ||
|
|
5b86bf9605 | ||
|
|
c5ece16753 | ||
|
|
4c2a89ee29 | ||
|
|
4505b60859 | ||
|
|
e8c75b8795 | ||
|
|
7e21a1070a | ||
|
|
2ce9f26e26 | ||
|
|
bfaca9dd5f | ||
|
|
30819dad72 | ||
|
|
e946916fc0 | ||
|
|
2eeca4451c | ||
|
|
ee17d3e995 | ||
|
|
a48e09b434 | ||
|
|
27ea85ea57 | ||
|
|
3baf52d307 | ||
|
|
0faa0036ee | ||
|
|
79189d4d93 | ||
|
|
f859522052 | ||
|
|
8d886a75d6 | ||
|
|
5a772ad05e | ||
|
|
a16e22818d | ||
|
|
0cc959bf34 | ||
|
|
2fcb31f3ac | ||
|
|
aa948b57d8 | ||
|
|
6ca459b38c | ||
|
|
79da4cbf27 | ||
|
|
e5a60a2ef1 | ||
|
|
7e2ae60e43 | ||
|
|
51f134538d | ||
|
|
0ee7a38c61 | ||
|
|
15dd2cf735 | ||
|
|
e895642157 | ||
|
|
154026fbf8 | ||
|
|
d7969e9455 | ||
|
|
7dcff7ec9c | ||
|
|
0e6bf1f46b | ||
|
|
67e52120d4 | ||
|
|
4b84d227f0 | ||
|
|
2fce93d925 | ||
|
|
df0dbc9108 | ||
|
|
db6354b60d | ||
|
|
4307ddcad3 | ||
|
|
daa734009e | ||
|
|
86e13df303 | ||
|
|
65cf53ce28 | ||
|
|
2e167358bb | ||
|
|
78d1a215e4 | ||
|
|
14daca9a72 | ||
|
|
48dba742ad | ||
|
|
2ca847e845 | ||
|
|
11c74ddc17 | ||
|
|
c38917fa2f | ||
|
|
1847a2372c | ||
|
|
fd155f8277 | ||
|
|
531132e8a7 | ||
|
|
7464406a17 | ||
|
|
bd5c1af335 | ||
|
|
53f556a4e6 | ||
|
|
0ddf8762c2 | ||
|
|
2893bfb290 | ||
|
|
d984a1b142 | ||
|
|
f10d676921 | ||
|
|
f02b774242 | ||
|
|
5ede860361 | ||
|
|
d0d52246f4 | ||
|
|
748aa131e4 | ||
|
|
1b4e170271 | ||
|
|
a3d56b6d1b | ||
|
|
33bd928076 | ||
|
|
23df6bbc2a | ||
|
|
f2fc321ded | ||
|
|
0b3fc515e0 | ||
|
|
e50d54f6bc | ||
|
|
6e60a66d0c | ||
|
|
11f0b2899d | ||
|
|
581138b5bc | ||
|
|
0ce3a189c3 | ||
|
|
9208d7a70d | ||
|
|
4076ff5bb5 | ||
|
|
056b761ebc | ||
|
|
0532c54cd5 | ||
|
|
298c569f93 | ||
|
|
32dbb520d6 | ||
|
|
6af66db4c3 | ||
|
|
ff84d682bd | ||
|
|
d2b7d46227 | ||
|
|
58f4eead1c | ||
|
|
f3bafd5803 | ||
|
|
2946c2e225 | ||
|
|
2e386be2f6 | ||
|
|
9c0c93507a | ||
|
|
baf7123364 | ||
|
|
f6b6a6a577 | ||
|
|
4d7d34b71f | ||
|
|
82bea9d5ff | ||
|
|
35d91c9c94 | ||
|
|
a44ad5c755 | ||
|
|
b7236eeb58 | ||
|
|
09933b307b | ||
|
|
21babb548c | ||
|
|
11967bd608 | ||
|
|
ea6e63dc9b | ||
|
|
547579ffb0 | ||
|
|
697042eac6 | ||
|
|
30d6936f1d | ||
|
|
b315375ade | ||
|
|
becaf47a66 | ||
|
|
e26647c2ca | ||
|
|
4ddd278471 | ||
|
|
72e31b90a9 | ||
|
|
677d888d96 | ||
|
|
06c3ca0079 | ||
|
|
406dbb707a | ||
|
|
4758af61c2 | ||
|
|
729c1f5e33 | ||
|
|
8386fe5f67 | ||
|
|
2c695e187f | ||
|
|
048ab6acfe | ||
|
|
f2783c46c2 | ||
|
|
df1bc5c55d | ||
|
|
e53a80783e | ||
|
|
a1fb09285b | ||
|
|
e2bf1f727d | ||
|
|
65315251b5 | ||
|
|
2a9e98c21e | ||
|
|
b40c1e4575 | ||
|
|
9ea8443286 | ||
|
|
a9befc4d96 | ||
|
|
65fb22b6cc | ||
|
|
d0346c4aa3 | ||
|
|
96da09b9e0 | ||
|
|
c1d468b35f | ||
|
|
109270d717 | ||
|
|
f80e7a2166 | ||
|
|
de6c7d636b | ||
|
|
f57beab6d2 | ||
|
|
29414bfd21 | ||
|
|
60b8a5f5af | ||
|
|
aaf3553597 | ||
|
|
4e50bd213c | ||
|
|
c813e2dbc4 | ||
|
|
761d83a68f | ||
|
|
3d93c268b3 | ||
|
|
d6a0fff993 | ||
|
|
8d45ea00e8 | ||
|
|
2d17c4d21a | ||
|
|
f76fa58a5f | ||
|
|
d8b046491b | ||
|
|
b20eb84d19 | ||
|
|
c8b36b8c99 | ||
|
|
c2be4fbcf1 | ||
|
|
58d9637c5d | ||
|
|
e0a108e00d | ||
|
|
acf37f6133 | ||
|
|
dd771a089c | ||
|
|
3f927b16e5 | ||
|
|
833a0561c3 | ||
|
|
cf48b21073 | ||
|
|
a70ad71689 | ||
|
|
7557e79c0c | ||
|
|
1b7eef5419 | ||
|
|
029bdc3bd1 | ||
|
|
93acd870ea | ||
|
|
93cdb92e76 | ||
|
|
39b89d937e | ||
|
|
b488d43d78 | ||
|
|
33259be4d9 | ||
|
|
e4cea7b3c4 | ||
|
|
6f5f89a0ee | ||
|
|
e2e9bd7de0 | ||
|
|
1b01b89343 | ||
|
|
4e36ed170b | ||
|
|
bf0ad93bf7 | ||
|
|
a51afeda14 | ||
|
|
e46b148721 | ||
|
|
8765ebe2c6 | ||
|
|
b55b11be09 | ||
|
|
2a7dbad02a | ||
|
|
44b3f41ae4 | ||
|
|
c5dec374c8 | ||
|
|
3f384d72ab | ||
|
|
1d5952b4a5 | ||
|
|
8eec7fcc9e | ||
|
|
db7e94d879 | ||
|
|
f482dac491 | ||
|
|
73fa021476 | ||
|
|
cd8abd97c5 | ||
|
|
e25eeee0cc | ||
|
|
0261020796 | ||
|
|
257530d421 | ||
|
|
a14435ce54 | ||
|
|
e82e4f7dd7 | ||
|
|
c7ef270d4d | ||
|
|
a9a56b3738 | ||
|
|
0d1fc2fbf2 | ||
|
|
63a0224ea4 | ||
|
|
69fa6f4ee6 | ||
|
|
1c4e3cb801 | ||
|
|
ab516e0cd8 | ||
|
|
f2ba2022c2 | ||
|
|
5b37e7b249 | ||
|
|
5b7e0ce375 | ||
|
|
c250712e53 | ||
|
|
566ebb67e3 | ||
|
|
6c21dfa48c | ||
|
|
b31fc3ed44 | ||
|
|
42fd2322d2 | ||
|
|
585901dc7d | ||
|
|
2a7213c1b7 | ||
|
|
cd4fb0c6c5 | ||
|
|
b8d44643c1 | ||
|
|
47d01f18c1 | ||
|
|
8a1c9c0e54 | ||
|
|
a4fd55e87d | ||
|
|
5243a408cc | ||
|
|
b224739df3 | ||
|
|
ff26e4d1dc | ||
|
|
1f17fd89a4 | ||
|
|
a8e35a552d | ||
|
|
6ee1afc670 | ||
|
|
3b8bbdd4c1 | ||
|
|
7e5a97e7c7 | ||
|
|
f342ba758e | ||
|
|
018d8eecf6 | ||
|
|
fe9d841af5 | ||
|
|
d0491b3b5a | ||
|
|
f789fbac70 | ||
|
|
bc3a5271dc | ||
|
|
4d4b8862c2 | ||
|
|
31b75b7d17 | ||
|
|
cfca4fdc46 | ||
|
|
cca5a5d55d | ||
|
|
3243c92331 | ||
|
|
eab37d5e48 | ||
|
|
e838431b28 | ||
|
|
1c10bfea92 | ||
|
|
2dc9f19d78 | ||
|
|
fd191be274 | ||
|
|
31bdde130a | ||
|
|
494550fe91 | ||
|
|
29c0d81c27 | ||
|
|
e79c2481da | ||
|
|
460ad9db39 | ||
|
|
099f059eec | ||
|
|
c3bba7d1fc | ||
|
|
db71610d72 | ||
|
|
1dc31cc852 | ||
|
|
68b97773fe | ||
|
|
3c0e977584 | ||
|
|
f03a48b118 | ||
|
|
a4704d0e2f | ||
|
|
4747dae51a | ||
|
|
b1e8ba74a8 | ||
|
|
7538f63c00 | ||
|
|
52ed645f6c | ||
|
|
9f41cc51be | ||
|
|
6390b223b0 | ||
|
|
62e8302753 | ||
|
|
bfaf88f017 | ||
|
|
cc79dc74d4 | ||
|
|
4f4e8b17c1 | ||
|
|
0850796368 | ||
|
|
ff58649954 | ||
|
|
bbf793febe | ||
|
|
f071c674d0 | ||
|
|
3c53f627c2 | ||
|
|
2dfde7d1fd | ||
|
|
c011d38313 | ||
|
|
68350d6824 | ||
|
|
2e6cac7bee | ||
|
|
b5965bbf81 | ||
|
|
a0429458d0 | ||
|
|
847dc1839f | ||
|
|
0dd4da1db4 | ||
|
|
4d4f8e9d61 | ||
|
|
6fe883a17a | ||
|
|
fbbdac9b7e | ||
|
|
de380614fb | ||
|
|
bcbda4eb64 | ||
|
|
f6fdff927b | ||
|
|
58ce4b001e | ||
|
|
9a360a3bd5 | ||
|
|
217b8fe71e | ||
|
|
32ae4986ca | ||
|
|
2a0086d3fe | ||
|
|
75a6a798ac | ||
|
|
067285f870 | ||
|
|
8075be92a7 | ||
|
|
f453619c78 | ||
|
|
ca20e059a6 | ||
|
|
2044068393 | ||
|
|
2c3e9e992d | ||
|
|
ef27daa282 | ||
|
|
e36ade55d2 | ||
|
|
2d631cba3f | ||
|
|
9ccfcb8fb1 | ||
|
|
a8e58b8121 | ||
|
|
dcc968c290 | ||
|
|
36aa697936 | ||
|
|
8bace684c2 | ||
|
|
aa5163fe3a | ||
|
|
097e0a3214 | ||
|
|
b5c9598cb0 | ||
|
|
bc454fdec2 | ||
|
|
166a7ab7db | ||
|
|
f459372720 | ||
|
|
f5d2439d69 | ||
|
|
04c092b9ef | ||
|
|
7af920891d | ||
|
|
d9d333a7af | ||
|
|
8f73a4c27c | ||
|
|
f4b83a97a9 | ||
|
|
3360f511ee | ||
|
|
f64ec74d1c | ||
|
|
b885ef7767 | ||
|
|
22f5104805 | ||
|
|
266e34a92d | ||
|
|
500a7f938f | ||
|
|
f408c11506 | ||
|
|
b4058ecab2 | ||
|
|
7306cc1102 | ||
|
|
21aadc14b1 | ||
|
|
eed6119193 | ||
|
|
6db2e333ad | ||
|
|
0eb9dfc7de | ||
|
|
4eb0f8e9ca | ||
|
|
5a583671a7 | ||
|
|
6406ce696b | ||
|
|
e560c3ffdd | ||
|
|
74bd41743b | ||
|
|
56d4143a05 | ||
|
|
1093e55ea8 | ||
|
|
cc95c45fb0 | ||
|
|
6c36910ac7 | ||
|
|
d60f20a162 | ||
|
|
dc26134845 | ||
|
|
0d9d0be0c3 | ||
|
|
adad7ef901 | ||
|
|
bb6bb20179 | ||
|
|
07cac604cf | ||
|
|
28cb44874f | ||
|
|
616f204f5b | ||
|
|
211e1b41b0 | ||
|
|
cd316e6719 | ||
|
|
0fb8fd8886 | ||
|
|
059d8ccfc0 | ||
|
|
bd9022c010 | ||
|
|
261a389ca5 | ||
|
|
708838c404 | ||
|
|
974a56b135 | ||
|
|
85c551cc59 | ||
|
|
f33ccee7b1 | ||
|
|
7277221905 | ||
|
|
497ac367ba | ||
|
|
92e2414612 | ||
|
|
3ca4898860 | ||
|
|
e4d6e6d80e | ||
|
|
99ebebe13c | ||
|
|
bf604da2ae | ||
|
|
bca3abe2c2 | ||
|
|
3a06f6314e | ||
|
|
e7f7199a39 | ||
|
|
6e1dabfe9b | ||
|
|
e48a823560 | ||
|
|
8f1e2a1d54 | ||
|
|
74d54637d5 | ||
|
|
1126b7753a | ||
|
|
e24acb28f7 | ||
|
|
f28f807ee7 | ||
|
|
375a564446 | ||
|
|
c00da0f925 | ||
|
|
6161da3a22 | ||
|
|
54e44299d8 | ||
|
|
f71d6f3f30 | ||
|
|
daae77def5 | ||
|
|
b808f2f568 | ||
|
|
91aa2eb9f2 | ||
|
|
3d697211bd | ||
|
|
4fced3416a | ||
|
|
1b5067088f | ||
|
|
2986a33a56 | ||
|
|
ce6624fe0b | ||
|
|
3ba868b3b9 | ||
|
|
85b10fb1c9 | ||
|
|
e578a673d9 | ||
|
|
3f04249d07 | ||
|
|
b8a2b28462 | ||
|
|
9ccde838e7 | ||
|
|
6ba62e3e04 | ||
|
|
fb1b5b209e | ||
|
|
9493570e6b | ||
|
|
439c11c376 | ||
|
|
a6c244f670 | ||
|
|
8c44cf8fca | ||
|
|
ffea9708d1 | ||
|
|
b108bd9ac6 | ||
|
|
a54b785ca3 | ||
|
|
6c3f3cf0d2 | ||
|
|
bd79750efa | ||
|
|
39fc112e53 | ||
|
|
5dc5736976 | ||
|
|
1f23525799 | ||
|
|
f390616e41 | ||
|
|
dfc7f17308 | ||
|
|
c4e8ad50c8 | ||
|
|
652df5570a | ||
|
|
bb8e6eb7a1 | ||
|
|
b7b369e78f | ||
|
|
b1436b66d4 | ||
|
|
d2107466cc | ||
|
|
3975e1961e | ||
|
|
78ffaf6e0a | ||
|
|
7c3c39c1ba | ||
|
|
147f39981b | ||
|
|
80fdbc4960 | ||
|
|
fc9ddae9b2 | ||
|
|
d0330cc696 | ||
|
|
dca70eaa05 | ||
|
|
5048201771 | ||
|
|
5e36425058 | ||
|
|
3f1ad24f6a | ||
|
|
674fef554d | ||
|
|
3e2d312202 | ||
|
|
6ccfd499c8 | ||
|
|
468a8fed8b | ||
|
|
ef3127fdab | ||
|
|
ab1e3e6c60 | ||
|
|
515764bb88 | ||
|
|
917f06fe04 | ||
|
|
e5e81dbc35 | ||
|
|
c5f3bfe4a9 | ||
|
|
5329745325 | ||
|
|
792222f567 | ||
|
|
a8f14fca70 | ||
|
|
02105b1efc | ||
|
|
93fd9e5d42 | ||
|
|
65c384622c | ||
|
|
d7b87b63d8 | ||
|
|
b5b079d75f | ||
|
|
d0421f5226 | ||
|
|
79ddc01bf7 | ||
|
|
c4b874e3f9 | ||
|
|
8b04d32839 | ||
|
|
382605d4cf | ||
|
|
1337815f05 | ||
|
|
1cd3b6a26b | ||
|
|
f34dcdb3db | ||
|
|
e3b7a85956 | ||
|
|
655282a034 | ||
|
|
94dde73561 | ||
|
|
45008c9d57 | ||
|
|
92b0ab3c8d | ||
|
|
7074b70e86 | ||
|
|
e15d335f3f | ||
|
|
840b14f4ce | ||
|
|
887f7aa3e9 | ||
|
|
a8daf70dad | ||
|
|
3e36e5f2b2 | ||
|
|
c3f5405288 | ||
|
|
084b47edb7 | ||
|
|
f84e2ede66 | ||
|
|
0a8782c890 | ||
|
|
5dd32d92c0 | ||
|
|
d96cc26cd8 | ||
|
|
be5c1bed3b | ||
|
|
2eafadcedf | ||
|
|
6b4c08d53f | ||
|
|
83bae9c2f7 | ||
|
|
944ef6332b | ||
|
|
1329cd23fd | ||
|
|
dbd78f35a4 | ||
|
|
a2772c97d5 | ||
|
|
4f8e65b515 | ||
|
|
1d6437f9e2 | ||
|
|
a733b17840 | ||
|
|
3adf6d635a | ||
|
|
2e9320df03 | ||
|
|
d08219f9d9 | ||
|
|
f929951dbe | ||
|
|
76a36cb9f9 | ||
|
|
56aebfbee8 | ||
|
|
ffdcfa0129 | ||
|
|
268b7ef80c | ||
|
|
172004b822 | ||
|
|
6aa4683080 | ||
|
|
677a64c3dc | ||
|
|
56fcd8f37f | ||
|
|
09d4e155de | ||
|
|
65703d1092 | ||
|
|
2afd09b878 | ||
|
|
4ed2b0610d | ||
|
|
cbd371b40f | ||
|
|
80e9cb692c | ||
|
|
3c74aef378 | ||
|
|
7e2233d8c7 | ||
|
|
065717b2f5 | ||
|
|
63a524f25c | ||
|
|
838e11de05 | ||
|
|
2a56da4bb3 | ||
|
|
f84d02d8a1 | ||
|
|
7d3a08cde2 | ||
|
|
a7857670d3 | ||
|
|
c41b256775 | ||
|
|
e2929a78c4 | ||
|
|
15bf379cdc | ||
|
|
8a8e40e810 | ||
|
|
2c8adf58cb | ||
|
|
bb579fff5b | ||
|
|
1ad538ea9f | ||
|
|
191f7a7377 | ||
|
|
77d2804fce | ||
|
|
63ba50a83a | ||
|
|
fb8f804af2 | ||
|
|
ffbab7453c | ||
|
|
10872918bb | ||
|
|
8979097fd7 | ||
|
|
71b2cc1ee5 | ||
|
|
389d5c7e5b | ||
|
|
178005346d | ||
|
|
041c21a883 | ||
|
|
fd946e971a | ||
|
|
0dab316514 | ||
|
|
248228720e | ||
|
|
e9c1b6d268 | ||
|
|
08be2d6e93 | ||
|
|
ac386d5ebe | ||
|
|
74c1e9d991 | ||
|
|
0e72717cdb | ||
|
|
1df525b9c5 | ||
|
|
cdbbad809a | ||
|
|
970275e96e | ||
|
|
5456cd04c3 | ||
|
|
1cdbe55cdd | ||
|
|
0577e5171b | ||
|
|
97376320f4 | ||
|
|
9c1acc731a | ||
|
|
92f81614ba | ||
|
|
2a11c4c98a | ||
|
|
e284773492 | ||
|
|
b3d46618c2 | ||
|
|
4e36e2011f | ||
|
|
a3876c296e | ||
|
|
c80213b4cf | ||
|
|
bfe7bf1af5 | ||
|
|
f28d92e865 | ||
|
|
bffb3e7778 | ||
|
|
d4c2de9dd1 | ||
|
|
ab5425bd83 | ||
|
|
aec3eee3a5 | ||
|
|
eec7e5f8d9 | ||
|
|
a9b51cca93 | ||
|
|
14ddba69b0 | ||
|
|
a7806deb76 | ||
|
|
0cf35b664f | ||
|
|
c3ffffbb52 | ||
|
|
d96a55d83c | ||
|
|
83353d710d | ||
|
|
9a4c09d249 | ||
|
|
c825191556 | ||
|
|
27e85e921f | ||
|
|
c120a48879 | ||
|
|
4a03074571 | ||
|
|
8855b117a8 | ||
|
|
2cedb5e996 | ||
|
|
0af68cd780 | ||
|
|
6a58748cd1 | ||
|
|
d31db1351a | ||
|
|
0f33603ecc | ||
|
|
3bbd55cfc2 | ||
|
|
163273096c | ||
|
|
6d1030925c | ||
|
|
dabe8a58d1 | ||
|
|
16cf6693ab | ||
|
|
fd51ec6932 | ||
|
|
7a16a5dda8 | ||
|
|
1b6648996c | ||
|
|
f45a22fe78 | ||
|
|
4314959cbb | ||
|
|
fad85ef7ed | ||
|
|
569b3df6af | ||
|
|
910da86caf | ||
|
|
73ff2c576d | ||
|
|
d5ffb48548 | ||
|
|
8ce371f898 | ||
|
|
6f02f23240 | ||
|
|
0a1d469c68 | ||
|
|
823f8fb4fb | ||
|
|
f7e64bc9b5 | ||
|
|
261f79851c | ||
|
|
6773ac7841 | ||
|
|
39f29b066b | ||
|
|
246879c003 | ||
|
|
709621967d | ||
|
|
0c376aec63 | ||
|
|
725efc3e70 | ||
|
|
81abe422de | ||
|
|
fb202012da | ||
|
|
89223ae142 | ||
|
|
2967de8f6e | ||
|
|
9c5260f801 | ||
|
|
4d9ce80c98 | ||
|
|
ee055531b6 | ||
|
|
c9b90e884d | ||
|
|
21db80afad | ||
|
|
d9d5458450 | ||
|
|
0575b366dd | ||
|
|
034b2444ff | ||
|
|
7901d53d54 | ||
|
|
88f34e5bb0 | ||
|
|
49f3e3fc2f | ||
|
|
cae084a352 | ||
|
|
6d07f7c48c | ||
|
|
014fea5f10 | ||
|
|
d07709a167 | ||
|
|
ac4db4a392 | ||
|
|
b30cdd073b | ||
|
|
a12e93c7cb | ||
|
|
bd01946f88 | ||
|
|
8d25bdec7c | ||
|
|
8da228c9a2 | ||
|
|
74abcce956 | ||
|
|
2032c2cfbf | ||
|
|
fb070a0c86 | ||
|
|
817c69bb11 | ||
|
|
6cd56e4de4 | ||
|
|
19a4ec48bb | ||
|
|
c7d990850a | ||
|
|
885d3b5228 | ||
|
|
7379b8135a | ||
|
|
549c9b9ce5 | ||
|
|
f4080d93e8 | ||
|
|
94b74b7056 | ||
|
|
6886107934 | ||
|
|
f65783ed6c | ||
|
|
d8e765a9b1 | ||
|
|
526f241dc3 | ||
|
|
dffb1c0768 | ||
|
|
f30f32732c | ||
|
|
9cd3027ea6 | ||
|
|
b4c7b63381 | ||
|
|
0782532763 | ||
|
|
6fa9e5894e | ||
|
|
c0bc9b393c | ||
|
|
a97e844aca | ||
|
|
d2e91ffcd2 | ||
|
|
d9eee7ea46 | ||
|
|
b1e233421e | ||
|
|
7157836eb1 | ||
|
|
53fa850d66 | ||
|
|
033c52ae54 | ||
|
|
e08b44187e | ||
|
|
0d29c39724 | ||
|
|
6946d8d185 | ||
|
|
6ac1d66aae | ||
|
|
a67bae4f0d | ||
|
|
4e7c689f7a | ||
|
|
f73ff10edb | ||
|
|
949e2f9ff3 | ||
|
|
cb9ab26522 | ||
|
|
7aa4aaf371 | ||
|
|
901480d99c | ||
|
|
84dbda6f2b | ||
|
|
9d00ec0c25 | ||
|
|
0d08d732a5 | ||
|
|
8c0f960e39 | ||
|
|
b0978b362e | ||
|
|
ffef3183c7 | ||
|
|
20a9857fcf | ||
|
|
828395c398 | ||
|
|
462e29da6e | ||
|
|
29ebe94015 | ||
|
|
ce7b30b54e | ||
|
|
feeb0c01f2 | ||
|
|
bef8e53347 | ||
|
|
46c3ed72c3 | ||
|
|
1fd8f4d837 | ||
|
|
6f3fbb25cf | ||
|
|
05b8df0d88 | ||
|
|
a4dcb643bd | ||
|
|
9e23cda02a | ||
|
|
c29b67df55 | ||
|
|
bd312b86d2 | ||
|
|
822b95e8aa | ||
|
|
a7e45338e3 | ||
|
|
7637f0c6ce | ||
|
|
6ec43b72ce | ||
|
|
91e80bf1a6 | ||
|
|
e6464dc5cb | ||
|
|
34c799b668 | ||
|
|
dbd7634f0e | ||
|
|
baa1dcbf8f | ||
|
|
660ebeadfe | ||
|
|
ef0ddddb46 | ||
|
|
77a39364f4 | ||
|
|
dc0a2bccd6 | ||
|
|
ac1b458eb4 | ||
|
|
f5938bc235 | ||
|
|
7280c17506 | ||
|
|
4e280f02b6 | ||
|
|
854f6ae6ae | ||
|
|
0487487e7c | ||
|
|
9ec66912c8 | ||
|
|
960f261ddd | ||
|
|
e55f96f393 | ||
|
|
713a5b067f | ||
|
|
d6aa7ec17c | ||
|
|
2da2ddb5bb | ||
|
|
608033f38f | ||
|
|
28c25816a6 | ||
|
|
709fccd96c | ||
|
|
2c24e56aa5 | ||
|
|
f104ddbe64 | ||
|
|
bbd8ceb8c0 | ||
|
|
b8498fa58f | ||
|
|
34c26c44bc | ||
|
|
c97f1791b0 | ||
|
|
63b16e5bd4 | ||
|
|
184f93168b | ||
|
|
0400f1a23e | ||
|
|
d3d60757c1 | ||
|
|
57079e5104 | ||
|
|
6d967358da | ||
|
|
095121d83c | ||
|
|
a415b131c4 | ||
|
|
54a1ea9f56 | ||
|
|
23091ff851 | ||
|
|
5571b49b4f | ||
|
|
4b4708e2a8 | ||
|
|
789a4c4b7f | ||
|
|
3775053609 | ||
|
|
35da50b67a | ||
|
|
9be30338a5 | ||
|
|
6510cca837 | ||
|
|
08b8dfbe0e | ||
|
|
9af242854a | ||
|
|
bfe9a1888e | ||
|
|
fec496f154 | ||
|
|
28fd35ad7e | ||
|
|
c5deb09c2c | ||
|
|
ee6d34a9bd | ||
|
|
6e6bb1e88d | ||
|
|
0b3aea2bf3 | ||
|
|
f731ec7b2f | ||
|
|
5b8f840d6e | ||
|
|
694ad5d33d | ||
|
|
383ee00e71 | ||
|
|
c279ab6311 | ||
|
|
4cc1db1365 | ||
|
|
f3d1378692 | ||
|
|
cfb3004142 | ||
|
|
016643e494 | ||
|
|
5ec18d45a2 | ||
|
|
f4c9bced45 | ||
|
|
e106ca3da5 | ||
|
|
262c8ffc59 | ||
|
|
affde2f030 | ||
|
|
a4982bd24e | ||
|
|
1099e8e876 | ||
|
|
6a4356fa94 | ||
|
|
2ec8d94e38 | ||
|
|
24d47ef353 | ||
|
|
76ebf8df07 | ||
|
|
a4e52c6c3c | ||
|
|
285f8d102b | ||
|
|
d0d21a6b5d | ||
|
|
ff58a47244 | ||
|
|
6e666b0ac8 | ||
|
|
47684e8717 | ||
|
|
0d0292385f | ||
|
|
83e20f8062 | ||
|
|
5943ae0a46 | ||
|
|
56c4a11626 | ||
|
|
f0f42df374 | ||
|
|
5898bc7f07 | ||
|
|
0d8b94c7fd | ||
|
|
0fa4be7c4a | ||
|
|
a7bad8e9f4 | ||
|
|
40276d190a | ||
|
|
71ccd23953 | ||
|
|
4e68e33ec7 | ||
|
|
79c8b31042 | ||
|
|
cee72c1d09 | ||
|
|
a7c8954740 | ||
|
|
a21b9b382e | ||
|
|
ef0b76a632 | ||
|
|
2806d3a191 | ||
|
|
9688c7ef01 | ||
|
|
d6181d26f8 | ||
|
|
aa5e8662ed | ||
|
|
ca11e724ab | ||
|
|
ab272da46e | ||
|
|
584e932769 | ||
|
|
691a500381 | ||
|
|
21a2df0830 | ||
|
|
4773a83a24 | ||
|
|
09e9377e54 | ||
|
|
19a90b7d9d | ||
|
|
dbaed1e97b | ||
|
|
9695789843 | ||
|
|
75ddd2e1e0 | ||
|
|
43c81afd12 | ||
|
|
88a837b769 | ||
|
|
55656761d2 | ||
|
|
92710f4625 | ||
|
|
58dc353bcd | ||
|
|
b194985827 | ||
|
|
bdd283956c | ||
|
|
a9b0017c04 | ||
|
|
8f185d1291 | ||
|
|
9564d9d893 | ||
|
|
fe01c6196e | ||
|
|
c8d9377dbb | ||
|
|
d53f01232d | ||
|
|
e3f9a27f87 | ||
|
|
e25b9155b4 | ||
|
|
b769568df1 | ||
|
|
daa60ac501 | ||
|
|
0340d17ab8 | ||
|
|
c33f637717 | ||
|
|
334af52ddf | ||
|
|
9a949c02c5 | ||
|
|
095c36b3ba | ||
|
|
ff7ebb4f92 | ||
|
|
3834991e6a | ||
|
|
67af073b95 | ||
|
|
5a44948050 | ||
|
|
3011d625b2 | ||
|
|
d25efe2293 | ||
|
|
8202791518 | ||
|
|
9871bf82d3 | ||
|
|
f9c1d62173 | ||
|
|
89d854f5be | ||
|
|
f1e0bacadb | ||
|
|
1b0131bd9d | ||
|
|
2f6cd20cbd | ||
|
|
d66d99a24e | ||
|
|
9e823f12c2 | ||
|
|
ef5ea01bc1 | ||
|
|
30e6542887 | ||
|
|
b501eec306 | ||
|
|
79e99dcb38 | ||
|
|
f6eccba966 | ||
|
|
fa1f67420d | ||
|
|
6e26e7eac3 | ||
|
|
0a04ff4f3c | ||
|
|
99023a3053 | ||
|
|
a3fd583d9d | ||
|
|
a6e7ea6590 | ||
|
|
178e4ceb7f | ||
|
|
e12455d154 | ||
|
|
71d5983adf | ||
|
|
696569f749 | ||
|
|
4892a58084 | ||
|
|
75d8d55691 | ||
|
|
614cfcd7f7 | ||
|
|
8eef039312 | ||
|
|
f6a88db46b | ||
|
|
9c5847153a | ||
|
|
cdfb47448f | ||
|
|
0adca414ce | ||
|
|
16bfbabf19 | ||
|
|
539dfd6a38 | ||
|
|
525666be7c | ||
|
|
386171bcab | ||
|
|
55383575e0 | ||
|
|
9659bfa553 | ||
|
|
85504fbe62 | ||
|
|
de8dcc4024 | ||
|
|
620c8eaa27 | ||
|
|
3f296554ed | ||
|
|
2a8d166c54 | ||
|
|
6bc263bd2b | ||
|
|
907d62c4e7 | ||
|
|
6965d319ef | ||
|
|
d674f55343 | ||
|
|
75bc95167f | ||
|
|
66bf32351a | ||
|
|
fe9a5aea2a | ||
|
|
b99d963cd5 | ||
|
|
b8398af5a3 | ||
|
|
10d8af2536 | ||
|
|
e79941bb8b | ||
|
|
4124b6d084 | ||
|
|
ae9c258531 | ||
|
|
df17a3d2a3 | ||
|
|
b47737bda3 | ||
|
|
96bb475306 | ||
|
|
7490796637 | ||
|
|
a9f2df83ff | ||
|
|
50aca57112 | ||
|
|
5011269586 | ||
|
|
bd42032e3a | ||
|
|
1256cc3bd1 | ||
|
|
62122a15bc | ||
|
|
f86db5f134 | ||
|
|
2acb841539 | ||
|
|
6724bb8edd | ||
|
|
7b5b5e0bd2 | ||
|
|
243ac3027f | ||
|
|
79a4af44d3 | ||
|
|
180a0b39d1 | ||
|
|
2664c36a14 | ||
|
|
911f4523a1 | ||
|
|
09b86d6fdf | ||
|
|
5ec8a4674c | ||
|
|
2a567c9f74 | ||
|
|
b9a7fc9409 | ||
|
|
0db13b6cdf | ||
|
|
08c7409627 | ||
|
|
c38cb046cd | ||
|
|
037b168825 | ||
|
|
41a928b775 | ||
|
|
27598406d1 | ||
|
|
a0ad5292b9 | ||
|
|
a1a258f48e | ||
|
|
4a0040a12f | ||
|
|
ab13b5f198 | ||
|
|
788d2d49b9 | ||
|
|
6c342ef910 | ||
|
|
a4b5362347 | ||
|
|
0e78be86e4 | ||
|
|
e348bbc344 | ||
|
|
bad17c39d1 | ||
|
|
8ed30da473 | ||
|
|
af1083d0f1 | ||
|
|
4fff842c90 | ||
|
|
7f81039f46 | ||
|
|
b63be6dd28 | ||
|
|
565a5294e2 | ||
|
|
254d43fef1 | ||
|
|
5819884c98 | ||
|
|
cb43f9c392 | ||
|
|
ed677b7682 | ||
|
|
ead8411454 | ||
|
|
1fc9f13919 | ||
|
|
6bf077e0aa | ||
|
|
0de8c0beb2 | ||
|
|
39f690f2b4 | ||
|
|
1a575d9364 | ||
|
|
fe58253a44 | ||
|
|
65cc72e28b | ||
|
|
00f8fccfae | ||
|
|
1fea016ac1 | ||
|
|
35057b9d05 | ||
|
|
b2fdcd5cf0 | ||
|
|
2b3363de40 | ||
|
|
d031651b58 | ||
|
|
8fb66ed329 | ||
|
|
e841a38866 | ||
|
|
addb7ba36a | ||
|
|
d4b5e24364 | ||
|
|
dd32d2e53c | ||
|
|
cc1e071e35 | ||
|
|
3f8efae23f | ||
|
|
8ee8898a78 | ||
|
|
fc77df4b5d | ||
|
|
13018ed96a | ||
|
|
236e7afcfc | ||
|
|
946a1de931 | ||
|
|
2840865b83 | ||
|
|
1411309204 | ||
|
|
60927e6728 | ||
|
|
4b11a6a304 | ||
|
|
37a00f25bc | ||
|
|
1fc541a9df | ||
|
|
c3cd732254 | ||
|
|
8f7694111b | ||
|
|
2854a2d93e | ||
|
|
78c209a96f | ||
|
|
9809f08954 | ||
|
|
4e671ce995 | ||
|
|
b5fd737cea | ||
|
|
6f82fd7eb6 | ||
|
|
542fe20782 | ||
|
|
92591432d3 | ||
|
|
a20cdac9c3 | ||
|
|
23f45359f8 | ||
|
|
0bc09548cf | ||
|
|
ee30ab48ae | ||
|
|
3028a384a4 | ||
|
|
f17db43501 | ||
|
|
7dd46ec24f | ||
|
|
cefb5d98f0 | ||
|
|
e750a99636 | ||
|
|
798684e300 | ||
|
|
7c004ee37c | ||
|
|
0a4bc23fb8 | ||
|
|
13a5146010 | ||
|
|
55fe3630c5 | ||
|
|
265196398a | ||
|
|
141d00e160 | ||
|
|
5c8d90f50e | ||
|
|
351a2463a2 | ||
|
|
f604f0f913 | ||
|
|
7afe76212d | ||
|
|
a777b40613 | ||
|
|
11ef7c6a00 | ||
|
|
b5bc881d52 | ||
|
|
66d5ba9981 | ||
|
|
eecef9a0aa | ||
|
|
7e6aa20168 | ||
|
|
69a80a6c38 | ||
|
|
d63ab1138c | ||
|
|
f790c4fb9e | ||
|
|
40427c75b9 | ||
|
|
e18a5e4832 | ||
|
|
4d2a58e428 | ||
|
|
005d6d2b06 | ||
|
|
7ada57033a | ||
|
|
1a332ae6ab | ||
|
|
064e082a12 | ||
|
|
10eec8a47b | ||
|
|
db469d1b84 | ||
|
|
1e04aaa77d | ||
|
|
e97753125d | ||
|
|
1474ff9b88 | ||
|
|
39bb95f127 | ||
|
|
42baf6c8d2 | ||
|
|
73b9552b5c | ||
|
|
60cf7506f8 | ||
|
|
894062c757 | ||
|
|
165a5d7364 | ||
|
|
405e66ea72 | ||
|
|
a42ff85406 | ||
|
|
2eba68b35c | ||
|
|
efe7673c4c | ||
|
|
ca92d7d569 | ||
|
|
0ee2baadce | ||
|
|
43856341e6 | ||
|
|
61aed403d9 | ||
|
|
a8a92c00fe | ||
|
|
84c41aa554 | ||
|
|
de415384f3 | ||
|
|
8a9ee747c1 | ||
|
|
2eeb918c8a | ||
|
|
72aa596317 | ||
|
|
6de3a45a51 | ||
|
|
28a826b35d | ||
|
|
41813dcc53 | ||
|
|
6290409e54 | ||
|
|
25033f4f6b | ||
|
|
b8fae00c1e | ||
|
|
6d4e4e2f69 | ||
|
|
1cde688fbb | ||
|
|
e3493fbe3e | ||
|
|
1b691a3dd7 | ||
|
|
3022dce26e | ||
|
|
9780a65f09 | ||
|
|
34dd864c8b | ||
|
|
9b16519a7e | ||
|
|
76321343c2 | ||
|
|
0159ce5b1d | ||
|
|
5abec25c58 | ||
|
|
d9de1e866f | ||
|
|
1ae8e7d55e | ||
|
|
67dc4521e9 | ||
|
|
852ebba530 | ||
|
|
79669d9a69 | ||
|
|
11d37bcb93 | ||
|
|
c95d5dc320 | ||
|
|
92044c7797 | ||
|
|
7084d9e084 | ||
|
|
af96e2f143 | ||
|
|
f7560714e7 | ||
|
|
785c5e66ec | ||
|
|
f281e5aa95 | ||
|
|
55f0f5271d | ||
|
|
b60d3a771d | ||
|
|
d2132b2e64 | ||
|
|
95494c0d03 | ||
|
|
76a8286c04 | ||
|
|
eca8d6dd8d | ||
|
|
e6ae034f7e | ||
|
|
236b4efb9b | ||
|
|
4b4c9ba959 | ||
|
|
6bf05741a9 | ||
|
|
5d1998accb | ||
|
|
3aa9ffc241 | ||
|
|
8ab5575e0a | ||
|
|
3980b8a9c8 | ||
|
|
27550d7ec9 | ||
|
|
35513e1e21 | ||
|
|
15496aed44 | ||
|
|
27408c191d | ||
|
|
4b6c6717ad | ||
|
|
c0bc3d8061 | ||
|
|
fe5f252bc9 | ||
|
|
e25af085fc | ||
|
|
400da676fa | ||
|
|
bf9f02e53a | ||
|
|
a437da76ec | ||
|
|
8cceee49ea | ||
|
|
34ff03936a | ||
|
|
bf3ee93c23 | ||
|
|
a3260b4ce3 | ||
|
|
ea8cf7b62a | ||
|
|
7168681918 | ||
|
|
233291b30c | ||
|
|
e53ff167ee | ||
|
|
df54d09494 | ||
|
|
4aa3edc508 | ||
|
|
4ea1b93f8d | ||
|
|
361ca2cece | ||
|
|
fa0d076a09 | ||
|
|
da5a1e0945 | ||
|
|
6d187f0d9a | ||
|
|
85eca4c464 | ||
|
|
1efbce7661 | ||
|
|
edf69d1ef1 | ||
|
|
375e7db449 | ||
|
|
ac71e38d96 | ||
|
|
ae5fd91cd4 | ||
|
|
14e8b2ef17 | ||
|
|
5bacea8b50 | ||
|
|
15dff87200 | ||
|
|
ae45c77523 | ||
|
|
7c834993f6 | ||
|
|
5f5749ac8f | ||
|
|
c99a7b6666 | ||
|
|
b4e2d3edfe | ||
|
|
8f9308f349 | ||
|
|
fc48473e40 | ||
|
|
71317db4cb | ||
|
|
23815429e2 | ||
|
|
b468134432 | ||
|
|
3e38db16f6 | ||
|
|
bf591cc01e | ||
|
|
3178cbc563 | ||
|
|
1c54f6b2f4 | ||
|
|
7743456d7d | ||
|
|
4dc43263a5 | ||
|
|
5d84f1c523 | ||
|
|
8289ebbe50 | ||
|
|
94741f1b4a | ||
|
|
a5b394aa93 | ||
|
|
9f3d152d8c | ||
|
|
94c91614d6 | ||
|
|
02a59b0742 | ||
|
|
882c2e2378 | ||
|
|
f6b56735b6 | ||
|
|
8aec463eb4 | ||
|
|
37cdcf93e6 | ||
|
|
9547a06f39 | ||
|
|
a8d5d2ace1 | ||
|
|
e8a0464f6c | ||
|
|
85a39e64c1 | ||
|
|
e18cf759f9 | ||
|
|
7e1ab1e6b0 | ||
|
|
eed74d72cd | ||
|
|
fa8c96af13 | ||
|
|
18ec2ff458 | ||
|
|
c38a737421 | ||
|
|
0166b53e21 | ||
|
|
724da4e500 | ||
|
|
ce15e8dfe0 | ||
|
|
b968d0d694 | ||
|
|
fa0549f34f | ||
|
|
999ef36963 | ||
|
|
7affd05247 | ||
|
|
2ccf4011ed | ||
|
|
61f3908d33 | ||
|
|
08e429210a | ||
|
|
f94944c41a | ||
|
|
200631e57e | ||
|
|
9c83d5e752 | ||
|
|
894bff2e35 | ||
|
|
6ff0a699c0 | ||
|
|
5083428a06 | ||
|
|
c74a14fcb0 | ||
|
|
d060c7535a | ||
|
|
5eb134f7b5 | ||
|
|
c1c5117f01 | ||
|
|
8ce1f5884f | ||
|
|
1f8b51fafe | ||
|
|
80f73f0bb1 | ||
|
|
88e7b3fb47 | ||
|
|
3bb36044c1 | ||
|
|
f9ace54fab | ||
|
|
498d7e2f66 | ||
|
|
420526df9d | ||
|
|
ab00d9534d | ||
|
|
4bb9073ce1 | ||
|
|
58cb0118b4 | ||
|
|
f19740e376 | ||
|
|
ab50d0a514 | ||
|
|
e551212516 | ||
|
|
888734b7d1 | ||
|
|
90d1a01998 | ||
|
|
ab1dd2b374 | ||
|
|
0e4d731068 | ||
|
|
f23416dfb8 | ||
|
|
469cc3d508 | ||
|
|
5ad88be997 | ||
|
|
536341b6de | ||
|
|
18dcd0a5d2 | ||
|
|
5f8a0643f4 | ||
|
|
ccbf8b34ef | ||
|
|
25915c077e | ||
|
|
bcb574e618 | ||
|
|
6cfa24340f | ||
|
|
0dc26216c2 | ||
|
|
8dd850d685 | ||
|
|
638f261bf4 | ||
|
|
ad5a0a5cd9 | ||
|
|
7dda54f36d | ||
|
|
a8477940e2 | ||
|
|
6a26f62ca1 | ||
|
|
06d0bfadca | ||
|
|
b805d7fe19 | ||
|
|
b784671397 | ||
|
|
4784a31513 | ||
|
|
3eb9bfe9ee | ||
|
|
ab31aecdac | ||
|
|
5cb2bd1332 | ||
|
|
8bff9efc5c | ||
|
|
d01360ca19 | ||
|
|
f48c71f30c | ||
|
|
a2b3190b1d | ||
|
|
913d5a532d | ||
|
|
96c6c372fd | ||
|
|
8926e06e44 | ||
|
|
6636e89a0b | ||
|
|
01e9e83641 | ||
|
|
30dc338636 | ||
|
|
d4999de214 | ||
|
|
a53595a055 | ||
|
|
0cb7415a4c | ||
|
|
9f287d0d7f | ||
|
|
feddda2948 | ||
|
|
613b7eda8a | ||
|
|
bd3364a3cf | ||
|
|
3f918bd309 | ||
|
|
9b3f2ae3c7 | ||
|
|
6c33c5701f | ||
|
|
e731fe9b98 | ||
|
|
edbfa9117d | ||
|
|
ae54cd8fde | ||
|
|
91686e252c | ||
|
|
88d132931e | ||
|
|
4afedcf126 | ||
|
|
d3d815f26a | ||
|
|
62725b1930 | ||
|
|
06d509b5ac | ||
|
|
77aba38625 | ||
|
|
ce33e1d242 | ||
|
|
591cf29edf | ||
|
|
dd81823e29 | ||
|
|
15994e7be8 | ||
|
|
61f3b87dae | ||
|
|
6279f1920e | ||
|
|
d169d60d8d | ||
|
|
f49cf43fb1 | ||
|
|
aa94ae8759 | ||
|
|
8ad20b57fd | ||
|
|
7c4cb5ea7f | ||
|
|
23733bb1a6 | ||
|
|
5be3f333f3 | ||
|
|
b14f3f53aa | ||
|
|
47c3fc35e3 | ||
|
|
0fd1497496 | ||
|
|
6c9c983f72 | ||
|
|
0422eee9af | ||
|
|
97a4b79713 | ||
|
|
0785ee3099 | ||
|
|
d58d04d6a0 | ||
|
|
9bb2b17c77 | ||
|
|
64e70d8e92 | ||
|
|
6fa9eb558a | ||
|
|
ddcc851951 | ||
|
|
dc2e5afe3e | ||
|
|
d8e9997987 | ||
|
|
3d919cd937 | ||
|
|
b094c2d78f | ||
|
|
9b699ba374 | ||
|
|
f8e5efc874 | ||
|
|
2c61c695d5 | ||
|
|
b6e806adbc | ||
|
|
e74aa160af | ||
|
|
6793228fbe | ||
|
|
e83ea8124e | ||
|
|
313f99d09d | ||
|
|
28de292107 | ||
|
|
10efb98eb3 | ||
|
|
8ac2241372 | ||
|
|
092434a103 | ||
|
|
a777997f79 | ||
|
|
36cf7f718b | ||
|
|
7989267d51 | ||
|
|
ef4398a5f1 | ||
|
|
0da8afc108 | ||
|
|
0e74d36227 | ||
|
|
290cc151bc | ||
|
|
21f93aa7e8 | ||
|
|
04c77e9760 | ||
|
|
c6da6544da | ||
|
|
94d3e38bc7 | ||
|
|
5fcf992920 | ||
|
|
22cc9eabc0 | ||
|
|
b191c0d341 | ||
|
|
d2d431ce2e | ||
|
|
3a6b58ea8c | ||
|
|
2d8fc40307 | ||
|
|
68dce2f247 | ||
|
|
bc03eb2e65 | ||
|
|
f725709e5b | ||
|
|
ba591c9dc5 | ||
|
|
def5d33055 | ||
|
|
1aaa51c4be | ||
|
|
37206bcc83 | ||
|
|
c2b86bac4b | ||
|
|
02dad179cd | ||
|
|
adb94f8773 | ||
|
|
035110df75 | ||
|
|
5adb65899c | ||
|
|
764a373e7d | ||
|
|
8114327c7e | ||
|
|
6404417dad | ||
|
|
d89cb8f1e9 | ||
|
|
dee95c2f08 | ||
|
|
3a907ec7c2 | ||
|
|
851dff6e8c | ||
|
|
47e7364976 | ||
|
|
41f8207b3a | ||
|
|
ed0a3a22ab | ||
|
|
3a513da942 | ||
|
|
a4f1c60da2 | ||
|
|
de0bf7d814 | ||
|
|
71fd72e462 | ||
|
|
619cc3c047 | ||
|
|
68c75a4e34 | ||
|
|
37671cefa3 | ||
|
|
d9f409069a | ||
|
|
fd5a190490 | ||
|
|
2f4d5b32b6 | ||
|
|
4c7ac68858 | ||
|
|
ad3a3c5266 | ||
|
|
51d924c1b8 | ||
|
|
83491f535a | ||
|
|
380731a244 | ||
|
|
60c78da0f6 | ||
|
|
2d02f4f962 | ||
|
|
982bd89924 | ||
|
|
04f60747d9 | ||
|
|
28c107b089 | ||
|
|
e6cc8757ac | ||
|
|
9169bfc608 | ||
|
|
610e33e4a4 | ||
|
|
77dd40fb4a | ||
|
|
5a63c51316 | ||
|
|
eabc8b5854 | ||
|
|
1a798886a2 | ||
|
|
8735dadbca | ||
|
|
2c53ebc0e4 | ||
|
|
f93033695d | ||
|
|
2d0f5817d0 | ||
|
|
2033e22216 | ||
|
|
bada6f64ae | ||
|
|
bc141698c8 | ||
|
|
75fddd9349 | ||
|
|
b1a417295f | ||
|
|
0522036b80 | ||
|
|
061469840b | ||
|
|
6e218ed908 | ||
|
|
626b48c3d1 | ||
|
|
dd957237e2 | ||
|
|
fc9e237dbb | ||
|
|
faac265373 | ||
|
|
998935e2a3 | ||
|
|
24f8116fce | ||
|
|
3415330871 | ||
|
|
eadeaae6db | ||
|
|
32bdaf4f24 | ||
|
|
7525fe9357 | ||
|
|
b24f31922f | ||
|
|
4c79349b8d | ||
|
|
44f7a27387 | ||
|
|
369425bec1 | ||
|
|
3dc284335e | ||
|
|
bfc284994a | ||
|
|
277409a807 | ||
|
|
d1f1f14bc3 | ||
|
|
5ee1f5d3af | ||
|
|
f4569fb5cc | ||
|
|
4ba0a2dafb | ||
|
|
c2b1c2b1d8 | ||
|
|
2e119e2efd | ||
|
|
4641918486 | ||
|
|
407f6f2b0f | ||
|
|
f01d7ecd96 | ||
|
|
e3d987bbdf | ||
|
|
89845883d0 | ||
|
|
4e7ff94b33 | ||
|
|
2fb9a1b1d7 | ||
|
|
5c0ab36662 | ||
|
|
fc6dac326d | ||
|
|
426dcff085 | ||
|
|
e623f45c04 | ||
|
|
3b9a9cb0fa | ||
|
|
c018a86bdb | ||
|
|
559be38baf | ||
|
|
e3e05e5003 | ||
|
|
95649d7d46 | ||
|
|
61097de76d | ||
|
|
e49fff5028 | ||
|
|
20ae7945e0 | ||
|
|
c5a50d23b6 | ||
|
|
ad37e5ca27 | ||
|
|
e8303064b9 | ||
|
|
f8a577749a | ||
|
|
e113817293 | ||
|
|
0d15cdd370 | ||
|
|
b5db08eec3 | ||
|
|
c3591c1fae | ||
|
|
e1a4d5497a | ||
|
|
4e83162adc | ||
|
|
42c6b8a016 | ||
|
|
48f9d808cf | ||
|
|
6546c27cf5 | ||
|
|
fc0c0f87dc | ||
|
|
9d703c0af6 | ||
|
|
24559c475b | ||
|
|
f92e8a285a | ||
|
|
0411120551 | ||
|
|
5f57d4ddcd | ||
|
|
4164bbeba8 | ||
|
|
14dea99ccd | ||
|
|
3ea1881ff5 | ||
|
|
5192c188f4 | ||
|
|
c1ffa47e9d | ||
|
|
2808a9dcc5 | ||
|
|
e1ab6b6c93 | ||
|
|
229868bb20 | ||
|
|
520eb4cd1d | ||
|
|
2d0b4d6ae5 | ||
|
|
5dae9a197a | ||
|
|
ff1ebf9775 | ||
|
|
e6f388518a | ||
|
|
3557706e3a | ||
|
|
f3d0d55a2f | ||
|
|
b0c2bad1d8 | ||
|
|
53c9ca3b3a | ||
|
|
e41ba1be45 | ||
|
|
594febaece | ||
|
|
890dae8ba7 | ||
|
|
8a3120be39 | ||
|
|
6b4975559d | ||
|
|
3326550705 | ||
|
|
6be0d82fc6 | ||
|
|
44ad841d05 | ||
|
|
53f45ace4c | ||
|
|
42e9cae876 | ||
|
|
e46922d341 | ||
|
|
21c242ee05 | ||
|
|
33b7a0cef2 | ||
|
|
9cddca1af5 | ||
|
|
8cdf0d9fce | ||
|
|
a079ac4207 | ||
|
|
099238a2e5 | ||
|
|
595bc16d92 | ||
|
|
e9875c8288 | ||
|
|
ec600ab672 | ||
|
|
c3689aee93 | ||
|
|
60a728d521 | ||
|
|
7bd7071ec5 | ||
|
|
bb787aa9ca | ||
|
|
d2f629d100 | ||
|
|
5d949de0ee | ||
|
|
e21bc8a930 | ||
|
|
af79f63870 | ||
|
|
4ff32342e3 | ||
|
|
98d55faf4e | ||
|
|
bd532ea808 | ||
|
|
d4bd57ee70 | ||
|
|
90dbfb31a6 | ||
|
|
55ca34cad3 | ||
|
|
36a5e919cd | ||
|
|
3263ba1440 | ||
|
|
9721c19e48 | ||
|
|
de71213eed | ||
|
|
65abbf9563 | ||
|
|
a94098494a | ||
|
|
ec935356aa | ||
|
|
6ab419dfad | ||
|
|
b1ffcff064 | ||
|
|
4ce09a3845 | ||
|
|
9686e74feb | ||
|
|
e97e24762d | ||
|
|
b3fd0805e8 | ||
|
|
300092d07d | ||
|
|
56ed3a11d6 | ||
|
|
6938b20ab6 | ||
|
|
77f2cf5089 | ||
|
|
19e3b015c5 | ||
|
|
2702d0fc2a | ||
|
|
472a4883f0 | ||
|
|
485e2e18bf | ||
|
|
40c0f69eff | ||
|
|
854a1e5723 | ||
|
|
f4cd28cdb9 | ||
|
|
5bae790dd8 | ||
|
|
d1d43c38cd | ||
|
|
7e1552eeb4 | ||
|
|
7306bf28e0 | ||
|
|
07e00a8faf | ||
|
|
ab93866366 | ||
|
|
d7801b59e7 | ||
|
|
ea926f173a | ||
|
|
f6b55da0c6 | ||
|
|
ee4e562874 | ||
|
|
abfe5ffc45 | ||
|
|
9629b0e1a3 | ||
|
|
80b03dd194 | ||
|
|
3f92f8d2aa | ||
|
|
823c94cace | ||
|
|
421ac6c427 | ||
|
|
72550d6d84 | ||
|
|
72999cc7b0 | ||
|
|
706cf641b3 | ||
|
|
d42bdb2505 | ||
|
|
9082054ba9 | ||
|
|
abc69bc838 | ||
|
|
23ea5d9d06 | ||
|
|
8d009d6366 | ||
|
|
8213b51bd6 | ||
|
|
a18fc2080d | ||
|
|
9c0ac0ff57 | ||
|
|
c34dc9f946 | ||
|
|
1c5c205614 | ||
|
|
897df1b8fa | ||
|
|
3fb22b7c55 | ||
|
|
7819a30c57 | ||
|
|
37d2c72945 | ||
|
|
5631e2c09f | ||
|
|
c7ddd6ec35 | ||
|
|
7280ceac32 | ||
|
|
f8b9128d8e | ||
|
|
c482f1dccd | ||
|
|
7e306be8aa | ||
|
|
035e6913b5 | ||
|
|
e12f233afc | ||
|
|
26c7ff8c18 | ||
|
|
5647364293 | ||
|
|
06fa585f69 | ||
|
|
035eac2f1e | ||
|
|
f01889cbf7 | ||
|
|
73025bfd4b | ||
|
|
aec6dd1246 | ||
|
|
ab4411e5bb | ||
|
|
0ac00efda6 | ||
|
|
f32eb8d710 | ||
|
|
ec33dfb76c | ||
|
|
43dfbac2fa | ||
|
|
7a483abec2 | ||
|
|
35e6b6faf4 | ||
|
|
1066b58fb6 | ||
|
|
b41b8f251f | ||
|
|
a1426c3e81 | ||
|
|
aa3967d88f | ||
|
|
c610c4cba9 | ||
|
|
abb3a2dbd2 | ||
|
|
1f035301d9 | ||
|
|
ebf7f76d48 | ||
|
|
397ab77105 | ||
|
|
f37abc69ea | ||
|
|
ee85b0e057 | ||
|
|
eab28abc86 | ||
|
|
16c5307fc2 | ||
|
|
8c8cae1e27 | ||
|
|
925c645821 | ||
|
|
c1c97a86b7 | ||
|
|
1fc1016148 | ||
|
|
e73545d296 | ||
|
|
f2fb7d43d0 | ||
|
|
781d421e1c | ||
|
|
a3a7464a29 | ||
|
|
ac936f5650 | ||
|
|
c0f5dc2dc8 | ||
|
|
31c113180e | ||
|
|
239df2deb2 | ||
|
|
31a8c4b0b9 | ||
|
|
f394bd45c7 | ||
|
|
63999c9ec3 | ||
|
|
82c24cee7e | ||
|
|
5e94b0c009 | ||
|
|
452ff62134 | ||
|
|
3df494cacd | ||
|
|
d62bb59df7 | ||
|
|
b367f9320b | ||
|
|
4bc3dbbf6c | ||
|
|
e7b7e3ac96 | ||
|
|
f3c4aea12f | ||
|
|
b9b5938a91 | ||
|
|
e7fdcf0db4 | ||
|
|
c1f22aa556 | ||
|
|
991b4089d6 | ||
|
|
a8132552de | ||
|
|
a0323aef19 | ||
|
|
a38abc2f7f | ||
|
|
a6beecf510 | ||
|
|
c5dece0e59 | ||
|
|
ce935bafc1 | ||
|
|
fd426a96aa | ||
|
|
fad8800842 | ||
|
|
273a473db1 | ||
|
|
a7588e517d | ||
|
|
84eff098eb | ||
|
|
f157f3b5d6 | ||
|
|
6cd00c60a7 | ||
|
|
2ea951db61 | ||
|
|
9d0bd0aabb | ||
|
|
3d88d16b4b | ||
|
|
02724dc26d | ||
|
|
21a93652cd | ||
|
|
fb4caf1a42 | ||
|
|
7a2508bf17 | ||
|
|
eeeab86952 | ||
|
|
a149ff1705 | ||
|
|
2c73c9c815 | ||
|
|
f6f29db9f1 | ||
|
|
c823a68616 | ||
|
|
e7e2184760 | ||
|
|
6fe2422bc9 | ||
|
|
cd62776be6 | ||
|
|
037357efe9 | ||
|
|
8d3910ea4c | ||
|
|
3e5926f706 | ||
|
|
a1d67bf539 | ||
|
|
3e65457041 | ||
|
|
f70180eb66 | ||
|
|
c0a558e229 | ||
|
|
801069f5ac | ||
|
|
f9dcac8264 | ||
|
|
902c001aa4 | ||
|
|
0cf2a4353d | ||
|
|
13c8cc90f2 | ||
|
|
db231fafeb | ||
|
|
c3f7deb602 | ||
|
|
300e3f2f58 | ||
|
|
513406f0e5 | ||
|
|
27e21e77f9 | ||
|
|
dadfd803f7 | ||
|
|
02b0ba2278 | ||
|
|
3e1005aef1 | ||
|
|
e2eb13739c | ||
|
|
c52e30ceae | ||
|
|
07754cdf5f | ||
|
|
c74c475a29 | ||
|
|
ad36ab520b | ||
|
|
bc32ff5db9 | ||
|
|
6009432933 | ||
|
|
99eaa37c76 | ||
|
|
ed6d5f727a | ||
|
|
c6995d6e58 | ||
|
|
cb0f453a8d | ||
|
|
d9866846ad | ||
|
|
de5d9195f3 | ||
|
|
fd1fe8562c | ||
|
|
b1298223aa | ||
|
|
c48128d92e | ||
|
|
0f4d466953 | ||
|
|
1b752fcaf6 | ||
|
|
d06db9909c | ||
|
|
921024035c | ||
|
|
3b1c8c3deb | ||
|
|
69862ab67d | ||
|
|
b05c321306 | ||
|
|
9b74a58dde | ||
|
|
d112ffaf6a | ||
|
|
554f063def | ||
|
|
f6dce02203 | ||
|
|
653dfe82fa | ||
|
|
5dbf743052 | ||
|
|
f7e7e2e41c | ||
|
|
b28b4db7fd | ||
|
|
c34f30e4a3 | ||
|
|
aa7f11185d | ||
|
|
1790d19809 | ||
|
|
fa6fbca67b | ||
|
|
cd79c57a27 | ||
|
|
4c3a97e2b2 | ||
|
|
f126dceeae | ||
|
|
414521acc5 | ||
|
|
9147422340 | ||
|
|
920646ea74 | ||
|
|
c57d839927 | ||
|
|
e7fd5db2c2 | ||
|
|
b76486ef5f | ||
|
|
5c06584676 | ||
|
|
2ae2ee64be | ||
|
|
17ba35e237 | ||
|
|
53e98e70aa | ||
|
|
359e18eb58 | ||
|
|
3377459df5 | ||
|
|
3e30d15405 | ||
|
|
2b50cf2243 | ||
|
|
b72e2b6bf9 | ||
|
|
c7a2b34f59 | ||
|
|
b48958995a | ||
|
|
58c496eacd | ||
|
|
7bd867c9dd | ||
|
|
be0558849c | ||
|
|
a1c7ec2ac9 | ||
|
|
8bf073c0c6 | ||
|
|
994689f05a | ||
|
|
3e10f9f451 | ||
|
|
972fa9f674 | ||
|
|
8e64d8e334 | ||
|
|
eccd81d40a | ||
|
|
649136f98f | ||
|
|
d7dae1366d | ||
|
|
19e2ebcd03 | ||
|
|
021c907d16 | ||
|
|
8ac3e28fdf | ||
|
|
c5af279730 | ||
|
|
e9377e93f1 | ||
|
|
6747c69511 | ||
|
|
9b6cae6c49 | ||
|
|
7148bd1d42 | ||
|
|
73940fffc6 | ||
|
|
09015449cd | ||
|
|
4dfdb99731 | ||
|
|
bbbca04066 | ||
|
|
e755bba608 | ||
|
|
9161cec238 | ||
|
|
dc14b60fcc | ||
|
|
da625d51f6 | ||
|
|
ce69055758 | ||
|
|
589ebd5bca | ||
|
|
35b50e1a9d | ||
|
|
f038564b1b | ||
|
|
1d0eb9806d | ||
|
|
c50a9bd318 | ||
|
|
cd9006d29b | ||
|
|
d3b88f9065 | ||
|
|
6a6cb1961d | ||
|
|
884c51a69a | ||
|
|
6f126e6cd4 | ||
|
|
b0c2e5409a | ||
|
|
9516ec3cd2 | ||
|
|
aecb92ccd3 | ||
|
|
bdf13f29f7 | ||
|
|
81120abfcb | ||
|
|
08a8170990 | ||
|
|
316ea910c2 | ||
|
|
0b5edfc21f | ||
|
|
76c08095ab | ||
|
|
538864519e | ||
|
|
cd6631049b | ||
|
|
079f8030b7 | ||
|
|
ad0b32c0ee | ||
|
|
8235b51a14 | ||
|
|
1bd5e7472f | ||
|
|
7433a7144c | ||
|
|
27632ecdd9 | ||
|
|
0b1e25b073 | ||
|
|
19a93f0026 | ||
|
|
3256a6d596 | ||
|
|
28ddfa5243 | ||
|
|
05c560be3b | ||
|
|
8ddd810fe2 | ||
|
|
f20760bae5 | ||
|
|
cea7320a9b | ||
|
|
fe6826016c | ||
|
|
f0167b3e88 | ||
|
|
0edbf7f517 | ||
|
|
a8a8dcff3f | ||
|
|
1b0ad13529 | ||
|
|
418d6c882c | ||
|
|
1e6899c40b | ||
|
|
259b201e65 | ||
|
|
8fb113a04e | ||
|
|
c6ebbc6122 | ||
|
|
755903a08e | ||
|
|
34e4825cd0 | ||
|
|
a68eeae9bd | ||
|
|
e4e31b554e | ||
|
|
eba6e3f5f1 | ||
|
|
d73ebaca76 | ||
|
|
94167152e5 | ||
|
|
830f76e909 | ||
|
|
8ae04944fe | ||
|
|
c55b8d29f7 | ||
|
|
30623f7d38 | ||
|
|
16964520df | ||
|
|
3050fdb3c3 | ||
|
|
77fc2c5cf1 | ||
|
|
b21c3ed4e9 | ||
|
|
93f4b345c5 | ||
|
|
88e59a2739 | ||
|
|
86bb256bf1 | ||
|
|
9a05f5bc93 | ||
|
|
bce28cf389 | ||
|
|
629c5e7739 | ||
|
|
ed402e2f5f | ||
|
|
4a56c7523d | ||
|
|
218d9f48b0 | ||
|
|
f67cf99477 | ||
|
|
2201b2adda | ||
|
|
6b36421bce | ||
|
|
8c573c65d4 | ||
|
|
730dabd9cf | ||
|
|
69175e1b19 | ||
|
|
a5ad58e516 | ||
|
|
82b4631341 | ||
|
|
a1c9c1538d | ||
|
|
1a53f58540 | ||
|
|
1b414b840e | ||
|
|
642cc0e98f | ||
|
|
63431bb54b | ||
|
|
d64de26ded | ||
|
|
8b45067226 | ||
|
|
061032e3d7 | ||
|
|
82432686aa | ||
|
|
b66d2039be | ||
|
|
d245a73d7f | ||
|
|
f0037151e6 | ||
|
|
52d494f573 | ||
|
|
36a2d71731 | ||
|
|
615a220acb | ||
|
|
c718584755 | ||
|
|
4db0ea616d | ||
|
|
5439e60078 | ||
|
|
a6880d4569 | ||
|
|
65e852f341 | ||
|
|
4ffdf9e536 | ||
|
|
8f698e3e62 | ||
|
|
61481e6e9a | ||
|
|
49397df90b | ||
|
|
7b254a08fb | ||
|
|
5bebbcf5eb | ||
|
|
83fd48e2f4 | ||
|
|
f5b25370b0 | ||
|
|
f68d3209ac | ||
|
|
2ab7f784c9 | ||
|
|
1e8d99a591 | ||
|
|
d517cba765 | ||
|
|
552eb5b9d8 | ||
|
|
684c4ea113 | ||
|
|
4dfaca610f | ||
|
|
8a53998251 | ||
|
|
6690f70b05 | ||
|
|
96d1d3cb66 | ||
|
|
09785ef451 | ||
|
|
25e118f3dc | ||
|
|
78b3e3c60b | ||
|
|
efe41a5e21 | ||
|
|
835041e5f6 | ||
|
|
93a8086ff6 | ||
|
|
1ac40684de | ||
|
|
433d1bbf57 | ||
|
|
e33de03522 | ||
|
|
86fedbfaae | ||
|
|
c0f4eef896 | ||
|
|
a2f3bf3a8c | ||
|
|
1b717e4683 | ||
|
|
52e2ac7174 | ||
|
|
3d6b053eb4 | ||
|
|
268eb1d60d | ||
|
|
a69865b8c9 | ||
|
|
4a1df3d5cc | ||
|
|
6dfd757ea1 | ||
|
|
fc1adf3b94 | ||
|
|
be2d1d7895 | ||
|
|
9e7c360912 | ||
|
|
51acd33d19 | ||
|
|
af3dbe2f86 | ||
|
|
97668e5413 | ||
|
|
464fde0ed2 | ||
|
|
65bd7909e1 | ||
|
|
5d3ea57d4d | ||
|
|
b7bc3cfbcf | ||
|
|
04ef32420b | ||
|
|
a3d8a48b92 | ||
|
|
ef86d1d7cb | ||
|
|
00b3e9b371 | ||
|
|
0d02f56855 | ||
|
|
48aa841add | ||
|
|
4ba52212a9 | ||
|
|
a14bca1059 | ||
|
|
a7e07af24f | ||
|
|
e14d655447 | ||
|
|
74bdeaf4f7 | ||
|
|
9591c62175 | ||
|
|
39c46dcab0 | ||
|
|
299e08f53d | ||
|
|
12555a6ff1 | ||
|
|
1cc012c7d1 | ||
|
|
28c6810878 | ||
|
|
1ed36fdff4 | ||
|
|
26801cf206 | ||
|
|
c80cebb824 | ||
|
|
3c6e8d6d01 | ||
|
|
76a53ab154 | ||
|
|
fa3e387dd1 | ||
|
|
dca626bbcb | ||
|
|
3289ad2817 | ||
|
|
5a022a2246 | ||
|
|
b012c5b2aa | ||
|
|
a861f8d9d4 | ||
|
|
36669c80da | ||
|
|
2ff128f184 | ||
|
|
3b44aba341 | ||
|
|
978be4e383 | ||
|
|
d4cdfcc48c | ||
|
|
5123ab0720 | ||
|
|
5021a1e1f3 | ||
|
|
576281a612 | ||
|
|
b84c0aba59 | ||
|
|
ee503a378e | ||
|
|
f235037cb9 | ||
|
|
0cd1cd97a6 | ||
|
|
74513f1b5c | ||
|
|
231c5bfea7 | ||
|
|
cfd0e4ba85 | ||
|
|
bf33e4ed4f | ||
|
|
6290db035d | ||
|
|
cd1935be1d | ||
|
|
64262d6ecc | ||
|
|
270c69344f | ||
|
|
10a0793af7 | ||
|
|
1b37af321f | ||
|
|
7cde279be1 | ||
|
|
0396741f3d | ||
|
|
117cf8888a | ||
|
|
83db7b32e8 | ||
|
|
d496d3d16e | ||
|
|
6b801247ab | ||
|
|
4c6cd31bfc | ||
|
|
a8ef096f24 | ||
|
|
c8d2a7e833 | ||
|
|
783391838b | ||
|
|
7c37d8b204 | ||
|
|
65ed8825b0 | ||
|
|
af9324dd5f | ||
|
|
064f727676 | ||
|
|
8025862fb9 | ||
|
|
2544ec5587 | ||
|
|
6c823b0137 | ||
|
|
88d44fa654 | ||
|
|
8b6f9f9de7 | ||
|
|
cb14961dcd | ||
|
|
dab486ec99 | ||
|
|
75849fbfb5 | ||
|
|
f984ff044b | ||
|
|
aaf5f295da | ||
|
|
8f612f2017 | ||
|
|
a2808163a7 | ||
|
|
e4aa23ce3d | ||
|
|
1b3cac9424 | ||
|
|
e49020b905 | ||
|
|
d68dcaf69a | ||
|
|
856c3578f6 | ||
|
|
18c6ea39ce | ||
|
|
1ce46c016c | ||
|
|
296944c23c | ||
|
|
4f772fecdc | ||
|
|
cdd22444b9 | ||
|
|
15848bc8c4 | ||
|
|
9eba6d607c | ||
|
|
e9d3c7c2e7 | ||
|
|
ad16c6d44f | ||
|
|
2046958bd6 | ||
|
|
0046533d53 | ||
|
|
ce7e152e13 | ||
|
|
edcdc057e6 | ||
|
|
cfa851beea | ||
|
|
f5d8efe86e | ||
|
|
7c8e5033ec | ||
|
|
22ec94b374 | ||
|
|
5cd3a172f1 | ||
|
|
a89a3b38ce | ||
|
|
3202702612 | ||
|
|
725e32f439 | ||
|
|
7da1905ad3 | ||
|
|
421005a3b6 | ||
|
|
d5bf28f799 | ||
|
|
990f748e42 | ||
|
|
a466365949 | ||
|
|
b12f71c430 | ||
|
|
236a69e5dc | ||
|
|
9458243926 | ||
|
|
41274e7801 | ||
|
|
0259e41ce8 | ||
|
|
e78f9cbd46 | ||
|
|
9d6851adec | ||
|
|
4668f072af | ||
|
|
a1a414925f | ||
|
|
19eb9dca30 | ||
|
|
8464a2ba43 | ||
|
|
a8549e2b7d | ||
|
|
2531a25c9e | ||
|
|
2f7b7eeddd | ||
|
|
ab1ec54c03 | ||
|
|
a1ca605206 | ||
|
|
a7b444dfea | ||
|
|
64b35b9cb3 | ||
|
|
4a8d52b328 | ||
|
|
3cbf6fff90 | ||
|
|
2693e76483 | ||
|
|
b232a5da37 | ||
|
|
e50fc00583 | ||
|
|
4b8802af37 | ||
|
|
ebd69fd10d | ||
|
|
c1a8c08880 | ||
|
|
647fb6acbf | ||
|
|
ede692ea2a | ||
|
|
ca44e2762b | ||
|
|
eda70742eb | ||
|
|
b81e3e9e6d | ||
|
|
e766eaeccc | ||
|
|
bab61271f2 | ||
|
|
b1465d89a6 | ||
|
|
05b1ddf013 | ||
|
|
903e8711f7 | ||
|
|
31b93fb42c | ||
|
|
e16bbfc2b9 | ||
|
|
220e004d73 | ||
|
|
3136861b24 | ||
|
|
dc2693bead | ||
|
|
d7da8c4253 | ||
|
|
c1ff5831ad | ||
|
|
ac5646075b | ||
|
|
5a1faba796 | ||
|
|
4ab16cb276 | ||
|
|
eb1e885c0a | ||
|
|
00ff9a11b8 | ||
|
|
8eabc024bf | ||
|
|
a848af0753 | ||
|
|
f4e7a3a314 | ||
|
|
d83283c709 | ||
|
|
a35112a6f3 | ||
|
|
66c012a30d | ||
|
|
7b92b7853d | ||
|
|
6c9f10e6a8 | ||
|
|
6db2c4465d | ||
|
|
c0cc960df5 | ||
|
|
968240ad44 | ||
|
|
50f3016711 | ||
|
|
56e2b06e9d | ||
|
|
c02f69720a | ||
|
|
96df7d1e42 | ||
|
|
1d4caf7588 | ||
|
|
b0e3201d3c | ||
|
|
bab097958f | ||
|
|
f4a3f6d433 | ||
|
|
e73ab89a18 | ||
|
|
187643f6ae | ||
|
|
3c9bdb2915 | ||
|
|
5241642447 | ||
|
|
3b2cbea1c4 | ||
|
|
80e3da49cb | ||
|
|
1df7a12587 | ||
|
|
663a59bd71 | ||
|
|
ced859424b | ||
|
|
4a6377c204 | ||
|
|
fd22558207 | ||
|
|
a6faadea48 | ||
|
|
42a26100b7 | ||
|
|
e8f4770abe | ||
|
|
7751d4ee88 | ||
|
|
cdd829e7be | ||
|
|
16bf3a89b5 | ||
|
|
11cdae098b | ||
|
|
a63ee3fa8b | ||
|
|
5cc023d1fe | ||
|
|
c4084156ac | ||
|
|
302018feff | ||
|
|
c50f6b72e7 | ||
|
|
c0401447dd | ||
|
|
43680c2fc3 | ||
|
|
2c92bb9d61 | ||
|
|
dcf1a56756 | ||
|
|
5990ab1cc9 | ||
|
|
084499fa0e | ||
|
|
74e84a73dd | ||
|
|
96b0393f91 | ||
|
|
0656c33e05 | ||
|
|
ec1ab49b54 | ||
|
|
1daa2857b2 | ||
|
|
8c55541d0e | ||
|
|
c5a4776b3a | ||
|
|
8bb9f0d7c0 | ||
|
|
7d83c251a8 | ||
|
|
ee3ead9aac | ||
|
|
54896e0e31 | ||
|
|
016198e7f2 | ||
|
|
0933eef4c3 | ||
|
|
fe55555c67 | ||
|
|
bcf8973eed | ||
|
|
50d2e42cc3 | ||
|
|
261d1cbeba | ||
|
|
242462b9ba | ||
|
|
fd4e478dbf | ||
|
|
6b91e68668 | ||
|
|
7516d2af56 | ||
|
|
c247a98402 | ||
|
|
83bcd55a7a | ||
|
|
5a43936e35 | ||
|
|
35b776179e | ||
|
|
f4cb6df8d4 | ||
|
|
a259b88f1d | ||
|
|
5b4f3d1c98 | ||
|
|
c62c21c386 | ||
|
|
17c56a11bd | ||
|
|
796561b8b6 | ||
|
|
209b7a64ed | ||
|
|
8f56299380 | ||
|
|
73b1394ca7 | ||
|
|
f3a2cf7284 | ||
|
|
df79c765f8 | ||
|
|
d09737c218 | ||
|
|
6b0c42ae50 | ||
|
|
7363da1b54 | ||
|
|
684f19c060 | ||
|
|
d08e4db0eb | ||
|
|
f1e7d8bd06 | ||
|
|
1328ac061e | ||
|
|
391f0fc9af | ||
|
|
38cf5be738 | ||
|
|
1bb70b8697 | ||
|
|
6e35b80daf | ||
|
|
a171c22ce4 | ||
|
|
f56457bc28 | ||
|
|
9708de70c7 | ||
|
|
d68589bb70 | ||
|
|
16eb38782a | ||
|
|
2175e9c0d6 | ||
|
|
9abd71f681 | ||
|
|
d1dc829136 | ||
|
|
eda672bdc6 | ||
|
|
0e5dbbea79 | ||
|
|
f5809ef302 | ||
|
|
457ce1ece1 | ||
|
|
9c9841332f | ||
|
|
9470d3a2ef | ||
|
|
8356271f8d | ||
|
|
42a6f3272d | ||
|
|
362b242c41 | ||
|
|
7ace7b49ca | ||
|
|
7cd902e924 | ||
|
|
e3c14678e2 | ||
|
|
bfaca75a7d | ||
|
|
5aecd8c255 | ||
|
|
cfc0f1a1f7 | ||
|
|
edf657c65c | ||
|
|
801d00fa26 | ||
|
|
eeffa31282 | ||
|
|
206528a530 | ||
|
|
41690fdf7b | ||
|
|
5b83f8e45b | ||
|
|
94863ed8ae | ||
|
|
e63b99c890 | ||
|
|
e8542743b4 | ||
|
|
309e1208c2 | ||
|
|
3e0db05664 | ||
|
|
9573d92cc0 | ||
|
|
1abc0dcb6a | ||
|
|
770fb3228f | ||
|
|
d6aa251c5e | ||
|
|
9305b870d2 | ||
|
|
824a98d7a8 | ||
|
|
7a55ba105c | ||
|
|
122425338e | ||
|
|
1d7f874a78 | ||
|
|
afb63a7331 | ||
|
|
0c07a660ee | ||
|
|
8ffda53e3d | ||
|
|
5a30c08ff6 | ||
|
|
9cac2674c4 | ||
|
|
ec3f43c69f | ||
|
|
270dfab6a2 | ||
|
|
624b1f5647 | ||
|
|
84332a3ebf | ||
|
|
63ff79ef0b | ||
|
|
09452444d7 | ||
|
|
75be2fc0ba | ||
|
|
1e0a0f8dc5 | ||
|
|
f3d9b9c5be | ||
|
|
cef0e444c9 | ||
|
|
bad8dc2220 | ||
|
|
e05d57d908 | ||
|
|
45c153f7a0 | ||
|
|
0948f418cd | ||
|
|
d027113b0b | ||
|
|
ff00c2fb15 | ||
|
|
cd5b4ee1be | ||
|
|
ac337b8459 | ||
|
|
567f7cbc29 | ||
|
|
d81ffcf119 | ||
|
|
6ed66a70a2 | ||
|
|
9ed3b045f7 | ||
|
|
2d6653c14a | ||
|
|
ab0e7e735a | ||
|
|
3243555d3f | ||
|
|
8696ce0cc1 | ||
|
|
459ff26868 | ||
|
|
277eb2d09f | ||
|
|
187093fa5a | ||
|
|
6c9ce55759 | ||
|
|
f9721e501a | ||
|
|
23c22651be | ||
|
|
2ad81ca499 | ||
|
|
7792381c36 | ||
|
|
591dd128ce | ||
|
|
ce10390406 | ||
|
|
bf299e5f8d | ||
|
|
7f98e703f1 | ||
|
|
421d27f640 | ||
|
|
fb1e95ab87 | ||
|
|
3737592734 | ||
|
|
6445cf01a2 | ||
|
|
8e07b93eac | ||
|
|
23f6752362 | ||
|
|
19b870c038 | ||
|
|
ca7f15e622 | ||
|
|
d497bb25f3 | ||
|
|
29d694722b | ||
|
|
40ffef035b | ||
|
|
a00c198bcc | ||
|
|
717842b276 | ||
|
|
d5c4c34759 | ||
|
|
edb0032118 | ||
|
|
123144d06e | ||
|
|
38f5d45d5b | ||
|
|
bcaf808b88 | ||
|
|
7b8db597ef | ||
|
|
18e192b235 | ||
|
|
5ad30277ba | ||
|
|
2e998dc315 | ||
|
|
cda1658541 | ||
|
|
8b640912c3 | ||
|
|
81a773b861 | ||
|
|
444cc43971 | ||
|
|
eb86d59203 | ||
|
|
5ee35f3fbb | ||
|
|
9a91145f89 | ||
|
|
637081ebdd | ||
|
|
7d2746e7be | ||
|
|
c84a92c787 | ||
|
|
b775aaa274 | ||
|
|
a97d7abc24 | ||
|
|
7e73db505b | ||
|
|
a126906776 | ||
|
|
2d6092c114 | ||
|
|
caef309547 | ||
|
|
f9ec21a2b5 | ||
|
|
06600b2a94 | ||
|
|
3f39ec0ae0 | ||
|
|
cfc45cf068 | ||
|
|
45d809a641 | ||
|
|
fcfbc5e17c | ||
|
|
f30c66424c | ||
|
|
f823fc6ee0 | ||
|
|
aac291c0c6 | ||
|
|
61adeeeda3 | ||
|
|
f94a5eed61 | ||
|
|
0695c48e7a | ||
|
|
f4bfcf58fd | ||
|
|
dee7307adc | ||
|
|
114032a743 | ||
|
|
e9e6a63e6a | ||
|
|
2a4f6020c2 | ||
|
|
3ea8b3737f | ||
|
|
ed47b4b3db | ||
|
|
adc89feda9 | ||
|
|
32c9a59ff0 | ||
|
|
200c1dac85 | ||
|
|
cf65c2af15 | ||
|
|
fb6ebc42a5 | ||
|
|
c7696c375e | ||
|
|
337e1a837f | ||
|
|
495a9fd3a0 | ||
|
|
e6f7493ddd | ||
|
|
76e75505e5 | ||
|
|
dafbd3f368 | ||
|
|
11ec70441a | ||
|
|
d1a18913f3 | ||
|
|
775b9e9fde | ||
|
|
286e34e057 | ||
|
|
da2aa00442 | ||
|
|
ba90176bb1 | ||
|
|
cf9248ecc8 | ||
|
|
0d42b12658 | ||
|
|
2f6d9b640f | ||
|
|
04923b65b2 | ||
|
|
2328f9a36b | ||
|
|
98971736f8 | ||
|
|
ec809085b4 | ||
|
|
af023c1994 | ||
|
|
d9b7cc18f3 | ||
|
|
ce1121a4c2 | ||
|
|
5fa75bf6b9 | ||
|
|
5cb1036618 | ||
|
|
9473dc2069 | ||
|
|
81f5184b43 | ||
|
|
b6bc22f991 | ||
|
|
56fad29df9 | ||
|
|
dfeea53cf6 | ||
|
|
71e6369960 | ||
|
|
0611db78b3 | ||
|
|
8c768cc517 | ||
|
|
b67750d808 | ||
|
|
96f2ad06e2 | ||
|
|
5cf4833455 | ||
|
|
f578fcfdc7 | ||
|
|
9838e1af19 | ||
|
|
cee443e28d | ||
|
|
1fe57cab67 | ||
|
|
80b22a8444 | ||
|
|
71733babf8 | ||
|
|
9f793d6cf7 | ||
|
|
46e73a108f | ||
|
|
b13ddc958b | ||
|
|
ba3954ad3f | ||
|
|
f2e417b21f | ||
|
|
d93d0afdf3 | ||
|
|
207c9ed62e | ||
|
|
e3f4aa3d64 | ||
|
|
2392c9dc8e | ||
|
|
682c1f5ef2 |
1
.github/workflows/build-docs.yml
vendored
1
.github/workflows/build-docs.yml
vendored
@@ -57,6 +57,7 @@ jobs:
|
||||
|
||||
- name: Update apt-get (needed for act docker image)
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/microsoft-prod.list
|
||||
sudo apt-get -qq update
|
||||
|
||||
- name: Install tree
|
||||
|
||||
3
.github/workflows/build-includes.yml
vendored
3
.github/workflows/build-includes.yml
vendored
@@ -47,6 +47,7 @@ jobs:
|
||||
|
||||
- name: Update apt-get (needed for act docker image)
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/microsoft-prod.list
|
||||
sudo apt-get -qq update
|
||||
|
||||
- name: Install tree
|
||||
@@ -107,7 +108,7 @@ jobs:
|
||||
- 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
|
||||
#########################################################################
|
||||
|
||||
10
.github/workflows/gh-pages.yml
vendored
10
.github/workflows/gh-pages.yml
vendored
@@ -33,7 +33,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
@@ -43,7 +43,7 @@ jobs:
|
||||
working-directory: docs/
|
||||
- name: Setup Pages
|
||||
id: pages
|
||||
uses: actions/configure-pages@v3
|
||||
uses: actions/configure-pages@v4
|
||||
- name: Build with Jekyll
|
||||
# Outputs to the './_site' directory by default
|
||||
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
|
||||
@@ -52,7 +52,7 @@ jobs:
|
||||
working-directory: docs/
|
||||
- name: Upload artifact
|
||||
# Automatically uploads an artifact from the './_site' directory by default
|
||||
uses: actions/upload-pages-artifact@v1
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: docs/_site/
|
||||
|
||||
@@ -66,13 +66,13 @@ jobs:
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v1
|
||||
uses: actions/deploy-pages@v4
|
||||
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
needs: deploy
|
||||
steps:
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
- 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
|
||||
|
||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -28,6 +28,13 @@ local.properties
|
||||
.buildpath
|
||||
|
||||
|
||||
#####################
|
||||
## Visual Studio Code
|
||||
#####################
|
||||
*.code-workspace
|
||||
.vscode/
|
||||
|
||||
|
||||
#################
|
||||
## Visual Studio
|
||||
#################
|
||||
|
||||
@@ -1151,14 +1151,14 @@ do -- AI_A2A_DISPATCHER
|
||||
|
||||
local AirbaseName = EventData.PlaceName -- The name of the airbase that was captured.
|
||||
|
||||
self:I( "Captured " .. AirbaseName )
|
||||
self:T( "Captured " .. AirbaseName )
|
||||
|
||||
-- Now search for all squadrons located at the airbase, and sanitize them.
|
||||
for SquadronName, Squadron in pairs( self.DefenderSquadrons ) do
|
||||
if Squadron.AirbaseName == AirbaseName then
|
||||
Squadron.ResourceCount = -999 -- The base has been captured, and the resources are eliminated. No more spawning.
|
||||
Squadron.Captured = true
|
||||
self:I( "Squadron " .. SquadronName .. " captured." )
|
||||
self:T( "Squadron " .. SquadronName .. " captured." )
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1828,7 +1828,7 @@ do -- AI_A2A_DISPATCHER
|
||||
|
||||
self:SetSquadronCapInterval( SquadronName, self.DefenderDefault.CapLimit, self.DefenderDefault.CapMinSeconds, self.DefenderDefault.CapMaxSeconds, 1 )
|
||||
|
||||
self:I( { CAP = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, Zone, PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageAltType } } )
|
||||
self:T( { CAP = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, Zone, PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageAltType } } )
|
||||
|
||||
-- Add the CAP to the EWR network.
|
||||
|
||||
@@ -2085,7 +2085,7 @@ do -- AI_A2A_DISPATCHER
|
||||
Intercept.EngageCeilingAltitude = EngageCeilingAltitude
|
||||
Intercept.EngageAltType = EngageAltType
|
||||
|
||||
self:I( { GCI = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||
self:T( { GCI = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||
end
|
||||
|
||||
--- Set squadron GCI.
|
||||
@@ -3000,17 +3000,17 @@ do -- AI_A2A_DISPATCHER
|
||||
for FriendlyDistance, AIFriendly in UTILS.spairs( DefenderFriendlies or {} ) do
|
||||
-- We only allow to ENGAGE targets as long as the Units on both sides are balanced.
|
||||
if AttackerCount > DefenderCount then
|
||||
--self:I("***** AI_A2A_DISPATCHER:CountDefendersToBeEngaged() *****\nThis is supposed to be a UNIT:")
|
||||
--self:T("***** AI_A2A_DISPATCHER:CountDefendersToBeEngaged() *****\nThis is supposed to be a UNIT:")
|
||||
if AIFriendly then
|
||||
local classname = AIFriendly.ClassName or "No Class Name"
|
||||
local unitname = AIFriendly.IdentifiableName or "No Unit Name"
|
||||
--self:I("Class Name: " .. classname)
|
||||
--self:I("Unit Name: " .. unitname)
|
||||
--self:I({AIFriendly})
|
||||
--self:T("Class Name: " .. classname)
|
||||
--self:T("Unit Name: " .. unitname)
|
||||
--self:T({AIFriendly})
|
||||
end
|
||||
local Friendly = nil
|
||||
if AIFriendly and AIFriendly:IsAlive() then
|
||||
--self:I("AIFriendly alive, getting GROUP")
|
||||
--self:T("AIFriendly alive, getting GROUP")
|
||||
Friendly = AIFriendly:GetGroup() -- Wrapper.Group#GROUP
|
||||
end
|
||||
|
||||
@@ -3952,7 +3952,7 @@ end
|
||||
|
||||
do
|
||||
|
||||
--- @type AI_A2A_GCICAP
|
||||
-- @type AI_A2A_GCICAP
|
||||
-- @extends #AI_A2A_DISPATCHER
|
||||
|
||||
--- Create an automatic air defence system for a coalition setting up GCI and CAP air defenses.
|
||||
@@ -4322,23 +4322,23 @@ do
|
||||
|
||||
-- Setup squadrons
|
||||
|
||||
self:I( { Airbases = AirbaseNames } )
|
||||
self:T( { Airbases = AirbaseNames } )
|
||||
|
||||
self:I( "Defining Templates for Airbases ..." )
|
||||
self:T( "Defining Templates for Airbases ..." )
|
||||
for AirbaseID, AirbaseName in pairs( AirbaseNames ) do
|
||||
local Airbase = _DATABASE:FindAirbase( AirbaseName ) -- Wrapper.Airbase#AIRBASE
|
||||
local AirbaseName = Airbase:GetName()
|
||||
local AirbaseCoord = Airbase:GetCoordinate()
|
||||
local AirbaseZone = ZONE_RADIUS:New( "Airbase", AirbaseCoord:GetVec2(), 3000 )
|
||||
local Templates = nil
|
||||
self:I( { Airbase = AirbaseName } )
|
||||
self:T( { Airbase = AirbaseName } )
|
||||
for TemplateID, Template in pairs( self.Templates:GetSet() ) do
|
||||
local Template = Template -- Wrapper.Group#GROUP
|
||||
local TemplateCoord = Template:GetCoordinate()
|
||||
if AirbaseZone:IsVec2InZone( TemplateCoord:GetVec2() ) then
|
||||
Templates = Templates or {}
|
||||
table.insert( Templates, Template:GetName() )
|
||||
self:I( { Template = Template:GetName() } )
|
||||
self:T( { Template = Template:GetName() } )
|
||||
end
|
||||
end
|
||||
if Templates then
|
||||
@@ -4354,13 +4354,13 @@ do
|
||||
self.CAPTemplates:FilterPrefixes( CapPrefixes )
|
||||
self.CAPTemplates:FilterOnce()
|
||||
|
||||
self:I( "Setting up CAP ..." )
|
||||
self:T( "Setting up CAP ..." )
|
||||
for CAPID, CAPTemplate in pairs( self.CAPTemplates:GetSet() ) do
|
||||
local CAPZone = ZONE_POLYGON:New( CAPTemplate:GetName(), CAPTemplate )
|
||||
-- Now find the closest airbase from the ZONE (start or center)
|
||||
local AirbaseDistance = 99999999
|
||||
local AirbaseClosest = nil -- Wrapper.Airbase#AIRBASE
|
||||
self:I( { CAPZoneGroup = CAPID } )
|
||||
self:T( { CAPZoneGroup = CAPID } )
|
||||
for AirbaseID, AirbaseName in pairs( AirbaseNames ) do
|
||||
local Airbase = _DATABASE:FindAirbase( AirbaseName ) -- Wrapper.Airbase#AIRBASE
|
||||
local AirbaseName = Airbase:GetName()
|
||||
@@ -4368,7 +4368,7 @@ do
|
||||
local Squadron = self.DefenderSquadrons[AirbaseName]
|
||||
if Squadron then
|
||||
local Distance = AirbaseCoord:Get2DDistance( CAPZone:GetCoordinate() )
|
||||
self:I( { AirbaseDistance = Distance } )
|
||||
self:T( { AirbaseDistance = Distance } )
|
||||
if Distance < AirbaseDistance then
|
||||
AirbaseDistance = Distance
|
||||
AirbaseClosest = Airbase
|
||||
@@ -4376,7 +4376,7 @@ do
|
||||
end
|
||||
end
|
||||
if AirbaseClosest then
|
||||
self:I( { CAPAirbase = AirbaseClosest:GetName() } )
|
||||
self:T( { CAPAirbase = AirbaseClosest:GetName() } )
|
||||
self:SetSquadronCap( AirbaseClosest:GetName(), CAPZone, 6000, 10000, 500, 800, 800, 1200, "RADIO" )
|
||||
self:SetSquadronCapInterval( AirbaseClosest:GetName(), CapLimit, 300, 600, 1 )
|
||||
end
|
||||
@@ -4384,14 +4384,14 @@ do
|
||||
|
||||
-- Setup GCI.
|
||||
-- GCI is setup for all Squadrons.
|
||||
self:I( "Setting up GCI ..." )
|
||||
self:T( "Setting up GCI ..." )
|
||||
for AirbaseID, AirbaseName in pairs( AirbaseNames ) do
|
||||
local Airbase = _DATABASE:FindAirbase( AirbaseName ) -- Wrapper.Airbase#AIRBASE
|
||||
local AirbaseName = Airbase:GetName()
|
||||
local Squadron = self.DefenderSquadrons[AirbaseName]
|
||||
self:F( { Airbase = AirbaseName } )
|
||||
if Squadron then
|
||||
self:I( { GCIAirbase = AirbaseName } )
|
||||
self:T( { GCIAirbase = AirbaseName } )
|
||||
self:SetSquadronGci( AirbaseName, 800, 1200 )
|
||||
end
|
||||
end
|
||||
|
||||
@@ -904,14 +904,14 @@ do -- AI_A2G_DISPATCHER
|
||||
-- @type AI_A2G_DISPATCHER.DefenseCoordinates
|
||||
-- @map <#string,Core.Point#COORDINATE> A list of all defense coordinates mapped per defense coordinate name.
|
||||
|
||||
--- @field #AI_A2G_DISPATCHER.DefenseCoordinates DefenseCoordinates
|
||||
-- @field #AI_A2G_DISPATCHER.DefenseCoordinates DefenseCoordinates
|
||||
AI_A2G_DISPATCHER.DefenseCoordinates = {}
|
||||
|
||||
--- Enumerator for spawns at airbases.
|
||||
-- @type AI_A2G_DISPATCHER.Takeoff
|
||||
-- @extends Wrapper.Group#GROUP.Takeoff
|
||||
|
||||
--- @field #AI_A2G_DISPATCHER.Takeoff Takeoff
|
||||
-- @field #AI_A2G_DISPATCHER.Takeoff Takeoff
|
||||
AI_A2G_DISPATCHER.Takeoff = GROUP.Takeoff
|
||||
|
||||
--- Defines Landing location.
|
||||
@@ -942,7 +942,7 @@ do -- AI_A2G_DISPATCHER
|
||||
-- @type AI_A2G_DISPATCHER.DefenseQueue
|
||||
-- @list<#AI_A2G_DISPATCHER.DefenseQueueItem> DefenseQueueItem A list of all defenses being queued ...
|
||||
|
||||
--- @field #AI_A2G_DISPATCHER.DefenseQueue DefenseQueue
|
||||
-- @field #AI_A2G_DISPATCHER.DefenseQueue DefenseQueue
|
||||
AI_A2G_DISPATCHER.DefenseQueue = {}
|
||||
|
||||
--- Defense approach types.
|
||||
@@ -1136,7 +1136,7 @@ do -- AI_A2G_DISPATCHER
|
||||
end
|
||||
|
||||
|
||||
--- @param #AI_A2G_DISPATCHER self
|
||||
-- @param #AI_A2G_DISPATCHER self
|
||||
function AI_A2G_DISPATCHER:onafterStart( From, Event, To )
|
||||
|
||||
self:GetParent( self ).onafterStart( self, From, Event, To )
|
||||
@@ -1147,7 +1147,7 @@ do -- AI_A2G_DISPATCHER
|
||||
for Resource = 1, DefenderSquadron.ResourceCount or 0 do
|
||||
self:ResourcePark( DefenderSquadron )
|
||||
end
|
||||
self:I( "Parked resources for squadron " .. DefenderSquadron.Name )
|
||||
self:T( "Parked resources for squadron " .. DefenderSquadron.Name )
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1201,7 +1201,7 @@ do -- AI_A2G_DISPATCHER
|
||||
end
|
||||
|
||||
|
||||
--- @param #AI_A2G_DISPATCHER self
|
||||
-- @param #AI_A2G_DISPATCHER self
|
||||
function AI_A2G_DISPATCHER:ResourcePark( DefenderSquadron )
|
||||
local TemplateID = math.random( 1, #DefenderSquadron.Spawn )
|
||||
local Spawn = DefenderSquadron.Spawn[ TemplateID ] -- Core.Spawn#SPAWN
|
||||
@@ -1218,33 +1218,33 @@ do -- AI_A2G_DISPATCHER
|
||||
end
|
||||
|
||||
|
||||
--- @param #AI_A2G_DISPATCHER self
|
||||
-- @param #AI_A2G_DISPATCHER self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
function AI_A2G_DISPATCHER:OnEventBaseCaptured( EventData )
|
||||
|
||||
local AirbaseName = EventData.PlaceName -- The name of the airbase that was captured.
|
||||
|
||||
self:I( "Captured " .. AirbaseName )
|
||||
self:T( "Captured " .. AirbaseName )
|
||||
|
||||
-- Now search for all squadrons located at the airbase, and sanitize them.
|
||||
for SquadronName, Squadron in pairs( self.DefenderSquadrons ) do
|
||||
if Squadron.AirbaseName == AirbaseName then
|
||||
Squadron.ResourceCount = -999 -- The base has been captured, and the resources are eliminated. No more spawning.
|
||||
Squadron.Captured = true
|
||||
self:I( "Squadron " .. SquadronName .. " captured." )
|
||||
self:T( "Squadron " .. SquadronName .. " captured." )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--- @param #AI_A2G_DISPATCHER self
|
||||
-- @param #AI_A2G_DISPATCHER self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
function AI_A2G_DISPATCHER:OnEventCrashOrDead( EventData )
|
||||
self.Detection:ForgetDetectedUnit( EventData.IniUnitName )
|
||||
end
|
||||
|
||||
|
||||
--- @param #AI_A2G_DISPATCHER self
|
||||
-- @param #AI_A2G_DISPATCHER self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
function AI_A2G_DISPATCHER:OnEventLand( EventData )
|
||||
self:F( "Landed" )
|
||||
@@ -1261,7 +1261,7 @@ do -- AI_A2G_DISPATCHER
|
||||
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||
end
|
||||
DefenderUnit:Destroy()
|
||||
self:ResourcePark( Squadron, Defender )
|
||||
self:ResourcePark( Squadron )
|
||||
return
|
||||
end
|
||||
if DefenderUnit:GetLife() ~= DefenderUnit:GetLife0() then
|
||||
@@ -1273,7 +1273,7 @@ do -- AI_A2G_DISPATCHER
|
||||
end
|
||||
|
||||
|
||||
--- @param #AI_A2G_DISPATCHER self
|
||||
-- @param #AI_A2G_DISPATCHER self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
function AI_A2G_DISPATCHER:OnEventEngineShutdown( EventData )
|
||||
local DefenderUnit = EventData.IniUnit
|
||||
@@ -1289,7 +1289,7 @@ do -- AI_A2G_DISPATCHER
|
||||
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||
end
|
||||
DefenderUnit:Destroy()
|
||||
self:ResourcePark( Squadron, Defender )
|
||||
self:ResourcePark( Squadron )
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1297,7 +1297,7 @@ do -- AI_A2G_DISPATCHER
|
||||
|
||||
do -- Manage the defensive behaviour
|
||||
|
||||
--- @param #AI_A2G_DISPATCHER self
|
||||
-- @param #AI_A2G_DISPATCHER self
|
||||
-- @param #string DefenseCoordinateName The name of the coordinate to be defended by A2G defenses.
|
||||
-- @param Core.Point#COORDINATE DefenseCoordinate The coordinate to be defended by A2G defenses.
|
||||
function AI_A2G_DISPATCHER:AddDefenseCoordinate( DefenseCoordinateName, DefenseCoordinate )
|
||||
@@ -1305,19 +1305,19 @@ do -- AI_A2G_DISPATCHER
|
||||
end
|
||||
|
||||
|
||||
--- @param #AI_A2G_DISPATCHER self
|
||||
-- @param #AI_A2G_DISPATCHER self
|
||||
function AI_A2G_DISPATCHER:SetDefenseReactivityLow()
|
||||
self.DefenseReactivity = 0.05
|
||||
end
|
||||
|
||||
|
||||
--- @param #AI_A2G_DISPATCHER self
|
||||
-- @param #AI_A2G_DISPATCHER self
|
||||
function AI_A2G_DISPATCHER:SetDefenseReactivityMedium()
|
||||
self.DefenseReactivity = 0.15
|
||||
end
|
||||
|
||||
|
||||
--- @param #AI_A2G_DISPATCHER self
|
||||
-- @param #AI_A2G_DISPATCHER self
|
||||
function AI_A2G_DISPATCHER:SetDefenseReactivityHigh()
|
||||
self.DefenseReactivity = 0.5
|
||||
end
|
||||
@@ -1351,14 +1351,14 @@ do -- AI_A2G_DISPATCHER
|
||||
-- 1. the **distance of the closest airbase to target**, being smaller than the **Defend Radius**.
|
||||
-- 2. the **distance to any defense reference point**.
|
||||
--
|
||||
-- The **default** defense radius is defined as **400000** or **40km**. Override the default defense radius when the era of the warfare is early, or,
|
||||
-- The **default** defense radius is defined as **40000** or **40km**. Override the default defense radius when the era of the warfare is early, or,
|
||||
-- when you don't want to let the AI_A2G_DISPATCHER react immediately when a certain border or area is not being crossed.
|
||||
--
|
||||
-- Use the method @{#AI_A2G_DISPATCHER.SetDefendRadius}() to set a specific defend radius for all squadrons,
|
||||
-- **the Defense Radius is defined for ALL squadrons which are operational.**
|
||||
--
|
||||
-- @param #AI_A2G_DISPATCHER self
|
||||
-- @param #number DefenseRadius (Optional, Default = 200000) The defense radius to engage detected targets from the nearest capable and available squadron airbase.
|
||||
-- @param #number DefenseRadius (Optional, Default = 20000) The defense radius to engage detected targets from the nearest capable and available squadron airbase.
|
||||
-- @return #AI_A2G_DISPATCHER
|
||||
-- @usage
|
||||
--
|
||||
@@ -1373,7 +1373,7 @@ do -- AI_A2G_DISPATCHER
|
||||
--
|
||||
function AI_A2G_DISPATCHER:SetDefenseRadius( DefenseRadius )
|
||||
|
||||
self.DefenseRadius = DefenseRadius or 100000
|
||||
self.DefenseRadius = DefenseRadius or 40000
|
||||
|
||||
self.Detection:SetAcceptRange( self.DefenseRadius )
|
||||
|
||||
@@ -1868,7 +1868,7 @@ do -- AI_A2G_DISPATCHER
|
||||
end
|
||||
|
||||
|
||||
--- @param #AI_A2G_DISPATCHER self
|
||||
-- @param #AI_A2G_DISPATCHER self
|
||||
-- @param #string SquadronName The squadron name.
|
||||
-- @param #number TakeoffInterval Only Takeoff new units each specified interval in seconds in 10 seconds steps.
|
||||
-- @usage
|
||||
@@ -2144,7 +2144,7 @@ do -- AI_A2G_DISPATCHER
|
||||
Sead.EngageAltType = EngageAltType
|
||||
Sead.Defend = true
|
||||
|
||||
self:I( { SEAD = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||
self:T( { SEAD = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||
|
||||
return self
|
||||
end
|
||||
@@ -2234,7 +2234,7 @@ do -- AI_A2G_DISPATCHER
|
||||
|
||||
self:SetSquadronPatrolInterval( SquadronName, self.DefenderDefault.PatrolLimit, self.DefenderDefault.PatrolMinSeconds, self.DefenderDefault.PatrolMaxSeconds, 1, "SEAD" )
|
||||
|
||||
self:I( { SEAD = { Zone:GetName(), PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||
self:T( { SEAD = { Zone:GetName(), PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||
end
|
||||
|
||||
|
||||
@@ -2295,7 +2295,7 @@ do -- AI_A2G_DISPATCHER
|
||||
Cas.EngageAltType = EngageAltType
|
||||
Cas.Defend = true
|
||||
|
||||
self:I( { CAS = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||
self:T( { CAS = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||
|
||||
return self
|
||||
end
|
||||
@@ -2385,7 +2385,7 @@ do -- AI_A2G_DISPATCHER
|
||||
|
||||
self:SetSquadronPatrolInterval( SquadronName, self.DefenderDefault.PatrolLimit, self.DefenderDefault.PatrolMinSeconds, self.DefenderDefault.PatrolMaxSeconds, 1, "CAS" )
|
||||
|
||||
self:I( { CAS = { Zone:GetName(), PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||
self:T( { CAS = { Zone:GetName(), PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||
end
|
||||
|
||||
|
||||
@@ -2446,7 +2446,7 @@ do -- AI_A2G_DISPATCHER
|
||||
Bai.EngageAltType = EngageAltType
|
||||
Bai.Defend = true
|
||||
|
||||
self:I( { BAI = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||
self:T( { BAI = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||
|
||||
return self
|
||||
end
|
||||
@@ -2536,7 +2536,7 @@ do -- AI_A2G_DISPATCHER
|
||||
|
||||
self:SetSquadronPatrolInterval( SquadronName, self.DefenderDefault.PatrolLimit, self.DefenderDefault.PatrolMinSeconds, self.DefenderDefault.PatrolMaxSeconds, 1, "BAI" )
|
||||
|
||||
self:I( { BAI = { Zone:GetName(), PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||
self:T( { BAI = { Zone:GetName(), PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||
end
|
||||
|
||||
|
||||
@@ -3369,7 +3369,7 @@ do -- AI_A2G_DISPATCHER
|
||||
end
|
||||
|
||||
|
||||
--- @param #AI_A2G_DISPATCHER self
|
||||
-- @param #AI_A2G_DISPATCHER self
|
||||
function AI_A2G_DISPATCHER:AddDefenderToSquadron( Squadron, Defender, Size )
|
||||
self.Defenders = self.Defenders or {}
|
||||
local DefenderName = Defender:GetName()
|
||||
@@ -3380,7 +3380,7 @@ do -- AI_A2G_DISPATCHER
|
||||
self:F( { DefenderName = DefenderName, SquadronResourceCount = Squadron.ResourceCount } )
|
||||
end
|
||||
|
||||
--- @param #AI_A2G_DISPATCHER self
|
||||
-- @param #AI_A2G_DISPATCHER self
|
||||
function AI_A2G_DISPATCHER:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||
self.Defenders = self.Defenders or {}
|
||||
local DefenderName = Defender:GetName()
|
||||
@@ -3796,7 +3796,7 @@ do -- AI_A2G_DISPATCHER
|
||||
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
||||
end
|
||||
|
||||
--- @param #AI_A2G_DISPATCHER self
|
||||
-- @param #AI_A2G_DISPATCHER self
|
||||
function AI_A2G_Fsm:onafterLostControl( DefenderGroup, From, Event, To )
|
||||
self:F({"LostControl", DefenderGroup:GetName()})
|
||||
self:GetParent(self).onafterHome( self, DefenderGroup, From, Event, To )
|
||||
@@ -3813,7 +3813,7 @@ do -- AI_A2G_DISPATCHER
|
||||
end
|
||||
end
|
||||
|
||||
--- @param #AI_A2G_DISPATCHER self
|
||||
-- @param #AI_A2G_DISPATCHER self
|
||||
function AI_A2G_Fsm:onafterHome( DefenderGroup, From, Event, To, Action )
|
||||
self:F({"Home", DefenderGroup:GetName()})
|
||||
self:GetParent(self).onafterHome( self, DefenderGroup, From, Event, To )
|
||||
@@ -3894,7 +3894,7 @@ do -- AI_A2G_DISPATCHER
|
||||
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
||||
|
||||
if Squadron then
|
||||
local FirstUnit = AttackSetUnit:GetFirst()
|
||||
local FirstUnit = AttackSetUnit:GetRandomSurely()
|
||||
local Coordinate = FirstUnit:GetCoordinate() -- Core.Point#COORDINATE
|
||||
if self.SetSendPlayerMessages then
|
||||
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", on route to ground target at " .. Coordinate:ToStringA2G( DefenderGroup ), DefenderGroup )
|
||||
@@ -3933,7 +3933,7 @@ do -- AI_A2G_DISPATCHER
|
||||
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
||||
end
|
||||
|
||||
--- @param #AI_A2G_DISPATCHER self
|
||||
-- @param #AI_A2G_DISPATCHER self
|
||||
function AI_A2G_Fsm:onafterLostControl( DefenderGroup, From, Event, To )
|
||||
self:F({"Defender LostControl", DefenderGroup:GetName()})
|
||||
self:GetParent(self).onafterHome( self, DefenderGroup, From, Event, To )
|
||||
@@ -3950,7 +3950,7 @@ do -- AI_A2G_DISPATCHER
|
||||
end
|
||||
end
|
||||
|
||||
--- @param #AI_A2G_DISPATCHER self
|
||||
-- @param #AI_A2G_DISPATCHER self
|
||||
function AI_A2G_Fsm:onafterHome( DefenderGroup, From, Event, To, Action )
|
||||
self:F({"Defender Home", DefenderGroup:GetName()})
|
||||
self:GetParent(self).onafterHome( self, DefenderGroup, From, Event, To )
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
-- @module AI.AI_Air
|
||||
-- @image MOOSE.JPG
|
||||
|
||||
--- @type AI_AIR
|
||||
-- @type AI_AIR
|
||||
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
||||
|
||||
--- The AI_AIR class implements the core functions to operate an AI @{Wrapper.Group}.
|
||||
@@ -264,7 +264,7 @@ function AI_AIR:New( AIGroup )
|
||||
return self
|
||||
end
|
||||
|
||||
--- @param Wrapper.Group#GROUP self
|
||||
-- @param Wrapper.Group#GROUP self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
function GROUP:OnEventTakeoff( EventData, Fsm )
|
||||
Fsm:Takeoff()
|
||||
@@ -446,13 +446,13 @@ function AI_AIR:onafterReturn( Controllable, From, Event, To )
|
||||
|
||||
end
|
||||
|
||||
--- @param #AI_AIR self
|
||||
-- @param #AI_AIR self
|
||||
function AI_AIR:onbeforeStatus()
|
||||
|
||||
return self.CheckStatus
|
||||
end
|
||||
|
||||
--- @param #AI_AIR self
|
||||
-- @param #AI_AIR self
|
||||
function AI_AIR:onafterStatus()
|
||||
|
||||
if self.Controllable and self.Controllable:IsAlive() then
|
||||
@@ -465,7 +465,7 @@ function AI_AIR:onafterStatus()
|
||||
local DistanceFromHomeBase = self.HomeAirbase:GetCoordinate():Get2DDistance( self.Controllable:GetCoordinate() )
|
||||
|
||||
if DistanceFromHomeBase > self.DisengageRadius then
|
||||
self:I( self.Controllable:GetName() .. " is too far from home base, RTB!" )
|
||||
self:T( self.Controllable:GetName() .. " is too far from home base, RTB!" )
|
||||
self:Hold( 300 )
|
||||
RTB = false
|
||||
end
|
||||
@@ -489,10 +489,10 @@ function AI_AIR:onafterStatus()
|
||||
if Fuel < self.FuelThresholdPercentage then
|
||||
|
||||
if self.TankerName then
|
||||
self:I( self.Controllable:GetName() .. " is out of fuel: " .. Fuel .. " ... Refuelling at Tanker!" )
|
||||
self:T( self.Controllable:GetName() .. " is out of fuel: " .. Fuel .. " ... Refuelling at Tanker!" )
|
||||
self:Refuel()
|
||||
else
|
||||
self:I( self.Controllable:GetName() .. " is out of fuel: " .. Fuel .. " ... RTB!" )
|
||||
self:T( self.Controllable:GetName() .. " is out of fuel: " .. Fuel .. " ... RTB!" )
|
||||
local OldAIControllable = self.Controllable
|
||||
|
||||
local OrbitTask = OldAIControllable:TaskOrbitCircle( math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude ), self.PatrolMinSpeed )
|
||||
@@ -518,7 +518,7 @@ function AI_AIR:onafterStatus()
|
||||
-- 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.
|
||||
if ( Damage / InitialLife ) < self.PatrolDamageThreshold then
|
||||
self:I( self.Controllable:GetName() .. " is damaged: " .. Damage .. " ... RTB!" )
|
||||
self:T( self.Controllable:GetName() .. " is damaged: " .. Damage .. " ... RTB!" )
|
||||
self:Damaged()
|
||||
RTB = true
|
||||
self:SetStatusOff()
|
||||
@@ -536,7 +536,7 @@ function AI_AIR:onafterStatus()
|
||||
if Damage ~= InitialLife then
|
||||
self:Damaged()
|
||||
else
|
||||
self:I( self.Controllable:GetName() .. " control lost! " )
|
||||
self:T( self.Controllable:GetName() .. " control lost! " )
|
||||
|
||||
self:LostControl()
|
||||
end
|
||||
@@ -560,7 +560,7 @@ function AI_AIR:onafterStatus()
|
||||
end
|
||||
|
||||
|
||||
--- @param Wrapper.Group#GROUP AIGroup
|
||||
-- @param Wrapper.Group#GROUP AIGroup
|
||||
function AI_AIR.RTBRoute( AIGroup, Fsm )
|
||||
|
||||
AIGroup:F( { "AI_AIR.RTBRoute:", AIGroup:GetName() } )
|
||||
@@ -571,7 +571,7 @@ function AI_AIR.RTBRoute( AIGroup, Fsm )
|
||||
|
||||
end
|
||||
|
||||
--- @param Wrapper.Group#GROUP AIGroup
|
||||
-- @param Wrapper.Group#GROUP AIGroup
|
||||
function AI_AIR.RTBHold( AIGroup, Fsm )
|
||||
|
||||
AIGroup:F( { "AI_AIR.RTBHold:", AIGroup:GetName() } )
|
||||
@@ -598,7 +598,7 @@ function AI_AIR:SetRTBSpeedFactors(MinFactor,MaxFactor)
|
||||
end
|
||||
|
||||
|
||||
--- @param #AI_AIR self
|
||||
-- @param #AI_AIR self
|
||||
-- @param Wrapper.Group#GROUP AIGroup
|
||||
function AI_AIR:onafterRTB( AIGroup, From, Event, To )
|
||||
self:F( { AIGroup, From, Event, To } )
|
||||
@@ -617,7 +617,10 @@ function AI_AIR:onafterRTB( AIGroup, From, Event, To )
|
||||
--- Calculate the target route point.
|
||||
|
||||
local FromCoord = AIGroup:GetCoordinate()
|
||||
if not FromCoord then return end
|
||||
|
||||
local ToTargetCoord = self.HomeAirbase:GetCoordinate() -- coordinate is on land height(!)
|
||||
|
||||
local ToTargetVec3 = ToTargetCoord:GetVec3()
|
||||
ToTargetVec3.y = ToTargetCoord:GetLandHeight()+3000 -- let's set this 1000m/3000 feet above ground
|
||||
local ToTargetCoord2 = COORDINATE:NewFromVec3( ToTargetVec3 )
|
||||
@@ -638,13 +641,13 @@ function AI_AIR:onafterRTB( AIGroup, From, Event, To )
|
||||
local ToAirbaseCoord = ToTargetCoord2
|
||||
|
||||
if Distance < 5000 then
|
||||
self:I( "RTB and near the airbase!" )
|
||||
self:T( "RTB and near the airbase!" )
|
||||
self:Home()
|
||||
return
|
||||
end
|
||||
|
||||
if not AIGroup:InAir() == true then
|
||||
self:I( "Not anymore in the air, considered Home." )
|
||||
self:T( "Not anymore in the air, considered Home." )
|
||||
self:Home()
|
||||
return
|
||||
end
|
||||
@@ -686,12 +689,12 @@ function AI_AIR:onafterRTB( AIGroup, From, Event, To )
|
||||
|
||||
end
|
||||
|
||||
--- @param #AI_AIR self
|
||||
-- @param #AI_AIR self
|
||||
-- @param Wrapper.Group#GROUP AIGroup
|
||||
function AI_AIR:onafterHome( AIGroup, From, Event, To )
|
||||
self:F( { AIGroup, From, Event, To } )
|
||||
|
||||
self:I( "Group " .. self.Controllable:GetName() .. " ... Home! ( " .. self:GetState() .. " )" )
|
||||
self:T( "Group " .. self.Controllable:GetName() .. " ... Home! ( " .. self:GetState() .. " )" )
|
||||
|
||||
if AIGroup and AIGroup:IsAlive() then
|
||||
end
|
||||
@@ -700,15 +703,17 @@ end
|
||||
|
||||
|
||||
|
||||
--- @param #AI_AIR self
|
||||
-- @param #AI_AIR self
|
||||
-- @param Wrapper.Group#GROUP AIGroup
|
||||
function AI_AIR:onafterHold( AIGroup, From, Event, To, HoldTime )
|
||||
self:F( { AIGroup, From, Event, To } )
|
||||
|
||||
self:I( "Group " .. self.Controllable:GetName() .. " ... Holding! ( " .. self:GetState() .. " )" )
|
||||
self:T( "Group " .. self.Controllable:GetName() .. " ... Holding! ( " .. self:GetState() .. " )" )
|
||||
|
||||
if AIGroup and AIGroup:IsAlive() then
|
||||
local OrbitTask = AIGroup:TaskOrbitCircle( math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude ), self.PatrolMinSpeed )
|
||||
local Coordinate = AIGroup:GetCoordinate()
|
||||
if Coordinate == nil then return end
|
||||
local OrbitTask = AIGroup:TaskOrbitCircle( math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude ), self.PatrolMinSpeed, Coordinate )
|
||||
local TimedOrbitTask = AIGroup:TaskControlled( OrbitTask, AIGroup:TaskCondition( nil, nil, nil, nil, HoldTime , nil ) )
|
||||
|
||||
local RTBTask = AIGroup:TaskFunction( "AI_AIR.RTBHold", self )
|
||||
@@ -722,17 +727,17 @@ function AI_AIR:onafterHold( AIGroup, From, Event, To, HoldTime )
|
||||
|
||||
end
|
||||
|
||||
--- @param Wrapper.Group#GROUP AIGroup
|
||||
-- @param Wrapper.Group#GROUP AIGroup
|
||||
function AI_AIR.Resume( AIGroup, Fsm )
|
||||
|
||||
AIGroup:I( { "AI_AIR.Resume:", AIGroup:GetName() } )
|
||||
AIGroup:T( { "AI_AIR.Resume:", AIGroup:GetName() } )
|
||||
if AIGroup:IsAlive() then
|
||||
Fsm:__RTB( Fsm.TaskDelay )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--- @param #AI_AIR self
|
||||
-- @param #AI_AIR self
|
||||
-- @param Wrapper.Group#GROUP AIGroup
|
||||
function AI_AIR:onafterRefuel( AIGroup, From, Event, To )
|
||||
self:F( { AIGroup, From, Event, To } )
|
||||
@@ -744,7 +749,7 @@ function AI_AIR:onafterRefuel( AIGroup, From, Event, To )
|
||||
|
||||
if Tanker and Tanker:IsAlive() and Tanker:IsAirPlane() then
|
||||
|
||||
self:I( "Group " .. self.Controllable:GetName() .. " ... Refuelling! State=" .. self:GetState() .. ", Refuelling tanker " .. self.TankerName )
|
||||
self:T( "Group " .. self.Controllable:GetName() .. " ... Refuelling! State=" .. self:GetState() .. ", Refuelling tanker " .. self.TankerName )
|
||||
|
||||
local RefuelRoute = {}
|
||||
|
||||
@@ -798,13 +803,13 @@ end
|
||||
|
||||
|
||||
|
||||
--- @param #AI_AIR self
|
||||
-- @param #AI_AIR self
|
||||
function AI_AIR:onafterDead()
|
||||
self:SetStatusOff()
|
||||
end
|
||||
|
||||
|
||||
--- @param #AI_AIR self
|
||||
-- @param #AI_AIR self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
function AI_AIR:OnCrash( EventData )
|
||||
|
||||
@@ -815,7 +820,7 @@ function AI_AIR:OnCrash( EventData )
|
||||
end
|
||||
end
|
||||
|
||||
--- @param #AI_AIR self
|
||||
-- @param #AI_AIR self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
function AI_AIR:OnEjection( EventData )
|
||||
|
||||
@@ -824,7 +829,7 @@ function AI_AIR:OnEjection( EventData )
|
||||
end
|
||||
end
|
||||
|
||||
--- @param #AI_AIR self
|
||||
-- @param #AI_AIR self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
function AI_AIR:OnPilotDead( EventData )
|
||||
|
||||
|
||||
@@ -900,14 +900,14 @@ do -- AI_AIR_DISPATCHER
|
||||
-- @type AI_AIR_DISPATCHER.DefenseCoordinates
|
||||
-- @map <#string,Core.Point#COORDINATE> A list of all defense coordinates mapped per defense coordinate name.
|
||||
|
||||
--- @field #AI_AIR_DISPATCHER.DefenseCoordinates DefenseCoordinates
|
||||
-- @field #AI_AIR_DISPATCHER.DefenseCoordinates DefenseCoordinates
|
||||
AI_AIR_DISPATCHER.DefenseCoordinates = {}
|
||||
|
||||
--- Enumerator for spawns at airbases
|
||||
-- @type AI_AIR_DISPATCHER.Takeoff
|
||||
-- @extends Wrapper.Group#GROUP.Takeoff
|
||||
|
||||
--- @field #AI_AIR_DISPATCHER.Takeoff Takeoff
|
||||
-- @field #AI_AIR_DISPATCHER.Takeoff Takeoff
|
||||
AI_AIR_DISPATCHER.Takeoff = GROUP.Takeoff
|
||||
|
||||
--- Defnes Landing location.
|
||||
@@ -938,7 +938,7 @@ do -- AI_AIR_DISPATCHER
|
||||
-- @type AI_AIR_DISPATCHER.DefenseQueue
|
||||
-- @list<#AI_AIR_DISPATCHER.DefenseQueueItem> DefenseQueueItem A list of all defenses being queued ...
|
||||
|
||||
--- @field #AI_AIR_DISPATCHER.DefenseQueue DefenseQueue
|
||||
-- @field #AI_AIR_DISPATCHER.DefenseQueue DefenseQueue
|
||||
AI_AIR_DISPATCHER.DefenseQueue = {}
|
||||
|
||||
--- Defense approach types
|
||||
@@ -1130,7 +1130,7 @@ do -- AI_AIR_DISPATCHER
|
||||
end
|
||||
|
||||
|
||||
--- @param #AI_AIR_DISPATCHER self
|
||||
-- @param #AI_AIR_DISPATCHER self
|
||||
function AI_AIR_DISPATCHER:onafterStart( From, Event, To )
|
||||
|
||||
self:GetParent( self ).onafterStart( self, From, Event, To )
|
||||
@@ -1141,7 +1141,7 @@ do -- AI_AIR_DISPATCHER
|
||||
for Resource = 1, DefenderSquadron.ResourceCount or 0 do
|
||||
self:ResourcePark( DefenderSquadron )
|
||||
end
|
||||
self:I( "Parked resources for squadron " .. DefenderSquadron.Name )
|
||||
self:T( "Parked resources for squadron " .. DefenderSquadron.Name )
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1194,7 +1194,7 @@ do -- AI_AIR_DISPATCHER
|
||||
end
|
||||
|
||||
|
||||
--- @param #AI_AIR_DISPATCHER self
|
||||
-- @param #AI_AIR_DISPATCHER self
|
||||
function AI_AIR_DISPATCHER:ResourcePark( DefenderSquadron )
|
||||
local TemplateID = math.random( 1, #DefenderSquadron.Spawn )
|
||||
local Spawn = DefenderSquadron.Spawn[ TemplateID ] -- Core.Spawn#SPAWN
|
||||
@@ -1211,31 +1211,31 @@ do -- AI_AIR_DISPATCHER
|
||||
end
|
||||
|
||||
|
||||
--- @param #AI_AIR_DISPATCHER self
|
||||
-- @param #AI_AIR_DISPATCHER self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
function AI_AIR_DISPATCHER:OnEventBaseCaptured( EventData )
|
||||
|
||||
local AirbaseName = EventData.PlaceName -- The name of the airbase that was captured.
|
||||
|
||||
self:I( "Captured " .. AirbaseName )
|
||||
self:T( "Captured " .. AirbaseName )
|
||||
|
||||
-- Now search for all squadrons located at the airbase, and sanitize them.
|
||||
for SquadronName, Squadron in pairs( self.DefenderSquadrons ) do
|
||||
if Squadron.AirbaseName == AirbaseName then
|
||||
Squadron.ResourceCount = -999 -- The base has been captured, and the resources are eliminated. No more spawning.
|
||||
Squadron.Captured = true
|
||||
self:I( "Squadron " .. SquadronName .. " captured." )
|
||||
self:T( "Squadron " .. SquadronName .. " captured." )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- @param #AI_AIR_DISPATCHER self
|
||||
-- @param #AI_AIR_DISPATCHER self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
function AI_AIR_DISPATCHER:OnEventCrashOrDead( EventData )
|
||||
self.Detection:ForgetDetectedUnit( EventData.IniUnitName )
|
||||
end
|
||||
|
||||
--- @param #AI_AIR_DISPATCHER self
|
||||
-- @param #AI_AIR_DISPATCHER self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
function AI_AIR_DISPATCHER:OnEventLand( EventData )
|
||||
self:F( "Landed" )
|
||||
@@ -1252,7 +1252,7 @@ do -- AI_AIR_DISPATCHER
|
||||
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||
end
|
||||
DefenderUnit:Destroy()
|
||||
self:ResourcePark( Squadron, Defender )
|
||||
self:ResourcePark( Squadron )
|
||||
return
|
||||
end
|
||||
if DefenderUnit:GetLife() ~= DefenderUnit:GetLife0() then
|
||||
@@ -1263,7 +1263,7 @@ do -- AI_AIR_DISPATCHER
|
||||
end
|
||||
end
|
||||
|
||||
--- @param #AI_AIR_DISPATCHER self
|
||||
-- @param #AI_AIR_DISPATCHER self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
function AI_AIR_DISPATCHER:OnEventEngineShutdown( EventData )
|
||||
local DefenderUnit = EventData.IniUnit
|
||||
@@ -1279,31 +1279,31 @@ do -- AI_AIR_DISPATCHER
|
||||
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||
end
|
||||
DefenderUnit:Destroy()
|
||||
self:ResourcePark( Squadron, Defender )
|
||||
self:ResourcePark( Squadron )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
do -- Manage the defensive behaviour
|
||||
|
||||
--- @param #AI_AIR_DISPATCHER self
|
||||
-- @param #AI_AIR_DISPATCHER self
|
||||
-- @param #string DefenseCoordinateName The name of the coordinate to be defended by AIR defenses.
|
||||
-- @param Core.Point#COORDINATE DefenseCoordinate The coordinate to be defended by AIR defenses.
|
||||
function AI_AIR_DISPATCHER:AddDefenseCoordinate( DefenseCoordinateName, DefenseCoordinate )
|
||||
self.DefenseCoordinates[DefenseCoordinateName] = DefenseCoordinate
|
||||
end
|
||||
|
||||
--- @param #AI_AIR_DISPATCHER self
|
||||
-- @param #AI_AIR_DISPATCHER self
|
||||
function AI_AIR_DISPATCHER:SetDefenseReactivityLow()
|
||||
self.DefenseReactivity = 0.05
|
||||
end
|
||||
|
||||
--- @param #AI_AIR_DISPATCHER self
|
||||
-- @param #AI_AIR_DISPATCHER self
|
||||
function AI_AIR_DISPATCHER:SetDefenseReactivityMedium()
|
||||
self.DefenseReactivity = 0.15
|
||||
end
|
||||
|
||||
--- @param #AI_AIR_DISPATCHER self
|
||||
-- @param #AI_AIR_DISPATCHER self
|
||||
function AI_AIR_DISPATCHER:SetDefenseReactivityHigh()
|
||||
self.DefenseReactivity = 0.5
|
||||
end
|
||||
@@ -1867,7 +1867,7 @@ do -- AI_AIR_DISPATCHER
|
||||
|
||||
end
|
||||
|
||||
--- @param #AI_AIR_DISPATCHER self
|
||||
-- @param #AI_AIR_DISPATCHER self
|
||||
-- @param #string SquadronName The squadron name.
|
||||
-- @param #number TakeoffInterval Only Takeoff new units each specified interval in seconds in 10 seconds steps.
|
||||
-- @usage
|
||||
@@ -2769,7 +2769,7 @@ do -- AI_AIR_DISPATCHER
|
||||
|
||||
-- TODO: Need to model the resources in a squadron.
|
||||
|
||||
--- @param #AI_AIR_DISPATCHER self
|
||||
-- @param #AI_AIR_DISPATCHER self
|
||||
-- @param AI.AI_Air_Squadron#AI_AIR_SQUADRON Squadron
|
||||
function AI_AIR_DISPATCHER:AddDefenderToSquadron( Squadron, Defender, Size )
|
||||
self.Defenders = self.Defenders or {}
|
||||
@@ -2782,7 +2782,7 @@ do -- AI_AIR_DISPATCHER
|
||||
self:F( { DefenderName = DefenderName, SquadronResourceCount = Squadron.ResourceCount } )
|
||||
end
|
||||
|
||||
--- @param #AI_AIR_DISPATCHER self
|
||||
-- @param #AI_AIR_DISPATCHER self
|
||||
-- @param AI.AI_Air_Squadron#AI_AIR_SQUADRON Squadron
|
||||
function AI_AIR_DISPATCHER:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||
self.Defenders = self.Defenders or {}
|
||||
@@ -2795,7 +2795,7 @@ do -- AI_AIR_DISPATCHER
|
||||
self:F( { DefenderName = DefenderName, SquadronResourceCount = SquadronResourceCount } )
|
||||
end
|
||||
|
||||
--- @param #AI_AIR_DISPATCHER self
|
||||
-- @param #AI_AIR_DISPATCHER self
|
||||
-- @param Wrapper.Group#GROUP Defender
|
||||
-- @return AI.AI_Air_Squadron#AI_AIR_SQUADRON The Squadron.
|
||||
function AI_AIR_DISPATCHER:GetSquadronFromDefender( Defender )
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
|
||||
|
||||
|
||||
--- @type AI_AIR_ENGAGE
|
||||
-- @extends AI.AI_Air#AI_AIR
|
||||
-- @type AI_AIR_ENGAGE
|
||||
-- @extends AI.AI_AIR#AI_AIR
|
||||
|
||||
|
||||
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
|
||||
@@ -351,7 +351,7 @@ function AI_AIR_ENGAGE:onafterAbort( AIGroup, From, Event, To )
|
||||
end
|
||||
|
||||
|
||||
--- @param #AI_AIR_ENGAGE self
|
||||
-- @param #AI_AIR_ENGAGE self
|
||||
-- @param Wrapper.Group#GROUP AIGroup The Group Object managed by the FSM.
|
||||
-- @param #string From The From State string.
|
||||
-- @param #string Event The Event string.
|
||||
@@ -361,7 +361,7 @@ function AI_AIR_ENGAGE:onafterAccomplish( AIGroup, From, Event, To )
|
||||
--self:SetDetectionOff()
|
||||
end
|
||||
|
||||
--- @param #AI_AIR_ENGAGE self
|
||||
-- @param #AI_AIR_ENGAGE self
|
||||
-- @param Wrapper.Group#GROUP AIGroup The Group Object managed by the FSM.
|
||||
-- @param #string From The From State string.
|
||||
-- @param #string Event The Event string.
|
||||
@@ -374,7 +374,7 @@ function AI_AIR_ENGAGE:onafterDestroy( AIGroup, From, Event, To, EventData )
|
||||
end
|
||||
end
|
||||
|
||||
--- @param #AI_AIR_ENGAGE self
|
||||
-- @param #AI_AIR_ENGAGE self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
function AI_AIR_ENGAGE:OnEventDead( EventData )
|
||||
self:F( { "EventDead", EventData } )
|
||||
@@ -387,9 +387,9 @@ function AI_AIR_ENGAGE:OnEventDead( EventData )
|
||||
end
|
||||
|
||||
|
||||
--- @param Wrapper.Group#GROUP AIControllable
|
||||
-- @param Wrapper.Group#GROUP AIControllable
|
||||
function AI_AIR_ENGAGE.___EngageRoute( AIGroup, Fsm, AttackSetUnit )
|
||||
Fsm:I(string.format("AI_AIR_ENGAGE.___EngageRoute: %s", tostring(AIGroup:GetName())))
|
||||
Fsm:T(string.format("AI_AIR_ENGAGE.___EngageRoute: %s", tostring(AIGroup:GetName())))
|
||||
|
||||
if AIGroup and AIGroup:IsAlive() then
|
||||
Fsm:__EngageRoute( Fsm.TaskDelay or 0.1, AttackSetUnit )
|
||||
@@ -397,14 +397,14 @@ function AI_AIR_ENGAGE.___EngageRoute( AIGroup, Fsm, AttackSetUnit )
|
||||
end
|
||||
|
||||
|
||||
--- @param #AI_AIR_ENGAGE self
|
||||
-- @param #AI_AIR_ENGAGE self
|
||||
-- @param Wrapper.Group#GROUP DefenderGroup The GroupGroup managed by the FSM.
|
||||
-- @param #string From The From State string.
|
||||
-- @param #string Event The Event string.
|
||||
-- @param #string To The To State string.
|
||||
-- @param Core.Set#SET_UNIT AttackSetUnit Unit set to be attacked.
|
||||
function AI_AIR_ENGAGE:onafterEngageRoute( DefenderGroup, From, Event, To, AttackSetUnit )
|
||||
self:I( { DefenderGroup, From, Event, To, AttackSetUnit } )
|
||||
self:T( { DefenderGroup, From, Event, To, AttackSetUnit } )
|
||||
|
||||
local DefenderGroupName = DefenderGroup:GetName()
|
||||
|
||||
@@ -426,7 +426,13 @@ function AI_AIR_ENGAGE:onafterEngageRoute( DefenderGroup, From, Event, To, Attac
|
||||
local DefenderCoord = DefenderGroup:GetPointVec3()
|
||||
DefenderCoord:SetY( EngageAltitude ) -- Ground targets don't have an altitude.
|
||||
|
||||
local TargetCoord = AttackSetUnit:GetFirst():GetPointVec3()
|
||||
local TargetCoord = AttackSetUnit:GetRandomSurely():GetPointVec3()
|
||||
|
||||
if TargetCoord == nil then
|
||||
self:Return()
|
||||
return
|
||||
end
|
||||
|
||||
TargetCoord:SetY( EngageAltitude ) -- Ground targets don't have an altitude.
|
||||
|
||||
local TargetDistance = DefenderCoord:Get2DDistance( TargetCoord )
|
||||
@@ -435,12 +441,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!
|
||||
if TargetDistance <= EngageDistance * 9 then
|
||||
|
||||
--self:I(string.format("AI_AIR_ENGAGE onafterEngageRoute ==> __Engage - target distance = %.1f km", TargetDistance/1000))
|
||||
--self:T(string.format("AI_AIR_ENGAGE onafterEngageRoute ==> __Engage - target distance = %.1f km", TargetDistance/1000))
|
||||
self:__Engage( 0.1, AttackSetUnit )
|
||||
|
||||
else
|
||||
|
||||
--self:I(string.format("FF AI_AIR_ENGAGE onafterEngageRoute ==> Routing - target distance = %.1f km", TargetDistance/1000))
|
||||
--self:T(string.format("FF AI_AIR_ENGAGE onafterEngageRoute ==> Routing - target distance = %.1f km", TargetDistance/1000))
|
||||
|
||||
local EngageRoute = {}
|
||||
local AttackTasks = {}
|
||||
@@ -472,16 +478,16 @@ function AI_AIR_ENGAGE:onafterEngageRoute( DefenderGroup, From, Event, To, Attac
|
||||
end
|
||||
else
|
||||
-- TODO: This will make an A2A Dispatcher CAP flight to return rather than going back to patrolling!
|
||||
self:I( DefenderGroupName .. ": No targets found -> Going RTB")
|
||||
self:T( DefenderGroupName .. ": No targets found -> Going RTB")
|
||||
self:Return()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--- @param Wrapper.Group#GROUP AIControllable
|
||||
-- @param Wrapper.Group#GROUP AIControllable
|
||||
function AI_AIR_ENGAGE.___Engage( AIGroup, Fsm, AttackSetUnit )
|
||||
|
||||
Fsm:I(string.format("AI_AIR_ENGAGE.___Engage: %s", tostring(AIGroup:GetName())))
|
||||
Fsm:T(string.format("AI_AIR_ENGAGE.___Engage: %s", tostring(AIGroup:GetName())))
|
||||
|
||||
if AIGroup and AIGroup:IsAlive() then
|
||||
local delay=Fsm.TaskDelay or 0.1
|
||||
@@ -490,7 +496,7 @@ function AI_AIR_ENGAGE.___Engage( AIGroup, Fsm, AttackSetUnit )
|
||||
end
|
||||
|
||||
|
||||
--- @param #AI_AIR_ENGAGE self
|
||||
-- @param #AI_AIR_ENGAGE self
|
||||
-- @param Wrapper.Group#GROUP DefenderGroup The GroupGroup managed by the FSM.
|
||||
-- @param #string From The From State string.
|
||||
-- @param #string Event The Event string.
|
||||
@@ -516,7 +522,7 @@ function AI_AIR_ENGAGE:onafterEngage( DefenderGroup, From, Event, To, AttackSetU
|
||||
local DefenderCoord = DefenderGroup:GetPointVec3()
|
||||
DefenderCoord:SetY( EngageAltitude ) -- Ground targets don't have an altitude.
|
||||
|
||||
local TargetCoord = AttackSetUnit:GetFirst():GetPointVec3()
|
||||
local TargetCoord = AttackSetUnit:GetRandomSurely():GetPointVec3()
|
||||
if not TargetCoord then
|
||||
self:Return()
|
||||
return
|
||||
@@ -547,12 +553,12 @@ function AI_AIR_ENGAGE:onafterEngage( DefenderGroup, From, Event, To, AttackSetU
|
||||
local AttackUnitTasks = self:CreateAttackUnitTasks( AttackSetUnit, DefenderGroup, EngageAltitude ) -- Polymorphic
|
||||
|
||||
if #AttackUnitTasks == 0 then
|
||||
self:I( DefenderGroupName .. ": No valid targets found -> Going RTB")
|
||||
self:T( DefenderGroupName .. ": No valid targets found -> Going RTB")
|
||||
self:Return()
|
||||
return
|
||||
else
|
||||
local text=string.format("%s: Engaging targets at distance %.2f NM", DefenderGroupName, UTILS.MetersToNM(TargetDistance))
|
||||
self:I(text)
|
||||
self:T(text)
|
||||
DefenderGroup:OptionROEOpenFire()
|
||||
DefenderGroup:OptionROTEvadeFire()
|
||||
DefenderGroup:OptionKeepWeaponsOnThreat()
|
||||
@@ -569,13 +575,13 @@ function AI_AIR_ENGAGE:onafterEngage( DefenderGroup, From, Event, To, AttackSetU
|
||||
end
|
||||
else
|
||||
-- TODO: This will make an A2A Dispatcher CAP flight to return rather than going back to patrolling!
|
||||
self:I( DefenderGroupName .. ": No targets found -> returning.")
|
||||
self:T( DefenderGroupName .. ": No targets found -> returning.")
|
||||
self:Return()
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
--- @param Wrapper.Group#GROUP AIEngage
|
||||
-- @param Wrapper.Group#GROUP AIEngage
|
||||
function AI_AIR_ENGAGE.Resume( AIEngage, Fsm )
|
||||
|
||||
AIEngage:F( { "Resume:", AIEngage:GetName() } )
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
|
||||
|
||||
--- @type AI_AIR_SQUADRON
|
||||
-- @type AI_AIR_SQUADRON
|
||||
-- @extends Core.Base#BASE
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ AI_AIR_SQUADRON = {
|
||||
-- @return #AI_AIR_SQUADRON
|
||||
function AI_AIR_SQUADRON:New( SquadronName, AirbaseName, TemplatePrefixes, ResourceCount )
|
||||
|
||||
self:I( { Air_Squadron = { SquadronName, AirbaseName, TemplatePrefixes, ResourceCount } } )
|
||||
self:T( { Air_Squadron = { SquadronName, AirbaseName, TemplatePrefixes, ResourceCount } } )
|
||||
|
||||
local AI_Air_Squadron = BASE:New() -- #AI_AIR_SQUADRON
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
-- @module AI.AI_Cargo
|
||||
-- @image Cargo.JPG
|
||||
|
||||
--- @type AI_CARGO
|
||||
-- @type AI_CARGO
|
||||
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
||||
|
||||
|
||||
@@ -547,7 +547,7 @@ function AI_CARGO:onafterUnloaded( Carrier, From, Event, To, Cargo, CarrierUnit,
|
||||
for _, CarrierUnit in pairs( Carrier:GetUnits() ) do
|
||||
local CarrierUnit = CarrierUnit -- Wrapper.Unit#UNIT
|
||||
local IsEmpty = CarrierUnit:IsCargoEmpty()
|
||||
self:I({ IsEmpty = IsEmpty })
|
||||
self:T({ IsEmpty = IsEmpty })
|
||||
if not IsEmpty then
|
||||
AllUnloaded = false
|
||||
break
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
-- @image AI_Cargo_Dispatcher.JPG
|
||||
|
||||
|
||||
--- @type AI_CARGO_DISPATCHER
|
||||
-- @type AI_CARGO_DISPATCHER
|
||||
-- @field Core.Set#SET_GROUP CarrierSet The set of @{Wrapper.Group#GROUP} objects of carriers that will transport the cargo.
|
||||
-- @field Core.Set#SET_CARGO CargoSet The set of @{Cargo.Cargo#CARGO} objects, which can be CARGO_GROUP, CARGO_CRATE, CARGO_SLINGLOAD objects.
|
||||
-- @field Core.Zone#SET_ZONE PickupZoneSet The set of pickup zones, which are used to where the cargo can be picked up by the carriers. If nil, then cargo can be picked up everywhere.
|
||||
@@ -1161,7 +1161,7 @@ function AI_CARGO_DISPATCHER:onafterMonitor()
|
||||
else
|
||||
local text=string.format("WARNING: Cargo %s is too heavy to be loaded into transport. Cargo weight %.1f > %.1f load capacity of carrier %s.",
|
||||
tostring(Cargo:GetName()), Cargo:GetWeight(), LargestLoadCapacity, tostring(Carrier:GetName()))
|
||||
self:I(text)
|
||||
self:T(text)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -556,7 +556,7 @@ function AI_ESCORT:SetFlightMenuFormation( Formation )
|
||||
|
||||
if MenuFormation then
|
||||
local Arguments = MenuFormation.Arguments
|
||||
--self:I({Arguments=unpack(Arguments)})
|
||||
--self:T({Arguments=unpack(Arguments)})
|
||||
local FlightMenuFormation = MENU_GROUP:New( self.PlayerGroup, "Formation", self.MainMenu )
|
||||
local MenuFlightFormationID = MENU_GROUP_COMMAND:New( self.PlayerGroup, Formation, FlightMenuFormation,
|
||||
function ( self, Formation, ... )
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
-- @image MOOSE.JPG
|
||||
|
||||
|
||||
--- @type AI_ESCORT_DISPATCHER
|
||||
-- @type AI_ESCORT_DISPATCHER
|
||||
-- @extends Core.Fsm#FSM
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ AI_ESCORT_DISPATCHER = {
|
||||
ClassName = "AI_ESCORT_DISPATCHER",
|
||||
}
|
||||
|
||||
--- @field #list
|
||||
-- @field #list
|
||||
AI_ESCORT_DISPATCHER.AI_Escorts = {}
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ function AI_ESCORT_DISPATCHER:onafterStart( From, Event, To )
|
||||
|
||||
end
|
||||
|
||||
--- @param #AI_ESCORT_DISPATCHER self
|
||||
-- @param #AI_ESCORT_DISPATCHER self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
function AI_ESCORT_DISPATCHER:OnEventExit( EventData )
|
||||
|
||||
@@ -110,11 +110,11 @@ function AI_ESCORT_DISPATCHER:OnEventExit( EventData )
|
||||
local PlayerGroup = EventData.IniGroup
|
||||
local PlayerUnit = EventData.IniUnit
|
||||
|
||||
self:I({EscortAirbase= self.EscortAirbase } )
|
||||
self:I({PlayerGroupName = PlayerGroupName } )
|
||||
self:I({PlayerGroup = PlayerGroup})
|
||||
self:I({FirstGroup = self.CarrierSet:GetFirst()})
|
||||
self:I({FindGroup = self.CarrierSet:FindGroup( PlayerGroupName )})
|
||||
self:T({EscortAirbase= self.EscortAirbase } )
|
||||
self:T({PlayerGroupName = PlayerGroupName } )
|
||||
self:T({PlayerGroup = PlayerGroup})
|
||||
self:T({FirstGroup = self.CarrierSet:GetFirst()})
|
||||
self:T({FindGroup = self.CarrierSet:FindGroup( PlayerGroupName )})
|
||||
|
||||
if self.CarrierSet:FindGroup( PlayerGroupName ) then
|
||||
if self.AI_Escorts[PlayerGroupName] then
|
||||
@@ -125,7 +125,7 @@ function AI_ESCORT_DISPATCHER:OnEventExit( EventData )
|
||||
|
||||
end
|
||||
|
||||
--- @param #AI_ESCORT_DISPATCHER self
|
||||
-- @param #AI_ESCORT_DISPATCHER self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
function AI_ESCORT_DISPATCHER:OnEventBirth( EventData )
|
||||
|
||||
@@ -133,17 +133,17 @@ function AI_ESCORT_DISPATCHER:OnEventBirth( EventData )
|
||||
local PlayerGroup = EventData.IniGroup
|
||||
local PlayerUnit = EventData.IniUnit
|
||||
|
||||
self:I({EscortAirbase= self.EscortAirbase } )
|
||||
self:I({PlayerGroupName = PlayerGroupName } )
|
||||
self:I({PlayerGroup = PlayerGroup})
|
||||
self:I({FirstGroup = self.CarrierSet:GetFirst()})
|
||||
self:I({FindGroup = self.CarrierSet:FindGroup( PlayerGroupName )})
|
||||
self:T({EscortAirbase= self.EscortAirbase } )
|
||||
self:T({PlayerGroupName = PlayerGroupName } )
|
||||
self:T({PlayerGroup = PlayerGroup})
|
||||
self:T({FirstGroup = self.CarrierSet:GetFirst()})
|
||||
self:T({FindGroup = self.CarrierSet:FindGroup( PlayerGroupName )})
|
||||
|
||||
if self.CarrierSet:FindGroup( PlayerGroupName ) then
|
||||
if not self.AI_Escorts[PlayerGroupName] then
|
||||
local LeaderUnit = PlayerUnit
|
||||
local EscortGroup = self.EscortSpawn:SpawnAtAirbase( self.EscortAirbase, SPAWN.Takeoff.Hot )
|
||||
self:I({EscortGroup = EscortGroup})
|
||||
self:T({EscortGroup = EscortGroup})
|
||||
|
||||
self:ScheduleOnce( 1,
|
||||
function( EscortGroup )
|
||||
|
||||
@@ -652,15 +652,15 @@ function AI_PATROL_ZONE:onafterStart( Controllable, From, Event, To )
|
||||
end
|
||||
|
||||
|
||||
--- @param #AI_PATROL_ZONE self
|
||||
--- @param Wrapper.Controllable#CONTROLLABLE Controllable
|
||||
-- @param #AI_PATROL_ZONE self
|
||||
-- @param Wrapper.Controllable#CONTROLLABLE Controllable+
|
||||
function AI_PATROL_ZONE:onbeforeDetect( Controllable, From, Event, To )
|
||||
|
||||
return self.DetectOn and self.DetectActivated
|
||||
end
|
||||
|
||||
--- @param #AI_PATROL_ZONE self
|
||||
--- @param Wrapper.Controllable#CONTROLLABLE Controllable
|
||||
-- @param #AI_PATROL_ZONE self
|
||||
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
|
||||
function AI_PATROL_ZONE:onafterDetect( Controllable, From, Event, To )
|
||||
|
||||
local Detected = false
|
||||
@@ -705,7 +705,7 @@ function AI_PATROL_ZONE:onafterDetect( Controllable, From, Event, To )
|
||||
|
||||
end
|
||||
|
||||
--- @param Wrapper.Controllable#CONTROLLABLE AIControllable
|
||||
-- @param Wrapper.Controllable#CONTROLLABLE AIControllable
|
||||
-- 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.
|
||||
function AI_PATROL_ZONE:_NewPatrolRoute( AIControllable )
|
||||
@@ -822,13 +822,13 @@ function AI_PATROL_ZONE:onafterRoute( Controllable, From, Event, To )
|
||||
|
||||
end
|
||||
|
||||
--- @param #AI_PATROL_ZONE self
|
||||
-- @param #AI_PATROL_ZONE self
|
||||
function AI_PATROL_ZONE:onbeforeStatus()
|
||||
|
||||
return self.CheckStatus
|
||||
end
|
||||
|
||||
--- @param #AI_PATROL_ZONE self
|
||||
-- @param #AI_PATROL_ZONE self
|
||||
function AI_PATROL_ZONE:onafterStatus()
|
||||
self:F2()
|
||||
|
||||
@@ -838,7 +838,7 @@ function AI_PATROL_ZONE:onafterStatus()
|
||||
|
||||
local Fuel = self.Controllable:GetFuelMin()
|
||||
if Fuel < self.PatrolFuelThresholdPercentage then
|
||||
self:I( self.Controllable:GetName() .. " is out of fuel:" .. Fuel .. ", RTB!" )
|
||||
self:T( self.Controllable:GetName() .. " is out of fuel:" .. Fuel .. ", RTB!" )
|
||||
local OldAIControllable = self.Controllable
|
||||
|
||||
local OrbitTask = OldAIControllable:TaskOrbitCircle( math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude ), self.PatrolMinSpeed )
|
||||
@@ -852,7 +852,7 @@ function AI_PATROL_ZONE:onafterStatus()
|
||||
-- TODO: Check GROUP damage function.
|
||||
local Damage = self.Controllable:GetLife()
|
||||
if Damage <= self.PatrolDamageThreshold then
|
||||
self:I( self.Controllable:GetName() .. " is damaged:" .. Damage .. ", RTB!" )
|
||||
self:T( self.Controllable:GetName() .. " is damaged:" .. Damage .. ", RTB!" )
|
||||
RTB = true
|
||||
end
|
||||
|
||||
@@ -864,7 +864,7 @@ function AI_PATROL_ZONE:onafterStatus()
|
||||
end
|
||||
end
|
||||
|
||||
--- @param #AI_PATROL_ZONE self
|
||||
-- @param #AI_PATROL_ZONE self
|
||||
function AI_PATROL_ZONE:onafterRTB()
|
||||
self:F2()
|
||||
|
||||
@@ -903,13 +903,13 @@ function AI_PATROL_ZONE:onafterRTB()
|
||||
|
||||
end
|
||||
|
||||
--- @param #AI_PATROL_ZONE self
|
||||
-- @param #AI_PATROL_ZONE self
|
||||
function AI_PATROL_ZONE:onafterDead()
|
||||
self:SetDetectionOff()
|
||||
self:SetStatusOff()
|
||||
end
|
||||
|
||||
--- @param #AI_PATROL_ZONE self
|
||||
-- @param #AI_PATROL_ZONE self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
function AI_PATROL_ZONE:OnCrash( EventData )
|
||||
|
||||
@@ -920,7 +920,7 @@ function AI_PATROL_ZONE:OnCrash( EventData )
|
||||
end
|
||||
end
|
||||
|
||||
--- @param #AI_PATROL_ZONE self
|
||||
-- @param #AI_PATROL_ZONE self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
function AI_PATROL_ZONE:OnEjection( EventData )
|
||||
|
||||
@@ -929,7 +929,7 @@ function AI_PATROL_ZONE:OnEjection( EventData )
|
||||
end
|
||||
end
|
||||
|
||||
--- @param #AI_PATROL_ZONE self
|
||||
-- @param #AI_PATROL_ZONE self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
function AI_PATROL_ZONE:OnPilotDead( EventData )
|
||||
|
||||
|
||||
@@ -1144,6 +1144,28 @@ function BASE:TraceClassMethod( Class, Method )
|
||||
self:I( "Tracing method " .. Method .. " of class " .. Class )
|
||||
end
|
||||
|
||||
--- (Internal) Serialize arguments
|
||||
-- @param #BASE self
|
||||
-- @param #table Arguments
|
||||
-- @return #string Text
|
||||
function BASE:_Serialize(Arguments)
|
||||
local text = UTILS.PrintTableToLog({Arguments}, 0, true)
|
||||
text = string.gsub(text,"(\n+)","")
|
||||
text = string.gsub(text,"%(%(","%(")
|
||||
text = string.gsub(text,"%)%)","%)")
|
||||
text = string.gsub(text,"(%s+)"," ")
|
||||
return text
|
||||
end
|
||||
|
||||
----- (Internal) Serialize arguments
|
||||
---- @param #BASE self
|
||||
---- @param #table Arguments
|
||||
---- @return #string Text
|
||||
--function BASE:_Serialize(Arguments)
|
||||
-- local text=UTILS.BasicSerialize(Arguments)
|
||||
-- return text
|
||||
--end
|
||||
|
||||
--- Trace a function call. This function is private.
|
||||
-- @param #BASE self
|
||||
-- @param Arguments A #table or any field.
|
||||
@@ -1168,7 +1190,7 @@ function BASE:_F( Arguments, DebugInfoCurrentParam, DebugInfoFromParam )
|
||||
if DebugInfoFrom then
|
||||
LineFrom = DebugInfoFrom.currentline
|
||||
end
|
||||
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "F", self.ClassName, self.ClassID, Function, UTILS.BasicSerialize( Arguments ) ) )
|
||||
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "F", self.ClassName, self.ClassID, Function, BASE:_Serialize(Arguments) ) )
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1242,7 +1264,7 @@ function BASE:_T( Arguments, DebugInfoCurrentParam, DebugInfoFromParam )
|
||||
if DebugInfoFrom then
|
||||
LineFrom = DebugInfoFrom.currentline
|
||||
end
|
||||
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s", LineCurrent, LineFrom, "T", self.ClassName, self.ClassID, UTILS.BasicSerialize( Arguments ) ) )
|
||||
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s", LineCurrent, LineFrom, "T", self.ClassName, self.ClassID, BASE:_Serialize(Arguments) ) )
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1314,7 +1336,7 @@ function BASE:E( Arguments )
|
||||
|
||||
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "E", self.ClassName, self.ClassID, Function, UTILS.BasicSerialize( Arguments ) ) )
|
||||
else
|
||||
env.info( string.format( "%1s:%30s%05d(%s)", "E", self.ClassName, self.ClassID, UTILS.BasicSerialize( Arguments ) ) )
|
||||
env.info( string.format( "%1s:%30s%05d(%s)", "E", self.ClassName, self.ClassID, BASE:_Serialize(Arguments) ) )
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1341,39 +1363,8 @@ function BASE:I( Arguments )
|
||||
|
||||
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "I", self.ClassName, self.ClassID, Function, UTILS.BasicSerialize( Arguments ) ) )
|
||||
else
|
||||
env.info( string.format( "%1s:%30s%05d(%s)", "I", self.ClassName, self.ClassID, UTILS.BasicSerialize( Arguments ) ) )
|
||||
env.info( string.format( "%1s:%30s%05d(%s)", "I", self.ClassName, self.ClassID, BASE:_Serialize(Arguments)) )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--- old stuff
|
||||
|
||||
-- function BASE:_Destructor()
|
||||
-- --self:E("_Destructor")
|
||||
--
|
||||
-- --self:EventRemoveAll()
|
||||
-- end
|
||||
|
||||
-- THIS IS WHY WE NEED LUA 5.2 ...
|
||||
-- function BASE:_SetDestructor()
|
||||
--
|
||||
-- -- TODO: Okay, this is really technical...
|
||||
-- -- When you set a proxy to a table to catch __gc, weak tables don't behave like weak...
|
||||
-- -- Therefore, I am parking this logic until I've properly discussed all this with the community.
|
||||
--
|
||||
-- local proxy = newproxy(true)
|
||||
-- local proxyMeta = getmetatable(proxy)
|
||||
--
|
||||
-- proxyMeta.__gc = function ()
|
||||
-- env.info("In __gc for " .. self:GetClassNameAndID() )
|
||||
-- if self._Destructor then
|
||||
-- self:_Destructor()
|
||||
-- end
|
||||
-- end
|
||||
--
|
||||
-- -- keep the userdata from newproxy reachable until the object
|
||||
-- -- table is about to be garbage-collected - then the __gc hook
|
||||
-- -- will be invoked and the destructor called
|
||||
-- rawset( self, '__proxy', proxy )
|
||||
--
|
||||
-- end
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_Demos/tree/master/Core/Beacon)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### Authors: Hugues "Grey_Echo" Bousquet, funkyfranky
|
||||
--
|
||||
-- @module Core.Beacon
|
||||
@@ -34,11 +38,13 @@
|
||||
-- @type BEACON
|
||||
-- @field #string ClassName Name of the class "BEACON".
|
||||
-- @field Wrapper.Controllable#CONTROLLABLE Positionable The @{Wrapper.Controllable#CONTROLLABLE} that will receive radio capabilities.
|
||||
-- @field #number UniqueName Counter to make the unique naming work.
|
||||
-- @extends Core.Base#BASE
|
||||
BEACON = {
|
||||
ClassName = "BEACON",
|
||||
Positionable = nil,
|
||||
name = nil,
|
||||
UniqueName = 0,
|
||||
}
|
||||
|
||||
--- Beacon types supported by DCS.
|
||||
@@ -286,6 +292,7 @@ end
|
||||
-- myBeacon:AATACAN(20, "TEXACO", true) -- Activate the beacon
|
||||
function BEACON:AATACAN(TACANChannel, Message, Bearing, BeaconDuration)
|
||||
self:F({TACANChannel, Message, Bearing, BeaconDuration})
|
||||
self:E("This method is DEPRECATED! Please use ActivateTACAN() instead.")
|
||||
|
||||
local IsValid = true
|
||||
|
||||
@@ -379,7 +386,9 @@ end
|
||||
function BEACON:RadioBeacon(FileName, Frequency, Modulation, Power, BeaconDuration)
|
||||
self:F({FileName, Frequency, Modulation, Power, BeaconDuration})
|
||||
local IsValid = false
|
||||
|
||||
|
||||
Modulation = Modulation or radio.modulation.AM
|
||||
|
||||
-- Check the filename
|
||||
if type(FileName) == "string" then
|
||||
if FileName:find(".ogg") or FileName:find(".wav") then
|
||||
@@ -390,7 +399,7 @@ function BEACON:RadioBeacon(FileName, Frequency, Modulation, Power, BeaconDurati
|
||||
end
|
||||
end
|
||||
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
|
||||
|
||||
-- Check the Frequency
|
||||
@@ -416,7 +425,9 @@ function BEACON:RadioBeacon(FileName, Frequency, Modulation, Power, BeaconDurati
|
||||
if IsValid then
|
||||
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
|
||||
trigger.action.radioTransmission(FileName, self.Positionable:GetPositionVec3(), Modulation, true, Frequency, Power, tostring(self.ID))
|
||||
BEACON.UniqueName = BEACON.UniqueName + 1
|
||||
self.BeaconName = "MooseBeacon"..tostring(BEACON.UniqueName)
|
||||
trigger.action.radioTransmission(FileName, self.Positionable:GetPositionVec3(), Modulation, true, Frequency, Power, self.BeaconName)
|
||||
|
||||
if BeaconDuration then -- Schedule the stop of the BEACON if asked by the MD
|
||||
SCHEDULER:New( nil,
|
||||
@@ -424,7 +435,8 @@ function BEACON:RadioBeacon(FileName, Frequency, Modulation, Power, BeaconDurati
|
||||
self:StopRadioBeacon()
|
||||
end, {}, BeaconDuration)
|
||||
end
|
||||
end
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- Stops the Radio Beacon
|
||||
@@ -433,7 +445,7 @@ end
|
||||
function BEACON:StopRadioBeacon()
|
||||
self:F()
|
||||
-- The unique name of the transmission is the class ID
|
||||
trigger.action.stopRadioTransmission(tostring(self.ID))
|
||||
trigger.action.stopRadioTransmission(self.BeaconName)
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
920
Moose Development/Moose/Core/ClientMenu.lua
Normal file
920
Moose Development/Moose/Core/ClientMenu.lua
Normal file
@@ -0,0 +1,920 @@
|
||||
--- **Core** - Client Menu Management.
|
||||
--
|
||||
-- **Main Features:**
|
||||
--
|
||||
-- * For complex, non-static menu structures
|
||||
-- * Lightweigt implementation as alternative to MENU
|
||||
-- * Separation of menu tree creation from menu on the clients's side
|
||||
-- * Works with a SET_CLIENT set of clients
|
||||
-- * Allow manipulation of the shadow tree in various ways
|
||||
-- * Push to all or only one client
|
||||
-- * Change entries' menu text
|
||||
-- * Option to make an entry usable once only across all clients
|
||||
-- * Auto appends GROUP and CLIENT objects to menu calls
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### Author: **applevangelist**
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- @module Core.ClientMenu
|
||||
-- @image Core_Menu.JPG
|
||||
-- last change: Apr 2024
|
||||
|
||||
-- TODO
|
||||
----------------------------------------------------------------------------------------------------------------
|
||||
--
|
||||
-- CLIENTMENU
|
||||
--
|
||||
----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
---
|
||||
-- @type CLIENTMENU
|
||||
-- @field #string ClassName Class Name
|
||||
-- @field #string lid Lid for log entries
|
||||
-- @field #string version Version string
|
||||
-- @field #string name Name
|
||||
-- @field #string groupname Group name
|
||||
-- @field #table path
|
||||
-- @field #table parentpath
|
||||
-- @field #CLIENTMENU Parent
|
||||
-- @field Wrapper.Client#CLIENT client
|
||||
-- @field #number GroupID Group ID
|
||||
-- @field #number ID Entry ID
|
||||
-- @field Wrapper.Group#GROUP group
|
||||
-- @field #string UUID Unique ID based on path+name
|
||||
-- @field #string Function
|
||||
-- @field #table Functionargs
|
||||
-- @field #table Children
|
||||
-- @field #boolean Once
|
||||
-- @field #boolean Generic
|
||||
-- @field #boolean debug
|
||||
-- @field #CLIENTMENUMANAGER Controller
|
||||
-- @field #active boolean
|
||||
-- @extends Core.Base#BASE
|
||||
|
||||
---
|
||||
-- @field #CLIENTMENU
|
||||
CLIENTMENU = {
|
||||
ClassName = "CLIENTMENUE",
|
||||
lid = "",
|
||||
version = "0.1.2",
|
||||
name = nil,
|
||||
path = nil,
|
||||
group = nil,
|
||||
client = nil,
|
||||
GroupID = nil,
|
||||
Children = {},
|
||||
Once = false,
|
||||
Generic = false,
|
||||
debug = false,
|
||||
Controller = nil,
|
||||
groupname = nil,
|
||||
active = false,
|
||||
}
|
||||
|
||||
---
|
||||
-- @field #CLIENTMENU_ID
|
||||
CLIENTMENU_ID = 0
|
||||
|
||||
--- Create an new CLIENTMENU object.
|
||||
-- @param #CLIENTMENU self
|
||||
-- @param Wrapper.Client#CLIENT Client The client for whom this entry is. Leave as nil for a generic entry.
|
||||
-- @param #string Text Text of the F10 menu entry.
|
||||
-- @param #CLIENTMENU Parent The parent menu entry.
|
||||
-- @param #string Function (optional) Function to call when the entry is used.
|
||||
-- @param ... (optional) Arguments for the Function, comma separated
|
||||
-- @return #CLIENTMENU self
|
||||
function CLIENTMENU:NewEntry(Client,Text,Parent,Function,...)
|
||||
-- Inherit everything from BASE class.
|
||||
local self=BASE:Inherit(self, BASE:New()) -- #CLIENTMENU
|
||||
CLIENTMENU_ID = CLIENTMENU_ID + 1
|
||||
self.ID = CLIENTMENU_ID
|
||||
if Client then
|
||||
self.group = Client:GetGroup()
|
||||
self.client = Client
|
||||
self.GroupID = self.group:GetID()
|
||||
self.groupname = self.group:GetName() or "Unknown Groupname"
|
||||
else
|
||||
self.Generic = true
|
||||
end
|
||||
self.name = Text or "unknown entry"
|
||||
if Parent then
|
||||
if Parent:IsInstanceOf("MENU_BASE") then
|
||||
self.parentpath = Parent.MenuPath
|
||||
else
|
||||
self.parentpath = Parent:GetPath()
|
||||
Parent:AddChild(self)
|
||||
end
|
||||
end
|
||||
self.Parent = Parent
|
||||
self.Function = Function
|
||||
self.Functionargs = arg or {}
|
||||
table.insert(self.Functionargs,self.group)
|
||||
table.insert(self.Functionargs,self.client)
|
||||
if self.Functionargs and self.debug then
|
||||
self:T({"Functionargs",self.Functionargs})
|
||||
end
|
||||
if not self.Generic and self.active == false then
|
||||
if Function ~= nil then
|
||||
local ErrorHandler = function( errmsg )
|
||||
env.info( "MOOSE Error in CLIENTMENU COMMAND function: " .. errmsg )
|
||||
if BASE.Debug ~= nil then
|
||||
env.info( BASE.Debug.traceback() )
|
||||
end
|
||||
return errmsg
|
||||
end
|
||||
self.CallHandler = function()
|
||||
local function MenuFunction()
|
||||
return self.Function( unpack( self.Functionargs ) )
|
||||
end
|
||||
local Status, Result = xpcall( MenuFunction, ErrorHandler)
|
||||
if self.Once == true then
|
||||
self:Clear()
|
||||
end
|
||||
end
|
||||
self.path = missionCommands.addCommandForGroup(self.GroupID,Text,self.parentpath, self.CallHandler)
|
||||
self.active = true
|
||||
else
|
||||
self.path = missionCommands.addSubMenuForGroup(self.GroupID,Text,self.parentpath)
|
||||
self.active = true
|
||||
end
|
||||
else
|
||||
if self.parentpath then
|
||||
self.path = UTILS.DeepCopy(self.parentpath)
|
||||
else
|
||||
self.path = {}
|
||||
end
|
||||
self.path[#self.path+1] = Text
|
||||
end
|
||||
self.UUID = table.concat(self.path,";")
|
||||
self:T({self.UUID})
|
||||
self.Once = false
|
||||
-- Log id.
|
||||
self.lid=string.format("CLIENTMENU %s | %s | ", self.ID, self.name)
|
||||
self:T(self.lid.."Created")
|
||||
return self
|
||||
end
|
||||
|
||||
--- Create a UUID
|
||||
-- @param #CLIENTMENU self
|
||||
-- @param #CLIENTMENU Parent The parent object if any
|
||||
-- @param #string Text The menu entry text
|
||||
-- @return #string UUID
|
||||
function CLIENTMENU:CreateUUID(Parent,Text)
|
||||
local path = {}
|
||||
if Parent and Parent.path then
|
||||
path = Parent.path
|
||||
end
|
||||
path[#path+1] = Text
|
||||
local UUID = table.concat(path,";")
|
||||
return UUID
|
||||
end
|
||||
|
||||
--- Set the CLIENTMENUMANAGER for this entry.
|
||||
-- @param #CLIENTMENU self
|
||||
-- @param #CLIENTMENUMANAGER Controller The controlling object.
|
||||
-- @return #CLIENTMENU self
|
||||
function CLIENTMENU:SetController(Controller)
|
||||
self.Controller = Controller
|
||||
return self
|
||||
end
|
||||
|
||||
--- The entry will be deleted after being used used - for menu entries with functions only.
|
||||
-- @param #CLIENTMENU self
|
||||
-- @return #CLIENTMENU self
|
||||
function CLIENTMENU:SetOnce()
|
||||
self:T(self.lid.."SetOnce")
|
||||
self.Once = true
|
||||
return self
|
||||
end
|
||||
|
||||
--- Remove the entry from the F10 menu.
|
||||
-- @param #CLIENTMENU self
|
||||
-- @return #CLIENTMENU self
|
||||
function CLIENTMENU:RemoveF10()
|
||||
self:T(self.lid.."RemoveF10")
|
||||
if self.GroupID then
|
||||
--self:I(self.lid.."Removing "..table.concat(self.path,";"))
|
||||
local function RemoveFunction()
|
||||
return missionCommands.removeItemForGroup(self.GroupID , self.path )
|
||||
end
|
||||
local status, err = pcall(RemoveFunction)
|
||||
if not status then
|
||||
self:I(string.format("**** Error Removing Menu Entry %s for %s!",tostring(self.name),self.groupname))
|
||||
end
|
||||
self.active = false
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- Get the menu path table.
|
||||
-- @param #CLIENTMENU self
|
||||
-- @return #table Path
|
||||
function CLIENTMENU:GetPath()
|
||||
self:T(self.lid.."GetPath")
|
||||
return self.path
|
||||
end
|
||||
|
||||
--- Get the UUID.
|
||||
-- @param #CLIENTMENU self
|
||||
-- @return #string UUID
|
||||
function CLIENTMENU:GetUUID()
|
||||
self:T(self.lid.."GetUUID")
|
||||
return self.UUID
|
||||
end
|
||||
|
||||
--- Link a child entry.
|
||||
-- @param #CLIENTMENU self
|
||||
-- @param #CLIENTMENU Child The entry to link as a child.
|
||||
-- @return #CLIENTMENU self
|
||||
function CLIENTMENU:AddChild(Child)
|
||||
self:T(self.lid.."AddChild "..Child.ID)
|
||||
table.insert(self.Children,Child.ID,Child)
|
||||
return self
|
||||
end
|
||||
|
||||
--- Remove a child entry.
|
||||
-- @param #CLIENTMENU self
|
||||
-- @param #CLIENTMENU Child The entry to remove from the children.
|
||||
-- @return #CLIENTMENU self
|
||||
function CLIENTMENU:RemoveChild(Child)
|
||||
self:T(self.lid.."RemoveChild "..Child.ID)
|
||||
table.remove(self.Children,Child.ID)
|
||||
return self
|
||||
end
|
||||
|
||||
--- Remove all subentries (children) from this entry.
|
||||
-- @param #CLIENTMENU self
|
||||
-- @return #CLIENTMENU self
|
||||
function CLIENTMENU:RemoveSubEntries()
|
||||
self:T(self.lid.."RemoveSubEntries")
|
||||
self:T({self.Children})
|
||||
for _id,_entry in pairs(self.Children) do
|
||||
self:T("Removing ".._id)
|
||||
if _entry then
|
||||
_entry:RemoveSubEntries()
|
||||
_entry:RemoveF10()
|
||||
if _entry.Parent then
|
||||
_entry.Parent:RemoveChild(self)
|
||||
end
|
||||
--if self.Controller then
|
||||
--self.Controller:_RemoveByID(_entry.ID)
|
||||
--end
|
||||
--_entry = nil
|
||||
end
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- Remove this entry and all subentries (children) from this entry.
|
||||
-- @param #CLIENTMENU self
|
||||
-- @return #CLIENTMENU self
|
||||
function CLIENTMENU:Clear()
|
||||
self:T(self.lid.."Clear")
|
||||
for _id,_entry in pairs(self.Children) do
|
||||
if _entry then
|
||||
_entry:RemoveSubEntries()
|
||||
_entry = nil
|
||||
end
|
||||
end
|
||||
self:RemoveF10()
|
||||
if self.Parent then
|
||||
self.Parent:RemoveChild(self)
|
||||
end
|
||||
--if self.Controller then
|
||||
--self.Controller:_RemoveByID(self.ID)
|
||||
--end
|
||||
return self
|
||||
end
|
||||
|
||||
-- TODO
|
||||
----------------------------------------------------------------------------------------------------------------
|
||||
--
|
||||
-- CLIENTMENUMANAGER
|
||||
--
|
||||
----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
--- Class CLIENTMENUMANAGER
|
||||
-- @type CLIENTMENUMANAGER
|
||||
-- @field #string ClassName Class Name
|
||||
-- @field #string lid Lid for log entries
|
||||
-- @field #string version Version string
|
||||
-- @field #string name Name
|
||||
-- @field Core.Set#SET_CLIENT clientset The set of clients this menu manager is for
|
||||
-- @field #table flattree
|
||||
-- @field #table rootentries
|
||||
-- @field #table menutree
|
||||
-- @field #number entrycount
|
||||
-- @field #boolean debug
|
||||
-- @field #table PlayerMenu
|
||||
-- @field #number Coalition
|
||||
-- @extends Core.Base#BASE
|
||||
|
||||
--- *As a child my family's menu consisted of two choices: take it, or leave it.*
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ## CLIENTMENU and CLIENTMENUMANAGER
|
||||
--
|
||||
-- Manage menu structures for a SET_CLIENT of clients.
|
||||
--
|
||||
-- ## Concept
|
||||
--
|
||||
-- Separate creation of a menu tree structure from pushing it to each client. Create a shadow "reference" menu structure tree for your client pilot's in a mission.
|
||||
-- This can then be propagated to all clients. Manipulate the entries in the structure with removing, clearing or changing single entries, create replacement sub-structures
|
||||
-- for entries etc, push to one or all clients.
|
||||
--
|
||||
-- Many functions can either change the tree for one client or for all clients.
|
||||
--
|
||||
-- ## Conceptual remarks
|
||||
--
|
||||
-- There's a couple of things to fully understand:
|
||||
--
|
||||
-- 1) **CLIENTMENUMANAGER** manages a set of entries from **CLIENTMENU**, it's main purpose is to administer the *shadow menu tree*, ie. a menu structure which is not
|
||||
-- (yet) visible to any client
|
||||
-- 2) The entries are **CLIENTMENU** objects, which are linked in a tree form. There's two ways to create them:
|
||||
-- A) in the manager with ":NewEntry()" which initially
|
||||
-- adds it to the shadow menu **only**
|
||||
-- B) stand-alone directly as `CLIENTMENU:NewEntry()` - here it depends on whether or not you gave a CLIENT object if the entry is created as generic entry or pushed
|
||||
-- a **specific** client. **Be aware** though that the entries are not managed by the CLIENTMANAGER before the next step!
|
||||
-- A generic entry can be added to the manager (and the shadow tree) with `:AddEntry()` - this will also push it to all clients(!) if no client is given, or a specific client only.
|
||||
-- 3) Pushing only works for alive clients.
|
||||
-- 4) Live and shadow tree entries are managed via the CLIENTMENUMANAGER object.
|
||||
-- 5) `Propagate()`refreshes the menu tree for all, or a single client.
|
||||
--
|
||||
-- ## Create a base reference tree and send to all clients
|
||||
--
|
||||
-- local clientset = SET_CLIENT:New():FilterStart()
|
||||
--
|
||||
-- local menumgr = CLIENTMENUMANAGER:New(clientset,"Dayshift")
|
||||
-- local mymenu = menumgr:NewEntry("Top")
|
||||
-- local mymenu_lv1a = menumgr:NewEntry("Level 1 a",mymenu)
|
||||
-- local mymenu_lv1b = menumgr:NewEntry("Level 1 b",mymenu)
|
||||
-- -- next one is a command menu entry, which can only be used once
|
||||
-- local mymenu_lv1c = menumgr:NewEntry("Action Level 1 c",mymenu, testfunction, "testtext"):SetOnce()
|
||||
--
|
||||
-- local mymenu_lv2a = menumgr:NewEntry("Go here",mymenu_lv1a)
|
||||
-- local mymenu_lv2b = menumgr:NewEntry("Level 2 ab",mymenu_lv1a)
|
||||
-- local mymenu_lv2c = menumgr:NewEntry("Level 2 ac",mymenu_lv1a)
|
||||
--
|
||||
-- local mymenu_lv2ba = menumgr:NewEntry("Level 2 ba",mymenu_lv1b)
|
||||
-- local mymenu_lv2bb = menumgr:NewEntry("Level 2 bb",mymenu_lv1b)
|
||||
-- local mymenu_lv2bc = menumgr:NewEntry("Level 2 bc",mymenu_lv1b)
|
||||
--
|
||||
-- local mymenu_lv3a = menumgr:NewEntry("Level 3 aaa",mymenu_lv2a)
|
||||
-- local mymenu_lv3b = menumgr:NewEntry("Level 3 aab",mymenu_lv2a)
|
||||
-- local mymenu_lv3c = menumgr:NewEntry("Level 3 aac",mymenu_lv2a)
|
||||
--
|
||||
-- menumgr:Propagate() -- propagate **once** to all clients in the SET_CLIENT
|
||||
--
|
||||
-- ## Remove a single entry's subtree
|
||||
--
|
||||
-- menumgr:RemoveSubEntries(mymenu_lv3a)
|
||||
--
|
||||
-- ## Remove a single entry and also it's subtree
|
||||
--
|
||||
-- menumgr:DeleteEntry(mymenu_lv3a)
|
||||
--
|
||||
-- ## Add a single entry
|
||||
--
|
||||
-- local baimenu = menumgr:NewEntry("BAI",mymenu_lv1b)
|
||||
--
|
||||
-- menumgr:AddEntry(baimenu)
|
||||
--
|
||||
-- ## Add an entry with a function
|
||||
--
|
||||
-- local baimenu = menumgr:NewEntry("Task Action", mymenu_lv1b, TestFunction, Argument1, Argument1)
|
||||
--
|
||||
-- Now, the class will **automatically append the call with GROUP and CLIENT objects**, as this is can only be done when pushing the entry to the clients. So, the actual function implementation needs to look like this:
|
||||
--
|
||||
-- function TestFunction( Argument1, Argument2, Group, Client)
|
||||
--
|
||||
-- **Caveat is**, that you need to ensure your arguments are not **nil** or **false**, as LUA will optimize those away. You would end up having Group and Client in wrong places in the function call. Hence,
|
||||
-- if you need/ want to send **nil** or **false**, send a place holder instead and ensure your function can handle this, e.g.
|
||||
--
|
||||
-- local baimenu = menumgr:NewEntry("Task Action", mymenu_lv1b, TestFunction, "nil", Argument1)
|
||||
--
|
||||
-- ## Change the text of a leaf entry in the menu tree
|
||||
--
|
||||
-- menumgr:ChangeEntryTextForAll(mymenu_lv1b,"Attack")
|
||||
--
|
||||
-- ## Reset a single clients menu tree
|
||||
--
|
||||
-- menumgr:ResetMenu(client)
|
||||
--
|
||||
-- ## Reset all and clear the reference tree
|
||||
--
|
||||
-- menumgr:ResetMenuComplete()
|
||||
--
|
||||
-- ## Set to auto-propagate for CLIENTs joining the SET_CLIENT **after** the script is loaded - handy if you have a single menu tree.
|
||||
--
|
||||
-- menumgr:InitAutoPropagation()
|
||||
--
|
||||
-- @field #CLIENTMENUMANAGER
|
||||
CLIENTMENUMANAGER = {
|
||||
ClassName = "CLIENTMENUMANAGER",
|
||||
lid = "",
|
||||
version = "0.1.5a",
|
||||
name = nil,
|
||||
clientset = nil,
|
||||
menutree = {},
|
||||
flattree = {},
|
||||
playertree = {},
|
||||
entrycount = 0,
|
||||
rootentries = {},
|
||||
debug = true,
|
||||
PlayerMenu = {},
|
||||
Coalition = nil,
|
||||
}
|
||||
|
||||
--- Create a new ClientManager instance.
|
||||
-- @param #CLIENTMENUMANAGER self
|
||||
-- @param Core.Set#SET_CLIENT ClientSet The set of clients to manage.
|
||||
-- @param #string Alias The name of this manager.
|
||||
-- @param #number Coalition (Optional) Coalition of this Manager, defaults to coalition.side.BLUE
|
||||
-- @return #CLIENTMENUMANAGER self
|
||||
function CLIENTMENUMANAGER:New(ClientSet, Alias, Coalition)
|
||||
-- Inherit everything from FSM class.
|
||||
local self=BASE:Inherit(self, BASE:New()) -- #CLIENTMENUMANAGER
|
||||
self.clientset = ClientSet
|
||||
self.PlayerMenu = {}
|
||||
self.name = Alias or "Nightshift"
|
||||
self.Coalition = Coalition or coalition.side.BLUE
|
||||
-- Log id.
|
||||
self.lid=string.format("CLIENTMENUMANAGER %s | %s | ", self.version, self.name)
|
||||
if self.debug then
|
||||
self:I(self.lid.."Created")
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- [Internal] Event handling
|
||||
-- @param #CLIENTMENUMANAGER self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
-- @return #CLIENTMENUMANAGER self
|
||||
function CLIENTMENUMANAGER:_EventHandler(EventData)
|
||||
self:T(self.lid.."_EventHandler: "..EventData.id)
|
||||
--self:I(self.lid.."_EventHandler: "..tostring(EventData.IniPlayerName))
|
||||
if EventData.id == EVENTS.PlayerLeaveUnit or EventData.id == EVENTS.Ejection or EventData.id == EVENTS.Crash or EventData.id == EVENTS.PilotDead then
|
||||
self:T(self.lid.."Leave event for player: "..tostring(EventData.IniPlayerName))
|
||||
local Client = _DATABASE:FindClient( EventData.IniUnitName )
|
||||
if Client then
|
||||
self:ResetMenu(Client)
|
||||
end
|
||||
elseif (EventData.id == EVENTS.PlayerEnterAircraft) and EventData.IniCoalition == self.Coalition then
|
||||
if EventData.IniPlayerName and EventData.IniGroup then
|
||||
if (not self.clientset:IsIncludeObject(_DATABASE:FindClient( EventData.IniUnitName ))) then
|
||||
self:T(self.lid.."Client not in SET: "..EventData.IniPlayerName)
|
||||
return self
|
||||
end
|
||||
--self:I(self.lid.."Join event for player: "..EventData.IniPlayerName)
|
||||
local player = _DATABASE:FindClient( EventData.IniUnitName )
|
||||
self:Propagate(player)
|
||||
end
|
||||
elseif EventData.id == EVENTS.PlayerEnterUnit then
|
||||
-- special for CA slots
|
||||
local grp = GROUP:FindByName(EventData.IniGroupName)
|
||||
if grp:IsGround() then
|
||||
self:T(string.format("Player %s entered GROUND unit %s!",EventData.IniPlayerName,EventData.IniUnitName))
|
||||
local IsPlayer = EventData.IniDCSUnit:getPlayerName()
|
||||
if IsPlayer then
|
||||
|
||||
local client=_DATABASE.CLIENTS[EventData.IniDCSUnitName] --Wrapper.Client#CLIENT
|
||||
|
||||
-- Add client in case it does not exist already.
|
||||
if not client then
|
||||
|
||||
-- Debug info.
|
||||
self:I(string.format("Player '%s' joined ground unit '%s' of group '%s'", tostring(EventData.IniPlayerName), tostring(EventData.IniDCSUnitName), tostring(EventData.IniDCSGroupName)))
|
||||
|
||||
client=_DATABASE:AddClient(EventData.IniDCSUnitName)
|
||||
|
||||
-- Add player.
|
||||
client:AddPlayer(EventData.IniPlayerName)
|
||||
|
||||
-- Add player.
|
||||
if not _DATABASE.PLAYERS[EventData.IniPlayerName] then
|
||||
_DATABASE:AddPlayer( EventData.IniUnitName, EventData.IniPlayerName )
|
||||
end
|
||||
|
||||
-- Player settings.
|
||||
local Settings = SETTINGS:Set( EventData.IniPlayerName )
|
||||
Settings:SetPlayerMenu(EventData.IniUnit)
|
||||
end
|
||||
--local player = _DATABASE:FindClient( EventData.IniPlayerName )
|
||||
self:Propagate(client)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set this Client Manager to auto-propagate menus **once** to newly joined players. Useful if you have **one** menu structure only. Does not automatically push follow-up changes to the client(s).
|
||||
-- @param #CLIENTMENUMANAGER self
|
||||
-- @return #CLIENTMENUMANAGER self
|
||||
function CLIENTMENUMANAGER:InitAutoPropagation()
|
||||
-- Player Events
|
||||
self:HandleEvent(EVENTS.PlayerLeaveUnit, self._EventHandler)
|
||||
self:HandleEvent(EVENTS.Ejection, self._EventHandler)
|
||||
self:HandleEvent(EVENTS.Crash, self._EventHandler)
|
||||
self:HandleEvent(EVENTS.PilotDead, self._EventHandler)
|
||||
self:HandleEvent(EVENTS.PlayerEnterAircraft, self._EventHandler)
|
||||
self:HandleEvent(EVENTS.PlayerEnterUnit, self._EventHandler)
|
||||
self:SetEventPriority(5)
|
||||
return self
|
||||
end
|
||||
|
||||
--- Create a new entry in the **generic** structure.
|
||||
-- @param #CLIENTMENUMANAGER self
|
||||
-- @param #string Text Text of the F10 menu entry.
|
||||
-- @param #CLIENTMENU Parent The parent menu entry.
|
||||
-- @param #string Function (optional) Function to call when the entry is used.
|
||||
-- @param ... (optional) Arguments for the Function, comma separated.
|
||||
-- @return #CLIENTMENU Entry
|
||||
function CLIENTMENUMANAGER:NewEntry(Text,Parent,Function,...)
|
||||
self:T(self.lid.."NewEntry "..Text or "None")
|
||||
self.entrycount = self.entrycount + 1
|
||||
local entry = CLIENTMENU:NewEntry(nil,Text,Parent,Function,unpack(arg))
|
||||
if not Parent then
|
||||
self.rootentries[self.entrycount] = entry
|
||||
end
|
||||
local depth = #entry.path
|
||||
if not self.menutree[depth] then self.menutree[depth] = {} end
|
||||
table.insert(self.menutree[depth],entry.UUID)
|
||||
self.flattree[entry.UUID] = entry
|
||||
return entry
|
||||
end
|
||||
|
||||
--- Check matching entry in the generic structure by UUID.
|
||||
-- @param #CLIENTMENUMANAGER self
|
||||
-- @param #string UUID UUID of the menu entry.
|
||||
-- @return #boolean Exists
|
||||
function CLIENTMENUMANAGER:EntryUUIDExists(UUID)
|
||||
local exists = self.flattree[UUID] and true or false
|
||||
return exists
|
||||
end
|
||||
|
||||
--- Find matching entry in the generic structure by UUID.
|
||||
-- @param #CLIENTMENUMANAGER self
|
||||
-- @param #string UUID UUID of the menu entry.
|
||||
-- @return #CLIENTMENU Entry The #CLIENTMENU object found or nil.
|
||||
function CLIENTMENUMANAGER:FindEntryByUUID(UUID)
|
||||
self:T(self.lid.."FindEntryByUUID "..UUID or "None")
|
||||
local entry = nil
|
||||
for _gid,_entry in pairs(self.flattree) do
|
||||
local Entry = _entry -- #CLIENTMENU
|
||||
if Entry and Entry.UUID == UUID then
|
||||
entry = Entry
|
||||
end
|
||||
end
|
||||
return entry
|
||||
end
|
||||
|
||||
--- Find matching entries by text in the generic structure by UUID.
|
||||
-- @param #CLIENTMENUMANAGER self
|
||||
-- @param #string Text Text or partial text of the menu entry to find.
|
||||
-- @param #CLIENTMENU Parent (Optional) Only find entries under this parent entry.
|
||||
-- @return #table Table of matching UUIDs of #CLIENTMENU objects
|
||||
-- @return #table Table of matching #CLIENTMENU objects
|
||||
-- @return #number Number of matches
|
||||
function CLIENTMENUMANAGER:FindUUIDsByText(Text,Parent)
|
||||
self:T(self.lid.."FindUUIDsByText "..Text or "None")
|
||||
local matches = {}
|
||||
local entries = {}
|
||||
local n = 0
|
||||
for _uuid,_entry in pairs(self.flattree) do
|
||||
local Entry = _entry -- #CLIENTMENU
|
||||
if Parent then
|
||||
if Entry and string.find(Entry.name,Text,1,true) and string.find(Entry.UUID,Parent.UUID,1,true) then
|
||||
table.insert(matches,_uuid)
|
||||
table.insert(entries,Entry )
|
||||
n=n+1
|
||||
end
|
||||
else
|
||||
if Entry and string.find(Entry.name,Text,1,true) then
|
||||
table.insert(matches,_uuid)
|
||||
table.insert(entries,Entry )
|
||||
n=n+1
|
||||
end
|
||||
end
|
||||
end
|
||||
return matches, entries, n
|
||||
end
|
||||
|
||||
--- Find matching entries in the generic structure by the menu text.
|
||||
-- @param #CLIENTMENUMANAGER self
|
||||
-- @param #string Text Text or partial text of the F10 menu entry.
|
||||
-- @param #CLIENTMENU Parent (Optional) Only find entries under this parent entry.
|
||||
-- @return #table Table of matching #CLIENTMENU objects.
|
||||
-- @return #number Number of matches
|
||||
function CLIENTMENUMANAGER:FindEntriesByText(Text,Parent)
|
||||
self:T(self.lid.."FindEntriesByText "..Text or "None")
|
||||
local matches, objects, number = self:FindUUIDsByText(Text, Parent)
|
||||
return objects, number
|
||||
end
|
||||
|
||||
--- Find matching entries under a parent in the generic structure by UUID.
|
||||
-- @param #CLIENTMENUMANAGER self
|
||||
-- @param #CLIENTMENU Parent Find entries under this parent entry.
|
||||
-- @return #table Table of matching UUIDs of #CLIENTMENU objects
|
||||
-- @return #table Table of matching #CLIENTMENU objects
|
||||
-- @return #number Number of matches
|
||||
function CLIENTMENUMANAGER:FindUUIDsByParent(Parent)
|
||||
self:T(self.lid.."FindUUIDsByParent")
|
||||
local matches = {}
|
||||
local entries = {}
|
||||
local n = 0
|
||||
for _uuid,_entry in pairs(self.flattree) do
|
||||
local Entry = _entry -- #CLIENTMENU
|
||||
if Parent then
|
||||
if Entry and string.find(Entry.UUID,Parent.UUID,1,true) then
|
||||
table.insert(matches,_uuid)
|
||||
table.insert(entries,Entry )
|
||||
n=n+1
|
||||
end
|
||||
end
|
||||
end
|
||||
return matches, entries, n
|
||||
end
|
||||
|
||||
--- Find matching entries in the generic structure under a parent.
|
||||
-- @param #CLIENTMENUMANAGER self
|
||||
-- @param #CLIENTMENU Parent Find entries under this parent entry.
|
||||
-- @return #table Table of matching #CLIENTMENU objects.
|
||||
-- @return #number Number of matches
|
||||
function CLIENTMENUMANAGER:FindEntriesByParent(Parent)
|
||||
self:T(self.lid.."FindEntriesByParent")
|
||||
local matches, objects, number = self:FindUUIDsByParent(Parent)
|
||||
return objects, number
|
||||
end
|
||||
|
||||
--- Alter the text of a leaf entry in the generic structure and push to one specific client's F10 menu.
|
||||
-- @param #CLIENTMENUMANAGER self
|
||||
-- @param #CLIENTMENU Entry The menu entry.
|
||||
-- @param #string Text New Text of the F10 menu entry.
|
||||
-- @param Wrapper.Client#CLIENT Client (optional) The client for whom to alter the entry, if nil done for all clients.
|
||||
-- @return #CLIENTMENUMANAGER self
|
||||
function CLIENTMENUMANAGER:ChangeEntryText(Entry, Text, Client)
|
||||
self:T(self.lid.."ChangeEntryText "..Text or "None")
|
||||
local newentry = CLIENTMENU:NewEntry(nil,Text,Entry.Parent,Entry.Function,unpack(Entry.Functionargs))
|
||||
self:DeleteF10Entry(Entry,Client)
|
||||
self:DeleteGenericEntry(Entry)
|
||||
if not Entry.Parent then
|
||||
self.rootentries[self.entrycount] = newentry
|
||||
end
|
||||
local depth = #newentry.path
|
||||
if not self.menutree[depth] then self.menutree[depth] = {} end
|
||||
table.insert(self.menutree[depth],newentry.UUID)
|
||||
self.flattree[newentry.UUID] = newentry
|
||||
self:AddEntry(newentry,Client)
|
||||
return self
|
||||
end
|
||||
|
||||
--- Push the complete menu structure to each of the clients in the set - refresh the menu tree of the clients.
|
||||
-- @param #CLIENTMENUMANAGER self
|
||||
-- @param Wrapper.Client#CLIENT Client (optional) If given, propagate only for this client.
|
||||
-- @return #CLIENTMENU Entry
|
||||
function CLIENTMENUMANAGER:Propagate(Client)
|
||||
self:T(self.lid.."Propagate")
|
||||
--self:I(UTILS.PrintTableToLog(Client,1))
|
||||
local knownunits = {} -- track so we can ID multi seated
|
||||
local Set = self.clientset.Set
|
||||
if Client then
|
||||
Set = {Client}
|
||||
end
|
||||
self:ResetMenu(Client)
|
||||
for _,_client in pairs(Set) do
|
||||
local client = _client -- Wrapper.Client#CLIENT
|
||||
if client and client:IsAlive() then
|
||||
local playerunit = client:GetName()
|
||||
local playergroup = client:GetGroup()
|
||||
local playername = client:GetPlayerName() or "none"
|
||||
if not knownunits[playerunit] then
|
||||
knownunits[playerunit] = true
|
||||
else
|
||||
self:I("Player in multi seat unit: "..playername)
|
||||
break -- multi seat already build
|
||||
end
|
||||
if not self.playertree[playername] then
|
||||
self.playertree[playername] = {}
|
||||
end
|
||||
for level,branch in pairs (self.menutree) do
|
||||
self:T("Building branch:" .. level)
|
||||
for _,leaf in pairs(branch) do
|
||||
self:T("Building leaf:" .. leaf)
|
||||
local entry = self:FindEntryByUUID(leaf)
|
||||
if entry then
|
||||
self:T("Found generic entry:" .. entry.UUID)
|
||||
local parent = nil
|
||||
if entry.Parent and entry.Parent.UUID then
|
||||
parent = self.playertree[playername][entry.Parent.UUID] or self:FindEntryByUUID(entry.Parent.UUID)
|
||||
end
|
||||
self.playertree[playername][entry.UUID] = CLIENTMENU:NewEntry(client,entry.name,parent,entry.Function,unpack(entry.Functionargs))
|
||||
self.playertree[playername][entry.UUID].Once = entry.Once
|
||||
else
|
||||
self:T("NO generic entry for:" .. leaf)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- Push a single previously created entry into the F10 menu structure of all clients.
|
||||
-- @param #CLIENTMENUMANAGER self
|
||||
-- @param #CLIENTMENU Entry The entry to add.
|
||||
-- @param Wrapper.Client#CLIENT Client (optional) If given, make this change only for this client.
|
||||
-- @return #CLIENTMENUMANAGER self
|
||||
function CLIENTMENUMANAGER:AddEntry(Entry,Client)
|
||||
self:T(self.lid.."AddEntry")
|
||||
local Set = self.clientset.Set
|
||||
local knownunits = {}
|
||||
if Client then
|
||||
Set = {Client}
|
||||
end
|
||||
for _,_client in pairs(Set) do
|
||||
local client = _client -- Wrapper.Client#CLIENT
|
||||
if client and client:IsAlive() then
|
||||
local playername = client:GetPlayerName()
|
||||
local unitname = client:GetName()
|
||||
if not knownunits[unitname] then
|
||||
knownunits[unitname] = true
|
||||
else
|
||||
self:I("Player in multi seat unit: "..playername)
|
||||
break
|
||||
end
|
||||
if Entry then
|
||||
self:T("Adding generic entry:" .. Entry.UUID)
|
||||
local parent = nil
|
||||
if not self.playertree[playername] then
|
||||
self.playertree[playername] = {}
|
||||
end
|
||||
if Entry.Parent and Entry.Parent.UUID then
|
||||
parent = self.playertree[playername][Entry.Parent.UUID] or self:FindEntryByUUID(Entry.Parent.UUID)
|
||||
end
|
||||
self.playertree[playername][Entry.UUID] = CLIENTMENU:NewEntry(client,Entry.name,parent,Entry.Function,unpack(Entry.Functionargs))
|
||||
self.playertree[playername][Entry.UUID].Once = Entry.Once
|
||||
else
|
||||
self:T("NO generic entry given")
|
||||
end
|
||||
end
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- Blank out the menu - remove **all root entries** and all entries below from the client's F10 menus, leaving the generic structure untouched.
|
||||
-- @param #CLIENTMENUMANAGER self
|
||||
-- @param Wrapper.Client#CLIENT Client (optional) If given, remove only for this client.
|
||||
-- @return #CLIENTMENUMANAGER self
|
||||
function CLIENTMENUMANAGER:ResetMenu(Client)
|
||||
self:T(self.lid.."ResetMenu")
|
||||
for _,_entry in pairs(self.rootentries) do
|
||||
--local RootEntry = self.structure.generic[_entry]
|
||||
if _entry then
|
||||
self:DeleteF10Entry(_entry,Client)
|
||||
end
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- Blank out the menu - remove **all root entries** and all entries below from all clients' F10 menus, and **delete** the generic structure.
|
||||
-- @param #CLIENTMENUMANAGER self
|
||||
-- @return #CLIENTMENUMANAGER self
|
||||
function CLIENTMENUMANAGER:ResetMenuComplete()
|
||||
self:T(self.lid.."ResetMenuComplete")
|
||||
for _,_entry in pairs(self.rootentries) do
|
||||
--local RootEntry = self.structure.generic[_entry]
|
||||
if _entry then
|
||||
self:DeleteF10Entry(_entry)
|
||||
end
|
||||
end
|
||||
self.playertree = nil
|
||||
self.playertree = {}
|
||||
self.rootentries = nil
|
||||
self.rootentries = {}
|
||||
self.menutree = nil
|
||||
self.menutree = {}
|
||||
return self
|
||||
end
|
||||
|
||||
--- Remove the entry and all entries below the given entry from the client's F10 menus.
|
||||
-- @param #CLIENTMENUMANAGER self
|
||||
-- @param #CLIENTMENU Entry The entry to remove
|
||||
-- @param Wrapper.Client#CLIENT Client (optional) If given, make this change only for this client.
|
||||
-- @return #CLIENTMENUMANAGER self
|
||||
function CLIENTMENUMANAGER:DeleteF10Entry(Entry,Client)
|
||||
self:T(self.lid.."DeleteF10Entry")
|
||||
local Set = self.clientset.Set
|
||||
if Client then
|
||||
Set = {Client}
|
||||
end
|
||||
for _,_client in pairs(Set) do
|
||||
if _client and _client:IsAlive() then
|
||||
local playername = _client:GetPlayerName()
|
||||
if self.playertree[playername] then
|
||||
local centry = self.playertree[playername][Entry.UUID] -- #CLIENTMENU
|
||||
if centry then
|
||||
--self:I("Match for "..Entry.UUID)
|
||||
centry:Clear()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- Remove the entry and all entries below the given entry from the generic tree.
|
||||
-- @param #CLIENTMENUMANAGER self
|
||||
-- @param #CLIENTMENU Entry The entry to remove
|
||||
-- @return #CLIENTMENUMANAGER self
|
||||
function CLIENTMENUMANAGER:DeleteGenericEntry(Entry)
|
||||
self:T(self.lid.."DeleteGenericEntry")
|
||||
|
||||
if Entry.Children and #Entry.Children > 0 then
|
||||
self:RemoveGenericSubEntries(Entry)
|
||||
end
|
||||
|
||||
local depth = #Entry.path
|
||||
local uuid = Entry.UUID
|
||||
|
||||
local tbl = UTILS.DeepCopy(self.menutree)
|
||||
|
||||
if tbl[depth] then
|
||||
for i=depth,#tbl do
|
||||
--self:I("Level = "..i)
|
||||
for _id,_uuid in pairs(tbl[i]) do
|
||||
self:T(_uuid)
|
||||
if string.find(_uuid,uuid,1,true) or _uuid == uuid then
|
||||
--self:I("Match for ".._uuid)
|
||||
self.menutree[i][_id] = nil
|
||||
self.flattree[_uuid] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Remove all entries below the given entry from the generic tree.
|
||||
-- @param #CLIENTMENUMANAGER self
|
||||
-- @param #CLIENTMENU Entry The entry where to start. This entry stays.
|
||||
-- @return #CLIENTMENUMANAGER self
|
||||
function CLIENTMENUMANAGER:RemoveGenericSubEntries(Entry)
|
||||
self:T(self.lid.."RemoveGenericSubEntries")
|
||||
|
||||
local depth = #Entry.path + 1
|
||||
local uuid = Entry.UUID
|
||||
|
||||
local tbl = UTILS.DeepCopy(self.menutree)
|
||||
|
||||
if tbl[depth] then
|
||||
for i=depth,#tbl do
|
||||
self:T("Level = "..i)
|
||||
for _id,_uuid in pairs(tbl[i]) do
|
||||
self:T(_uuid)
|
||||
if string.find(_uuid,uuid,1,true) then
|
||||
self:T("Match for ".._uuid)
|
||||
self.menutree[i][_id] = nil
|
||||
self.flattree[_uuid] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Remove all entries below the given entry from the client's F10 menus.
|
||||
-- @param #CLIENTMENUMANAGER self
|
||||
-- @param #CLIENTMENU Entry The entry where to start. This entry stays.
|
||||
-- @param Wrapper.Client#CLIENT Client (optional) If given, make this change only for this client. In this case the generic structure will not be touched.
|
||||
-- @return #CLIENTMENUMANAGER self
|
||||
function CLIENTMENUMANAGER:RemoveF10SubEntries(Entry,Client)
|
||||
self:T(self.lid.."RemoveSubEntries")
|
||||
local Set = self.clientset.Set
|
||||
if Client then
|
||||
Set = {Client}
|
||||
end
|
||||
for _,_client in pairs(Set) do
|
||||
if _client and _client:IsAlive() then
|
||||
local playername = _client:GetPlayerName()
|
||||
if self.playertree[playername] then
|
||||
local centry = self.playertree[playername][Entry.UUID] -- #CLIENTMENU
|
||||
centry:RemoveSubEntries()
|
||||
end
|
||||
end
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
----------------------------------------------------------------------------------------------------------------
|
||||
--
|
||||
-- End ClientMenu
|
||||
--
|
||||
----------------------------------------------------------------------------------------------------------------
|
||||
@@ -37,6 +37,8 @@
|
||||
-- @field #table Templates Templates: Units, Groups, Statics, ClientsByName, ClientsByID.
|
||||
-- @field #table CLIENTS Clients.
|
||||
-- @field #table STORAGES DCS warehouse storages.
|
||||
-- @field #table STNS Used Link16 octal numbers for F16/15/18/AWACS planes.
|
||||
-- @field #table SADL Used Link16 octal numbers for A10/C-II planes.
|
||||
-- @extends Core.Base#BASE
|
||||
|
||||
--- Contains collections of wrapper objects defined within MOOSE that reflect objects within the simulator.
|
||||
@@ -93,6 +95,8 @@ DATABASE = {
|
||||
OPSZONES = {},
|
||||
PATHLINES = {},
|
||||
STORAGES = {},
|
||||
STNS={},
|
||||
SADL={},
|
||||
}
|
||||
|
||||
local _DATABASECoalition =
|
||||
@@ -928,7 +932,7 @@ function DATABASE:Spawn( SpawnTemplate )
|
||||
SpawnTemplate.CountryID = nil
|
||||
SpawnTemplate.CategoryID = nil
|
||||
|
||||
self:_RegisterGroupTemplate( SpawnTemplate, SpawnCoalitionID, SpawnCategoryID, SpawnCountryID )
|
||||
self:_RegisterGroupTemplate( SpawnTemplate, SpawnCoalitionID, SpawnCategoryID, SpawnCountryID, SpawnTemplate.name )
|
||||
|
||||
self:T3( SpawnTemplate )
|
||||
coalition.addGroup( SpawnCountryID, SpawnCategoryID, SpawnTemplate )
|
||||
@@ -1005,7 +1009,7 @@ function DATABASE:_RegisterGroupTemplate( GroupTemplate, CoalitionSide, Category
|
||||
self.Templates.Groups[GroupTemplateName].CategoryID = CategoryID
|
||||
self.Templates.Groups[GroupTemplateName].CoalitionID = CoalitionSide
|
||||
self.Templates.Groups[GroupTemplateName].CountryID = CountryID
|
||||
|
||||
|
||||
local UnitNames = {}
|
||||
|
||||
for unit_num, UnitTemplate in pairs( GroupTemplate.units ) do
|
||||
@@ -1029,10 +1033,31 @@ function DATABASE:_RegisterGroupTemplate( GroupTemplate, CoalitionSide, Category
|
||||
self.Templates.ClientsByName[UnitTemplate.name].CountryID = CountryID
|
||||
self.Templates.ClientsByID[UnitTemplate.unitId] = UnitTemplate
|
||||
end
|
||||
|
||||
if UnitTemplate.AddPropAircraft then
|
||||
if UnitTemplate.AddPropAircraft.STN_L16 then
|
||||
local stn = UTILS.OctalToDecimal(UnitTemplate.AddPropAircraft.STN_L16)
|
||||
if stn == nil or stn < 1 then
|
||||
self:E("WARNING: Invalid STN "..tostring(UnitTemplate.AddPropAircraft.STN_L16).." for ".. UnitTemplate.name)
|
||||
else
|
||||
self.STNS[stn] = UnitTemplate.name
|
||||
self:I("Register STN "..tostring(UnitTemplate.AddPropAircraft.STN_L16).." for ".. UnitTemplate.name)
|
||||
end
|
||||
end
|
||||
if UnitTemplate.AddPropAircraft.SADL_TN then
|
||||
local sadl = UTILS.OctalToDecimal(UnitTemplate.AddPropAircraft.SADL_TN)
|
||||
if sadl == nil or sadl < 1 then
|
||||
self:E("WARNING: Invalid SADL "..tostring(UnitTemplate.AddPropAircraft.SADL_TN).." for ".. UnitTemplate.name)
|
||||
else
|
||||
self.SADL[sadl] = UnitTemplate.name
|
||||
self:I("Register SADL "..tostring(UnitTemplate.AddPropAircraft.SADL_TN).." for ".. UnitTemplate.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
UnitNames[#UnitNames+1] = self.Templates.Units[UnitTemplate.name].UnitName
|
||||
end
|
||||
|
||||
|
||||
-- Debug info.
|
||||
self:T( { Group = self.Templates.Groups[GroupTemplateName].GroupName,
|
||||
Coalition = self.Templates.Groups[GroupTemplateName].CoalitionID,
|
||||
@@ -1043,6 +1068,80 @@ function DATABASE:_RegisterGroupTemplate( GroupTemplate, CoalitionSide, Category
|
||||
)
|
||||
end
|
||||
|
||||
--- Get next (consecutive) free STN as octal number.
|
||||
-- @param #DATABASE self
|
||||
-- @param #number octal Starting octal.
|
||||
-- @param #string unitname Name of the associated unit.
|
||||
-- @return #number Octal
|
||||
function DATABASE:GetNextSTN(octal,unitname)
|
||||
local first = UTILS.OctalToDecimal(octal) or 0
|
||||
if self.STNS[first] == unitname then return octal end
|
||||
local nextoctal = 77777
|
||||
local found = false
|
||||
if 32767-first < 10 then
|
||||
first = 0
|
||||
end
|
||||
for i=first+1,32767 do
|
||||
if self.STNS[i] == nil then
|
||||
found = true
|
||||
nextoctal = UTILS.DecimalToOctal(i)
|
||||
self.STNS[i] = unitname
|
||||
self:T("Register STN "..tostring(nextoctal).." for ".. unitname)
|
||||
break
|
||||
end
|
||||
end
|
||||
if not found then
|
||||
self:E(string.format("WARNING: No next free STN past %05d found!",octal))
|
||||
-- cleanup
|
||||
local NewSTNS = {}
|
||||
for _id,_name in pairs(self.STNS) do
|
||||
if self.UNITS[_name] ~= nil then
|
||||
NewSTNS[_id] = _name
|
||||
end
|
||||
end
|
||||
self.STNS = nil
|
||||
self.STNS = NewSTNS
|
||||
end
|
||||
return nextoctal
|
||||
end
|
||||
|
||||
--- Get next (consecutive) free SADL as octal number.
|
||||
-- @param #DATABASE self
|
||||
-- @param #number octal Starting octal.
|
||||
-- @param #string unitname Name of the associated unit.
|
||||
-- @return #number Octal
|
||||
function DATABASE:GetNextSADL(octal,unitname)
|
||||
local first = UTILS.OctalToDecimal(octal) or 0
|
||||
if self.SADL[first] == unitname then return octal end
|
||||
local nextoctal = 7777
|
||||
local found = false
|
||||
if 4095-first < 10 then
|
||||
first = 0
|
||||
end
|
||||
for i=first+1,4095 do
|
||||
if self.STNS[i] == nil then
|
||||
found = true
|
||||
nextoctal = UTILS.DecimalToOctal(i)
|
||||
self.SADL[i] = unitname
|
||||
self:T("Register SADL "..tostring(nextoctal).." for ".. unitname)
|
||||
break
|
||||
end
|
||||
end
|
||||
if not found then
|
||||
self:E(string.format("WARNING: No next free SADL past %04d found!",octal))
|
||||
-- cleanup
|
||||
local NewSTNS = {}
|
||||
for _id,_name in pairs(self.SADL) do
|
||||
if self.UNITS[_name] ~= nil then
|
||||
NewSTNS[_id] = _name
|
||||
end
|
||||
end
|
||||
self.SADL = nil
|
||||
self.SADL = NewSTNS
|
||||
end
|
||||
return nextoctal
|
||||
end
|
||||
|
||||
--- Get group template.
|
||||
-- @param #DATABASE self
|
||||
-- @param #string GroupName Group name.
|
||||
@@ -1586,7 +1685,7 @@ function DATABASE:_EventOnPlayerLeaveUnit( Event )
|
||||
if Event.IniObjectCategory == 1 then
|
||||
|
||||
-- Try to get the player name. This can be buggy for multicrew aircraft!
|
||||
local PlayerName = Event.IniUnit:GetPlayerName() or FindPlayerName(Event.IniUnitName)
|
||||
local PlayerName = Event.IniPlayerName or Event.IniUnit:GetPlayerName() or FindPlayerName(Event.IniUnitName)
|
||||
|
||||
if PlayerName then
|
||||
|
||||
@@ -1982,7 +2081,7 @@ function DATABASE:_RegisterTemplates()
|
||||
for group_num, Template in pairs(obj_type_data.group) do
|
||||
|
||||
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)
|
||||
|
||||
else
|
||||
|
||||
@@ -1378,6 +1378,7 @@ function EVENT:onEvent( Event )
|
||||
Event.MarkCoordinate=COORDINATE:NewFromVec3(Event.pos)
|
||||
Event.MarkText=Event.text
|
||||
Event.MarkCoalition=Event.coalition
|
||||
Event.IniCoalition=Event.coalition
|
||||
Event.MarkGroupID = Event.groupID
|
||||
end
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
-- ### Author: **Applevangelist**
|
||||
--
|
||||
-- Date: 5 May 2021
|
||||
-- Last Update: Feb 2023
|
||||
-- Last Update: Mar 2023
|
||||
--
|
||||
-- ===
|
||||
---
|
||||
@@ -50,7 +50,7 @@ MARKEROPS_BASE = {
|
||||
ClassName = "MARKEROPS",
|
||||
Tag = "mytag",
|
||||
Keywords = {},
|
||||
version = "0.1.1",
|
||||
version = "0.1.3",
|
||||
debug = false,
|
||||
Casesensitive = true,
|
||||
}
|
||||
@@ -114,6 +114,8 @@ function MARKEROPS_BASE:New(Tagname,Keywords,Casesensitive)
|
||||
-- @param #string Text The text on the marker
|
||||
-- @param #table Keywords Table of matching keywords found in the Event text
|
||||
-- @param Core.Point#COORDINATE Coord Coordinate of the marker.
|
||||
-- @param #number MarkerID Id of this marker
|
||||
-- @param #number CoalitionNumber Coalition of the marker creator
|
||||
|
||||
--- On after "MarkChanged" event. Triggered when a Marker is changed on the F10 map.
|
||||
-- @function [parent=#MARKEROPS_BASE] OnAfterMarkChanged
|
||||
@@ -124,7 +126,8 @@ function MARKEROPS_BASE:New(Tagname,Keywords,Casesensitive)
|
||||
-- @param #string Text The text on the marker
|
||||
-- @param #table Keywords Table of matching keywords found in the Event text
|
||||
-- @param Core.Point#COORDINATE Coord Coordinate of the marker.
|
||||
-- @param #number idx DCS Marker ID
|
||||
-- @param #number MarkerID Id of this marker
|
||||
-- @param #number CoalitionNumber Coalition of the marker creator
|
||||
|
||||
--- On after "MarkDeleted" event. Triggered when a Marker is deleted from the F10 map.
|
||||
-- @function [parent=#MARKEROPS_BASE] OnAfterMarkDeleted
|
||||
@@ -133,7 +136,7 @@ function MARKEROPS_BASE:New(Tagname,Keywords,Casesensitive)
|
||||
-- @param #string Event The Event called
|
||||
-- @param #string To The To state
|
||||
|
||||
--- "Stop" trigger. Used to stop the function an unhandle events
|
||||
--- "Stop" trigger. Used to stop the function an unhandle events
|
||||
-- @function [parent=#MARKEROPS_BASE] Stop
|
||||
|
||||
end
|
||||
@@ -155,29 +158,30 @@ function MARKEROPS_BASE:OnEventMark(Event)
|
||||
local text = tostring(Event.text)
|
||||
local m = MESSAGE:New(string.format("Mark added at %s with text: %s",coordtext,text),10,"Info",false):ToAll()
|
||||
end
|
||||
local coalition = Event.MarkCoalition
|
||||
-- decision
|
||||
if Event.id==world.event.S_EVENT_MARK_ADDED then
|
||||
self:T({event="S_EVENT_MARK_ADDED", carrier=self.groupname, vec3=Event.pos})
|
||||
self:T({event="S_EVENT_MARK_ADDED", carrier=Event.IniGroupName, vec3=Event.pos})
|
||||
-- Handle event
|
||||
local Eventtext = tostring(Event.text)
|
||||
if Eventtext~=nil then
|
||||
if self:_MatchTag(Eventtext) then
|
||||
local matchtable = self:_MatchKeywords(Eventtext)
|
||||
self:MarkAdded(Eventtext,matchtable,coord)
|
||||
self:MarkAdded(Eventtext,matchtable,coord,Event.idx,coalition)
|
||||
end
|
||||
end
|
||||
elseif Event.id==world.event.S_EVENT_MARK_CHANGE then
|
||||
self:T({event="S_EVENT_MARK_CHANGE", carrier=self.groupname, vec3=Event.pos})
|
||||
self:T({event="S_EVENT_MARK_CHANGE", carrier=Event.IniGroupName, vec3=Event.pos})
|
||||
-- Handle event.
|
||||
local Eventtext = tostring(Event.text)
|
||||
if Eventtext~=nil then
|
||||
if self:_MatchTag(Eventtext) then
|
||||
local matchtable = self:_MatchKeywords(Eventtext)
|
||||
self:MarkChanged(Eventtext,matchtable,coord,Event.idx)
|
||||
self:MarkChanged(Eventtext,matchtable,coord,Event.idx,coalition)
|
||||
end
|
||||
end
|
||||
elseif Event.id==world.event.S_EVENT_MARK_REMOVED then
|
||||
self:T({event="S_EVENT_MARK_REMOVED", carrier=self.groupname, vec3=Event.pos})
|
||||
self:T({event="S_EVENT_MARK_REMOVED", carrier=Event.IniGroupName, vec3=Event.pos})
|
||||
-- Hande event.
|
||||
local Eventtext = tostring(Event.text)
|
||||
if Eventtext~=nil then
|
||||
@@ -230,8 +234,10 @@ end
|
||||
-- @param #string To The To state
|
||||
-- @param #string Text The text on the marker
|
||||
-- @param #table Keywords Table of matching keywords found in the Event text
|
||||
-- @param #number MarkerID Id of this marker
|
||||
-- @param #number CoalitionNumber Coalition of the marker creator
|
||||
-- @param Core.Point#COORDINATE Coord Coordinate of the marker.
|
||||
function MARKEROPS_BASE:onbeforeMarkAdded(From,Event,To,Text,Keywords,Coord)
|
||||
function MARKEROPS_BASE:onbeforeMarkAdded(From,Event,To,Text,Keywords,Coord,MarkerID,CoalitionNumber)
|
||||
self:T({self.lid,From,Event,To,Text,Keywords,Coord:ToStringLLDDM()})
|
||||
end
|
||||
|
||||
@@ -242,8 +248,10 @@ end
|
||||
-- @param #string To The To state
|
||||
-- @param #string Text The text on the marker
|
||||
-- @param #table Keywords Table of matching keywords found in the Event text
|
||||
-- @param #number MarkerID Id of this marker
|
||||
-- @param #number CoalitionNumber Coalition of the marker creator
|
||||
-- @param Core.Point#COORDINATE Coord Coordinate of the marker.
|
||||
function MARKEROPS_BASE:onbeforeMarkChanged(From,Event,To,Text,Keywords,Coord)
|
||||
function MARKEROPS_BASE:onbeforeMarkChanged(From,Event,To,Text,Keywords,Coord,MarkerID,CoalitionNumber)
|
||||
self:T({self.lid,From,Event,To,Text,Keywords,Coord:ToStringLLDDM()})
|
||||
end
|
||||
|
||||
|
||||
@@ -395,29 +395,36 @@ end
|
||||
--- Sends a MESSAGE to all players.
|
||||
-- @param #MESSAGE self
|
||||
-- @param Core.Settings#Settings Settings (Optional) Settings for message display.
|
||||
-- @return #MESSAGE
|
||||
-- @param #number Delay (Optional) Delay in seconds before the message is send. Default instantly (`nil`).
|
||||
-- @return #MESSAGE self
|
||||
-- @usage
|
||||
--
|
||||
-- -- Send a message created to all players.
|
||||
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25 ):ToAll()
|
||||
-- or
|
||||
-- MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25 ):ToAll()
|
||||
-- or
|
||||
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25 )
|
||||
-- MessageAll:ToAll()
|
||||
-- -- Send a message created to all players.
|
||||
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25 ):ToAll()
|
||||
-- or
|
||||
-- MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25 ):ToAll()
|
||||
-- or
|
||||
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25 )
|
||||
-- MessageAll:ToAll()
|
||||
--
|
||||
function MESSAGE:ToAll( Settings )
|
||||
function MESSAGE:ToAll( Settings, Delay )
|
||||
self:F()
|
||||
|
||||
if self.MessageType then
|
||||
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
||||
self.MessageDuration = Settings:GetMessageTime( self.MessageType )
|
||||
self.MessageCategory = "" -- self.MessageType .. ": "
|
||||
end
|
||||
if Delay and Delay>0 then
|
||||
self:ScheduleOnce(Delay, MESSAGE.ToAll, self, Settings, 0)
|
||||
else
|
||||
|
||||
if self.MessageDuration ~= 0 then
|
||||
self:T( self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ) .. " / " .. self.MessageDuration )
|
||||
trigger.action.outText( self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ), self.MessageDuration, self.ClearScreen )
|
||||
if self.MessageType then
|
||||
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
||||
self.MessageDuration = Settings:GetMessageTime( self.MessageType )
|
||||
self.MessageCategory = "" -- self.MessageType .. ": "
|
||||
end
|
||||
|
||||
if self.MessageDuration ~= 0 then
|
||||
self:T( self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ) .. " / " .. self.MessageDuration )
|
||||
trigger.action.outText( self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ), self.MessageDuration, self.ClearScreen )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return self
|
||||
|
||||
@@ -73,7 +73,7 @@ PATHLINE = {
|
||||
|
||||
--- PATHLINE class version.
|
||||
-- @field #string version
|
||||
PATHLINE.version="0.1.0"
|
||||
PATHLINE.version="0.1.1"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- TODO list
|
||||
@@ -237,13 +237,14 @@ 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()
|
||||
function PATHLINE:GetCoordinates()
|
||||
|
||||
local vecs={}
|
||||
|
||||
for _,_point in pairs(self.points) do
|
||||
local point=_point --#PATHLINE.Point
|
||||
local coord=COORDINATE:NewFromVec3(point.vec3)
|
||||
table.insert(vecs,coord)
|
||||
end
|
||||
|
||||
return vecs
|
||||
@@ -262,7 +263,7 @@ function PATHLINE:GetPointFromIndex(n)
|
||||
local point=nil --#PATHLINE.Point
|
||||
|
||||
if n>=1 and n<=N then
|
||||
point=self.point[n]
|
||||
point=self.points[n]
|
||||
else
|
||||
self:E(self.lid..string.format("ERROR: No point in pathline for N=%s", tostring(n)))
|
||||
end
|
||||
@@ -367,4 +368,4 @@ end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -702,8 +702,9 @@ do -- COORDINATE
|
||||
-- @param #COORDINATE PointVec2Reference The reference @{#COORDINATE}.
|
||||
-- @return DCS#Distance The distance from the reference @{#COORDINATE} in meters.
|
||||
function COORDINATE:DistanceFromPointVec2( PointVec2Reference )
|
||||
self:F2( PointVec2Reference )
|
||||
|
||||
self:F2( PointVec2Reference )
|
||||
if not PointVec2Reference then return math.huge end
|
||||
|
||||
local Distance = ( ( PointVec2Reference.x - self.x ) ^ 2 + ( PointVec2Reference.z - self.z ) ^2 ) ^ 0.5
|
||||
|
||||
self:T2( Distance )
|
||||
@@ -3147,17 +3148,18 @@ do -- COORDINATE
|
||||
-- @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
|
||||
if string.len(Easting) < 5 then Easting = tostring(Easting..string.rep("0",5-string.len(Easting) )) end
|
||||
if string.len(Northing) < 5 then Northing = tostring(Northing..string.rep("0",5-string.len(Northing) )) end
|
||||
local MGRS = {
|
||||
UTMZone = UTMZone,
|
||||
MGRSDigraph = MGRSDigraph,
|
||||
Easting = Easting,
|
||||
Northing = Northing,
|
||||
Easting = tostring(Easting),
|
||||
Northing = tostring(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 string of the point, based on a coordinate format system:
|
||||
|
||||
@@ -1097,6 +1097,7 @@ do
|
||||
GroupPrefixes = nil,
|
||||
Zones = nil,
|
||||
Functions = nil,
|
||||
Alive = nil,
|
||||
},
|
||||
FilterMeta = {
|
||||
Coalitions = {
|
||||
@@ -1204,7 +1205,7 @@ do
|
||||
if not DontSetCargoBayLimit then
|
||||
-- I set the default cargo bay weight limit each time a new group is added to the set.
|
||||
-- TODO Why is this here in the first place?
|
||||
for UnitID, UnitData in pairs( group:GetUnits() ) do
|
||||
for UnitID, UnitData in pairs( group:GetUnits() or {} ) do
|
||||
if UnitData and UnitData:IsAlive() then
|
||||
UnitData:SetCargoBayWeightLimit()
|
||||
end
|
||||
@@ -1470,7 +1471,7 @@ do
|
||||
|
||||
end
|
||||
|
||||
--- Builds a set of groups that are only active.
|
||||
--- Builds a set of groups that are active, ie in the mission but not yet activated (false) or actived (true).
|
||||
-- Only the groups that are active will be included within the set.
|
||||
-- @param #SET_GROUP self
|
||||
-- @param #boolean Active (Optional) Include only active groups to the set.
|
||||
@@ -1495,6 +1496,14 @@ do
|
||||
self.Filter.Active = Active
|
||||
return self
|
||||
end
|
||||
|
||||
--- Build a set of groups that are alive.
|
||||
-- @param #SET_GROUP self
|
||||
-- @return #SET_GROUP self
|
||||
function SET_GROUP:FilterAlive()
|
||||
self.Filter.Alive = true
|
||||
return self
|
||||
end
|
||||
|
||||
--- Starts the filtering.
|
||||
-- @param #SET_GROUP self
|
||||
@@ -1993,7 +2002,16 @@ do
|
||||
function SET_GROUP:IsIncludeObject( MGroup )
|
||||
self:F2( MGroup )
|
||||
local MGroupInclude = true
|
||||
|
||||
|
||||
if self.Filter.Alive == true then
|
||||
local MGroupAlive = false
|
||||
self:F( { Active = self.Filter.Active } )
|
||||
if MGroup and MGroup:IsAlive() then
|
||||
MGroupAlive = true
|
||||
end
|
||||
MGroupInclude = MGroupInclude and MGroupAlive
|
||||
end
|
||||
|
||||
if self.Filter.Active ~= nil then
|
||||
local MGroupActive = false
|
||||
self:F( { Active = self.Filter.Active } )
|
||||
@@ -2997,7 +3015,7 @@ do -- SET_UNIT
|
||||
local velocity = self:GetVelocity() or 0
|
||||
Coordinate:SetHeading( heading )
|
||||
Coordinate:SetVelocity( velocity )
|
||||
self:I(UTILS.PrintTableToLog(Coordinate))
|
||||
self:T(UTILS.PrintTableToLog(Coordinate))
|
||||
end
|
||||
|
||||
return Coordinate
|
||||
@@ -4370,8 +4388,8 @@ do -- SET_CLIENT
|
||||
return self
|
||||
end
|
||||
|
||||
--- Builds a set of CLIENTs that contain the given string in their unit/pilot name.
|
||||
-- **Attention!** Bad naming convention as this **does not** filter only **prefixes** but all clients that **contain** the string.
|
||||
--- Builds a set of CLIENTs that contain the given string in their **unit/pilot** name and **NOT** the group name!
|
||||
-- **Attention!** Bad naming convention as this **does not** filter only **prefixes** but all clients that **contain** the string. Pattern matching applies.
|
||||
-- @param #SET_CLIENT self
|
||||
-- @param #string Prefixes The string pattern(s) that needs to be contained in the unit/pilot name. Can also be passed as a `#table` of strings.
|
||||
-- @return #SET_CLIENT self
|
||||
@@ -4521,7 +4539,7 @@ do -- SET_CLIENT
|
||||
if Event.IniObjectCategory == Object.Category.UNIT and Event.IniGroup and Event.IniGroup:IsGround() then
|
||||
-- CA Slot entered
|
||||
local ObjectName, Object = self:AddInDatabase( Event )
|
||||
self:I( ObjectName, UTILS.PrintTableToLog(Object) )
|
||||
self:T( ObjectName, UTILS.PrintTableToLog(Object) )
|
||||
if Object and self:IsIncludeObject( Object ) then
|
||||
self:Add( ObjectName, Object )
|
||||
end
|
||||
@@ -8399,7 +8417,7 @@ do -- SET_SCENERY
|
||||
--- Calculate current relative lifepoints of the SET objects, i.e. Life divided by Life0 as percentage value, eg 75 meaning 75% alive.
|
||||
-- **CAVEAT**: Some objects change their life value or "hitpoints" **after** the first hit. Hence we will adjust the Life0 value to 120%
|
||||
-- of the last life value if life exceeds life0 ata any point.
|
||||
-- Thus will will get a smooth percentage decrease, if you use this e.g. as success criteria for a bombing task.
|
||||
-- Thus we will get a smooth percentage decrease, if you use this e.g. as success criteria for a bombing task.
|
||||
-- @param #SET_SCENERY self
|
||||
-- @return #number LifePoints
|
||||
function SET_SCENERY:GetRelativeLife()
|
||||
|
||||
@@ -199,6 +199,22 @@
|
||||
--
|
||||
-- * @{#SPAWN.InitRepeat}() or @{#SPAWN.InitRepeatOnLanding}(): This method is used to re-spawn automatically the same group after it has landed.
|
||||
-- * @{#SPAWN.InitRepeatOnEngineShutDown}(): This method is used to re-spawn automatically the same group after it has landed and it shuts down the engines at the ramp.
|
||||
--
|
||||
-- ### Link-16 Datalink STN and SADL IDs (limited at the moment to F15/16/18/AWACS/Tanker/B1B, but not the F15E for clients, SADL A10CII only)
|
||||
--
|
||||
-- *{#SPAWN.InitSTN}(): Set the STN of the first unit in the group. All other units will have consecutive STNs, provided they have not been used yet.
|
||||
-- *{#SPAWN.InitSADL}(): Set the SADL of the first unit in the group. All other units will have consecutive SADLs, provided they have not been used yet.
|
||||
--
|
||||
-- ### Callsigns
|
||||
--
|
||||
-- *{#SPAWN.InitRandomizeCallsign}(): Set a random callsign name per spawn.
|
||||
-- *{#SPAWN.SpawnInitCallSign}(): Set a specific callsign for a spawned group.
|
||||
--
|
||||
-- ### Speed
|
||||
--
|
||||
-- *{#SPAWN.InitSpeedMps}(): Set the initial speed on spawning in meters per second.
|
||||
-- *{#SPAWN.InitSpeedKph}(): Set the initial speed on spawning in kilometers per hour.
|
||||
-- *{#SPAWN.InitSpeedKnots}(): Set the initial speed on spawning in knots.
|
||||
--
|
||||
-- ## SPAWN **Spawn** methods
|
||||
--
|
||||
@@ -276,9 +292,10 @@ SPAWN = {
|
||||
|
||||
--- Enumerator for spawns at airbases
|
||||
-- @type SPAWN.Takeoff
|
||||
-- @extends Wrapper.Group#GROUP.Takeoff
|
||||
|
||||
-- @field #SPAWN.Takeoff Takeoff
|
||||
-- @field #number Air Take off happens in air.
|
||||
-- @field #number Runway Spawn on runway. Does not work in MP!
|
||||
-- @field #number Hot Spawn at parking with engines on.
|
||||
-- @field #number Cold Spawn at parking with engines off.
|
||||
SPAWN.Takeoff = {
|
||||
Air = 1,
|
||||
Runway = 2,
|
||||
@@ -520,7 +537,7 @@ function SPAWN:NewFromTemplate( SpawnTemplate, SpawnTemplatePrefix, SpawnAliasPr
|
||||
end
|
||||
|
||||
if SpawnTemplate then
|
||||
self.SpawnTemplate = SpawnTemplate -- Contains the template structure for a Group Spawn from the Mission Editor. Note that this group must have lateActivation always on!!!
|
||||
self.SpawnTemplate = UTILS.DeepCopy(SpawnTemplate) -- Contains the template structure for a Group Spawn from the Mission Editor. Note that this group must have lateActivation always on!!!
|
||||
self.SpawnTemplatePrefix = SpawnTemplatePrefix
|
||||
self.SpawnAliasPrefix = SpawnAliasPrefix or SpawnTemplatePrefix
|
||||
self.SpawnTemplate.name = SpawnTemplatePrefix
|
||||
@@ -724,7 +741,7 @@ end
|
||||
-- @param #number Country Country id as number or enumerator:
|
||||
--
|
||||
-- * @{DCS#country.id.RUSSIA}
|
||||
-- * @{DCS#county.id.USA}
|
||||
-- * @{DCS#country.id.USA}
|
||||
--
|
||||
-- @return #SPAWN self
|
||||
function SPAWN:InitCountry( Country )
|
||||
@@ -780,6 +797,82 @@ function SPAWN:InitSkill( Skill )
|
||||
return self
|
||||
end
|
||||
|
||||
--- [Airplane - F15/16/18/AWACS/B1B/Tanker only] Set the STN Link16 starting number of the Group; each unit of the spawned group will have a consecutive STN set.
|
||||
-- @param #SPAWN self
|
||||
-- @param #number Octal The octal number (digits 1..7, max 5 digits, i.e. 1..77777) to set the STN to. Every STN needs to be unique!
|
||||
-- @return #SPAWN self
|
||||
function SPAWN:InitSTN(Octal)
|
||||
self:F( { Octal = Octal } )
|
||||
self.SpawnInitSTN = Octal or 77777
|
||||
local num = UTILS.OctalToDecimal(Octal)
|
||||
if num == nil or num < 1 then
|
||||
self:E("WARNING - STN "..tostring(Octal).." is not valid!")
|
||||
return self
|
||||
end
|
||||
if _DATABASE.STNS[num] ~= nil then
|
||||
self:E("WARNING - STN already assigned: "..tostring(Octal).." is used for ".._DATABASE.STNS[Octal])
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- [Airplane - A10-C II only] Set the SADL TN starting number of the Group; each unit of the spawned group will have a consecutive SADL set.
|
||||
-- @param #SPAWN self
|
||||
-- @param #number Octal The octal number (digits 1..7, max 4 digits, i.e. 1..7777) to set the SADL to. Every SADL needs to be unique!
|
||||
-- @return #SPAWN self
|
||||
function SPAWN:InitSADL(Octal)
|
||||
self:F( { Octal = Octal } )
|
||||
self.SpawnInitSADL = Octal or 7777
|
||||
local num = UTILS.OctalToDecimal(Octal)
|
||||
if num == nil or num < 1 then
|
||||
self:E("WARNING - SADL "..tostring(Octal).." is not valid!")
|
||||
return self
|
||||
end
|
||||
if _DATABASE.SADL[num] ~= nil then
|
||||
self:E("WARNING - SADL already assigned: "..tostring(Octal).." is used for ".._DATABASE.SADL[Octal])
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- [Airplane] Set the initial speed on spawning in meters per second. Useful when spawning in-air only.
|
||||
-- @param #SPAWN self
|
||||
-- @param #number MPS The speed in MPS to use.
|
||||
-- @return #SPAWN self
|
||||
function SPAWN:InitSpeedMps(MPS)
|
||||
self:F( { MPS = MPS } )
|
||||
if MPS == nil or tonumber(MPS)<0 then
|
||||
MPS=125
|
||||
end
|
||||
self.InitSpeed = MPS
|
||||
return self
|
||||
end
|
||||
|
||||
--- [Airplane] Set the initial speed on spawning in knots. Useful when spawning in-air only.
|
||||
-- @param #SPAWN self
|
||||
-- @param #number Knots The speed in knots to use.
|
||||
-- @return #SPAWN self
|
||||
function SPAWN:InitSpeedKnots(Knots)
|
||||
self:F( { Knots = Knots } )
|
||||
if Knots == nil or tonumber(Knots)<0 then
|
||||
Knots=300
|
||||
end
|
||||
self.InitSpeed = UTILS.KnotsToMps(Knots)
|
||||
return self
|
||||
end
|
||||
|
||||
--- [Airplane] Set the initial speed on spawning in kilometers per hour. Useful when spawning in-air only.
|
||||
-- @param #SPAWN self
|
||||
-- @param #number KPH The speed in KPH to use.
|
||||
-- @return #SPAWN self
|
||||
function SPAWN:InitSpeedKph(KPH)
|
||||
self:F( { KPH = KPH } )
|
||||
if KPH == nil or tonumber(KPH)<0 then
|
||||
KPH=UTILS.KnotsToKmph(300)
|
||||
end
|
||||
self.InitSpeed = UTILS.KmphToMps(KPH)
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Sets the radio communication on or off. Same as checking/unchecking the COMM box in the mission editor.
|
||||
-- @param #SPAWN self
|
||||
-- @param #number switch If true (or nil), enables the radio communication. If false, disables the radio for the spawned group.
|
||||
@@ -1375,6 +1468,30 @@ do -- Delay methods
|
||||
|
||||
end -- Delay methods
|
||||
|
||||
--- Hide the group on the map view (visible to game master slots!).
|
||||
-- @param #SPAWN self
|
||||
-- @return #SPAWN The SPAWN object
|
||||
function SPAWN:InitHiddenOnMap()
|
||||
self.SpawnHiddenOnMap = true
|
||||
return self
|
||||
end
|
||||
|
||||
--- Hide the group on MFDs (visible to game master slots!).
|
||||
-- @param #SPAWN self
|
||||
-- @return #SPAWN The SPAWN object
|
||||
function SPAWN:InitHiddenOnMFD()
|
||||
self.SpawnHiddenOnMFD = true
|
||||
return self
|
||||
end
|
||||
|
||||
--- Hide the group on planner (visible to game master slots!).
|
||||
-- @param #SPAWN self
|
||||
-- @return #SPAWN The SPAWN object
|
||||
function SPAWN:InitHiddenOnPlanner()
|
||||
self.SpawnHiddenOnPlanner = true
|
||||
return self
|
||||
end
|
||||
|
||||
--- Will spawn a group based on the internal index.
|
||||
-- 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
|
||||
@@ -1648,7 +1765,20 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
|
||||
if self.SpawnInitModu then
|
||||
SpawnTemplate.modulation = self.SpawnInitModu
|
||||
end
|
||||
|
||||
-- hiding options
|
||||
if self.SpawnHiddenOnPlanner then
|
||||
SpawnTemplate.hiddenOnPlanner=true
|
||||
end
|
||||
|
||||
if self.SpawnHiddenOnMFD then
|
||||
SpawnTemplate.hiddenOnMFD=true
|
||||
end
|
||||
|
||||
if self.SpawnHiddenOnMap then
|
||||
SpawnTemplate.hidden=true
|
||||
end
|
||||
|
||||
-- Set country, coalition and category.
|
||||
SpawnTemplate.CategoryID = self.SpawnInitCategory or SpawnTemplate.CategoryID
|
||||
SpawnTemplate.CountryID = self.SpawnInitCountry or SpawnTemplate.CountryID
|
||||
@@ -1689,8 +1819,8 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
|
||||
|
||||
-- If there is a SpawnFunction hook defined, call it.
|
||||
if self.SpawnFunctionHook then
|
||||
-- delay calling this for .1 seconds so that it hopefully comes after the BIRTH event of the group.
|
||||
self.SpawnHookScheduler:Schedule( nil, self.SpawnFunctionHook, { self.SpawnGroups[self.SpawnIndex].Group, unpack( self.SpawnFunctionArguments ) }, 0.1 )
|
||||
-- delay calling this for .3 seconds so that it hopefully comes after the BIRTH event of the group.
|
||||
self.SpawnHookScheduler:Schedule( nil, self.SpawnFunctionHook, { self.SpawnGroups[self.SpawnIndex].Group, unpack( self.SpawnFunctionArguments ) }, 0.3 )
|
||||
end
|
||||
-- TODO: Need to fix this by putting an "R" in the name of the group when the group repeats.
|
||||
-- if self.Repeat then
|
||||
@@ -1699,6 +1829,7 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
|
||||
end
|
||||
|
||||
self.SpawnGroups[self.SpawnIndex].Spawned = true
|
||||
self.SpawnGroups[self.SpawnIndex].Group.TemplateDonor = self.SpawnTemplatePrefix
|
||||
return self.SpawnGroups[self.SpawnIndex].Group
|
||||
else
|
||||
-- self:E( { self.SpawnTemplatePrefix, "No more Groups to Spawn:", SpawnIndex, self.SpawnMaxGroups } )
|
||||
@@ -3145,7 +3276,7 @@ end
|
||||
--- Get the index from a given group.
|
||||
-- The function will search the name of the group for a #, and will return the number behind the #-mark.
|
||||
function SPAWN:GetSpawnIndexFromGroup( SpawnGroup )
|
||||
self:F2( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, SpawnGroup } )
|
||||
self:F3( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, SpawnGroup } )
|
||||
|
||||
local IndexString = string.match( SpawnGroup:GetName(), "#(%d*)$" ):sub( 2 )
|
||||
local Index = tonumber( IndexString )
|
||||
@@ -3157,7 +3288,7 @@ end
|
||||
|
||||
--- Return the last maximum index that can be used.
|
||||
function SPAWN:_GetLastIndex()
|
||||
self:F( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix } )
|
||||
self:F3( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix } )
|
||||
|
||||
return self.SpawnMaxGroups
|
||||
end
|
||||
@@ -3303,7 +3434,7 @@ function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex ) -- R2.2
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if self.SpawnInitKeepUnitNames == false then
|
||||
for UnitID = 1, #SpawnTemplate.units do
|
||||
SpawnTemplate.units[UnitID].name = string.format( SpawnTemplate.name .. '-%02d', UnitID )
|
||||
@@ -3311,9 +3442,17 @@ function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex ) -- R2.2
|
||||
end
|
||||
else
|
||||
for UnitID = 1, #SpawnTemplate.units do
|
||||
local UnitPrefix, Rest = string.match( SpawnTemplate.units[UnitID].name, "^([^#]+)#?" ):gsub( "^%s*(.-)%s*$", "%1" )
|
||||
self:T( { UnitPrefix, Rest } )
|
||||
|
||||
local SpawnInitKeepUnitIFF = false
|
||||
if string.find(SpawnTemplate.units[UnitID].name,"#IFF_",1,true) then --Razbam IFF hack for F15E etc
|
||||
SpawnInitKeepUnitIFF = true
|
||||
end
|
||||
local UnitPrefix, Rest
|
||||
if SpawnInitKeepUnitIFF == false then
|
||||
UnitPrefix, Rest = string.match( SpawnTemplate.units[UnitID].name, "^([^#]+)#?" ):gsub( "^%s*(.-)%s*$", "%1" )
|
||||
self:T( { UnitPrefix, Rest } )
|
||||
else
|
||||
UnitPrefix=SpawnTemplate.units[UnitID].name
|
||||
end
|
||||
SpawnTemplate.units[UnitID].name = string.format( '%s#%03d-%02d', UnitPrefix, SpawnIndex, UnitID )
|
||||
SpawnTemplate.units[UnitID].unitId = nil
|
||||
end
|
||||
@@ -3395,34 +3534,58 @@ function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex ) -- R2.2
|
||||
SpawnTemplate.units[UnitID].callsign = Callsign + SpawnIndex
|
||||
end
|
||||
end
|
||||
-- Speed
|
||||
if self.InitSpeed then
|
||||
SpawnTemplate.units[UnitID].speed = self.InitSpeed
|
||||
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)
|
||||
if self.SpawnInitSTN then
|
||||
local octal = self.SpawnInitSTN
|
||||
if UnitID > 1 then
|
||||
octal = _DATABASE:GetNextSTN(self.SpawnInitSTN,SpawnTemplate.units[UnitID].name)
|
||||
end
|
||||
SpawnTemplate.units[UnitID].AddPropAircraft.STN_L16 = string.format("%05d",octal)
|
||||
else
|
||||
-- 5 digit octal with leading 0
|
||||
if tonumber(SpawnTemplate.units[UnitID].AddPropAircraft.STN_L16) ~= nil then
|
||||
local octal = SpawnTemplate.units[UnitID].AddPropAircraft.STN_L16
|
||||
local num = UTILS.OctalToDecimal(octal)
|
||||
if _DATABASE.STNS[num] ~= nil or UnitID > 1 then -- STN taken or next unit
|
||||
octal = _DATABASE:GetNextSTN(octal,SpawnTemplate.units[UnitID].name)
|
||||
end
|
||||
SpawnTemplate.units[UnitID].AddPropAircraft.STN_L16 = string.format("%05d",octal)
|
||||
else -- ED bug - chars in here
|
||||
local OSTN = _DATABASE:GetNextSTN(1,SpawnTemplate.units[UnitID].name)
|
||||
SpawnTemplate.units[UnitID].AddPropAircraft.STN_L16 = string.format("%05d",OSTN)
|
||||
end
|
||||
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)
|
||||
-- 4 digit octal with leading 0
|
||||
if self.SpawnInitSADL then
|
||||
local octal = self.SpawnInitSADL
|
||||
if UnitID > 1 then
|
||||
octal = _DATABASE:GetNextSADL(self.SpawnInitSADL,SpawnTemplate.units[UnitID].name)
|
||||
end
|
||||
SpawnTemplate.units[UnitID].AddPropAircraft.SADL_TN = string.format("%04d",octal)
|
||||
else
|
||||
if tonumber(SpawnTemplate.units[UnitID].AddPropAircraft.SADL_TN) ~= nil then
|
||||
local octal = SpawnTemplate.units[UnitID].AddPropAircraft.SADL_TN
|
||||
local num = UTILS.OctalToDecimal(octal)
|
||||
self.SpawnInitSADL = num -- we arrived here seeing that self.SpawnInitSADL == nil, but now that we have a SADL (num), we also need to set it to self.SpawnInitSADL in case
|
||||
-- we need to get the next SADL from _DATABASE, or else UTILS.OctalToDecimal() will fail in GetNextSADL
|
||||
if _DATABASE.SADL[num] ~= nil or UnitID > 1 then -- SADL taken or next unit
|
||||
octal = _DATABASE:GetNextSADL(self.SpawnInitSADL,SpawnTemplate.units[UnitID].name)
|
||||
end
|
||||
SpawnTemplate.units[UnitID].AddPropAircraft.SADL_TN = string.format("%04d",octal)
|
||||
else -- ED bug - chars in here
|
||||
local OSTN = _DATABASE:GetNextSADL(1,SpawnTemplate.units[UnitID].name)
|
||||
SpawnTemplate.units[UnitID].AddPropAircraft.SADL_TN = string.format("%04d",OSTN)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- VoiceCallsignNumber
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
--- **Core** - Spawn statics.
|
||||
--
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
--
|
||||
-- ## Features:
|
||||
--
|
||||
--
|
||||
-- * Spawn new statics from a static already defined in the mission editor.
|
||||
-- * Spawn new statics from a given template.
|
||||
-- * Spawn new statics from a given type.
|
||||
-- * Spawn with a custom heading and location.
|
||||
-- * Spawn within a zone.
|
||||
-- * Spawn statics linked to units, .e.g on aircraft carriers.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- # Demo Missions
|
||||
--
|
||||
-- ## [SPAWNSTATIC Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Core/SpawnStatic)
|
||||
--
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
--
|
||||
-- # Demo Missions
|
||||
--
|
||||
-- ## [SPAWNSTATIC Demo Missions](https://github.com/FlightControl-Master/MOOSE_Demos/tree/master/Core/SpawnStatic)
|
||||
--
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- # YouTube Channel
|
||||
--
|
||||
--
|
||||
-- ## No videos yet!
|
||||
--
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
--
|
||||
-- ### Author: **FlightControl**
|
||||
-- ### Contributions: **funkyfranky**
|
||||
--
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
--
|
||||
-- @module Core.SpawnStatic
|
||||
-- @image Core_Spawnstatic.JPG
|
||||
|
||||
@@ -58,37 +58,37 @@
|
||||
|
||||
|
||||
--- 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.
|
||||
--
|
||||
-- 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.
|
||||
--
|
||||
-- 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 @{Wrapper.Static}s will follow a naming convention at run-time:
|
||||
--
|
||||
--
|
||||
-- * 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
|
||||
--
|
||||
--
|
||||
-- Firstly, we need to create a SPAWNSTATIC object that will be used to spawn new statics into the mission. There are three ways to do this.
|
||||
--
|
||||
--
|
||||
-- ## Use another Static
|
||||
--
|
||||
--
|
||||
-- A new SPAWNSTATIC object can be created using another static by the @{#SPAWNSTATIC.NewFromStatic}() function. All parameters such as position, heading, country will be initialized
|
||||
-- from the static.
|
||||
--
|
||||
--
|
||||
-- ## From a Template
|
||||
--
|
||||
--
|
||||
-- A SPAWNSTATIC object can also be created from a template table using the @{#SPAWNSTATIC.NewFromTemplate}(SpawnTemplate, CountryID) function. All parameters are taken from the template.
|
||||
--
|
||||
--
|
||||
-- ## From a Type
|
||||
--
|
||||
--
|
||||
-- A very basic method is to create a SPAWNSTATIC object by just giving the type of the static. All parameters must be initialized from the InitXYZ functions described below. Otherwise default values
|
||||
-- are used. For example, if no spawn coordinate is given, the static will be created at the origin of the map.
|
||||
--
|
||||
--
|
||||
-- # Setting Parameters
|
||||
--
|
||||
--
|
||||
-- Parameters such as the spawn position, heading, country etc. can be set via :Init*XYZ* functions. Note that these functions must be given before the actual spawn command!
|
||||
--
|
||||
--
|
||||
-- * @{#SPAWNSTATIC.InitCoordinate}(Coordinate) Sets the coordinate where the static is spawned. Statics are always spawnd on the ground.
|
||||
-- * @{#SPAWNSTATIC.InitHeading}(Heading) sets the orientation of the static.
|
||||
-- * @{#SPAWNSTATIC.InitLivery}(LiveryName) sets the livery of the static. Not all statics support this.
|
||||
@@ -99,17 +99,17 @@
|
||||
-- * @{#SPAWNSTATIC.InitLinkToUnit}(Unit, OffsetX, OffsetY, OffsetAngle) links the static to a unit, e.g. to an aircraft carrier.
|
||||
--
|
||||
-- # Spawning the Statics
|
||||
--
|
||||
--
|
||||
-- Once the SPAWNSTATIC object is created and parameters are initialized, the spawn command can be given. There are different methods where some can be used to directly set parameters
|
||||
-- such as position and heading.
|
||||
--
|
||||
--
|
||||
-- * @{#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.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 @{Core.Zone}. Optionally, heading and name can be given. The name **must be unique**!
|
||||
--
|
||||
--
|
||||
-- @field #SPAWNSTATIC SPAWNSTATIC
|
||||
--
|
||||
--
|
||||
SPAWNSTATIC = {
|
||||
ClassName = "SPAWNSTATIC",
|
||||
SpawnIndex = 0,
|
||||
@@ -139,9 +139,9 @@ SPAWNSTATIC = {
|
||||
function SPAWNSTATIC:NewFromStatic(SpawnTemplateName, SpawnCountryID)
|
||||
|
||||
local self = BASE:Inherit( self, BASE:New() ) -- #SPAWNSTATIC
|
||||
|
||||
|
||||
local TemplateStatic, CoalitionID, CategoryID, CountryID = _DATABASE:GetStaticGroupTemplate(SpawnTemplateName)
|
||||
|
||||
|
||||
if TemplateStatic then
|
||||
self.SpawnTemplatePrefix = SpawnTemplateName
|
||||
self.TemplateStaticUnit = UTILS.DeepCopy(TemplateStatic.units[1])
|
||||
@@ -166,11 +166,11 @@ end
|
||||
function SPAWNSTATIC:NewFromTemplate(SpawnTemplate, CountryID)
|
||||
|
||||
local self = BASE:Inherit( self, BASE:New() ) -- #SPAWNSTATIC
|
||||
|
||||
|
||||
self.TemplateStaticUnit = UTILS.DeepCopy(SpawnTemplate)
|
||||
self.SpawnTemplatePrefix = SpawnTemplate.name
|
||||
self.CountryID = CountryID or country.id.USA
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -189,7 +189,7 @@ function SPAWNSTATIC:NewFromType(StaticType, StaticCategory, CountryID)
|
||||
self.InitStaticCategory=StaticCategory
|
||||
self.CountryID=CountryID or country.id.USA
|
||||
self.SpawnTemplatePrefix=self.InitStaticType
|
||||
|
||||
|
||||
self.InitStaticCoordinate=COORDINATE:New(0, 0, 0)
|
||||
self.InitStaticHeading=0
|
||||
|
||||
@@ -291,7 +291,7 @@ function SPAWNSTATIC:InitCountry(CountryID)
|
||||
return self
|
||||
end
|
||||
|
||||
--- Initialize name prefix statics get. This will be appended by "#0001", "#0002" etc.
|
||||
--- Initialize name prefix statics get. This will be appended by "#0001", "#0002" etc.
|
||||
-- @param #SPAWNSTATIC self
|
||||
-- @param #string NamePrefix Name prefix of statics spawned. Will append #0001, etc to the name.
|
||||
-- @return #SPAWNSTATIC self
|
||||
@@ -327,13 +327,13 @@ function SPAWNSTATIC:Spawn(Heading, NewName)
|
||||
if Heading then
|
||||
self.InitStaticHeading=Heading
|
||||
end
|
||||
|
||||
|
||||
if NewName then
|
||||
self.InitStaticName=NewName
|
||||
end
|
||||
|
||||
return self:_SpawnStatic(self.TemplateStaticUnit, self.CountryID)
|
||||
|
||||
|
||||
end
|
||||
|
||||
--- Creates a new @{Wrapper.Static} from a POINT_VEC2.
|
||||
@@ -347,7 +347,7 @@ function SPAWNSTATIC:SpawnFromPointVec2(PointVec2, Heading, NewName)
|
||||
local vec2={x=PointVec2:GetX(), y=PointVec2:GetY()}
|
||||
|
||||
local Coordinate=COORDINATE:NewFromVec2(vec2)
|
||||
|
||||
|
||||
return self:SpawnFromCoordinate(Coordinate, Heading, NewName)
|
||||
end
|
||||
|
||||
@@ -362,11 +362,11 @@ function SPAWNSTATIC:SpawnFromCoordinate(Coordinate, Heading, NewName)
|
||||
|
||||
-- Set up coordinate.
|
||||
self.InitStaticCoordinate=Coordinate
|
||||
|
||||
|
||||
if Heading then
|
||||
self.InitStaticHeading=Heading
|
||||
end
|
||||
|
||||
|
||||
if NewName then
|
||||
self.InitStaticName=NewName
|
||||
end
|
||||
@@ -385,7 +385,7 @@ function SPAWNSTATIC:SpawnFromZone(Zone, Heading, NewName)
|
||||
|
||||
-- Spawn the new static at the center of the zone.
|
||||
local Static = self:SpawnFromPointVec2( Zone:GetPointVec2(), Heading, NewName )
|
||||
|
||||
|
||||
return Static
|
||||
end
|
||||
|
||||
@@ -399,45 +399,45 @@ function SPAWNSTATIC:_SpawnStatic(Template, CountryID)
|
||||
Template=Template or {}
|
||||
|
||||
local CountryID=CountryID or self.CountryID
|
||||
|
||||
|
||||
if self.InitStaticType then
|
||||
Template.type=self.InitStaticType
|
||||
end
|
||||
|
||||
|
||||
if self.InitStaticCategory then
|
||||
Template.category=self.InitStaticCategory
|
||||
end
|
||||
|
||||
if self.InitStaticCoordinate then
|
||||
Template.x = self.InitStaticCoordinate.x
|
||||
|
||||
if self.InitStaticCoordinate then
|
||||
Template.x = self.InitStaticCoordinate.x
|
||||
Template.y = self.InitStaticCoordinate.z
|
||||
Template.alt = self.InitStaticCoordinate.y
|
||||
Template.alt = self.InitStaticCoordinate.y
|
||||
end
|
||||
|
||||
|
||||
if self.InitStaticHeading then
|
||||
Template.heading = math.rad(self.InitStaticHeading)
|
||||
Template.heading = math.rad(self.InitStaticHeading)
|
||||
end
|
||||
|
||||
if self.InitStaticShape then
|
||||
Template.shape_name=self.InitStaticShape
|
||||
end
|
||||
|
||||
|
||||
if self.InitStaticLivery then
|
||||
Template.livery_id=self.InitStaticLivery
|
||||
end
|
||||
|
||||
|
||||
if self.InitStaticDead~=nil then
|
||||
Template.dead=self.InitStaticDead
|
||||
end
|
||||
|
||||
|
||||
if self.InitStaticCargo~=nil then
|
||||
Template.canCargo=self.InitStaticCargo
|
||||
end
|
||||
|
||||
|
||||
if self.InitStaticCargoMass~=nil then
|
||||
Template.mass=self.InitStaticCargoMass
|
||||
end
|
||||
|
||||
|
||||
if self.InitLinkUnit then
|
||||
Template.linkUnit=self.InitLinkUnit:GetID()
|
||||
Template.linkOffset=true
|
||||
@@ -446,45 +446,45 @@ function SPAWNSTATIC:_SpawnStatic(Template, CountryID)
|
||||
Template.offsets.x=self.InitOffsetX
|
||||
Template.offsets.angle=self.InitOffsetAngle and math.rad(self.InitOffsetAngle) or 0
|
||||
end
|
||||
|
||||
|
||||
if self.InitFarp then
|
||||
Template.heliport_callsign_id = self.InitFarpCallsignID
|
||||
Template.heliport_frequency = self.InitFarpFreq
|
||||
Template.heliport_modulation = self.InitFarpModu
|
||||
Template.unitId=nil
|
||||
end
|
||||
|
||||
|
||||
-- Increase spawn index counter.
|
||||
self.SpawnIndex = self.SpawnIndex + 1
|
||||
|
||||
|
||||
-- Name of the spawned static.
|
||||
Template.name = self.InitStaticName or string.format("%s#%05d", self.SpawnTemplatePrefix, self.SpawnIndex)
|
||||
|
||||
-- Add and register the new static.
|
||||
local mystatic=_DATABASE:AddStatic(Template.name)
|
||||
|
||||
|
||||
-- Debug output.
|
||||
self:T(Template)
|
||||
|
||||
|
||||
-- Add static to the game.
|
||||
local Static=nil --DCS#StaticObject
|
||||
|
||||
|
||||
if self.InitFarp then
|
||||
|
||||
local TemplateGroup={}
|
||||
|
||||
local TemplateGroup={}
|
||||
TemplateGroup.units={}
|
||||
TemplateGroup.units[1]=Template
|
||||
|
||||
|
||||
TemplateGroup.visible=true
|
||||
TemplateGroup.hidden=false
|
||||
TemplateGroup.x=Template.x
|
||||
TemplateGroup.y=Template.y
|
||||
TemplateGroup.name=Template.name
|
||||
|
||||
self:T("Spawning FARP")
|
||||
self:T("Spawning FARP")
|
||||
self:T({Template=Template})
|
||||
self:T({TemplateGroup=TemplateGroup})
|
||||
|
||||
|
||||
-- ED's dirty way to spawn FARPS.
|
||||
Static=coalition.addGroup(CountryID, -1, TemplateGroup)
|
||||
|
||||
@@ -499,10 +499,10 @@ function SPAWNSTATIC:_SpawnStatic(Template, CountryID)
|
||||
world.onEvent(Event)
|
||||
|
||||
else
|
||||
self:T("Spawning Static")
|
||||
self:T2({Template=Template})
|
||||
self:T("Spawning Static")
|
||||
self:T2({Template=Template})
|
||||
Static=coalition.addStaticObject(CountryID, Template)
|
||||
end
|
||||
|
||||
|
||||
return mystatic
|
||||
end
|
||||
|
||||
@@ -46,6 +46,10 @@
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_Demos/tree/master/Core/Zone)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### Author: **FlightControl**
|
||||
-- ### Contributions: **Applevangelist**, **FunkyFranky**, **coconutcockpit**
|
||||
--
|
||||
@@ -326,14 +330,14 @@ function ZONE_BASE:GetRandomVec2()
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Define a random @{Core.Point#POINT_VEC2} within the zone.
|
||||
--- Define a random @{Core.Point#POINT_VEC2} within the zone. Note that this is actually a @{Core.Point#COORDINATE} type object, and not a simple Vec2 table.
|
||||
-- @param #ZONE_BASE self
|
||||
-- @return Core.Point#POINT_VEC2 The PointVec2 coordinates.
|
||||
function ZONE_BASE:GetRandomPointVec2()
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Define a random @{Core.Point#POINT_VEC3} within the zone.
|
||||
--- Define a random @{Core.Point#POINT_VEC3} within the zone. Note that this is actually a @{Core.Point#COORDINATE} type object, and not a simple Vec3 table.
|
||||
-- @param #ZONE_BASE self
|
||||
-- @return Core.Point#POINT_VEC3 The PointVec3 coordinates.
|
||||
function ZONE_BASE:GetRandomPointVec3()
|
||||
@@ -899,7 +903,8 @@ function ZONE_RADIUS:BoundZone( Points, CountryID, UnBound )
|
||||
|
||||
local Point = {}
|
||||
local Vec2 = self:GetVec2()
|
||||
|
||||
local countryID = CountryID or country.id.USA
|
||||
|
||||
Points = Points and Points or 360
|
||||
|
||||
local Angle
|
||||
@@ -910,7 +915,7 @@ function ZONE_RADIUS:BoundZone( Points, CountryID, UnBound )
|
||||
Point.x = Vec2.x + math.cos( 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 = {
|
||||
["country"] = CountryName,
|
||||
@@ -925,7 +930,7 @@ function ZONE_RADIUS:BoundZone( Points, CountryID, UnBound )
|
||||
["heading"] = 0,
|
||||
} -- end of ["group"]
|
||||
|
||||
local Group = coalition.addStaticObject( CountryID, Tire )
|
||||
local Group = coalition.addStaticObject( countryID, Tire )
|
||||
if UnBound and UnBound == true then
|
||||
Group:destroy()
|
||||
end
|
||||
@@ -1175,7 +1180,7 @@ function ZONE_RADIUS:RemoveJunk()
|
||||
return n
|
||||
end
|
||||
|
||||
--- Count the number of different coalitions inside the zone.
|
||||
--- Get a table of scanned units.
|
||||
-- @param #ZONE_RADIUS self
|
||||
-- @return #table Table of DCS units and DCS statics inside the zone.
|
||||
function ZONE_RADIUS:GetScannedUnits()
|
||||
@@ -1210,7 +1215,7 @@ function ZONE_RADIUS:GetScannedSetUnit()
|
||||
return SetUnit
|
||||
end
|
||||
|
||||
--- Get a set of scanned units.
|
||||
--- Get a set of scanned groups.
|
||||
-- @param #ZONE_RADIUS self
|
||||
-- @return Core.Set#SET_GROUP Set of groups.
|
||||
function ZONE_RADIUS:GetScannedSetGroup()
|
||||
@@ -1510,7 +1515,7 @@ function ZONE_RADIUS:GetRandomVec2(inner, outer, surfacetypes)
|
||||
return point
|
||||
end
|
||||
|
||||
--- Returns a @{Core.Point#POINT_VEC2} object reflecting a random 2D location within the zone.
|
||||
--- Returns a @{Core.Point#POINT_VEC2} object reflecting a random 2D location within the zone. Note that this is actually a @{Core.Point#COORDINATE} type object, and not a simple Vec2 table.
|
||||
-- @param #ZONE_RADIUS self
|
||||
-- @param #number inner (optional) Minimal distance from the center of the zone. Default is 0.
|
||||
-- @param #number outer (optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.
|
||||
@@ -1541,7 +1546,7 @@ function ZONE_RADIUS:GetRandomVec3( inner, outer )
|
||||
end
|
||||
|
||||
|
||||
--- Returns a @{Core.Point#POINT_VEC3} object reflecting a random 3D location within the zone.
|
||||
--- Returns a @{Core.Point#POINT_VEC3} object reflecting a random 3D location within the zone. Note that this is actually a @{Core.Point#COORDINATE} type object, and not a simple Vec3 table.
|
||||
-- @param #ZONE_RADIUS self
|
||||
-- @param #number inner (optional) Minimal distance from the center of the zone. Default is 0.
|
||||
-- @param #number outer (optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.
|
||||
@@ -1985,7 +1990,7 @@ function ZONE_GROUP:GetRandomVec2()
|
||||
return Point
|
||||
end
|
||||
|
||||
--- Returns a @{Core.Point#POINT_VEC2} object reflecting a random 2D location within the zone.
|
||||
--- Returns a @{Core.Point#POINT_VEC2} object reflecting a random 2D location within the zone. Note that this is actually a @{Core.Point#COORDINATE} type object, and not a simple Vec2 table.
|
||||
-- @param #ZONE_GROUP self
|
||||
-- @param #number inner (optional) Minimal distance from the center of the zone. Default is 0.
|
||||
-- @param #number outer (optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.
|
||||
@@ -2829,7 +2834,7 @@ function ZONE_POLYGON_BASE:GetRandomVec2()
|
||||
end
|
||||
end
|
||||
|
||||
--- Return a @{Core.Point#POINT_VEC2} object representing a random 2D point at landheight within the zone.
|
||||
--- Return a @{Core.Point#POINT_VEC2} object representing a random 2D point at landheight within the zone. Note that this is actually a @{Core.Point#COORDINATE} type object, and not a simple Vec2 table.
|
||||
-- @param #ZONE_POLYGON_BASE self
|
||||
-- @return @{Core.Point#POINT_VEC2}
|
||||
function ZONE_POLYGON_BASE:GetRandomPointVec2()
|
||||
@@ -2842,7 +2847,7 @@ function ZONE_POLYGON_BASE:GetRandomPointVec2()
|
||||
return PointVec2
|
||||
end
|
||||
|
||||
--- Return a @{Core.Point#POINT_VEC3} object representing a random 3D point at landheight within the zone.
|
||||
--- Return a @{Core.Point#POINT_VEC3} object representing a random 3D point at landheight within the zone. Note that this is actually a @{Core.Point#COORDINATE} type object, and not a simple Vec3 table.
|
||||
-- @param #ZONE_POLYGON_BASE self
|
||||
-- @return @{Core.Point#POINT_VEC3}
|
||||
function ZONE_POLYGON_BASE:GetRandomPointVec3()
|
||||
@@ -3830,18 +3835,18 @@ function ZONE_OVAL:GetRandomVec2()
|
||||
return {x=rx, y=ry}
|
||||
end
|
||||
|
||||
--- Define a random @{Core.Point#POINT_VEC2} within the zone.
|
||||
--- Define a random @{Core.Point#POINT_VEC2} within the zone. Note that this is actually a @{Core.Point#COORDINATE} type object, and not a simple Vec2 table.
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @return Core.Point#POINT_VEC2 The PointVec2 coordinates.
|
||||
function ZONE_OVAL:GetRandomPointVec2()
|
||||
return POINT_VEC2:NewFromVec2(self:GetRandomVec2())
|
||||
end
|
||||
|
||||
--- Define a random @{Core.Point#POINT_VEC2} within the zone.
|
||||
--- Define a random @{Core.Point#POINT_VEC2} within the zone. Note that this is actually a @{Core.Point#COORDINATE} type object, and not a simple Vec3 table.
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @return Core.Point#POINT_VEC2 The PointVec2 coordinates.
|
||||
function ZONE_OVAL:GetRandomPointVec3()
|
||||
return POINT_VEC2:NewFromVec3(self:GetRandomVec2())
|
||||
return POINT_VEC3:NewFromVec3(self:GetRandomVec2())
|
||||
end
|
||||
|
||||
--- Draw the zone on the F10 map.
|
||||
@@ -3981,7 +3986,7 @@ do -- ZONE_AIRBASE
|
||||
return ZoneVec2
|
||||
end
|
||||
|
||||
--- Returns a @{Core.Point#POINT_VEC2} object reflecting a random 2D location within the zone.
|
||||
--- Returns a @{Core.Point#POINT_VEC2} object reflecting a random 2D location within the zone. Note that this is actually a @{Core.Point#COORDINATE} type object, and not a simple Vec2 table.
|
||||
-- @param #ZONE_AIRBASE self
|
||||
-- @param #number inner (optional) Minimal distance from the center of the zone. Default is 0.
|
||||
-- @param #number outer (optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.
|
||||
|
||||
1343
Moose Development/Moose/Functional/AICSAR.lua
Normal file
1343
Moose Development/Moose/Functional/AICSAR.lua
Normal file
File diff suppressed because it is too large
Load Diff
806
Moose Development/Moose/Functional/AmmoTruck.lua
Normal file
806
Moose Development/Moose/Functional/AmmoTruck.lua
Normal file
@@ -0,0 +1,806 @@
|
||||
--- **Functional** -- Send a truck to supply artillery groups.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- **AMMOTRUCK** - Send a truck to supply artillery groups.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ## Missions:
|
||||
--
|
||||
-- Demo missions can be found on [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/Functional/AmmoTruck)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### Author : **applevangelist**
|
||||
--
|
||||
-- @module Functional.AmmoTruck
|
||||
-- @image Artillery.JPG
|
||||
--
|
||||
-- Last update: July 2023
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
--- **AMMOTRUCK** class, extends Core.Fsm#FSM
|
||||
-- @type AMMOTRUCK
|
||||
-- @field #string ClassName Class Name
|
||||
-- @field #string lid Lid for log entries
|
||||
-- @field #string version Version string
|
||||
-- @field #string alias Alias name
|
||||
-- @field #boolean debug Debug flag
|
||||
-- @field #table trucklist List of (alive) #AMMOTRUCK.data trucks
|
||||
-- @field #table targetlist List of (alive) #AMMOTRUCK.data artillery
|
||||
-- @field #number coalition Coalition this is for
|
||||
-- @field Core.Set#SET_GROUP truckset SET of trucks
|
||||
-- @field Core.Set#SET_GROUP targetset SET of artillery
|
||||
-- @field #table remunitionqueue List of (alive) #AMMOTRUCK.data artillery to be reloaded
|
||||
-- @field #table waitingtargets List of (alive) #AMMOTRUCK.data artillery waiting
|
||||
-- @field #number ammothreshold Threshold (min) ammo before sending a truck
|
||||
-- @field #number remunidist Max distance trucks will go
|
||||
-- @field #number monitor Monitor interval in seconds
|
||||
-- @field #number unloadtime Unload time in seconds
|
||||
-- @field #number waitingtime Max waiting time in seconds
|
||||
-- @field #boolean routeonroad Route truck on road if true (default)
|
||||
-- @field #number reloads Number of reloads a single truck can do before he must return home
|
||||
-- @extends Core.Fsm#FSM
|
||||
|
||||
--- *Amateurs talk about tactics, but professionals study logistics.* - General Robert H Barrow, USMC
|
||||
--
|
||||
-- Simple Class to re-arm your artillery with trucks.
|
||||
--
|
||||
-- #AMMOTRUCK
|
||||
--
|
||||
-- * Controls a SET\_GROUP of trucks which will re-arm a SET\_GROUP of artillery groups when they run out of ammunition.
|
||||
--
|
||||
-- ## 1 The AMMOTRUCK concept
|
||||
--
|
||||
-- A SET\_GROUP of trucks which will re-arm a SET\_GROUP of artillery groups when they run out of ammunition. They will be based on a
|
||||
-- homebase and drive from there to the artillery groups and then back home.
|
||||
-- Trucks are the **only known in-game mechanic** to re-arm artillery and other units in DCS. Working units are e.g.: M-939 (blue), Ural-375 and ZIL-135 (both red).
|
||||
--
|
||||
-- ## 2 Set-up
|
||||
--
|
||||
-- Define a set of trucks and a set of artillery:
|
||||
--
|
||||
-- local truckset = SET_GROUP:New():FilterCoalitions("blue"):FilterActive(true):FilterCategoryGround():FilterPrefixes("Ammo Truck"):FilterStart()
|
||||
-- local ariset = SET_GROUP:New():FilterCoalitions("blue"):FilterActive(true):FilterCategoryGround():FilterPrefixes("Artillery"):FilterStart()
|
||||
--
|
||||
-- Create an AMMOTRUCK object to take care of the artillery using the trucks, with a homezone:
|
||||
--
|
||||
-- local ammotruck = AMMOTRUCK:New(truckset,ariset,coalition.side.BLUE,"Logistics",ZONE:FindByName("HomeZone")
|
||||
--
|
||||
-- ## 2 Options and their default values
|
||||
--
|
||||
-- ammotruck.ammothreshold = 5 -- send a truck when down to this many rounds
|
||||
-- ammotruck.remunidist = 20000 -- 20km - send trucks max this far from home
|
||||
-- ammotruck.unloadtime = 600 -- 10 minutes - min time to unload ammunition
|
||||
-- ammotruck.waitingtime = 1800 -- 30 mintes - wait max this long until remunition is done
|
||||
-- ammotruck.monitor = -60 -- 1 minute - AMMOTRUCK checks run every one minute
|
||||
-- ammotruck.routeonroad = true -- Trucks will **try** to drive on roads
|
||||
-- ammotruck.usearmygroup = false -- If true, will make use of ARMYGROUP in the background (if used in DEV branch)
|
||||
-- ammotruck.reloads = 5 -- Maxn re-arms a truck can do before he needs to go home and restock. Set to -1 for unlimited
|
||||
--
|
||||
-- ## 3 FSM Events to shape mission
|
||||
--
|
||||
-- Truck has been sent off:
|
||||
--
|
||||
-- function ammotruck:OnAfterRouteTruck(From, Event, To, Truckdata, Aridata)
|
||||
-- ...
|
||||
-- end
|
||||
--
|
||||
-- Truck has arrived:
|
||||
--
|
||||
-- function ammotruck:OnAfterTruckArrived(From, Event, To, Truckdata)
|
||||
-- ...
|
||||
-- end
|
||||
--
|
||||
-- Truck is unloading:
|
||||
--
|
||||
-- function ammotruck:OnAfterTruckUnloading(From, Event, To, Truckdata)
|
||||
-- ...
|
||||
-- end
|
||||
--
|
||||
-- Truck is returning home:
|
||||
--
|
||||
-- function ammotruck:OnAfterTruckReturning(From, Event, To, Truckdata)
|
||||
-- ...
|
||||
-- end
|
||||
--
|
||||
-- Truck is arrived at home:
|
||||
--
|
||||
-- function ammotruck:OnAfterTruckHome(From, Event, To, Truckdata)
|
||||
-- ...
|
||||
-- end
|
||||
--
|
||||
-- @field #AMMOTRUCK
|
||||
AMMOTRUCK = {
|
||||
ClassName = "AMMOTRUCK",
|
||||
lid = "",
|
||||
version = "0.0.12",
|
||||
alias = "",
|
||||
debug = false,
|
||||
trucklist = {},
|
||||
targetlist = {},
|
||||
coalition = nil,
|
||||
truckset = nil,
|
||||
targetset = nil,
|
||||
remunitionqueue = {},
|
||||
waitingtargets = {},
|
||||
ammothreshold = 5,
|
||||
remunidist = 20000,
|
||||
monitor = -60,
|
||||
unloadtime = 600,
|
||||
waitingtime = 1800,
|
||||
routeonroad = true,
|
||||
reloads = 5,
|
||||
}
|
||||
|
||||
---
|
||||
-- @type AMMOTRUCK.State
|
||||
AMMOTRUCK.State = {
|
||||
IDLE = "idle",
|
||||
DRIVING = "driving",
|
||||
ARRIVED = "arrived",
|
||||
UNLOADING = "unloading",
|
||||
RETURNING = "returning",
|
||||
WAITING = "waiting",
|
||||
RELOADING = "reloading",
|
||||
OUTOFAMMO = "outofammo",
|
||||
REQUESTED = "requested",
|
||||
}
|
||||
|
||||
---
|
||||
--@type AMMOTRUCK.data
|
||||
--@field Wrapper.Group#GROUP group
|
||||
--@field #string name
|
||||
--@field #AMMOTRUCK.State statusquo
|
||||
--@field #number timestamp
|
||||
--@field #number ammo
|
||||
--@field Core.Point#COORDINATE coordinate
|
||||
--@field #string targetname
|
||||
--@field Wrapper.Group#GROUP targetgroup
|
||||
--@field Core.Point#COORDINATE targetcoordinate
|
||||
--@field #number reloads
|
||||
|
||||
---
|
||||
-- @param #AMMOTRUCK self
|
||||
-- @param Core.Set#SET_GROUP Truckset Set of truck groups
|
||||
-- @param Core.Set#SET_GROUP Targetset Set of artillery groups
|
||||
-- @param #number Coalition Coalition
|
||||
-- @param #string Alias Alias Name
|
||||
-- @param Core.Zone#ZONE Homezone Home, return zone for trucks
|
||||
-- @return #AMMOTRUCK self
|
||||
-- @usage
|
||||
-- Define a set of trucks and a set of artillery:
|
||||
-- local truckset = SET_GROUP:New():FilterCoalitions("blue"):FilterActive(true):FilterCategoryGround():FilterPrefixes("Ammo Truck"):FilterStart()
|
||||
-- local ariset = SET_GROUP:New():FilterCoalitions("blue"):FilterActive(true):FilterCategoryGround():FilterPrefixes("Artillery"):FilterStart()
|
||||
--
|
||||
-- Create an AMMOTRUCK object to take care of the artillery using the trucks, with a homezone:
|
||||
-- local ammotruck = AMMOTRUCK:New(truckset,ariset,coalition.side.BLUE,"Logistics",ZONE:FindByName("HomeZone")
|
||||
function AMMOTRUCK:New(Truckset,Targetset,Coalition,Alias,Homezone)
|
||||
|
||||
-- Inherit everything from BASE class.
|
||||
local self=BASE:Inherit(self, FSM:New()) -- #AMMOTRUCK
|
||||
|
||||
self.truckset = Truckset -- Core.Set#SET_GROUP
|
||||
self.targetset = Targetset -- Core.Set#SET_GROUP
|
||||
self.coalition = Coalition -- #number
|
||||
self.alias = Alias -- #string
|
||||
self.debug = false
|
||||
self.remunitionqueue = {}
|
||||
self.trucklist = {}
|
||||
self.targetlist = {}
|
||||
self.ammothreshold = 5
|
||||
self.remunidist = 20000
|
||||
self.homezone = Homezone -- Core.Zone#ZONE
|
||||
self.waitingtime = 1800
|
||||
self.usearmygroup = false
|
||||
self.hasarmygroup = false
|
||||
|
||||
-- Log id.
|
||||
self.lid=string.format("AMMOTRUCK %s | %s | ", self.version, self.alias)
|
||||
|
||||
self:SetStartState("Stopped")
|
||||
self:AddTransition("Stopped", "Start", "Running")
|
||||
self:AddTransition("*", "Monitor", "*")
|
||||
self:AddTransition("*", "RouteTruck", "*")
|
||||
self:AddTransition("*", "TruckArrived", "*")
|
||||
self:AddTransition("*", "TruckUnloading", "*")
|
||||
self:AddTransition("*", "TruckReturning", "*")
|
||||
self:AddTransition("*", "TruckHome", "*")
|
||||
self:AddTransition("*", "Stop", "Stopped")
|
||||
|
||||
self:__Start(math.random(5,10))
|
||||
|
||||
self:I(self.lid .. "Started")
|
||||
|
||||
------------------------
|
||||
--- Pseudo Functions ---
|
||||
------------------------
|
||||
|
||||
--- Triggers the FSM event "Stop". Stops the AMMOTRUCK and all its event handlers.
|
||||
-- @function [parent=#AMMOTRUCK] Stop
|
||||
-- @param #AMMOTRUCK self
|
||||
|
||||
--- Triggers the FSM event "Stop" after a delay. Stops the AMMOTRUCK and all its event handlers.
|
||||
-- @function [parent=#AMMOTRUCK] __Stop
|
||||
-- @param #AMMOTRUCK self
|
||||
-- @param #number delay Delay in seconds.
|
||||
|
||||
--- On after "RouteTruck" event.
|
||||
-- @function [parent=#AMMOTRUCK] OnAfterRouteTruck
|
||||
-- @param #AMMOTRUCK self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param #AMMOTRUCK.data Truck
|
||||
-- @param #AMMOTRUCK.data Artillery
|
||||
|
||||
--- On after "TruckUnloading" event.
|
||||
-- @function [parent=#AMMOTRUCK] OnAfterTruckUnloading
|
||||
-- @param #AMMOTRUCK self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param #AMMOTRUCK.data Truck
|
||||
|
||||
--- On after "TruckReturning" event.
|
||||
-- @function [parent=#AMMOTRUCK] OnAfterTruckReturning
|
||||
-- @param #AMMOTRUCK self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param #AMMOTRUCK.data Truck
|
||||
|
||||
--- On after "RouteTruck" event.
|
||||
-- @function [parent=#AMMOTRUCK] OnAfterRouteTruck
|
||||
-- @param #AMMOTRUCK self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param #AMMOTRUCK.data Truck
|
||||
|
||||
--- On after "TruckHome" event.
|
||||
-- @function [parent=#AMMOTRUCK] OnAfterTruckHome
|
||||
-- @param #AMMOTRUCK self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param #AMMOTRUCK.data Truck
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #AMMOTRUCK self
|
||||
-- @param #table dataset table of #AMMOTRUCK.data entries
|
||||
-- @return #AMMOTRUCK self
|
||||
function AMMOTRUCK:CheckDrivingTrucks(dataset)
|
||||
self:T(self.lid .. " CheckDrivingTrucks")
|
||||
local data = dataset
|
||||
for _,_data in pairs (data) do
|
||||
local truck = _data -- #AMMOTRUCK.data
|
||||
-- see if we arrived at destination
|
||||
local coord = truck.group:GetCoordinate()
|
||||
local tgtcoord = truck.targetcoordinate
|
||||
local dist = coord:Get2DDistance(tgtcoord)
|
||||
if dist <= 150 then
|
||||
-- arrived
|
||||
truck.statusquo = AMMOTRUCK.State.ARRIVED
|
||||
truck.timestamp = timer.getAbsTime()
|
||||
truck.coordinate = coord
|
||||
self:__TruckArrived(1,truck)
|
||||
end
|
||||
-- still driving?
|
||||
local Tnow = timer.getAbsTime()
|
||||
if Tnow - truck.timestamp > 30 then
|
||||
local group = truck.group
|
||||
if self.usearmygroup then
|
||||
group = truck.group:GetGroup()
|
||||
end
|
||||
local currspeed = group:GetVelocityKMH()
|
||||
if truck.lastspeed then
|
||||
if truck.lastspeed == 0 and currspeed == 0 then
|
||||
self:T(truck.group:GetName().." Is not moving!")
|
||||
-- try and move it
|
||||
truck.timestamp = timer.getAbsTime()
|
||||
if self.routeonroad then
|
||||
group:RouteGroundOnRoad(truck.targetcoordinate,30,2,"Vee")
|
||||
else
|
||||
group:RouteGroundTo(truck.targetcoordinate,30,"Vee",2)
|
||||
end
|
||||
end
|
||||
truck.lastspeed = currspeed
|
||||
else
|
||||
truck.lastspeed = currspeed
|
||||
truck.timestamp = timer.getAbsTime()
|
||||
end
|
||||
self:I({truck=truck.group:GetName(),currspeed=currspeed,lastspeed=truck.lastspeed})
|
||||
end
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #AMMOTRUCK self
|
||||
-- @param Wrapper.Group#GROUP Group
|
||||
-- @return #AMMOTRUCK self
|
||||
function AMMOTRUCK:GetAmmoStatus(Group)
|
||||
local ammotot, shells, rockets, bombs, missiles, narti = Group:GetAmmunition()
|
||||
return rockets+missiles+narti
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #AMMOTRUCK self
|
||||
-- @param #table dataset table of #AMMOTRUCK.data entries
|
||||
-- @return #AMMOTRUCK self
|
||||
function AMMOTRUCK:CheckWaitingTargets(dataset)
|
||||
self:T(self.lid .. " CheckWaitingTargets")
|
||||
local data = dataset
|
||||
for _,_data in pairs (data) do
|
||||
local truck = _data -- #AMMOTRUCK.data
|
||||
-- see how long we're waiting - maybe ammo truck is dead?
|
||||
local Tnow = timer.getAbsTime()
|
||||
local Tdiff = Tnow - truck.timestamp
|
||||
if Tdiff > self.waitingtime then
|
||||
local hasammo = self:GetAmmoStatus(truck.group)
|
||||
if hasammo <= self.ammothreshold then
|
||||
truck.statusquo = AMMOTRUCK.State.OUTOFAMMO
|
||||
else
|
||||
truck.statusquo = AMMOTRUCK.State.IDLE
|
||||
end
|
||||
end
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #AMMOTRUCK self
|
||||
-- @param #table dataset table of #AMMOTRUCK.data entries
|
||||
-- @return #AMMOTRUCK self
|
||||
function AMMOTRUCK:CheckReturningTrucks(dataset)
|
||||
self:T(self.lid .. " CheckReturningTrucks")
|
||||
local data = dataset
|
||||
local tgtcoord = self.homezone:GetCoordinate()
|
||||
local radius = self.homezone:GetRadius()
|
||||
for _,_data in pairs (data) do
|
||||
local truck = _data -- #AMMOTRUCK.data
|
||||
-- see if we arrived at destination
|
||||
local coord = truck.group:GetCoordinate()
|
||||
local dist = coord:Get2DDistance(tgtcoord)
|
||||
self:T({name=truck.name,radius=radius,distance=dist})
|
||||
if dist <= radius then
|
||||
-- arrived
|
||||
truck.statusquo = AMMOTRUCK.State.IDLE
|
||||
truck.timestamp = timer.getAbsTime()
|
||||
truck.coordinate = coord
|
||||
truck.reloads = self.reloads or 5
|
||||
self:__TruckHome(1,truck)
|
||||
end
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #AMMOTRUCK self
|
||||
-- @param #string name Artillery group name to find
|
||||
-- @return #AMMOTRUCK.data Data
|
||||
function AMMOTRUCK:FindTarget(name)
|
||||
self:T(self.lid .. " FindTarget")
|
||||
local data = nil
|
||||
local dataset = self.targetlist
|
||||
for _,_entry in pairs(dataset) do
|
||||
local entry = _entry -- #AMMOTRUCK.data
|
||||
if entry.name == name then
|
||||
data = entry
|
||||
break
|
||||
end
|
||||
end
|
||||
return data
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #AMMOTRUCK self
|
||||
-- @param #string name Truck group name to find
|
||||
-- @return #AMMOTRUCK.data Data
|
||||
function AMMOTRUCK:FindTruck(name)
|
||||
self:T(self.lid .. " FindTruck")
|
||||
local data = nil
|
||||
local dataset = self.trucklist
|
||||
for _,_entry in pairs(dataset) do
|
||||
local entry = _entry -- #AMMOTRUCK.data
|
||||
if entry.name == name then
|
||||
data = entry
|
||||
break
|
||||
end
|
||||
end
|
||||
return data
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #AMMOTRUCK self
|
||||
-- @param #table dataset table of #AMMOTRUCK.data entries
|
||||
-- @return #AMMOTRUCK self
|
||||
function AMMOTRUCK:CheckArrivedTrucks(dataset)
|
||||
self:T(self.lid .. " CheckArrivedTrucks")
|
||||
local data = dataset
|
||||
for _,_data in pairs (data) do
|
||||
-- set to unloading
|
||||
local truck = _data -- #AMMOTRUCK.data
|
||||
truck.statusquo = AMMOTRUCK.State.UNLOADING
|
||||
truck.timestamp = timer.getAbsTime()
|
||||
self:__TruckUnloading(2,truck)
|
||||
-- set target to reloading
|
||||
local aridata = self:FindTarget(truck.targetname) -- #AMMOTRUCK.data
|
||||
if aridata then
|
||||
aridata.statusquo = AMMOTRUCK.State.RELOADING
|
||||
aridata.timestamp = timer.getAbsTime()
|
||||
end
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #AMMOTRUCK self
|
||||
-- @param #table dataset table of #AMMOTRUCK.data entries
|
||||
-- @return #AMMOTRUCK self
|
||||
function AMMOTRUCK:CheckUnloadingTrucks(dataset)
|
||||
self:T(self.lid .. " CheckUnloadingTrucks")
|
||||
local data = dataset
|
||||
for _,_data in pairs (data) do
|
||||
-- check timestamp
|
||||
local truck = _data -- #AMMOTRUCK.data
|
||||
local Tnow = timer.getAbsTime()
|
||||
local Tpassed = Tnow - truck.timestamp
|
||||
local hasammo = self:GetAmmoStatus(truck.targetgroup)
|
||||
if Tpassed > self.unloadtime and hasammo > self.ammothreshold then
|
||||
truck.statusquo = AMMOTRUCK.State.RETURNING
|
||||
truck.timestamp = timer.getAbsTime()
|
||||
self:__TruckReturning(2,truck)
|
||||
-- set target to reloaded
|
||||
local aridata = self:FindTarget(truck.targetname) -- #AMMOTRUCK.data
|
||||
if aridata then
|
||||
aridata.statusquo = AMMOTRUCK.State.IDLE
|
||||
aridata.timestamp = timer.getAbsTime()
|
||||
end
|
||||
end
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #AMMOTRUCK self
|
||||
-- @return #AMMOTRUCK self
|
||||
function AMMOTRUCK:CheckTargetsAlive()
|
||||
self:T(self.lid .. " CheckTargetsAlive")
|
||||
local arilist = self.targetlist
|
||||
for _,_ari in pairs(arilist) do
|
||||
local ari = _ari -- #AMMOTRUCK.data
|
||||
if ari.group and ari.group:IsAlive() then
|
||||
-- everything fine
|
||||
else
|
||||
-- ari dead
|
||||
self.targetlist[ari.name] = nil
|
||||
end
|
||||
end
|
||||
-- new arrivals?
|
||||
local aritable = self.targetset:GetSetObjects() --#table
|
||||
for _,_ari in pairs(aritable) do
|
||||
local ari = _ari -- Wrapper.Group#GROUP
|
||||
if ari and ari:IsAlive() and not self.targetlist[ari:GetName()] then
|
||||
local name = ari:GetName()
|
||||
local newari = {} -- #AMMOTRUCK.data
|
||||
newari.name = name
|
||||
newari.group = ari
|
||||
newari.statusquo = AMMOTRUCK.State.IDLE
|
||||
newari.timestamp = timer.getAbsTime()
|
||||
newari.coordinate = ari:GetCoordinate()
|
||||
local hasammo = self:GetAmmoStatus(ari)
|
||||
--newari.ammo = ari:GetAmmunition()
|
||||
newari.ammo = hasammo
|
||||
self.targetlist[name] = newari
|
||||
end
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #AMMOTRUCK self
|
||||
-- @return #AMMOTRUCK self
|
||||
function AMMOTRUCK:CheckTrucksAlive()
|
||||
self:T(self.lid .. " CheckTrucksAlive")
|
||||
local trucklist = self.trucklist
|
||||
for _,_truck in pairs(trucklist) do
|
||||
local truck = _truck -- #AMMOTRUCK.data
|
||||
if truck.group and truck.group:IsAlive() then
|
||||
-- everything fine
|
||||
else
|
||||
-- truck dead
|
||||
local tgtname = truck.targetname
|
||||
local targetdata = self:FindTarget(tgtname) -- #AMMOTRUCK.data
|
||||
if targetdata then
|
||||
if targetdata.statusquo ~= AMMOTRUCK.State.IDLE then
|
||||
targetdata.statusquo = AMMOTRUCK.State.IDLE
|
||||
end
|
||||
end
|
||||
self.trucklist[truck.name] = nil
|
||||
end
|
||||
end
|
||||
-- new arrivals?
|
||||
local trucktable = self.truckset:GetSetObjects() --#table
|
||||
for _,_truck in pairs(trucktable) do
|
||||
local truck = _truck -- Wrapper.Group#GROUP
|
||||
if truck and truck:IsAlive() and not self.trucklist[truck:GetName()] then
|
||||
local name = truck:GetName()
|
||||
local newtruck = {} -- #AMMOTRUCK.data
|
||||
newtruck.name = name
|
||||
newtruck.group = truck
|
||||
if self.hasarmygroup then
|
||||
-- is (not) already ARMYGROUP?
|
||||
if truck.ClassName and truck.ClassName == "GROUP" then
|
||||
local trucker = ARMYGROUP:New(truck)
|
||||
trucker:Activate()
|
||||
newtruck.group = trucker
|
||||
end
|
||||
end
|
||||
newtruck.statusquo = AMMOTRUCK.State.IDLE
|
||||
newtruck.timestamp = timer.getAbsTime()
|
||||
newtruck.coordinate = truck:GetCoordinate()
|
||||
newtruck.reloads = self.reloads or 5
|
||||
self.trucklist[name] = newtruck
|
||||
end
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #AMMOTRUCK self
|
||||
-- @param #string From
|
||||
-- @param #string Event
|
||||
-- @param #string To
|
||||
-- @return #AMMOTRUCK self
|
||||
function AMMOTRUCK:onafterStart(From, Event, To)
|
||||
self:T({From, Event, To})
|
||||
if ARMYGROUP and self.usearmygroup then
|
||||
self.hasarmygroup = true
|
||||
else
|
||||
self.hasarmygroup = false
|
||||
end
|
||||
if self.debug then
|
||||
BASE:TraceOn()
|
||||
BASE:TraceClass("AMMOTRUCK")
|
||||
end
|
||||
self:CheckTargetsAlive()
|
||||
self:CheckTrucksAlive()
|
||||
self:__Monitor(-30)
|
||||
return self
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #AMMOTRUCK self
|
||||
-- @param #string From
|
||||
-- @param #string Event
|
||||
-- @param #string To
|
||||
-- @return #AMMOTRUCK self
|
||||
function AMMOTRUCK:onafterMonitor(From, Event, To)
|
||||
self:T({From, Event, To})
|
||||
self:CheckTargetsAlive()
|
||||
self:CheckTrucksAlive()
|
||||
-- update ammo state
|
||||
local remunition = false
|
||||
local remunitionqueue = {}
|
||||
local waitingtargets = {}
|
||||
for _,_ari in pairs(self.targetlist) do
|
||||
local data = _ari -- #AMMOTRUCK.data
|
||||
if data.group and data.group:IsAlive() then
|
||||
data.ammo = self:GetAmmoStatus(data.group)
|
||||
data.timestamp = timer.getAbsTime()
|
||||
local text = string.format("Ari %s | Ammo %d | State %s",data.name,data.ammo,data.statusquo)
|
||||
self:T(text)
|
||||
if data.ammo <= self.ammothreshold and (data.statusquo == AMMOTRUCK.State.IDLE or data.statusquo == AMMOTRUCK.State.OUTOFAMMO) then
|
||||
-- add to remu queue
|
||||
data.statusquo = AMMOTRUCK.State.OUTOFAMMO
|
||||
remunitionqueue[#remunitionqueue+1] = data
|
||||
remunition = true
|
||||
elseif data.statusquo == AMMOTRUCK.State.WAITING then
|
||||
waitingtargets[#waitingtargets+1] = data
|
||||
end
|
||||
else
|
||||
self.targetlist[data.name] = nil
|
||||
end
|
||||
end
|
||||
-- sort trucks in buckets
|
||||
local idletrucks = {}
|
||||
local drivingtrucks = {}
|
||||
local unloadingtrucks = {}
|
||||
local arrivedtrucks = {}
|
||||
local returningtrucks = {}
|
||||
local found = false
|
||||
for _,_truckdata in pairs(self.trucklist) do
|
||||
local data = _truckdata -- #AMMOTRUCK.data
|
||||
if data.group and data.group:IsAlive() then
|
||||
-- check state
|
||||
local text = string.format("Truck %s | State %s",data.name,data.statusquo)
|
||||
self:T(text)
|
||||
if data.statusquo == AMMOTRUCK.State.IDLE then
|
||||
idletrucks[#idletrucks+1] = data
|
||||
found = true
|
||||
elseif data.statusquo == AMMOTRUCK.State.DRIVING then
|
||||
drivingtrucks[#drivingtrucks+1] = data
|
||||
elseif data.statusquo == AMMOTRUCK.State.ARRIVED then
|
||||
arrivedtrucks[#arrivedtrucks+1] = data
|
||||
elseif data.statusquo == AMMOTRUCK.State.UNLOADING then
|
||||
unloadingtrucks[#unloadingtrucks+1] = data
|
||||
elseif data.statusquo == AMMOTRUCK.State.RETURNING then
|
||||
returningtrucks[#returningtrucks+1] = data
|
||||
if data.reloads > 0 or data.reloads == -1 then
|
||||
idletrucks[#idletrucks+1] = data
|
||||
found = true
|
||||
end
|
||||
end
|
||||
else
|
||||
self.truckset[data.name] = nil
|
||||
end
|
||||
end
|
||||
-- see if we can/need route one
|
||||
local n=0
|
||||
if found and remunition then
|
||||
-- match
|
||||
--local match = false
|
||||
for _,_truckdata in pairs(idletrucks) do
|
||||
local truckdata = _truckdata -- #AMMOTRUCK.data
|
||||
local truckcoord = truckdata.group:GetCoordinate() -- Core.Point#COORDINATE
|
||||
for _,_aridata in pairs(remunitionqueue) do
|
||||
local aridata = _aridata -- #AMMOTRUCK.data
|
||||
local aricoord = aridata.coordinate
|
||||
local distance = truckcoord:Get2DDistance(aricoord)
|
||||
if distance <= self.remunidist and aridata.statusquo == AMMOTRUCK.State.OUTOFAMMO and n <= #idletrucks then
|
||||
n = n + 1
|
||||
aridata.statusquo = AMMOTRUCK.State.REQUESTED
|
||||
self:__RouteTruck(n*5,truckdata,aridata)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- check driving trucks
|
||||
if #drivingtrucks > 0 then
|
||||
self:CheckDrivingTrucks(drivingtrucks)
|
||||
end
|
||||
|
||||
-- check arrived trucks
|
||||
if #arrivedtrucks > 0 then
|
||||
self:CheckArrivedTrucks(arrivedtrucks)
|
||||
end
|
||||
|
||||
-- check unloading trucks
|
||||
if #unloadingtrucks > 0 then
|
||||
self:CheckUnloadingTrucks(unloadingtrucks)
|
||||
end
|
||||
|
||||
-- check returningtrucks trucks
|
||||
if #returningtrucks > 0 then
|
||||
self:CheckReturningTrucks(returningtrucks)
|
||||
end
|
||||
|
||||
-- check waiting targets
|
||||
if #waitingtargets > 0 then
|
||||
self:CheckWaitingTargets(waitingtargets)
|
||||
end
|
||||
|
||||
self:__Monitor(self.monitor)
|
||||
return self
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #AMMOTRUCK self
|
||||
-- @param #string From
|
||||
-- @param #string Event
|
||||
-- @param #string To
|
||||
-- @param #AMMOTRUCK.data Truckdata
|
||||
-- @param #AMMOTRUCK.data Aridata
|
||||
-- @return #AMMOTRUCK self
|
||||
function AMMOTRUCK:onafterRouteTruck(From, Event, To, Truckdata, Aridata)
|
||||
self:T({From, Event, To, Truckdata.name, Aridata.name})
|
||||
local truckdata = Truckdata -- #AMMOTRUCK.data
|
||||
local aridata = Aridata -- #AMMOTRUCK.data
|
||||
local tgtgrp = aridata.group
|
||||
local tgtzone = ZONE_GROUP:New(aridata.name,tgtgrp,30)
|
||||
local tgtcoord = tgtzone:GetRandomCoordinate(15)
|
||||
if self.hasarmygroup then
|
||||
local mission = AUFTRAG:NewONGUARD(tgtcoord)
|
||||
local oldmission = truckdata.group:GetMissionCurrent()
|
||||
if oldmission then oldmission:Cancel() end
|
||||
mission:SetTime(5)
|
||||
mission:SetTeleport(false)
|
||||
truckdata.group:AddMission(mission)
|
||||
elseif self.routeonroad then
|
||||
truckdata.group:RouteGroundOnRoad(tgtcoord,30)
|
||||
else
|
||||
truckdata.group:RouteGroundTo(tgtcoord,30)
|
||||
end
|
||||
truckdata.statusquo = AMMOTRUCK.State.DRIVING
|
||||
truckdata.targetgroup = tgtgrp
|
||||
truckdata.targetname = aridata.name
|
||||
truckdata.targetcoordinate = tgtcoord
|
||||
aridata.statusquo = AMMOTRUCK.State.WAITING
|
||||
aridata.timestamp = timer.getAbsTime()
|
||||
return self
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #AMMOTRUCK self
|
||||
-- @param #string From
|
||||
-- @param #string Event
|
||||
-- @param #string To
|
||||
-- @param #AMMOTRUCK.data Truckdata
|
||||
-- @return #AMMOTRUCK self
|
||||
function AMMOTRUCK:onafterTruckUnloading(From, Event, To, Truckdata)
|
||||
local m = MESSAGE:New("Truck "..Truckdata.name.." unloading!",15,"AmmoTruck"):ToCoalitionIf(self.coalition,self.debug)
|
||||
local truck = Truckdata -- Functional.AmmoTruck#AMMOTRUCK.data
|
||||
local coord = truck.group:GetCoordinate()
|
||||
local heading = truck.group:GetHeading()
|
||||
heading = heading < 180 and (360-heading) or (heading - 180)
|
||||
local cid = self.coalition == coalition.side.BLUE and country.id.USA or country.id.RUSSIA
|
||||
cid = self.coalition == coalition.side.NEUTRAL and country.id.UN_PEACEKEEPERS or cid
|
||||
|
||||
local ammo = {}
|
||||
for i=1,5 do
|
||||
ammo[i] = SPAWNSTATIC:NewFromType("ammo_cargo","Cargos",cid)
|
||||
:InitCoordinate(coord:Translate((15+((i-1)*4)),heading))
|
||||
:Spawn(0,"AmmoCrate-"..math.random(1,10000))
|
||||
end
|
||||
|
||||
local function destroyammo(ammo)
|
||||
for _,_crate in pairs(ammo) do
|
||||
_crate:Destroy(false)
|
||||
end
|
||||
end
|
||||
|
||||
local scheduler = SCHEDULER:New(nil,destroyammo,{ammo},self.waitingtime)
|
||||
|
||||
-- one reload less
|
||||
if truck.reloads ~= -1 then
|
||||
truck.reloads = truck.reloads - 1
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #AMMOTRUCK self
|
||||
-- @param #string From
|
||||
-- @param #string Event
|
||||
-- @param #string To
|
||||
-- @param #AMMOTRUCK.data Truck
|
||||
-- @return #AMMOTRUCK self
|
||||
function AMMOTRUCK:onafterTruckReturning(From, Event, To, Truck)
|
||||
self:T({From, Event, To, Truck.name})
|
||||
-- route home
|
||||
local truckdata = Truck -- #AMMOTRUCK.data
|
||||
local tgtzone = self.homezone
|
||||
local tgtcoord = tgtzone:GetRandomCoordinate()
|
||||
if self.hasarmygroup then
|
||||
local mission = AUFTRAG:NewONGUARD(tgtcoord)
|
||||
local oldmission = truckdata.group:GetMissionCurrent()
|
||||
if oldmission then oldmission:Cancel() end
|
||||
mission:SetTime(5)
|
||||
mission:SetTeleport(false)
|
||||
truckdata.group:AddMission(mission)
|
||||
elseif self.routeonroad then
|
||||
truckdata.group:RouteGroundOnRoad(tgtcoord,30,1,"Cone")
|
||||
else
|
||||
truckdata.group:RouteGroundTo(tgtcoord,30,"Cone",1)
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #AMMOTRUCK self
|
||||
-- @param #string From
|
||||
-- @param #string Event
|
||||
-- @param #string To
|
||||
-- @return #AMMOTRUCK self
|
||||
function AMMOTRUCK:onafterStop(From, Event, To)
|
||||
self:T({From, Event, To})
|
||||
return self
|
||||
end
|
||||
1174
Moose Development/Moose/Functional/Autolase.lua
Normal file
1174
Moose Development/Moose/Functional/Autolase.lua
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -22,7 +22,7 @@
|
||||
-- @module Functional.Mantis
|
||||
-- @image Functional.Mantis.jpg
|
||||
--
|
||||
-- Last Update: Dec 2023
|
||||
-- Last Update: Feb 2024
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
--- **MANTIS** class, extends Core.Base#BASE
|
||||
@@ -347,17 +347,17 @@ MANTIS.SamType = {
|
||||
-- @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.SamData = {
|
||||
["Hawk"] = { Range=44, Blindspot=0, Height=9, Type="Medium", Radar="Hawk" }, -- measures in km
|
||||
["NASAMS"] = { Range=14, Blindspot=0, Height=3, Type="Short", Radar="NSAMS" },
|
||||
["Patriot"] = { Range=99, Blindspot=0, Height=9, Type="Long", Radar="Patriot" },
|
||||
["Rapier"] = { Range=6, Blindspot=0, Height=3, Type="Short", Radar="rapier" },
|
||||
["Hawk"] = { Range=35, Blindspot=0, Height=12, Type="Medium", Radar="Hawk" }, -- measures in km
|
||||
["NASAMS"] = { Range=14, Blindspot=0, Height=7, Type="Short", Radar="NSAMS" }, -- AIM 120B
|
||||
["Patriot"] = { Range=99, Blindspot=0, Height=25, Type="Long", Radar="Patriot" },
|
||||
["Rapier"] = { Range=10, Blindspot=0, Height=3, Type="Short", Radar="rapier" },
|
||||
["SA-2"] = { Range=40, Blindspot=7, Height=25, Type="Medium", Radar="S_75M_Volhov" },
|
||||
["SA-3"] = { Range=18, Blindspot=6, Height=18, Type="Short", Radar="5p73 s-125 ln" },
|
||||
["SA-5"] = { Range=250, Blindspot=7, Height=40, Type="Long", Radar="5N62V" },
|
||||
["SA-6"] = { Range=25, Blindspot=0, Height=8, Type="Medium", Radar="1S91" },
|
||||
["SA-10"] = { Range=119, Blindspot=0, Height=18, Type="Long" , Radar="S-300PS 4"},
|
||||
["SA-11"] = { Range=35, Blindspot=0, Height=20, Type="Medium", Radar="SA-11" },
|
||||
["Roland"] = { Range=8, Blindspot=0, Height=3, Type="Short", Radar="Roland" },
|
||||
["Roland"] = { Range=5, Blindspot=0, Height=5, Type="Short", Radar="Roland" },
|
||||
["HQ-7"] = { Range=12, Blindspot=0, Height=3, Type="Short", Radar="HQ-7" },
|
||||
["SA-9"] = { Range=4, Blindspot=0, Height=3, Type="Short", Radar="Strela" },
|
||||
["SA-8"] = { Range=10, Blindspot=0, Height=5, Type="Short", Radar="Osa 9A33" },
|
||||
@@ -376,7 +376,7 @@ MANTIS.SamData = {
|
||||
["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" },
|
||||
["STUNNER IDFA"] = { Range=250, Blindspot=1, Height=45, Type="Long", Radar="DAVID_SLING_LN" },
|
||||
}
|
||||
|
||||
--- SAM data HDS
|
||||
@@ -1222,10 +1222,10 @@ do
|
||||
function MANTIS:_PreFilterHeight(height)
|
||||
self:T(self.lid.."_PreFilterHeight")
|
||||
local set = {}
|
||||
local dlink = self.Detection -- Ops.Intelligence#INTEL_DLINK
|
||||
local dlink = self.Detection -- Ops.Intel#INTEL_DLINK
|
||||
local detectedgroups = dlink:GetContactTable()
|
||||
for _,_contact in pairs(detectedgroups) do
|
||||
local contact = _contact -- Ops.Intelligence#INTEL.Contact
|
||||
local contact = _contact -- Ops.Intel#INTEL.Contact
|
||||
local grp = contact.group -- Wrapper.Group#GROUP
|
||||
if grp:IsAlive() then
|
||||
if grp:GetHeight(true) < height then
|
||||
@@ -1777,7 +1777,7 @@ do
|
||||
-- @return #MANTIS self
|
||||
function MANTIS:_CheckDLinkState()
|
||||
self:T(self.lid .. "_CheckDLinkState")
|
||||
local dlink = self.Detection -- Ops.Intelligence#INTEL_DLINK
|
||||
local dlink = self.Detection -- Ops.Intel#INTEL_DLINK
|
||||
local TS = timer.getAbsTime()
|
||||
if not dlink:Is("Running") and (TS - self.DLTimeStamp > 29) then
|
||||
self.DLink = false
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1226,8 +1226,10 @@ function RANGE:SetSRS(PathToSRS, Port, Coalition, Frequency, Modulation, Volume,
|
||||
self.instructsrsQ = MSRSQUEUE:New("INSTRUCT")
|
||||
|
||||
if PathToGoogleKey then
|
||||
self.controlmsrs:SetGoogle(PathToGoogleKey)
|
||||
self.instructmsrs:SetGoogle(PathToGoogleKey)
|
||||
self.controlmsrs:SetProviderOptionsGoogle(PathToGoogleKey,PathToGoogleKey)
|
||||
self.controlmsrs:SetProvider(MSRS.Provider.GOOGLE)
|
||||
self.instructmsrs:SetProviderOptionsGoogle(PathToGoogleKey,PathToGoogleKey)
|
||||
self.instructmsrs:SetProvider(MSRS.Provider.GOOGLE)
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
@@ -78,7 +78,8 @@
|
||||
-- ### Authors: **FlightControl**
|
||||
--
|
||||
-- ### Contributions:
|
||||
--
|
||||
--
|
||||
-- * **Applevangelist**: Additional functionality, fixes.
|
||||
-- * **Wingthor (TAW)**: Testing & Advice.
|
||||
-- * **Dutch-Baron (TAW)**: Testing & Advice.
|
||||
-- * **Whisper**: Testing and Advice.
|
||||
@@ -116,11 +117,13 @@
|
||||
-- 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.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.AddScoreSetGroup}() to specify a special additional score for a specific @{Wrapper.Group}s gathered in a @{Core.Set#SET_GROUP}.
|
||||
--
|
||||
-- local Scoring = SCORING:New( "Scoring File" )
|
||||
-- Scoring:AddUnitScore( UNIT:FindByName( "Unit #001" ), 200 )
|
||||
-- Scoring:AddStaticScore( STATIC:FindByName( "Static #1" ), 100 )
|
||||
-- local GroupSet = SET_GROUP:New():FilterPrefixes("RAT"):FilterStart()
|
||||
-- Scoring:AddScoreSetGroup( GroupSet, 100)
|
||||
--
|
||||
-- The above grants an additional score of 200 points for Unit #001 and an additional 100 points of Static #1 if these are destroyed.
|
||||
-- Note that later in the mission, one can remove these scores set, for example, when the a goal achievement time limit is over.
|
||||
@@ -226,7 +229,7 @@ SCORING = {
|
||||
ClassID = 0,
|
||||
Players = {},
|
||||
AutoSave = true,
|
||||
version = "1.17.1"
|
||||
version = "1.18.4"
|
||||
}
|
||||
|
||||
local _SCORINGCoalition = {
|
||||
@@ -245,13 +248,15 @@ local _SCORINGCategory = {
|
||||
--- Creates a new SCORING object to administer the scoring achieved by players.
|
||||
-- @param #SCORING self
|
||||
-- @param #string GameName The name of the game. This name is also logged in the CSV score file.
|
||||
-- @param #string SavePath (Optional) Path where to save the CSV file, defaults to your **<User>\\Saved Games\\DCS\\Logs** folder.
|
||||
-- @param #boolean AutoSave (Optional) If passed as `false`, then swith autosave off.
|
||||
-- @return #SCORING self
|
||||
-- @usage
|
||||
--
|
||||
-- -- Define a new scoring object for the mission Gori Valley.
|
||||
-- ScoringObject = SCORING:New( "Gori Valley" )
|
||||
--
|
||||
function SCORING:New( GameName )
|
||||
function SCORING:New( GameName, SavePath, AutoSave )
|
||||
|
||||
-- Inherits from BASE
|
||||
local self = BASE:Inherit( self, BASE:New() ) -- #SCORING
|
||||
@@ -314,7 +319,8 @@ function SCORING:New( GameName )
|
||||
end )
|
||||
|
||||
-- Create the CSV file.
|
||||
self.AutoSave = true
|
||||
self.AutoSavePath = SavePath
|
||||
self.AutoSave = AutoSave or true
|
||||
self:OpenCSV( GameName )
|
||||
|
||||
return self
|
||||
@@ -428,6 +434,31 @@ function SCORING:AddScoreGroup( ScoreGroup, Score )
|
||||
return self
|
||||
end
|
||||
|
||||
--- Specify a special additional score for a @{Core.Set#SET_GROUP}.
|
||||
-- @param #SCORING self
|
||||
-- @param Core.Set#SET_GROUP Set The @{Core.Set#SET_GROUP} for which each @{Wrapper.Unit} in each Group a Score is given.
|
||||
-- @param #number Score The Score value.
|
||||
-- @return #SCORING
|
||||
function SCORING:AddScoreSetGroup(Set, Score)
|
||||
local set = Set:GetSetObjects()
|
||||
|
||||
for _,_group in pairs (set) do
|
||||
if _group and _group:IsAlive() then
|
||||
self:AddScoreGroup(_group,Score)
|
||||
end
|
||||
end
|
||||
|
||||
local function AddScore(group)
|
||||
self:AddScoreGroup(group,Score)
|
||||
end
|
||||
|
||||
function Set:OnAfterAdded(From,Event,To,ObjectName,Object)
|
||||
AddScore(Object)
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Add a @{Core.Zone} to define additional scoring when any object is destroyed in that zone.
|
||||
-- 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.
|
||||
@@ -1030,11 +1061,11 @@ function SCORING:_EventOnHit( Event )
|
||||
PlayerHit.PenaltyHit = PlayerHit.PenaltyHit or 0
|
||||
PlayerHit.TimeStamp = PlayerHit.TimeStamp or 0
|
||||
PlayerHit.UNIT = PlayerHit.UNIT or TargetUNIT
|
||||
-- After an instant kill we can't compute the thread level anymore. To fix this we compute at OnEventBirth
|
||||
-- After an instant kill we can't compute the threat 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
|
||||
if PlayerHit.ThreatType == nil or PlayerHit.ThreatType == "" then
|
||||
PlayerHit.ThreatLevel = 1
|
||||
PlayerHit.ThreatType = "Unknown"
|
||||
end
|
||||
@@ -1141,7 +1172,7 @@ function SCORING:_EventOnHit( Event )
|
||||
PlayerHit.PenaltyHit = PlayerHit.PenaltyHit or 0
|
||||
PlayerHit.TimeStamp = PlayerHit.TimeStamp or 0
|
||||
PlayerHit.UNIT = PlayerHit.UNIT or TargetUNIT
|
||||
-- After an instant kill we can't compute the thread level anymore. To fix this we compute at OnEventBirth
|
||||
-- After an instant kill we can't compute the threat 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
|
||||
@@ -1288,17 +1319,17 @@ function SCORING:_EventOnDeadOrCrash( Event )
|
||||
TargetDestroy.PenaltyDestroy = TargetDestroy.PenaltyDestroy + 1
|
||||
|
||||
|
||||
self:OnKillPvP(Player, TargetPlayerName, true, TargetThreatLevel, Player.ThreatLevel, ThreatPenalty)
|
||||
--self:OnKillPvP(PlayerName, TargetPlayerName, true, TargetThreatLevel, Player.ThreatLevel, ThreatPenalty)
|
||||
|
||||
if Player.HitPlayers[TargetPlayerName] then -- A player destroyed another player
|
||||
self:OnKillPvP(Player, TargetPlayerName, true)
|
||||
self:OnKillPvP(PlayerName, TargetPlayerName, true)
|
||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed friendly player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
||||
"Penalty: -" .. ThreatPenalty .. " = " .. Player.Score - Player.Penalty,
|
||||
MESSAGE.Type.Information )
|
||||
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
|
||||
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
|
||||
else
|
||||
self:OnKillPvE(Player, TargetUnitName, true, TargetThreatLevel, Player.ThreatLevel, ThreatPenalty)
|
||||
self:OnKillPvE(PlayerName, TargetUnitName, true, TargetThreatLevel, Player.ThreatLevel, ThreatPenalty)
|
||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed friendly target " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
||||
"Penalty: -" .. ThreatPenalty .. " = " .. Player.Score - Player.Penalty,
|
||||
MESSAGE.Type.Information )
|
||||
@@ -1326,14 +1357,14 @@ function SCORING:_EventOnDeadOrCrash( Event )
|
||||
else
|
||||
Player.PlayerKills = 1
|
||||
end
|
||||
self:OnKillPvP(Player, TargetPlayerName, false, TargetThreatLevel, Player.ThreatLevel, ThreatScore)
|
||||
self:OnKillPvP(PlayerName, TargetPlayerName, false, TargetThreatLevel, Player.ThreatLevel, ThreatScore)
|
||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed enemy player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
||||
"Score: +" .. ThreatScore .. " = " .. Player.Score - Player.Penalty,
|
||||
MESSAGE.Type.Information )
|
||||
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
|
||||
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
|
||||
else
|
||||
self:OnKillPvE(Player, TargetUnitName, false, TargetThreatLevel, Player.ThreatLevel, ThreatScore)
|
||||
self:OnKillPvE(PlayerName, TargetUnitName, false, TargetThreatLevel, Player.ThreatLevel, ThreatScore)
|
||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed enemy " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
||||
"Score: +" .. ThreatScore .. " = " .. Player.Score - Player.Penalty,
|
||||
MESSAGE.Type.Information )
|
||||
@@ -1811,10 +1842,11 @@ end
|
||||
function SCORING:OpenCSV( ScoringCSV )
|
||||
self:F( ScoringCSV )
|
||||
|
||||
if lfs and io and os and self.AutoSave then
|
||||
if lfs and io and os and self.AutoSave == true then
|
||||
if ScoringCSV then
|
||||
self.ScoringCSV = ScoringCSV
|
||||
local fdir = lfs.writedir() .. [[Logs\]] .. self.ScoringCSV .. " " .. os.date( "%Y-%m-%d %H-%M-%S" ) .. ".csv"
|
||||
local path = self.AutoSavePath or lfs.writedir() .. [[Logs\]]
|
||||
local fdir = path .. self.ScoringCSV .. " " .. os.date( "%Y-%m-%d %H-%M-%S" ) .. ".csv"
|
||||
|
||||
self.CSVFile, self.err = io.open( fdir, "w+" )
|
||||
if not self.CSVFile then
|
||||
@@ -1935,23 +1967,23 @@ 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 #string PlayerName The attacking player
|
||||
-- @param #string TargetPlayerName The name of the killed player
|
||||
-- @param #boolean IsTeamKill true if this kill was a team kill
|
||||
-- @param #number TargetThreatLevel Threat level of the target
|
||||
-- @param #number PlayerThreatLevel Threat level of the player
|
||||
-- @param #number Score The score based on both threat levels
|
||||
function SCORING:OnKillPvP(Player, TargetPlayerName, IsTeamKill, TargetThreatLevel, PlayerThreatLevel, Score)
|
||||
function SCORING:OnKillPvP(PlayerName, 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 PlayerName The attacking 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 #boolean IsTeamKill true if this kill was a team kill
|
||||
-- @param #number TargetThreatLevel Threat level of the target
|
||||
-- @param #number PlayerThreatLevel Threat level of the player
|
||||
-- @param #number Score The score based on both threat levels
|
||||
function SCORING:OnKillPvE(Player, TargetUnitName, IsTeamKill, TargetThreatLevel, PlayerThreatLevel, Score)
|
||||
function SCORING:OnKillPvE(PlayerName, TargetUnitName, IsTeamKill, TargetThreatLevel, PlayerThreatLevel, Score)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -320,9 +320,6 @@ function SEAD:onafterCalculateHitZone(From,Event,To,SEADWeapon,pos0,height,SEADG
|
||||
end
|
||||
|
||||
local seadset = SET_GROUP:New():FilterPrefixes(self.SEADGroupPrefixes):FilterZones({targetzone}):FilterOnce()
|
||||
local tgtcoord = targetzone:GetRandomPointVec2()
|
||||
--if tgtcoord and tgtcoord.ClassName == "COORDINATE" then
|
||||
--local tgtgrp = seadset:FindNearestGroupFromPointVec2(tgtcoord)
|
||||
local tgtgrp = seadset:GetRandom()
|
||||
local _targetgroup = nil
|
||||
local _targetgroupname = "none"
|
||||
|
||||
1370
Moose Development/Moose/Functional/Stratego.lua
Normal file
1370
Moose Development/Moose/Functional/Stratego.lua
Normal file
File diff suppressed because it is too large
Load Diff
590
Moose Development/Moose/Functional/Tiresias.lua
Normal file
590
Moose Development/Moose/Functional/Tiresias.lua
Normal file
@@ -0,0 +1,590 @@
|
||||
--- **Functional** - TIRESIAS - manages AI behaviour.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- The @{#TIRESIAS} class is working in the back to keep your large-scale ground units in check.
|
||||
--
|
||||
-- ## Features:
|
||||
--
|
||||
-- * Designed to keep CPU and Network usage lower on missions with a lot of ground units.
|
||||
-- * Does not affect ships to keep the Navy guys happy.
|
||||
-- * Does not affect OpsGroup type groups.
|
||||
-- * Distinguishes between SAM groups, AAA groups and other ground groups.
|
||||
-- * Exceptions can be defined to keep certain actions going.
|
||||
-- * Works coalition-independent in the back
|
||||
-- * Easy setup.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ## Missions:
|
||||
--
|
||||
-- ### [TIRESIAS](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### Author : **applevangelist **
|
||||
--
|
||||
-- @module Functional.Tiresias
|
||||
-- @image Functional.Tiresias.jpg
|
||||
--
|
||||
-- Last Update: Dec 2023
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
--- **TIRESIAS** class, extends Core.Base#BASE
|
||||
-- @type TIRESIAS
|
||||
-- @field #string ClassName
|
||||
-- @field #booelan debug
|
||||
-- @field #string version
|
||||
-- @field #number Interval
|
||||
-- @field Core.Set#SET_GROUP GroundSet
|
||||
-- @field #number Coalition
|
||||
-- @field Core.Set#SET_GROUP VehicleSet
|
||||
-- @field Core.Set#SET_GROUP AAASet
|
||||
-- @field Core.Set#SET_GROUP SAMSet
|
||||
-- @field Core.Set#SET_GROUP ExceptionSet
|
||||
-- @field Core.Set#SET_OPSGROUP OpsGroupSet
|
||||
-- @field #number AAARange
|
||||
-- @field #number HeloSwitchRange
|
||||
-- @field #number PlaneSwitchRange
|
||||
-- @field Core.Set#SET_GROUP FlightSet
|
||||
-- @field #boolean SwitchAAA
|
||||
-- @extends Core.Fsm#FSM
|
||||
|
||||
---
|
||||
-- @type TIRESIAS.Data
|
||||
-- @field #string type
|
||||
-- @field #number range
|
||||
-- @field #boolean invisible
|
||||
-- @field #boolean AIOff
|
||||
-- @field #boolean exception
|
||||
|
||||
|
||||
--- *Tiresias, Greek demi-god and shapeshifter, blinded by the Gods, works as oracle for you.* (Wiki)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ## TIRESIAS Concept
|
||||
--
|
||||
-- * Designed to keep CPU and Network usage lower on missions with a lot of ground units.
|
||||
-- * Does not affect ships to keep the Navy guys happy.
|
||||
-- * Does not affect OpsGroup type groups.
|
||||
-- * Distinguishes between SAM groups, AAA groups and other ground groups.
|
||||
-- * Exceptions can be defined in SET_GROUP objects to keep certain actions going.
|
||||
-- * Works coalition-independent in the back
|
||||
-- * Easy setup.
|
||||
--
|
||||
-- ## Setup
|
||||
--
|
||||
-- Setup is a one-liner:
|
||||
--
|
||||
-- local blinder = TIRESIAS:New()
|
||||
--
|
||||
-- Optionally you can set up exceptions, e.g. for convoys driving around
|
||||
--
|
||||
-- local exceptionset = SET_GROUP:New():FilterCoalitions("red"):FilterPrefixes("Convoy"):FilterStart()
|
||||
-- local blinder = TIRESIAS:New()
|
||||
-- blinder:AddExceptionSet(exceptionset)
|
||||
--
|
||||
-- Options
|
||||
--
|
||||
-- -- Setup different radius for activation around helo and airplane groups (applies to AI and humans)
|
||||
-- blinder:SetActivationRanges(10,25) -- defaults are 10, and 25
|
||||
--
|
||||
-- -- Setup engagement ranges for AAA (non-advanced SAM units like Flaks etc) and if you want them to be AIOff
|
||||
-- blinder:SetAAARanges(60,true) -- defaults are 60, and true
|
||||
--
|
||||
-- @field #TIRESIAS
|
||||
TIRESIAS = {
|
||||
ClassName = "TIRESIAS",
|
||||
debug = false,
|
||||
version = "0.0.4",
|
||||
Interval = 20,
|
||||
GroundSet = nil,
|
||||
VehicleSet = nil,
|
||||
AAASet = nil,
|
||||
SAMSet = nil,
|
||||
ExceptionSet = nil,
|
||||
AAARange = 60, -- 60%
|
||||
HeloSwitchRange = 10, -- NM
|
||||
PlaneSwitchRange = 25, -- NM
|
||||
SwitchAAA = true,
|
||||
}
|
||||
|
||||
--- [USER] Create a new Tiresias object and start it up.
|
||||
-- @param #TIRESIAS self
|
||||
-- @return #TIRESIAS self
|
||||
function TIRESIAS:New()
|
||||
|
||||
-- Inherit everything from FSM class.
|
||||
local self = BASE:Inherit(self, FSM:New()) -- #TIRESIAS
|
||||
|
||||
--- FSM Functions ---
|
||||
|
||||
-- Start State.
|
||||
self:SetStartState("Stopped")
|
||||
|
||||
-- Add FSM transitions.
|
||||
-- From State --> Event --> To State
|
||||
self:AddTransition("Stopped", "Start", "Running") -- Start FSM.
|
||||
self:AddTransition("*", "Status", "*") -- TIRESIAS status update.
|
||||
self:AddTransition("*", "Stop", "Stopped") -- Stop FSM.
|
||||
|
||||
self.ExceptionSet = SET_GROUP:New():Clear(false)
|
||||
|
||||
self:HandleEvent(EVENTS.PlayerEnterAircraft,self._EventHandler)
|
||||
|
||||
self.lid = string.format("TIRESIAS %s | ",self.version)
|
||||
|
||||
self:I(self.lid.."Managing ground groups!")
|
||||
|
||||
--- Triggers the FSM event "Stop". Stops TIRESIAS and all its event handlers.
|
||||
-- @function [parent=#TIRESIAS] Stop
|
||||
-- @param #TIRESIAS self
|
||||
|
||||
--- Triggers the FSM event "Stop" after a delay. Stops TIRESIAS and all its event handlers.
|
||||
-- @function [parent=#TIRESIAS] __Stop
|
||||
-- @param #TIRESIAS self
|
||||
-- @param #number delay Delay in seconds.
|
||||
|
||||
--- Triggers the FSM event "Start". Starts TIRESIAS and all its event handlers. Note - `:New()` already starts the instance.
|
||||
-- @function [parent=#TIRESIAS] Start
|
||||
-- @param #TIRESIAS self
|
||||
|
||||
--- Triggers the FSM event "Start" after a delay. Starts TIRESIAS and all its event handlers. Note - `:New()` already starts the instance.
|
||||
-- @function [parent=#TIRESIAS] __Start
|
||||
-- @param #TIRESIAS self
|
||||
-- @param #number delay Delay in seconds.
|
||||
|
||||
self:__Start(1)
|
||||
return self
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
--
|
||||
-- Helper Functions
|
||||
--
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
---[USER] Set activation radius for Helos and Planes in Nautical Miles.
|
||||
-- @param #TIRESIAS self
|
||||
-- @param #number HeloMiles Radius around a Helicopter in which AI ground units will be activated. Defaults to 10NM.
|
||||
-- @param #number PlaneMiles Radius around an Airplane in which AI ground units will be activated. Defaults to 25NM.
|
||||
-- @return #TIRESIAS self
|
||||
function TIRESIAS:SetActivationRanges(HeloMiles,PlaneMiles)
|
||||
self.HeloSwitchRange = HeloMiles or 10
|
||||
self.PlaneSwitchRange = PlaneMiles or 25
|
||||
return self
|
||||
end
|
||||
|
||||
---[USER] Set AAA Ranges - AAA equals non-SAM systems which qualify as AAA in DCS world.
|
||||
-- @param #TIRESIAS self
|
||||
-- @param #number FiringRange The engagement range that AAA units will be set to. Can be 0 to 100 (percent). Defaults to 60.
|
||||
-- @param #boolean SwitchAAA Decide if these system will have their AI switched off, too. Defaults to true.
|
||||
-- @return #TIRESIAS self
|
||||
function TIRESIAS:SetAAARanges(FiringRange,SwitchAAA)
|
||||
self.AAARange = FiringRange or 60
|
||||
self.SwitchAAA = (SwitchAAA == false) and false or true
|
||||
return self
|
||||
end
|
||||
|
||||
--- [USER] Add a SET_GROUP of GROUP objects as exceptions. Can be done multiple times.
|
||||
-- @param #TIRESIAS self
|
||||
-- @param Core.Set#SET_GROUP Set to add to the exception list.
|
||||
-- @return #TIRESIAS self
|
||||
function TIRESIAS:AddExceptionSet(Set)
|
||||
self:T(self.lid.."AddExceptionSet")
|
||||
local exceptions = self.ExceptionSet
|
||||
Set:ForEachGroupAlive(
|
||||
function(grp)
|
||||
if not grp.Tiresias then
|
||||
grp.Tiresias = { -- #TIRESIAS.Data
|
||||
type = "Exception",
|
||||
exception = true,
|
||||
}
|
||||
exceptions:AddGroup(grp,true)
|
||||
end
|
||||
BASE:I("TIRESIAS: Added exception group: "..grp:GetName())
|
||||
end
|
||||
)
|
||||
return self
|
||||
end
|
||||
|
||||
--- [INTERNAL] Filter Function
|
||||
-- @param Wrapper.Group#GROUP Group
|
||||
-- @return #boolean isin
|
||||
function TIRESIAS._FilterNotAAA(Group)
|
||||
local grp = Group -- Wrapper.Group#GROUP
|
||||
local isaaa = grp:IsAAA()
|
||||
if isaaa == true and grp:IsGround() and not grp:IsShip() then
|
||||
return false -- remove from SET
|
||||
else
|
||||
return true -- keep in SET
|
||||
end
|
||||
end
|
||||
|
||||
--- [INTERNAL] Filter Function
|
||||
-- @param Wrapper.Group#GROUP Group
|
||||
-- @return #boolean isin
|
||||
function TIRESIAS._FilterNotSAM(Group)
|
||||
local grp = Group -- Wrapper.Group#GROUP
|
||||
local issam = grp:IsSAM()
|
||||
if issam == true and grp:IsGround() and not grp:IsShip() then
|
||||
return false -- remove from SET
|
||||
else
|
||||
return true -- keep in SET
|
||||
end
|
||||
end
|
||||
|
||||
--- [INTERNAL] Filter Function
|
||||
-- @param Wrapper.Group#GROUP Group
|
||||
-- @return #boolean isin
|
||||
function TIRESIAS._FilterAAA(Group)
|
||||
local grp = Group -- Wrapper.Group#GROUP
|
||||
local isaaa = grp:IsAAA()
|
||||
if isaaa == true and grp:IsGround() and not grp:IsShip() then
|
||||
return true -- remove from SET
|
||||
else
|
||||
return false -- keep in SET
|
||||
end
|
||||
end
|
||||
|
||||
--- [INTERNAL] Filter Function
|
||||
-- @param Wrapper.Group#GROUP Group
|
||||
-- @return #boolean isin
|
||||
function TIRESIAS._FilterSAM(Group)
|
||||
local grp = Group -- Wrapper.Group#GROUP
|
||||
local issam = grp:IsSAM()
|
||||
if issam == true and grp:IsGround() and not grp:IsShip() then
|
||||
return true -- remove from SET
|
||||
else
|
||||
return false -- keep in SET
|
||||
end
|
||||
end
|
||||
|
||||
--- [INTERNAL] Init Groups
|
||||
-- @param #TIRESIAS self
|
||||
-- @return #TIRESIAS self
|
||||
function TIRESIAS:_InitGroups()
|
||||
self:T(self.lid.."_InitGroups")
|
||||
-- Set all groups invisible/motionless
|
||||
local EngageRange = self.AAARange
|
||||
local SwitchAAA = self.SwitchAAA
|
||||
--- AAA
|
||||
self.AAASet:ForEachGroupAlive(
|
||||
function(grp)
|
||||
if not grp.Tiresias then
|
||||
grp:OptionEngageRange(EngageRange)
|
||||
grp:SetCommandInvisible(true)
|
||||
if SwitchAAA then
|
||||
grp:SetAIOff()
|
||||
grp:EnableEmission(false)
|
||||
end
|
||||
grp.Tiresias = { -- #TIRESIAS.Data
|
||||
type = "AAA",
|
||||
invisible = true,
|
||||
range = EngageRange,
|
||||
exception = false,
|
||||
AIOff = SwitchAAA,
|
||||
}
|
||||
end
|
||||
if grp.Tiresias and (not grp.Tiresias.exception == true) then
|
||||
if grp.Tiresias.invisible and grp.Tiresias.invisible == false then
|
||||
grp:SetCommandInvisible(true)
|
||||
grp.Tiresias.invisible = true
|
||||
if SwitchAAA then
|
||||
grp:SetAIOff()
|
||||
grp:EnableEmission(false)
|
||||
grp.Tiresias.AIOff = true
|
||||
end
|
||||
end
|
||||
end
|
||||
--BASE:I(string.format("Init/Switch off AAA %s (Exception %s)",grp:GetName(),tostring(grp.Tiresias.exception)))
|
||||
end
|
||||
)
|
||||
--- Vehicles
|
||||
self.VehicleSet:ForEachGroupAlive(
|
||||
function(grp)
|
||||
if not grp.Tiresias then
|
||||
grp:SetAIOff()
|
||||
grp:SetCommandInvisible(true)
|
||||
grp.Tiresias = { -- #TIRESIAS.Data
|
||||
type = "Vehicle",
|
||||
invisible = true,
|
||||
AIOff = true,
|
||||
exception = false,
|
||||
}
|
||||
end
|
||||
if grp.Tiresias and (not grp.Tiresias.exception == true) then
|
||||
if grp.Tiresias and grp.Tiresias.invisible and grp.Tiresias.invisible == false then
|
||||
grp:SetCommandInvisible(true)
|
||||
grp:SetAIOff()
|
||||
grp.Tiresias.invisible = true
|
||||
end
|
||||
end
|
||||
--BASE:I(string.format("Init/Switch off Vehicle %s (Exception %s)",grp:GetName(),tostring(grp.Tiresias.exception)))
|
||||
end
|
||||
)
|
||||
--- SAM
|
||||
self.SAMSet:ForEachGroupAlive(
|
||||
function(grp)
|
||||
if not grp.Tiresias then
|
||||
grp:SetCommandInvisible(true)
|
||||
grp.Tiresias = { -- #TIRESIAS.Data
|
||||
type = "SAM",
|
||||
invisible = true,
|
||||
exception = false,
|
||||
}
|
||||
end
|
||||
if grp.Tiresias and (not grp.Tiresias.exception == true) then
|
||||
if grp.Tiresias and grp.Tiresias.invisible and grp.Tiresias.invisible == false then
|
||||
grp:SetCommandInvisible(true)
|
||||
grp.Tiresias.invisible = true
|
||||
end
|
||||
end
|
||||
--BASE:I(string.format("Init/Switch off SAM %s (Exception %s)",grp:GetName(),tostring(grp.Tiresias.exception)))
|
||||
end
|
||||
)
|
||||
return self
|
||||
end
|
||||
|
||||
--- [INTERNAL] Event handler function
|
||||
-- @param #TIRESIAS self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
-- @return #TIRESIAS self
|
||||
function TIRESIAS:_EventHandler(EventData)
|
||||
self:T(string.format("%s Event = %d",self.lid, EventData.id))
|
||||
local event = EventData -- Core.Event#EVENTDATA
|
||||
if event.id == EVENTS.PlayerEnterAircraft or event.id == EVENTS.PlayerEnterUnit then
|
||||
--local _coalition = event.IniCoalition
|
||||
--if _coalition ~= self.Coalition then
|
||||
-- return --ignore!
|
||||
--end
|
||||
local unitname = event.IniUnitName or "none"
|
||||
local _unit = event.IniUnit
|
||||
local _group = event.IniGroup
|
||||
if _group and _group:IsAlive() then
|
||||
local radius = self.PlaneSwitchRange
|
||||
if _group:IsHelicopter() then
|
||||
radius = self.HeloSwitchRange
|
||||
end
|
||||
self:_SwitchOnGroups(_group,radius)
|
||||
end
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- [INTERNAL] Switch Groups Behaviour
|
||||
-- @param #TIRESIAS self
|
||||
-- @param Wrapper.Group#GROUP group
|
||||
-- @param #number radius Radius in NM
|
||||
-- @return #TIRESIAS self
|
||||
function TIRESIAS:_SwitchOnGroups(group,radius)
|
||||
self:T(self.lid.."_SwitchOnGroups "..group:GetName().." Radius "..radius.." NM")
|
||||
local zone = ZONE_GROUP:New("Zone-"..group:GetName(),group,UTILS.NMToMeters(radius))
|
||||
local ground = SET_GROUP:New():FilterCategoryGround():FilterZones({zone}):FilterOnce()
|
||||
local count = ground:CountAlive()
|
||||
if self.debug then
|
||||
local text = string.format("There are %d groups around this plane or helo!",count)
|
||||
self:I(text)
|
||||
end
|
||||
local SwitchAAA = self.SwitchAAA
|
||||
if ground:CountAlive() > 0 then
|
||||
ground:ForEachGroupAlive(
|
||||
function(grp)
|
||||
if grp.Tiresias and grp.Tiresias.type and (not grp.Tiresias.exception == true ) then
|
||||
if grp.Tiresias.invisible == true then
|
||||
grp:SetCommandInvisible(false)
|
||||
grp.Tiresias.invisible = false
|
||||
end
|
||||
if grp.Tiresias.type == "Vehicle" and grp.Tiresias.AIOff and grp.Tiresias.AIOff == true then
|
||||
grp:SetAIOn()
|
||||
grp.Tiresias.AIOff = false
|
||||
end
|
||||
if SwitchAAA and grp.Tiresias.type == "AAA" and grp.Tiresias.AIOff and grp.Tiresias.AIOff == true then
|
||||
grp:SetAIOn()
|
||||
grp:EnableEmission(true)
|
||||
grp.Tiresias.AIOff = false
|
||||
end
|
||||
--BASE:I(string.format("TIRESIAS - Switch on %s %s (Exception %s)",tostring(grp.Tiresias.type),grp:GetName(),tostring(grp.Tiresias.exception)))
|
||||
else
|
||||
BASE:E("TIRESIAS - This group has not been initialized or is an exception!")
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
--
|
||||
-- FSM Functions
|
||||
--
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--- [INTERNAL] FSM Function
|
||||
-- @param #TIRESIAS self
|
||||
-- @param #string From
|
||||
-- @param #string Event
|
||||
-- @param #string To
|
||||
-- @return #TIRESIAS self
|
||||
function TIRESIAS:onafterStart(From, Event, To)
|
||||
self:T({From, Event, To})
|
||||
|
||||
local VehicleSet = SET_GROUP:New():FilterCategoryGround():FilterFunction(TIRESIAS._FilterNotAAA):FilterFunction(TIRESIAS._FilterNotSAM):FilterStart()
|
||||
local AAASet = SET_GROUP:New():FilterCategoryGround():FilterFunction(TIRESIAS._FilterAAA):FilterStart()
|
||||
local SAMSet = SET_GROUP:New():FilterCategoryGround():FilterFunction(TIRESIAS._FilterSAM):FilterStart()
|
||||
local OpsGroupSet = SET_OPSGROUP:New():FilterActive(true):FilterStart()
|
||||
self.FlightSet = SET_GROUP:New():FilterCategories({"plane","helicopter"}):FilterStart()
|
||||
|
||||
local EngageRange = self.AAARange
|
||||
|
||||
local ExceptionSet = self.ExceptionSet
|
||||
if self.ExceptionSet then
|
||||
function ExceptionSet:OnAfterAdded(From,Event,To,ObjectName,Object)
|
||||
BASE:I("TIRESIAS: EXCEPTION Object Added: "..Object:GetName())
|
||||
if Object and Object:IsAlive() then
|
||||
Object.Tiresias = { -- #TIRESIAS.Data
|
||||
type = "Exception",
|
||||
exception = true,
|
||||
}
|
||||
Object:SetAIOn()
|
||||
Object:SetCommandInvisible(false)
|
||||
Object:EnableEmission(true)
|
||||
end
|
||||
end
|
||||
|
||||
local OGS = OpsGroupSet:GetAliveSet()
|
||||
for _,_OG in pairs(OGS or {}) do
|
||||
local OG = _OG -- Ops.OpsGroup#OPSGROUP
|
||||
local grp = OG:GetGroup()
|
||||
ExceptionSet:AddGroup(grp,true)
|
||||
end
|
||||
|
||||
function OpsGroupSet:OnAfterAdded(From,Event,To,ObjectName,Object)
|
||||
local grp = Object:GetGroup()
|
||||
ExceptionSet:AddGroup(grp,true)
|
||||
end
|
||||
end
|
||||
|
||||
function VehicleSet:OnAfterAdded(From,Event,To,ObjectName,Object)
|
||||
BASE:I("TIRESIAS: VEHCILE Object Added: "..Object:GetName())
|
||||
if Object and Object:IsAlive() then
|
||||
Object:SetAIOff()
|
||||
Object:SetCommandInvisible(true)
|
||||
Object.Tiresias = { -- #TIRESIAS.Data
|
||||
type = "Vehicle",
|
||||
invisible = true,
|
||||
AIOff = true,
|
||||
exception = false,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
local SwitchAAA = self.SwitchAAA
|
||||
|
||||
function AAASet:OnAfterAdded(From,Event,To,ObjectName,Object)
|
||||
if Object and Object:IsAlive() then
|
||||
BASE:I("TIRESIAS: AAA Object Added: "..Object:GetName())
|
||||
Object:OptionEngageRange(EngageRange)
|
||||
Object:SetCommandInvisible(true)
|
||||
if SwitchAAA then
|
||||
Object:SetAIOff()
|
||||
Object:EnableEmission(false)
|
||||
end
|
||||
Object.Tiresias = { -- #TIRESIAS.Data
|
||||
type = "AAA",
|
||||
invisible = true,
|
||||
range = EngageRange,
|
||||
exception = false,
|
||||
AIOff = SwitchAAA,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function SAMSet:OnAfterAdded(From,Event,To,ObjectName,Object)
|
||||
if Object and Object:IsAlive() then
|
||||
BASE:I("TIRESIAS: SAM Object Added: "..Object:GetName())
|
||||
Object:SetCommandInvisible(true)
|
||||
Object.Tiresias = { -- #TIRESIAS.Data
|
||||
type = "SAM",
|
||||
invisible = true,
|
||||
exception = false,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
self.VehicleSet = VehicleSet
|
||||
self.AAASet = AAASet
|
||||
self.SAMSet = SAMSet
|
||||
self.OpsGroupSet = OpsGroupSet
|
||||
|
||||
self:_InitGroups()
|
||||
|
||||
self:__Status(1)
|
||||
return self
|
||||
end
|
||||
|
||||
--- [INTERNAL] FSM Function
|
||||
-- @param #TIRESIAS self
|
||||
-- @param #string From
|
||||
-- @param #string Event
|
||||
-- @param #string To
|
||||
-- @return #TIRESIAS self
|
||||
function TIRESIAS:onbeforeStatus(From, Event, To)
|
||||
self:T({From, Event, To})
|
||||
if self:GetState() == "Stopped" then
|
||||
return false
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- [INTERNAL] FSM Function
|
||||
-- @param #TIRESIAS self
|
||||
-- @param #string From
|
||||
-- @param #string Event
|
||||
-- @param #string To
|
||||
-- @return #TIRESIAS self
|
||||
function TIRESIAS:onafterStatus(From, Event, To)
|
||||
self:T({From, Event, To})
|
||||
if self.debug then
|
||||
local count = self.VehicleSet:CountAlive()
|
||||
local AAAcount = self.AAASet:CountAlive()
|
||||
local SAMcount = self.SAMSet:CountAlive()
|
||||
local text = string.format("Overall: %d | Vehicles: %d | AAA: %d | SAM: %d",count+AAAcount+SAMcount,count,AAAcount,SAMcount)
|
||||
self:I(text)
|
||||
end
|
||||
self:_InitGroups()
|
||||
if self.FlightSet:CountAlive() > 0 then
|
||||
local Set = self.FlightSet:GetAliveSet()
|
||||
for _,_plane in pairs(Set) do
|
||||
local plane = _plane -- Wrapper.Group#GROUP
|
||||
local radius = self.PlaneSwitchRange
|
||||
if plane:IsHelicopter() then
|
||||
radius = self.HeloSwitchRange
|
||||
end
|
||||
self:_SwitchOnGroups(_plane,radius)
|
||||
end
|
||||
end
|
||||
if self:GetState() ~= "Stopped" then
|
||||
self:__Status(self.Interval)
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- [INTERNAL] FSM Function
|
||||
-- @param #TIRESIAS self
|
||||
-- @param #string From
|
||||
-- @param #string Event
|
||||
-- @param #string To
|
||||
-- @return #TIRESIAS self
|
||||
function TIRESIAS:onafterStop(From, Event, To)
|
||||
self:T({From, Event, To})
|
||||
self:UnHandleEvent(EVENTS.PlayerEnterAircraft)
|
||||
return self
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
--
|
||||
-- End
|
||||
--
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
@@ -1629,7 +1629,7 @@ WAREHOUSE = {
|
||||
-- @field #boolean arrived If true, asset arrived at its destination.
|
||||
--
|
||||
-- @field #number damage Damage of asset group in percent.
|
||||
-- @field Ops.AirWing#AIRWING.Payload payload The payload of the asset.
|
||||
-- @field Ops.Airwing#AIRWING.Payload payload The payload of the asset.
|
||||
-- @field Ops.OpsGroup#OPSGROUP flightgroup The flightgroup object.
|
||||
-- @field Ops.Cohort#COHORT cohort The cohort this asset belongs to.
|
||||
-- @field Ops.Legion#LEGION legion The legion this asset belonts to.
|
||||
@@ -3414,7 +3414,7 @@ end
|
||||
-- FSM states
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--- On after Start event. Starts the warehouse. Addes event handlers and schedules status updates of reqests and queue.
|
||||
--- On after Start event. Starts the warehouse. Adds event handlers and schedules status updates of reqests and queue.
|
||||
-- @param #WAREHOUSE self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
@@ -3595,6 +3595,7 @@ function WAREHOUSE:onafterStatus(From, Event, To)
|
||||
local Trepair=self:GetRunwayRepairtime()
|
||||
self:I(self.lid..string.format("Runway destroyed! Will be repaired in %d sec", Trepair))
|
||||
if Trepair==0 then
|
||||
self.runwaydestroyed = nil
|
||||
self:RunwayRepaired()
|
||||
end
|
||||
end
|
||||
@@ -5392,7 +5393,8 @@ function WAREHOUSE:onafterRunwayDestroyed(From, Event, To)
|
||||
self:_InfoMessage(text)
|
||||
|
||||
self.runwaydestroyed=timer.getAbsTime()
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- On after "RunwayRepaired" event.
|
||||
@@ -5407,7 +5409,8 @@ function WAREHOUSE:onafterRunwayRepaired(From, Event, To)
|
||||
self:_InfoMessage(text)
|
||||
|
||||
self.runwaydestroyed=nil
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
--- **Functional** - Base class that models processes to achieve goals involving a Zone for a Coalition.
|
||||
--- **Functional (WIP)** - Base class modeling processes to achieve goals involving coalition zones.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
|
||||
@@ -33,6 +33,7 @@ __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Spot.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/MarkerOps_Base.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/TextAndSound.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Pathline.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/ClientMenu.lua')
|
||||
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Object.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Identifiable.lua' )
|
||||
@@ -77,6 +78,12 @@ __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Warehouse.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Fox.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Mantis.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Shorad.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/AICSAR.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/AmmoTruck.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Autolase.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/ZoneGoalCargo.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Tiresias.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Stratego.lua' )
|
||||
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Airboss.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/RecoveryTanker.lua' )
|
||||
@@ -84,6 +91,31 @@ __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/RescueHelo.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/ATIS.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/CTLD.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/CSAR.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/AirWing.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/ArmyGroup.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Auftrag.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Awacs.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Brigade.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Chief.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Cohort.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Commander.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Fleet.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/FlightControl.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/FlightGroup.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Flotilla.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Intelligence.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Legion.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/NavyGroup.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Operation.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/OpsGroup.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/OpsTransport.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/OpsZone.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Platoon.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/PlayerTask.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/PlayerRecce.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Squadron.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Target.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/EasyGCICAP.lua' )
|
||||
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Balancer.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Air.lua' )
|
||||
@@ -122,6 +154,14 @@ __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Actions/Act_Route.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Actions/Act_Account.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Actions/Act_Assist.lua' )
|
||||
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Shapes/ShapeBase.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Shapes/Circle.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Shapes/Cube.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Shapes/Line.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Shapes/Oval.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Shapes/Polygon.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Shapes/Triangle.lua' )
|
||||
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Sound/UserSound.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Sound/SoundOutput.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Sound/Radio.lua' )
|
||||
|
||||
172
Moose Development/Moose/Modules_local.lua
Normal file
172
Moose Development/Moose/Modules_local.lua
Normal file
@@ -0,0 +1,172 @@
|
||||
__Moose.Include( 'Utilities\\Enums.lua' )
|
||||
__Moose.Include( 'Utilities\\Routines.lua' )
|
||||
__Moose.Include( 'Utilities\\Utils.lua' )
|
||||
__Moose.Include( 'Utilities\\Profiler.lua' )
|
||||
__Moose.Include( 'Utilities\\Templates.lua' )
|
||||
__Moose.Include( 'Utilities\\STTS.lua' )
|
||||
__Moose.Include( 'Utilities\\FiFo.lua' )
|
||||
__Moose.Include( 'Utilities\\Socket.lua' )
|
||||
|
||||
__Moose.Include( 'Core\\Base.lua' )
|
||||
__Moose.Include( 'Core\\Beacon.lua' )
|
||||
__Moose.Include( 'Core\\UserFlag.lua' )
|
||||
__Moose.Include( 'Core\\Report.lua' )
|
||||
__Moose.Include( 'Core\\Scheduler.lua' )
|
||||
__Moose.Include( 'Core\\ScheduleDispatcher.lua' )
|
||||
__Moose.Include( 'Core\\Event.lua' )
|
||||
__Moose.Include( 'Core\\Settings.lua' )
|
||||
__Moose.Include( 'Core\\Menu.lua' )
|
||||
__Moose.Include( 'Core\\Zone.lua' )
|
||||
__Moose.Include( 'Core\\Zone_Detection.lua' )
|
||||
__Moose.Include( 'Core\\Database.lua' )
|
||||
__Moose.Include( 'Core\\Set.lua' )
|
||||
__Moose.Include( 'Core\\Point.lua' )
|
||||
__Moose.Include( 'Core\\Velocity.lua' )
|
||||
__Moose.Include( 'Core\\Message.lua' )
|
||||
__Moose.Include( 'Core\\Fsm.lua' )
|
||||
__Moose.Include( 'Core\\Spawn.lua' )
|
||||
__Moose.Include( 'Core\\SpawnStatic.lua' )
|
||||
__Moose.Include( 'Core\\Timer.lua' )
|
||||
__Moose.Include( 'Core\\Goal.lua' )
|
||||
__Moose.Include( 'Core\\Spot.lua' )
|
||||
__Moose.Include( 'Core\\Astar.lua' )
|
||||
__Moose.Include( 'Core\\MarkerOps_Base.lua' )
|
||||
__Moose.Include( 'Core\\TextAndSound.lua' )
|
||||
__Moose.Include( 'Core\\Condition.lua' )
|
||||
__Moose.Include( 'Core\\ClientMenu.lua' )
|
||||
|
||||
__Moose.Include( 'Wrapper\\Object.lua' )
|
||||
__Moose.Include( 'Wrapper\\Identifiable.lua' )
|
||||
__Moose.Include( 'Wrapper\\Positionable.lua' )
|
||||
__Moose.Include( 'Wrapper\\Controllable.lua' )
|
||||
__Moose.Include( 'Wrapper\\Group.lua' )
|
||||
__Moose.Include( 'Wrapper\\Unit.lua' )
|
||||
__Moose.Include( 'Wrapper\\Client.lua' )
|
||||
__Moose.Include( 'Wrapper\\Static.lua' )
|
||||
__Moose.Include( 'Wrapper\\Airbase.lua' )
|
||||
__Moose.Include( 'Wrapper\\Scenery.lua' )
|
||||
__Moose.Include( 'Wrapper\\Marker.lua' )
|
||||
|
||||
__Moose.Include( 'Cargo\\Cargo.lua' )
|
||||
__Moose.Include( 'Cargo\\CargoUnit.lua' )
|
||||
__Moose.Include( 'Cargo\\CargoSlingload.lua' )
|
||||
__Moose.Include( 'Cargo\\CargoCrate.lua' )
|
||||
__Moose.Include( 'Cargo\\CargoGroup.lua' )
|
||||
|
||||
__Moose.Include( 'Functional\\Scoring.lua' )
|
||||
__Moose.Include( 'Functional\\CleanUp.lua' )
|
||||
__Moose.Include( 'Functional\\Movement.lua' )
|
||||
__Moose.Include( 'Functional\\Sead.lua' )
|
||||
__Moose.Include( 'Functional\\Escort.lua' )
|
||||
__Moose.Include( 'Functional\\MissileTrainer.lua' )
|
||||
__Moose.Include( 'Functional\\ATC_Ground.lua' )
|
||||
__Moose.Include( 'Functional\\Detection.lua' )
|
||||
__Moose.Include( 'Functional\\DetectionZones.lua' )
|
||||
__Moose.Include( 'Functional\\Designate.lua' )
|
||||
__Moose.Include( 'Functional\\RAT.lua' )
|
||||
__Moose.Include( 'Functional\\Range.lua' )
|
||||
__Moose.Include( 'Functional\\ZoneGoal.lua' )
|
||||
__Moose.Include( 'Functional\\ZoneGoalCoalition.lua' )
|
||||
__Moose.Include( 'Functional\\ZoneCaptureCoalition.lua' )
|
||||
__Moose.Include( 'Functional\\Artillery.lua' )
|
||||
__Moose.Include( 'Functional\\Suppression.lua' )
|
||||
__Moose.Include( 'Functional\\PseudoATC.lua' )
|
||||
__Moose.Include( 'Functional\\Warehouse.lua' )
|
||||
__Moose.Include( 'Functional\\Fox.lua' )
|
||||
__Moose.Include( 'Functional\\Mantis.lua' )
|
||||
__Moose.Include( 'Functional\\Shorad.lua' )
|
||||
__Moose.Include( 'Functional\\Autolase.lua' )
|
||||
__Moose.Include( 'Functional\\AICSAR.lua' )
|
||||
|
||||
__Moose.Include( 'Ops\\Airboss.lua' )
|
||||
__Moose.Include( 'Ops\\RecoveryTanker.lua' )
|
||||
__Moose.Include( 'Ops\\RescueHelo.lua' )
|
||||
__Moose.Include( 'Ops\\ATIS.lua' )
|
||||
__Moose.Include( 'Ops\\Auftrag.lua' )
|
||||
__Moose.Include( 'Ops\\Target.lua' )
|
||||
__Moose.Include( 'Ops\\OpsGroup.lua' )
|
||||
__Moose.Include( 'Ops\\FlightGroup.lua' )
|
||||
__Moose.Include( 'Ops\\NavyGroup.lua' )
|
||||
__Moose.Include( 'Ops\\ArmyGroup.lua' )
|
||||
__Moose.Include( 'Ops\\Cohort.lua' )
|
||||
__Moose.Include( 'Ops\\Squadron.lua' )
|
||||
__Moose.Include( 'Ops\\Platoon.lua' )
|
||||
__Moose.Include( 'Ops\\Legion.lua' )
|
||||
__Moose.Include( 'Ops\\AirWing.lua' )
|
||||
__Moose.Include( 'Ops\\Brigade.lua' )
|
||||
__Moose.Include( 'Ops\\Intelligence.lua' )
|
||||
__Moose.Include( 'Ops\\Commander.lua' )
|
||||
__Moose.Include( 'Ops\\OpsTransport.lua' )
|
||||
__Moose.Include( 'Ops\\CSAR.lua' )
|
||||
__Moose.Include( 'Ops\\CTLD.lua' )
|
||||
__Moose.Include( 'Ops\\OpsZone.lua' )
|
||||
__Moose.Include( 'Ops\\Chief.lua' )
|
||||
__Moose.Include( 'Ops\\Flotilla.lua' )
|
||||
__Moose.Include( 'Ops\\Fleet.lua' )
|
||||
__Moose.Include( 'Ops\\Awacs.lua' )
|
||||
__Moose.Include( 'Ops\\PlayerTask.lua' )
|
||||
__Moose.Include( 'Ops\\Operation.lua' )
|
||||
__Moose.Include( 'Ops\\FlightControl.lua' )
|
||||
|
||||
__Moose.Include( 'AI\\AI_Balancer.lua' )
|
||||
__Moose.Include( 'AI\\AI_Air.lua' )
|
||||
__Moose.Include( 'AI\\AI_Air_Patrol.lua' )
|
||||
__Moose.Include( 'AI\\AI_Air_Engage.lua' )
|
||||
__Moose.Include( 'AI\\AI_A2A_Patrol.lua' )
|
||||
__Moose.Include( 'AI\\AI_A2A_Cap.lua' )
|
||||
__Moose.Include( 'AI\\AI_A2A_Gci.lua' )
|
||||
__Moose.Include( 'AI\\AI_A2A_Dispatcher.lua' )
|
||||
__Moose.Include( 'AI\\AI_A2G_BAI.lua' )
|
||||
__Moose.Include( 'AI\\AI_A2G_CAS.lua' )
|
||||
__Moose.Include( 'AI\\AI_A2G_SEAD.lua' )
|
||||
__Moose.Include( 'AI\\AI_A2G_Dispatcher.lua' )
|
||||
__Moose.Include( 'AI\\AI_Patrol.lua' )
|
||||
__Moose.Include( 'AI\\AI_Cap.lua' )
|
||||
__Moose.Include( 'AI\\AI_Cas.lua' )
|
||||
__Moose.Include( 'AI\\AI_Bai.lua' )
|
||||
__Moose.Include( 'AI\\AI_Formation.lua' )
|
||||
__Moose.Include( 'AI\\AI_Escort.lua' )
|
||||
__Moose.Include( 'AI\\AI_Escort_Request.lua' )
|
||||
__Moose.Include( 'AI\\AI_Escort_Dispatcher.lua' )
|
||||
__Moose.Include( 'AI\\AI_Escort_Dispatcher_Request.lua' )
|
||||
__Moose.Include( 'AI\\AI_Cargo.lua' )
|
||||
__Moose.Include( 'AI\\AI_Cargo_APC.lua' )
|
||||
__Moose.Include( 'AI\\AI_Cargo_Helicopter.lua' )
|
||||
__Moose.Include( 'AI\\AI_Cargo_Airplane.lua' )
|
||||
__Moose.Include( 'AI\\AI_Cargo_Ship.lua' )
|
||||
__Moose.Include( 'AI\\AI_Cargo_Dispatcher.lua' )
|
||||
__Moose.Include( 'AI\\AI_Cargo_Dispatcher_APC.lua' )
|
||||
__Moose.Include( 'AI\\AI_Cargo_Dispatcher_Helicopter.lua' )
|
||||
__Moose.Include( 'AI\\AI_Cargo_Dispatcher_Airplane.lua' )
|
||||
__Moose.Include( 'AI\\AI_Cargo_Dispatcher_Ship.lua' )
|
||||
|
||||
__Moose.Include( 'Actions\\Act_Assign.lua' )
|
||||
__Moose.Include( 'Actions\\Act_Route.lua' )
|
||||
__Moose.Include( 'Actions\\Act_Account.lua' )
|
||||
__Moose.Include( 'Actions\\Act_Assist.lua' )
|
||||
|
||||
__Moose.Include( 'Sound\\UserSound.lua' )
|
||||
__Moose.Include( 'Sound\\SoundOutput.lua' )
|
||||
__Moose.Include( 'Sound\\Radio.lua' )
|
||||
__Moose.Include( 'Sound\\RadioQueue.lua' )
|
||||
__Moose.Include( 'Sound\\RadioSpeech.lua' )
|
||||
__Moose.Include( 'Sound\\SRS.lua' )
|
||||
|
||||
__Moose.Include( 'Tasking\\CommandCenter.lua' )
|
||||
__Moose.Include( 'Tasking\\Mission.lua' )
|
||||
__Moose.Include( 'Tasking\\Task.lua' )
|
||||
__Moose.Include( 'Tasking\\TaskInfo.lua' )
|
||||
__Moose.Include( 'Tasking\\Task_Manager.lua' )
|
||||
__Moose.Include( 'Tasking\\DetectionManager.lua' )
|
||||
__Moose.Include( 'Tasking\\Task_A2G_Dispatcher.lua' )
|
||||
__Moose.Include( 'Tasking\\Task_A2G.lua' )
|
||||
__Moose.Include( 'Tasking\\Task_A2A_Dispatcher.lua' )
|
||||
__Moose.Include( 'Tasking\\Task_A2A.lua' )
|
||||
__Moose.Include( 'Tasking\\Task_Cargo.lua' )
|
||||
__Moose.Include( 'Tasking\\Task_Cargo_Transport.lua' )
|
||||
__Moose.Include( 'Tasking\\Task_Cargo_CSAR.lua' )
|
||||
__Moose.Include( 'Tasking\\Task_Cargo_Dispatcher.lua' )
|
||||
__Moose.Include( 'Tasking\\Task_Capture_Zone.lua' )
|
||||
__Moose.Include( 'Tasking\\Task_Capture_Dispatcher.lua' )
|
||||
|
||||
__Moose.Include( 'Globals.lua' )
|
||||
1584
Moose Development/Moose/Ops/AirWing.lua
Normal file
1584
Moose Development/Moose/Ops/AirWing.lua
Normal file
File diff suppressed because it is too large
Load Diff
@@ -3075,7 +3075,8 @@ function AIRBOSS:EnableSRS(PathToSRS,Port,Culture,Gender,Voice,GoogleCreds,Volum
|
||||
self.SRS:SetVolume(Volume or 1)
|
||||
--self.SRS:SetModulations(Modulations)
|
||||
if GoogleCreds then
|
||||
self.SRS:SetGoogle(GoogleCreds)
|
||||
self.SRS:SetProviderOptionsGoogle(GoogleCreds,GoogleCreds)
|
||||
self.SRS:SetProvider(MSRS.Provider.GOOGLE)
|
||||
end
|
||||
if Voice then
|
||||
self.SRS:SetVoice(Voice)
|
||||
@@ -9754,7 +9755,7 @@ function AIRBOSS:_Groove( playerData )
|
||||
local glideslopeError = groovedata.GSE
|
||||
local AoA = groovedata.AoA
|
||||
|
||||
if rho <= RXX and playerData.step == AIRBOSS.PatternStep.GROOVE_XX and (math.abs( groovedata.Roll ) <= 4.0 or playerData.unit:IsInZone( self:_GetZoneLineup() )) then
|
||||
if rho <= RXX and playerData.step == AIRBOSS.PatternStep.GROOVE_XX and (math.abs( groovedata.Roll ) <= 4.0 and playerData.unit:IsInZone( self:_GetZoneLineup() )) then
|
||||
|
||||
-- Start time in groove
|
||||
playerData.TIG0 = timer.getTime()
|
||||
@@ -12122,16 +12123,18 @@ function AIRBOSS:_LSOgrade( playerData )
|
||||
local GIC, nIC = self:_Flightdata2Text( playerData, AIRBOSS.GroovePos.IC )
|
||||
local GAR, nAR = self:_Flightdata2Text( playerData, AIRBOSS.GroovePos.AR )
|
||||
|
||||
-- VTOL approach, which is graded differently (currently only Harrier).
|
||||
local vtol=playerData.actype==AIRBOSS.AircraftCarrier.AV8B
|
||||
|
||||
-- Put everything together.
|
||||
local G = GXX .. " " .. GIM .. " " .. " " .. GIC .. " " .. GAR
|
||||
|
||||
-- Count number of minor, normal and major deviations.
|
||||
-- Count number of minor/small nS, normal nN and major/large deviations nL.
|
||||
local N=nXX+nIM+nIC+nAR
|
||||
local Nv=nXX+nIM
|
||||
local nL=count(G, '_')/2
|
||||
local nS=count(G, '%(')
|
||||
local nN=N-nS-nL
|
||||
local nNv=Nv-nS-nL
|
||||
|
||||
|
||||
-- Groove time 15-18.99 sec for a unicorn. Or 60-65 for V/STOL unicorn.
|
||||
local Tgroove=playerData.Tgroove
|
||||
@@ -12147,34 +12150,64 @@ function AIRBOSS:_LSOgrade( playerData )
|
||||
G = "Unicorn"
|
||||
else
|
||||
|
||||
-- Add AV-8B Harrier devation allowances due to lower groundspeed and 3x conventional groove time, this allows to maintain LSO tolerances while respecting the deviations are not unsafe.--Pene testing
|
||||
-- Large devaitions still result in a No Grade, A Unicorn still requires a clean pass with no deviation.
|
||||
if nL > 1 and playerData.actype==AIRBOSS.AircraftCarrier.AV8B then
|
||||
-- Larger deviations ==> "No grade" 2.0 points.
|
||||
grade="--"
|
||||
points=2.0
|
||||
elseif nNv >= 1 and playerData.actype==AIRBOSS.AircraftCarrier.AV8B then
|
||||
-- Only average deviations ==> "Fair Pass" Pass with average deviations and corrections.
|
||||
grade="(OK)"
|
||||
points=3.0
|
||||
elseif nNv < 1 and playerData.actype==AIRBOSS.AircraftCarrier.AV8B then
|
||||
-- Only minor average deviations ==> "OK" Pass with minor deviations and corrections. (test nNv<=1 and)
|
||||
grade="OK"
|
||||
points=4.0
|
||||
elseif nL > 0 then
|
||||
-- Larger deviations ==> "No grade" 2.0 points.
|
||||
grade="--"
|
||||
points=2.0
|
||||
elseif nN> 0 then
|
||||
-- No larger but average deviations ==> "Fair Pass" Pass with average deviations and corrections.
|
||||
grade="(OK)"
|
||||
points=3.0
|
||||
else
|
||||
-- Only minor corrections
|
||||
grade="OK"
|
||||
points=4.0
|
||||
end
|
||||
if vtol then
|
||||
|
||||
-- Add AV-8B Harrier devation allowances due to lower groundspeed and 3x conventional groove time, this allows to maintain LSO tolerances while respecting the deviations are not unsafe.--Pene testing
|
||||
-- Large devaitions still result in a No Grade, A Unicorn still requires a clean pass with no deviation.
|
||||
|
||||
-- Normal laning part at the beginning
|
||||
local Gb = GXX .. " " .. GIM
|
||||
|
||||
-- Number of deviations that occurred at the the beginning of the landing (XX or IM). These are graded like in non-VTOL landings, i.e. on deviations is
|
||||
local N=nXX+nIM
|
||||
local nL=count(Gb, '_')/2
|
||||
local nS=count(Gb, '%(')
|
||||
local nN=N-nS-nL
|
||||
|
||||
|
||||
-- VTOL part of the landing
|
||||
local Gv = GIC .. " " .. GAR
|
||||
|
||||
-- Number of deviations that occurred at the the end (VTOL part) of the landing (IC or AR).
|
||||
local Nv=nIC+nAR
|
||||
local nLv=count(Gv, '_')/2
|
||||
local nSv=count(Gv, '%(')
|
||||
local nNv=Nv-nSv-nLv
|
||||
|
||||
if nL>0 or nLv>1 then
|
||||
-- Larger deviations at XX or IM or at least one larger deviation IC or AR==> "No grade" 2.0 points.
|
||||
-- In other words, we allow one larger deviation at IC+AR
|
||||
grade="--"
|
||||
points=2.0
|
||||
elseif nN>0 or nNv>1 or nLv==1 then
|
||||
-- Average deviations at XX+IM or more than one normal deviation IC or AR ==> "Fair Pass" Pass with average deviations and corrections.
|
||||
grade="(OK)"
|
||||
points=3.0
|
||||
else
|
||||
-- Only minor corrections
|
||||
grade="OK"
|
||||
points=4.0
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
-- This is a normal (non-VTOL) landing.
|
||||
|
||||
if nL > 0 then
|
||||
-- Larger deviations ==> "No grade" 2.0 points.
|
||||
grade="--"
|
||||
points=2.0
|
||||
elseif nN> 0 then
|
||||
-- No larger but average/normal deviations ==> "Fair Pass" Pass with average deviations and corrections.
|
||||
grade="(OK)"
|
||||
points=3.0
|
||||
else
|
||||
-- Only minor corrections ==> "Okay pass" 4.0 points.
|
||||
grade="OK"
|
||||
points=4.0
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
-- Replace" )"( and "__"
|
||||
|
||||
2382
Moose Development/Moose/Ops/ArmyGroup.lua
Normal file
2382
Moose Development/Moose/Ops/ArmyGroup.lua
Normal file
File diff suppressed because it is too large
Load Diff
6843
Moose Development/Moose/Ops/Auftrag.lua
Normal file
6843
Moose Development/Moose/Ops/Auftrag.lua
Normal file
File diff suppressed because it is too large
Load Diff
7006
Moose Development/Moose/Ops/Awacs.lua
Normal file
7006
Moose Development/Moose/Ops/Awacs.lua
Normal file
File diff suppressed because it is too large
Load Diff
621
Moose Development/Moose/Ops/Brigade.lua
Normal file
621
Moose Development/Moose/Ops/Brigade.lua
Normal file
@@ -0,0 +1,621 @@
|
||||
--- **Ops** - Brigade Warehouse.
|
||||
--
|
||||
-- **Main Features:**
|
||||
--
|
||||
-- * Manage platoons
|
||||
-- * Carry out ARTY and PATROLZONE missions (AUFTRAG)
|
||||
-- * Define rearming zones
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ## Example Missions:
|
||||
--
|
||||
-- Demo missions can be found on [github](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/Ops/Brigade).
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### Author: **funkyfranky**
|
||||
--
|
||||
-- ===
|
||||
-- @module Ops.Brigade
|
||||
-- @image OPS_Brigade_.png
|
||||
|
||||
|
||||
--- BRIGADE class.
|
||||
-- @type BRIGADE
|
||||
-- @field #string ClassName Name of the class.
|
||||
-- @field #number verbose Verbosity of output.
|
||||
-- @field #table rearmingZones Rearming zones. Each element is of type `#BRIGADE.SupplyZone`.
|
||||
-- @field #table refuellingZones Refuelling zones. Each element is of type `#BRIGADE.SupplyZone`.
|
||||
-- @field Core.Set#SET_ZONE retreatZones Retreat zone set.
|
||||
-- @extends Ops.Legion#LEGION
|
||||
|
||||
--- *I am not afraid of an Army of lions lead by a sheep; I am afraid of sheep lead by a lion* -- Alexander the Great
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- # The BRIGADE Concept
|
||||
--
|
||||
-- A BRIGADE consists of one or multiple PLATOONs. These platoons "live" in a WAREHOUSE that has a phyiscal struction (STATIC or UNIT) and can be captured or destroyed.
|
||||
--
|
||||
--
|
||||
-- @field #BRIGADE
|
||||
BRIGADE = {
|
||||
ClassName = "BRIGADE",
|
||||
verbose = 0,
|
||||
rearmingZones = {},
|
||||
refuellingZones = {},
|
||||
}
|
||||
|
||||
--- Supply Zone.
|
||||
-- @type BRIGADE.SupplyZone
|
||||
-- @field Core.Zone#ZONE zone The zone.
|
||||
-- @field Ops.Auftrag#AUFTRAG mission Mission assigned to supply ammo or fuel.
|
||||
-- @field #boolean markerOn If `true`, marker is on.
|
||||
-- @field Wrapper.Marker#MARKER marker F10 marker.
|
||||
|
||||
--- BRIGADE class version.
|
||||
-- @field #string version
|
||||
BRIGADE.version="0.1.1"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- ToDo list
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- TODO: Spawn when hosting warehouse is a ship or oil rig or gas platform.
|
||||
-- TODO: Rearming zones.
|
||||
-- TODO: Retreat zones.
|
||||
-- DONE: Add weapon range.
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- Constructor
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--- Create a new BRIGADE class object.
|
||||
-- @param #BRIGADE self
|
||||
-- @param #string WarehouseName Name of the warehouse STATIC or UNIT object representing the warehouse.
|
||||
-- @param #string BrigadeName Name of the brigade.
|
||||
-- @return #BRIGADE self
|
||||
function BRIGADE:New(WarehouseName, BrigadeName)
|
||||
|
||||
-- Inherit everything from LEGION class.
|
||||
local self=BASE:Inherit(self, LEGION:New(WarehouseName, BrigadeName)) -- #BRIGADE
|
||||
|
||||
-- Nil check.
|
||||
if not self then
|
||||
BASE:E(string.format("ERROR: Could not find warehouse %s!", WarehouseName))
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Set some string id for output to DCS.log file.
|
||||
self.lid=string.format("BRIGADE %s | ", self.alias)
|
||||
|
||||
-- Defaults
|
||||
self:SetRetreatZones()
|
||||
|
||||
-- Turn ship into NAVYGROUP.
|
||||
if self:IsShip() then
|
||||
local wh=self.warehouse --Wrapper.Unit#UNIT
|
||||
local group=wh:GetGroup()
|
||||
self.warehouseOpsGroup=NAVYGROUP:New(group) --Ops.NavyGroup#NAVYGROUP
|
||||
self.warehouseOpsElement=self.warehouseOpsGroup:GetElementByName(wh:GetName())
|
||||
end
|
||||
|
||||
-- Add FSM transitions.
|
||||
-- From State --> Event --> To State
|
||||
self:AddTransition("*", "ArmyOnMission", "*") -- An ARMYGROUP was send on a Mission (AUFTRAG).
|
||||
|
||||
------------------------
|
||||
--- Pseudo Functions ---
|
||||
------------------------
|
||||
|
||||
--- Triggers the FSM event "Start". Starts the BRIGADE. Initializes parameters and starts event handlers.
|
||||
-- @function [parent=#BRIGADE] Start
|
||||
-- @param #BRIGADE self
|
||||
|
||||
--- Triggers the FSM event "Start" after a delay. Starts the BRIGADE. Initializes parameters and starts event handlers.
|
||||
-- @function [parent=#BRIGADE] __Start
|
||||
-- @param #BRIGADE self
|
||||
-- @param #number delay Delay in seconds.
|
||||
|
||||
|
||||
--- Triggers the FSM event "Stop". Stops the BRIGADE and all its event handlers.
|
||||
-- @param #BRIGADE self
|
||||
|
||||
--- Triggers the FSM event "Stop" after a delay. Stops the BRIGADE and all its event handlers.
|
||||
-- @function [parent=#BRIGADE] __Stop
|
||||
-- @param #BRIGADE self
|
||||
-- @param #number delay Delay in seconds.
|
||||
|
||||
|
||||
--- Triggers the FSM event "ArmyOnMission".
|
||||
-- @function [parent=#BRIGADE] ArmyOnMission
|
||||
-- @param #BRIGADE self
|
||||
-- @param Ops.ArmyGroup#ARMYGROUP ArmyGroup The ARMYGROUP on mission.
|
||||
-- @param Ops.Auftrag#AUFTRAG Mission The mission.
|
||||
|
||||
--- Triggers the FSM event "ArmyOnMission" after a delay.
|
||||
-- @function [parent=#BRIGADE] __ArmyOnMission
|
||||
-- @param #BRIGADE self
|
||||
-- @param #number delay Delay in seconds.
|
||||
-- @param Ops.ArmyGroup#ARMYGROUP ArmyGroup The ARMYGROUP on mission.
|
||||
-- @param Ops.Auftrag#AUFTRAG Mission The mission.
|
||||
|
||||
--- On after "ArmyOnMission" event.
|
||||
-- @function [parent=#BRIGADE] OnAfterArmyOnMission
|
||||
-- @param #BRIGADE self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param Ops.ArmyGroup#ARMYGROUP ArmyGroup The ARMYGROUP on mission.
|
||||
-- @param Ops.Auftrag#AUFTRAG Mission The mission.
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- User Functions
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--- Add a platoon to the brigade.
|
||||
-- @param #BRIGADE self
|
||||
-- @param Ops.Platoon#PLATOON Platoon The platoon object.
|
||||
-- @return #BRIGADE self
|
||||
function BRIGADE:AddPlatoon(Platoon)
|
||||
|
||||
-- Add platoon to brigade.
|
||||
table.insert(self.cohorts, Platoon)
|
||||
|
||||
-- Add assets to platoon.
|
||||
self:AddAssetToPlatoon(Platoon, Platoon.Ngroups)
|
||||
|
||||
-- Set brigade of platoon.
|
||||
Platoon:SetBrigade(self)
|
||||
|
||||
-- Start platoon.
|
||||
if Platoon:IsStopped() then
|
||||
Platoon:Start()
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Add asset group(s) to platoon.
|
||||
-- @param #BRIGADE self
|
||||
-- @param Ops.Platoon#PLATOON Platoon The platoon object.
|
||||
-- @param #number Nassets Number of asset groups to add.
|
||||
-- @return #BRIGADE self
|
||||
function BRIGADE:AddAssetToPlatoon(Platoon, Nassets)
|
||||
|
||||
if Platoon then
|
||||
|
||||
-- Get the template group of the platoon.
|
||||
local Group=GROUP:FindByName(Platoon.templatename)
|
||||
|
||||
if Group then
|
||||
|
||||
-- Debug text.
|
||||
local text=string.format("Adding asset %s to platoon %s", Group:GetName(), Platoon.name)
|
||||
self:T(self.lid..text)
|
||||
|
||||
-- Add assets to airwing warehouse.
|
||||
self:AddAsset(Group, Nassets, nil, nil, nil, nil, Platoon.skill, Platoon.livery, Platoon.name)
|
||||
|
||||
else
|
||||
self:E(self.lid.."ERROR: Group does not exist!")
|
||||
end
|
||||
|
||||
else
|
||||
self:E(self.lid.."ERROR: Platoon does not exit!")
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Define a set of retreat zones.
|
||||
-- @param #BRIGADE self
|
||||
-- @param Core.Set#SET_ZONE RetreatZoneSet Set of retreat zones.
|
||||
-- @return #BRIGADE self
|
||||
function BRIGADE:SetRetreatZones(RetreatZoneSet)
|
||||
self.retreatZones=RetreatZoneSet or SET_ZONE:New()
|
||||
return self
|
||||
end
|
||||
|
||||
--- Add a retreat zone.
|
||||
-- @param #BRIGADE self
|
||||
-- @param Core.Zone#ZONE RetreatZone Retreat zone.
|
||||
-- @return #BRIGADE self
|
||||
function BRIGADE:AddRetreatZone(RetreatZone)
|
||||
self.retreatZones:AddZone(RetreatZone)
|
||||
return self
|
||||
end
|
||||
|
||||
--- Get retreat zones.
|
||||
-- @param #BRIGADE self
|
||||
-- @return Core.Set#SET_ZONE Set of retreat zones.
|
||||
function BRIGADE:GetRetreatZones()
|
||||
return self.retreatZones
|
||||
end
|
||||
|
||||
--- Add a rearming zone.
|
||||
-- @param #BRIGADE self
|
||||
-- @param Core.Zone#ZONE RearmingZone Rearming zone.
|
||||
-- @return #BRIGADE.SupplyZone The rearming zone data.
|
||||
function BRIGADE:AddRearmingZone(RearmingZone)
|
||||
|
||||
local rearmingzone={} --#BRIGADE.SupplyZone
|
||||
|
||||
rearmingzone.zone=RearmingZone
|
||||
rearmingzone.mission=nil
|
||||
rearmingzone.marker=MARKER:New(rearmingzone.zone:GetCoordinate(), "Rearming Zone"):ToCoalition(self:GetCoalition())
|
||||
|
||||
table.insert(self.rearmingZones, rearmingzone)
|
||||
|
||||
return rearmingzone
|
||||
end
|
||||
|
||||
|
||||
--- Add a refuelling zone.
|
||||
-- @param #BRIGADE self
|
||||
-- @param Core.Zone#ZONE RefuellingZone Refuelling zone.
|
||||
-- @return #BRIGADE.SupplyZone The refuelling zone data.
|
||||
function BRIGADE:AddRefuellingZone(RefuellingZone)
|
||||
|
||||
local supplyzone={} --#BRIGADE.SupplyZone
|
||||
|
||||
supplyzone.zone=RefuellingZone
|
||||
supplyzone.mission=nil
|
||||
supplyzone.marker=MARKER:New(supplyzone.zone:GetCoordinate(), "Refuelling Zone"):ToCoalition(self:GetCoalition())
|
||||
|
||||
table.insert(self.refuellingZones, supplyzone)
|
||||
|
||||
return supplyzone
|
||||
end
|
||||
|
||||
|
||||
--- Get platoon by name.
|
||||
-- @param #BRIGADE self
|
||||
-- @param #string PlatoonName Name of the platoon.
|
||||
-- @return Ops.Platoon#PLATOON The Platoon object.
|
||||
function BRIGADE:GetPlatoon(PlatoonName)
|
||||
local platoon=self:_GetCohort(PlatoonName)
|
||||
return platoon
|
||||
end
|
||||
|
||||
--- Get platoon of an asset.
|
||||
-- @param #BRIGADE self
|
||||
-- @param Functional.Warehouse#WAREHOUSE.Assetitem Asset The platoon asset.
|
||||
-- @return Ops.Platoon#PLATOON The platoon object.
|
||||
function BRIGADE:GetPlatoonOfAsset(Asset)
|
||||
local platoon=self:GetPlatoon(Asset.squadname)
|
||||
return platoon
|
||||
end
|
||||
|
||||
--- Remove asset from platoon.
|
||||
-- @param #BRIGADE self
|
||||
-- @param Functional.Warehouse#WAREHOUSE.Assetitem Asset The platoon asset.
|
||||
function BRIGADE:RemoveAssetFromPlatoon(Asset)
|
||||
local platoon=self:GetPlatoonOfAsset(Asset)
|
||||
if platoon then
|
||||
platoon:DelAsset(Asset)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--- [ GROUND ] Function to load back an asset in the field that has been filed before.
|
||||
-- @param #BRIGADE self
|
||||
-- @param #string Templatename e.g."1 PzDv LogRg I\_AID-976" - that's the alias (name) of an platoon spawned as `"platoon - alias"_AID-"asset-ID"`
|
||||
-- @param Core.Point#COORDINATE Position where to spawn the platoon
|
||||
-- @return #BRIGADE self
|
||||
-- @usage
|
||||
-- Prerequisites:
|
||||
-- Save the assets spawned by BRIGADE/CHIEF regularly (~every 5 mins) into a file, e.g. like this:
|
||||
--
|
||||
-- local Path = FilePath or "C:\\Users\\<yourname>\\Saved Games\\DCS\\Missions\\" -- example path
|
||||
-- local BlueOpsFilename = BlueFileName or "ExamplePlatoonSave.csv" -- example filename
|
||||
-- local BlueSaveOps = SET_OPSGROUP:New():FilterCoalitions("blue"):FilterCategoryGround():FilterOnce()
|
||||
-- UTILS.SaveSetOfOpsGroups(BlueSaveOps,Path,BlueOpsFilename)
|
||||
--
|
||||
-- where Path and Filename are strings, as chosen by you.
|
||||
-- You can then load back the assets at the start of your next mission run. Be aware that it takes a couple of seconds for the
|
||||
-- platoon data to arrive in brigade, so make this an action after ~20 seconds, e.g. like so:
|
||||
--
|
||||
-- function LoadBackAssets()
|
||||
-- local Path = FilePath or "C:\\Users\\<yourname>\\Saved Games\\DCS\\Missions\\" -- example path
|
||||
-- local BlueOpsFilename = BlueFileName or "ExamplePlatoonSave.csv" -- example filename
|
||||
-- if UTILS.CheckFileExists(Path,BlueOpsFilename) then
|
||||
-- local loadback = UTILS.LoadSetOfOpsGroups(Path,BlueOpsFilename,false)
|
||||
-- for _,_platoondata in pairs (loadback) do
|
||||
-- local groupname = _platoondata.groupname -- #string
|
||||
-- local coordinate = _platoondata.coordinate -- Core.Point#COORDINATE
|
||||
-- Your_Brigade:LoadBackAssetInPosition(groupname,coordinate)
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
--
|
||||
-- local AssetLoader = TIMER:New(LoadBackAssets)
|
||||
-- AssetLoader:Start(20)
|
||||
--
|
||||
-- The assets loaded back into the mission will be considered for AUFTRAG type missions from CHIEF and BRIGADE.
|
||||
function BRIGADE:LoadBackAssetInPosition(Templatename,Position)
|
||||
self:T(self.lid .. "LoadBackAssetInPosition: " .. tostring(Templatename))
|
||||
|
||||
-- get Platoon alias from Templatename
|
||||
local nametbl = UTILS.Split(Templatename,"_")
|
||||
|
||||
local name = nametbl[1]
|
||||
|
||||
self:T(string.format("*** Target Platoon = %s ***",name))
|
||||
|
||||
-- find a matching asset table from BRIGADE
|
||||
local cohorts = self.cohorts or {}
|
||||
local thisasset = nil --Functional.Warehouse#WAREHOUSE.Assetitem
|
||||
local found = false
|
||||
|
||||
for _,_cohort in pairs(cohorts) do
|
||||
local asset = _cohort:GetName()
|
||||
self:T(string.format("*** Looking at Platoon = %s ***",asset))
|
||||
if asset == name then
|
||||
self:T("**** Found Platoon ****")
|
||||
local cohassets = _cohort.assets or {}
|
||||
for _,_zug in pairs (cohassets) do
|
||||
local zug = _zug -- Functional.Warehouse#WAREHOUSE.Assetitem
|
||||
if zug.assignment == name and zug.requested == false then
|
||||
self:T("**** Found Asset ****")
|
||||
found = true
|
||||
thisasset = zug --Functional.Warehouse#WAREHOUSE.Assetitem
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if found then
|
||||
|
||||
-- prep asset
|
||||
thisasset.rid = thisasset.uid
|
||||
thisasset.requested = false
|
||||
thisasset.score=100
|
||||
thisasset.missionTask="CAS"
|
||||
thisasset.spawned = true
|
||||
local template = thisasset.templatename
|
||||
local alias = thisasset.spawngroupname
|
||||
|
||||
-- Spawn group
|
||||
local spawnasset = SPAWN:NewWithAlias(template,alias)
|
||||
:InitDelayOff()
|
||||
:SpawnFromCoordinate(Position)
|
||||
|
||||
-- build a new self request
|
||||
local request = {} --Functional.Warehouse#WAREHOUSE.Pendingitem
|
||||
request.assignment = name
|
||||
request.warehouse = self
|
||||
request.assets = {thisasset}
|
||||
request.ntransporthome = 0
|
||||
request.ndelivered = 0
|
||||
request.ntransport = 0
|
||||
request.cargoattribute = thisasset.attribute
|
||||
request.category = thisasset.category
|
||||
request.cargoassets = {thisasset}
|
||||
request.assetdesc = WAREHOUSE.Descriptor.ASSETLIST
|
||||
request.cargocategory = thisasset.category
|
||||
request.toself = true
|
||||
request.transporttype = WAREHOUSE.TransportType.SELFPROPELLED
|
||||
request.assetproblem = {}
|
||||
request.born = true
|
||||
request.prio = 50
|
||||
request.uid = thisasset.uid
|
||||
request.airbase = nil
|
||||
request.timestamp = timer.getAbsTime()
|
||||
request.assetdescval = {thisasset}
|
||||
request.nasset = 1
|
||||
request.cargogroupset = SET_GROUP:New()
|
||||
request.cargogroupset:AddGroup(spawnasset)
|
||||
request.iscargo = true
|
||||
|
||||
-- Call Brigade self
|
||||
self:__AssetSpawned(2, spawnasset, thisasset, request)
|
||||
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- FSM Functions
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--- Start BRIGADE FSM.
|
||||
-- @param #BRIGADE self
|
||||
function BRIGADE:onafterStart(From, Event, To)
|
||||
|
||||
-- Start parent Warehouse.
|
||||
self:GetParent(self, BRIGADE).onafterStart(self, From, Event, To)
|
||||
|
||||
-- Info.
|
||||
self:I(self.lid..string.format("Starting BRIGADE v%s", BRIGADE.version))
|
||||
|
||||
end
|
||||
|
||||
--- Update status.
|
||||
-- @param #BRIGADE self
|
||||
function BRIGADE:onafterStatus(From, Event, To)
|
||||
|
||||
-- Status of parent Warehouse.
|
||||
self:GetParent(self).onafterStatus(self, From, Event, To)
|
||||
|
||||
-- FSM state.
|
||||
local fsmstate=self:GetState()
|
||||
|
||||
----------------
|
||||
-- Transport ---
|
||||
----------------
|
||||
|
||||
self:CheckTransportQueue()
|
||||
|
||||
--------------
|
||||
-- Mission ---
|
||||
--------------
|
||||
|
||||
-- Check if any missions should be cancelled.
|
||||
self:CheckMissionQueue()
|
||||
|
||||
---------------------
|
||||
-- Rearming Zones ---
|
||||
---------------------
|
||||
|
||||
for _,_rearmingzone in pairs(self.rearmingZones) do
|
||||
local rearmingzone=_rearmingzone --#BRIGADE.SupplyZone
|
||||
if (not rearmingzone.mission) or rearmingzone.mission:IsOver() then
|
||||
rearmingzone.mission=AUFTRAG:NewAMMOSUPPLY(rearmingzone.zone)
|
||||
self:AddMission(rearmingzone.mission)
|
||||
end
|
||||
end
|
||||
|
||||
-----------------------
|
||||
-- Refuelling Zones ---
|
||||
-----------------------
|
||||
|
||||
-- Check refuelling zones.
|
||||
for _,_supplyzone in pairs(self.refuellingZones) do
|
||||
local supplyzone=_supplyzone --#BRIGADE.SupplyZone
|
||||
-- Check if mission is nil or over.
|
||||
if (not supplyzone.mission) or supplyzone.mission:IsOver() then
|
||||
supplyzone.mission=AUFTRAG:NewFUELSUPPLY(supplyzone.zone)
|
||||
self:AddMission(supplyzone.mission)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-----------
|
||||
-- Info ---
|
||||
-----------
|
||||
|
||||
-- General info:
|
||||
if self.verbose>=1 then
|
||||
|
||||
-- Count missions not over yet.
|
||||
local Nmissions=self:CountMissionsInQueue()
|
||||
|
||||
-- Asset count.
|
||||
local Npq, Np, Nq=self:CountAssetsOnMission()
|
||||
|
||||
-- Asset string.
|
||||
local assets=string.format("%d [OnMission: Total=%d, Active=%d, Queued=%d]", self:CountAssets(), Npq, Np, Nq)
|
||||
|
||||
-- Output.
|
||||
local text=string.format("%s: Missions=%d, Platoons=%d, Assets=%s", fsmstate, Nmissions, #self.cohorts, assets)
|
||||
self:I(self.lid..text)
|
||||
end
|
||||
|
||||
------------------
|
||||
-- Mission Info --
|
||||
------------------
|
||||
if self.verbose>=2 then
|
||||
local text=string.format("Missions Total=%d:", #self.missionqueue)
|
||||
for i,_mission in pairs(self.missionqueue) do
|
||||
local mission=_mission --Ops.Auftrag#AUFTRAG
|
||||
|
||||
local prio=string.format("%d/%s", mission.prio, tostring(mission.importance)) ; if mission.urgent then prio=prio.." (!)" end
|
||||
local assets=string.format("%d/%d", mission:CountOpsGroups(), mission.Nassets or 0)
|
||||
local target=string.format("%d/%d Damage=%.1f", mission:CountMissionTargets(), mission:GetTargetInitialNumber(), mission:GetTargetDamage())
|
||||
|
||||
text=text..string.format("\n[%d] %s %s: Status=%s, Prio=%s, Assets=%s, Targets=%s", i, mission.name, mission.type, mission.status, prio, assets, target)
|
||||
end
|
||||
self:I(self.lid..text)
|
||||
end
|
||||
|
||||
--------------------
|
||||
-- Transport Info --
|
||||
--------------------
|
||||
if self.verbose>=2 then
|
||||
local text=string.format("Transports Total=%d:", #self.transportqueue)
|
||||
for i,_transport in pairs(self.transportqueue) do
|
||||
local transport=_transport --Ops.OpsTransport#OPSTRANSPORT
|
||||
|
||||
local prio=string.format("%d/%s", transport.prio, tostring(transport.importance)) ; if transport.urgent then prio=prio.." (!)" end
|
||||
local carriers=string.format("Ncargo=%d/%d, Ncarriers=%d", transport.Ncargo, transport.Ndelivered, transport.Ncarrier)
|
||||
|
||||
text=text..string.format("\n[%d] UID=%d: Status=%s, Prio=%s, Cargo: %s", i, transport.uid, transport:GetState(), prio, carriers)
|
||||
end
|
||||
self:I(self.lid..text)
|
||||
end
|
||||
|
||||
-------------------
|
||||
-- Platoon Info --
|
||||
-------------------
|
||||
if self.verbose>=3 then
|
||||
local text="Platoons:"
|
||||
for i,_platoon in pairs(self.cohorts) do
|
||||
local platoon=_platoon --Ops.Platoon#PLATOON
|
||||
|
||||
local callsign=platoon.callsignName and UTILS.GetCallsignName(platoon.callsignName) or "N/A"
|
||||
local modex=platoon.modex and platoon.modex or -1
|
||||
local skill=platoon.skill and tostring(platoon.skill) or "N/A"
|
||||
|
||||
-- Platoon text.
|
||||
text=text..string.format("\n* %s %s: %s*%d/%d, Callsign=%s, Modex=%d, Skill=%s", platoon.name, platoon:GetState(), platoon.aircrafttype, platoon:CountAssets(true), #platoon.assets, callsign, modex, skill)
|
||||
end
|
||||
self:I(self.lid..text)
|
||||
end
|
||||
|
||||
-------------------
|
||||
-- Rearming Info --
|
||||
-------------------
|
||||
if self.verbose>=4 then
|
||||
local text="Rearming Zones:"
|
||||
for i,_rearmingzone in pairs(self.rearmingZones) do
|
||||
local rearmingzone=_rearmingzone --#BRIGADE.SupplyZone
|
||||
-- Info text.
|
||||
text=text..string.format("\n* %s: Mission status=%s, suppliers=%d", rearmingzone.zone:GetName(), rearmingzone.mission:GetState(), rearmingzone.mission:CountOpsGroups())
|
||||
end
|
||||
self:I(self.lid..text)
|
||||
end
|
||||
|
||||
---------------------
|
||||
-- Refuelling Info --
|
||||
---------------------
|
||||
if self.verbose>=4 then
|
||||
local text="Refuelling Zones:"
|
||||
for i,_refuellingzone in pairs(self.refuellingZones) do
|
||||
local refuellingzone=_refuellingzone --#BRIGADE.SupplyZone
|
||||
-- Info text.
|
||||
text=text..string.format("\n* %s: Mission status=%s, suppliers=%d", refuellingzone.zone:GetName(), refuellingzone.mission:GetState(), refuellingzone.mission:CountOpsGroups())
|
||||
end
|
||||
self:I(self.lid..text)
|
||||
end
|
||||
|
||||
----------------
|
||||
-- Asset Info --
|
||||
----------------
|
||||
if self.verbose>=5 then
|
||||
local text="Assets in stock:"
|
||||
for i,_asset in pairs(self.stock) do
|
||||
local asset=_asset --Functional.Warehouse#WAREHOUSE.Assetitem
|
||||
-- Info text.
|
||||
text=text..string.format("\n* %s: spawned=%s", asset.spawngroupname, tostring(asset.spawned))
|
||||
end
|
||||
self:I(self.lid..text)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- FSM Functions
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--- On after "ArmyOnMission".
|
||||
-- @param #BRIGADE self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param Ops.ArmyGroup#ARMYGROUP ArmyGroup Ops army group on mission.
|
||||
-- @param Ops.Auftrag#AUFTRAG Mission The requested mission.
|
||||
function BRIGADE:onafterArmyOnMission(From, Event, To, ArmyGroup, Mission)
|
||||
-- Debug info.
|
||||
self:T(self.lid..string.format("Group %s on %s mission %s", ArmyGroup:GetName(), Mission:GetType(), Mission:GetName()))
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -30,8 +30,8 @@
|
||||
-- @module Ops.CSAR
|
||||
-- @image OPS_CSAR.jpg
|
||||
|
||||
-- Date: May 2023
|
||||
-- Last: Update Dec 2024
|
||||
---
|
||||
-- Last Update April 2024
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
--- **CSAR** class, extends Core.Base#BASE, Core.Fsm#FSM
|
||||
@@ -290,10 +290,12 @@ CSAR.AircraftType["Bell-47"] = 2
|
||||
CSAR.AircraftType["UH-60L"] = 10
|
||||
CSAR.AircraftType["AH-64D_BLK_II"] = 2
|
||||
CSAR.AircraftType["Bronco-OV-10A"] = 2
|
||||
CSAR.AircraftType["MH-60R"] = 10
|
||||
CSAR.AircraftType["OH-6A"] = 2
|
||||
|
||||
--- CSAR class version.
|
||||
-- @field #string version
|
||||
CSAR.version="1.0.19"
|
||||
CSAR.version="1.0.22"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- ToDo list
|
||||
@@ -462,7 +464,7 @@ function CSAR:New(Coalition, Template, Alias)
|
||||
self.SRSModulation = radio.modulation.AM -- modulation
|
||||
self.SRSport = 5002 -- port
|
||||
self.SRSCulture = "en-GB"
|
||||
self.SRSVoice = nil
|
||||
self.SRSVoice = MSRS.Voices.Google.Standard.en_GB_Standard_B
|
||||
self.SRSGPathToCredentials = nil
|
||||
self.SRSVolume = 1.0 -- volume 0.0 to 1.0
|
||||
self.SRSGender = "male" -- male or female
|
||||
@@ -1189,7 +1191,7 @@ function CSAR:_EventHandler(EventData)
|
||||
|
||||
if _place:GetCoalition() == self.coalition or _place:GetCoalition() == coalition.side.NEUTRAL then
|
||||
self:__Landed(2,_event.IniUnitName, _place)
|
||||
self:_ScheduledSARFlight(_event.IniUnitName,_event.IniGroupName,true)
|
||||
self:_ScheduledSARFlight(_event.IniUnitName,_event.IniGroupName,true,true)
|
||||
else
|
||||
self:T(string.format("Airfield %d, Unit %d", _place:GetCoalition(), _unit:GetCoalition()))
|
||||
end
|
||||
@@ -1528,7 +1530,7 @@ function CSAR:_CheckCloseWoundedGroup(_distance, _heliUnit, _heliName, _woundedG
|
||||
local _reset = true
|
||||
|
||||
if (_distance < 500) then
|
||||
|
||||
self:T(self.lid .. "[Pickup Debug] Helo closer than 500m: ".._lookupKeyHeli)
|
||||
if self.heliCloseMessage[_lookupKeyHeli] == nil then
|
||||
if self.autosmoke == true then
|
||||
self:_DisplayMessageToSAR(_heliUnit, string.format("%s: %s. You\'re close now! Land or hover at the smoke.", self:_GetCustomCallSign(_heliName), _pilotName), self.messageTime,false,true)
|
||||
@@ -1537,14 +1539,16 @@ function CSAR:_CheckCloseWoundedGroup(_distance, _heliUnit, _heliName, _woundedG
|
||||
end
|
||||
self.heliCloseMessage[_lookupKeyHeli] = true
|
||||
end
|
||||
|
||||
self:T(self.lid .. "[Pickup Debug] Checking landed vs Hover for ".._lookupKeyHeli)
|
||||
-- have we landed close enough?
|
||||
if not _heliUnit:InAir() then
|
||||
|
||||
self:T(self.lid .. "[Pickup Debug] Helo landed: ".._lookupKeyHeli)
|
||||
if self.pilotRuntoExtractPoint == true then
|
||||
if (_distance < self.extractDistance) then
|
||||
local _time = self.landedStatus[_lookupKeyHeli]
|
||||
self:T(self.lid .. "[Pickup Debug] Check pilot running or arrived ".._lookupKeyHeli)
|
||||
if _time == nil then
|
||||
self:T(self.lid .. "[Pickup Debug] Pilot running not arrived yet ".._lookupKeyHeli)
|
||||
self.landedStatus[_lookupKeyHeli] = math.floor( (_distance - self.loadDistance) / 3.6 )
|
||||
_time = self.landedStatus[_lookupKeyHeli]
|
||||
_woundedGroup:OptionAlarmStateGreen()
|
||||
@@ -1555,11 +1559,15 @@ function CSAR:_CheckCloseWoundedGroup(_distance, _heliUnit, _heliName, _woundedG
|
||||
self.landedStatus[_lookupKeyHeli] = _time
|
||||
end
|
||||
--if _time <= 0 or _distance < self.loadDistance then
|
||||
self:T(self.lid .. "[Pickup Debug] Pilot close enough? ".._lookupKeyHeli)
|
||||
if _distance < self.loadDistance + 5 or _distance <= 13 then
|
||||
self:T(self.lid .. "[Pickup Debug] Pilot close enough - YES ".._lookupKeyHeli)
|
||||
if self.pilotmustopendoors and (self:_IsLoadingDoorOpen(_heliName) == false) then
|
||||
self:_DisplayMessageToSAR(_heliUnit, "Open the door to let me in!", self.messageTime, true, true)
|
||||
self:T(self.lid .. "[Pickup Debug] Door closed, try again next loop ".._lookupKeyHeli)
|
||||
return false
|
||||
else
|
||||
self:T(self.lid .. "[Pickup Debug] Pick up Pilot ".._lookupKeyHeli)
|
||||
self.landedStatus[_lookupKeyHeli] = nil
|
||||
self:_PickupUnit(_heliUnit, _pilotName, _woundedGroup, _woundedGroupName)
|
||||
return true
|
||||
@@ -1567,28 +1575,32 @@ function CSAR:_CheckCloseWoundedGroup(_distance, _heliUnit, _heliName, _woundedG
|
||||
end
|
||||
end
|
||||
else
|
||||
self:T(self.lid .. "[Pickup Debug] Helo landed, pilot NOT set to run to helo ".._lookupKeyHeli)
|
||||
if (_distance < self.loadDistance) then
|
||||
self:T(self.lid .. "[Pickup Debug] Helo close enough, door check ".._lookupKeyHeli)
|
||||
if self.pilotmustopendoors and (self:_IsLoadingDoorOpen(_heliName) == false) then
|
||||
self:T(self.lid .. "[Pickup Debug] Door closed, try again next loop ".._lookupKeyHeli)
|
||||
self:_DisplayMessageToSAR(_heliUnit, "Open the door to let me in!", self.messageTime, true, true)
|
||||
return false
|
||||
else
|
||||
self:T(self.lid .. "[Pickup Debug] Pick up Pilot ".._lookupKeyHeli)
|
||||
self:_PickupUnit(_heliUnit, _pilotName, _woundedGroup, _woundedGroupName)
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
|
||||
self:T(self.lid .. "[Pickup Debug] Helo hovering".._lookupKeyHeli)
|
||||
local _unitsInHelicopter = self:_PilotsOnboard(_heliName)
|
||||
local _maxUnits = self.AircraftType[_heliUnit:GetTypeName()]
|
||||
if _maxUnits == nil then
|
||||
_maxUnits = self.max_units
|
||||
end
|
||||
|
||||
self:T(self.lid .. "[Pickup Debug] Check capacity and close enough for winching ".._lookupKeyHeli)
|
||||
if _heliUnit:InAir() and _unitsInHelicopter + 1 <= _maxUnits then
|
||||
-- DONE - make variable
|
||||
if _distance < self.rescuehoverdistance then
|
||||
|
||||
self:T(self.lid .. "[Pickup Debug] Helo hovering close enough ".._lookupKeyHeli)
|
||||
--check height!
|
||||
local leaderheight = _woundedLeader:GetHeight()
|
||||
if leaderheight < 0 then leaderheight = 0 end
|
||||
@@ -1596,7 +1608,7 @@ function CSAR:_CheckCloseWoundedGroup(_distance, _heliUnit, _heliName, _woundedG
|
||||
|
||||
-- DONE - make variable
|
||||
if _height <= self.rescuehoverheight then
|
||||
|
||||
self:T(self.lid .. "[Pickup Debug] Helo hovering low enough ".._lookupKeyHeli)
|
||||
local _time = self.hoverStatus[_lookupKeyHeli]
|
||||
|
||||
if _time == nil then
|
||||
@@ -1606,22 +1618,28 @@ function CSAR:_CheckCloseWoundedGroup(_distance, _heliUnit, _heliName, _woundedG
|
||||
_time = self.hoverStatus[_lookupKeyHeli] - 10
|
||||
self.hoverStatus[_lookupKeyHeli] = _time
|
||||
end
|
||||
|
||||
self:T(self.lid .. "[Pickup Debug] Check hover timer ".._lookupKeyHeli)
|
||||
if _time > 0 then
|
||||
self:T(self.lid .. "[Pickup Debug] Helo hovering not long enough ".._lookupKeyHeli)
|
||||
self:_DisplayMessageToSAR(_heliUnit, "Hovering above " .. _pilotName .. ". \n\nHold hover for " .. _time .. " seconds to winch them up. \n\nIf the countdown stops you\'re too far away!", self.messageTime, true)
|
||||
else
|
||||
self:T(self.lid .. "[Pickup Debug] Helo hovering long enough - door check ".._lookupKeyHeli)
|
||||
if self.pilotmustopendoors and (self:_IsLoadingDoorOpen(_heliName) == false) then
|
||||
self:_DisplayMessageToSAR(_heliUnit, "Open the door to let me in!", self.messageTime, true, true)
|
||||
self:T(self.lid .. "[Pickup Debug] Door closed, try again next loop ".._lookupKeyHeli)
|
||||
return false
|
||||
else
|
||||
self.hoverStatus[_lookupKeyHeli] = nil
|
||||
self:_PickupUnit(_heliUnit, _pilotName, _woundedGroup, _woundedGroupName)
|
||||
self:T(self.lid .. "[Pickup Debug] Pilot picked up ".._lookupKeyHeli)
|
||||
return true
|
||||
end
|
||||
end
|
||||
_reset = false
|
||||
else
|
||||
self:T(self.lid .. "[Pickup Debug] Helo hovering too high ".._lookupKeyHeli)
|
||||
self:_DisplayMessageToSAR(_heliUnit, "Too high to winch " .. _pilotName .. " \nReduce height and hover for 10 seconds!", self.messageTime, true,true)
|
||||
self:T(self.lid .. "[Pickup Debug] Hovering too high, try again next loop ".._lookupKeyHeli)
|
||||
return false
|
||||
end
|
||||
end
|
||||
@@ -1646,7 +1664,8 @@ end
|
||||
-- @param #string heliname Heli name
|
||||
-- @param #string groupname Group name
|
||||
-- @param #boolean isairport If true, EVENT.Landing took place at an airport or FARP
|
||||
function CSAR:_ScheduledSARFlight(heliname,groupname, isairport)
|
||||
-- @param #boolean noreschedule If true, do not try to reschedule this is distances are not ok (coming from landing event)
|
||||
function CSAR:_ScheduledSARFlight(heliname,groupname, isairport, noreschedule)
|
||||
self:T(self.lid .. " _ScheduledSARFlight")
|
||||
self:T({heliname,groupname})
|
||||
local _heliUnit = self:_GetSARHeli(heliname)
|
||||
@@ -1666,20 +1685,29 @@ function CSAR:_ScheduledSARFlight(heliname,groupname, isairport)
|
||||
local _dist = self:_GetClosestMASH(_heliUnit)
|
||||
|
||||
if _dist == -1 then
|
||||
return
|
||||
self:T(self.lid.."[Drop off debug] Check distance to MASH for "..heliname.." Distance can not be determined!")
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
self:T(self.lid.."[Drop off debug] Check distance to MASH for "..heliname.." Distance km: "..math.floor(_dist/1000))
|
||||
|
||||
if ( _dist < self.FARPRescueDistance or isairport ) and _heliUnit:InAir() == false then
|
||||
self:T(self.lid.."[Drop off debug] Distance ok, door check")
|
||||
if self.pilotmustopendoors and self:_IsLoadingDoorOpen(heliname) == false then
|
||||
self:_DisplayMessageToSAR(_heliUnit, "Open the door to let me out!", self.messageTime, true, true)
|
||||
self:T(self.lid.."[Drop off debug] Door closed, try again next loop")
|
||||
else
|
||||
self:T(self.lid.."[Drop off debug] Rescued!")
|
||||
self:_RescuePilots(_heliUnit)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
--queue up
|
||||
self:__Returning(-5,heliname,_woundedGroupName, isairport)
|
||||
if not noreschedule then
|
||||
self:__Returning(5,heliname,_woundedGroupName, isairport)
|
||||
self:ScheduleOnce(5,self._ScheduledSARFlight,self,heliname,groupname, isairport, noreschedule)
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -1751,7 +1779,7 @@ function CSAR:_DisplayMessageToSAR(_unit, _text, _time, _clear, _speak, _overrid
|
||||
_text = string.gsub(_text,"nm"," nautical miles")
|
||||
--self.msrs:SetVoice(self.SRSVoice)
|
||||
--self.SRSQueue:NewTransmission(_text,nil,self.msrs,nil,1)
|
||||
self:I("Voice = "..self.SRSVoice)
|
||||
--self:I("Voice = "..self.SRSVoice)
|
||||
self.SRSQueue:NewTransmission(_text,duration,self.msrs,tstart,2,subgroups,subtitle,subduration,self.SRSchannel,self.SRSModulation,gender,culture,self.SRSVoice,volume,label,coord)
|
||||
end
|
||||
return self
|
||||
@@ -1980,7 +2008,7 @@ end
|
||||
--- (Internal) Determine distance to closest MASH.
|
||||
-- @param #CSAR self
|
||||
-- @param Wrapper.Unit#UNIT _heli Helicopter #UNIT
|
||||
-- @retunr
|
||||
-- @return #CSAR self
|
||||
function CSAR:_GetClosestMASH(_heli)
|
||||
self:T(self.lid .. " _GetClosestMASH")
|
||||
local _mashset = self.mash -- Core.Set#SET_GROUP
|
||||
@@ -2218,7 +2246,7 @@ function CSAR:_RefreshRadioBeacons()
|
||||
if self:_CountActiveDownedPilots() > 0 then
|
||||
local PilotTable = self.downedPilots
|
||||
for _,_pilot in pairs (PilotTable) do
|
||||
self:T({_pilot})
|
||||
self:T({_pilot.name})
|
||||
local pilot = _pilot -- #CSAR.DownedPilot
|
||||
local group = pilot.group
|
||||
local frequency = pilot.frequency or 0 -- thanks to @Thrud
|
||||
@@ -2500,7 +2528,7 @@ end
|
||||
-- @param #boolean IsAirport True if heli has landed on an AFB (from event land).
|
||||
function CSAR:onbeforeReturning(From, Event, To, Heliname, Woundedgroupname, IsAirPort)
|
||||
self:T({From, Event, To, Heliname, Woundedgroupname})
|
||||
self:_ScheduledSARFlight(Heliname,Woundedgroupname, IsAirPort)
|
||||
--self:_ScheduledSARFlight(Heliname,Woundedgroupname, IsAirPort)
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
-- @module Ops.CTLD
|
||||
-- @image OPS_CTLD.jpg
|
||||
|
||||
-- Last Update December 2023
|
||||
-- Last Update April 2024
|
||||
|
||||
do
|
||||
|
||||
@@ -44,6 +44,8 @@ do
|
||||
-- @field #number PerCrateMass Mass in kg.
|
||||
-- @field #number Stock Number of builds available, -1 for unlimited.
|
||||
-- @field #string Subcategory Sub-category name.
|
||||
-- @field #boolean DontShowInMenu Show this item in menu or not.
|
||||
-- @field Core.Zone#ZONE Location Location (if set) where to get this cargo item.
|
||||
-- @extends Core.Base#BASE
|
||||
|
||||
---
|
||||
@@ -62,6 +64,8 @@ CTLD_CARGO = {
|
||||
PerCrateMass = 0,
|
||||
Stock = nil,
|
||||
Mark = nil,
|
||||
DontShowInMenu = false,
|
||||
Location = nil,
|
||||
}
|
||||
|
||||
--- Define cargo types.
|
||||
@@ -97,8 +101,10 @@ CTLD_CARGO = {
|
||||
-- @param #number PerCrateMass Mass in kg
|
||||
-- @param #number Stock Number of builds available, nil for unlimited
|
||||
-- @param #string Subcategory Name of subcategory, handy if using > 10 types to load.
|
||||
-- @param #boolean DontShowInMenu Show this item in menu or not (default: false == show it).
|
||||
-- @param Core.Zone#ZONE Location (optional) Where the cargo is available (one location only).
|
||||
-- @return #CTLD_CARGO self
|
||||
function CTLD_CARGO:New(ID, Name, Templates, Sorte, HasBeenMoved, LoadDirectly, CratesNeeded, Positionable, Dropped, PerCrateMass, Stock, Subcategory)
|
||||
function CTLD_CARGO:New(ID, Name, Templates, Sorte, HasBeenMoved, LoadDirectly, CratesNeeded, Positionable, Dropped, PerCrateMass, Stock, Subcategory, DontShowInMenu, Location)
|
||||
-- Inherit everything from BASE class.
|
||||
local self=BASE:Inherit(self, BASE:New()) -- #CTLD_CARGO
|
||||
self:T({ID, Name, Templates, Sorte, HasBeenMoved, LoadDirectly, CratesNeeded, Positionable, Dropped})
|
||||
@@ -115,8 +121,20 @@ CTLD_CARGO = {
|
||||
self.Stock = Stock or nil --#number
|
||||
self.Mark = nil
|
||||
self.Subcategory = Subcategory or "Other"
|
||||
self.DontShowInMenu = DontShowInMenu or false
|
||||
if type(Location) == "string" then
|
||||
Location = ZONE:New(Location)
|
||||
end
|
||||
self.Location = Location
|
||||
return self
|
||||
end
|
||||
|
||||
--- Query Location.
|
||||
-- @param #CTLD_CARGO self
|
||||
-- @return Core.Zone#ZONE location or `nil` if not set
|
||||
function CTLD_CARGO:GetLocation()
|
||||
return self.Location
|
||||
end
|
||||
|
||||
--- Query ID.
|
||||
-- @param #CTLD_CARGO self
|
||||
@@ -656,6 +674,8 @@ do
|
||||
-- my_ctld:AddCratesCargo("Humvee",{"Humvee"},CTLD_CARGO.Enum.VEHICLE,2,2775)
|
||||
-- -- if you want to limit your stock, add a number (here: 10) as parameter after weight. No parameter / nil means unlimited stock.
|
||||
-- my_ctld:AddCratesCargo("Humvee",{"Humvee"},CTLD_CARGO.Enum.VEHICLE,2,2775,10)
|
||||
-- -- additionally, you can limit **where** the stock is available (one location only!) - this one is available in a zone called "Vehicle Store".
|
||||
-- my_ctld:AddCratesCargo("Humvee",{"Humvee"},CTLD_CARGO.Enum.VEHICLE,2,2775,10,nil,nil,"Vehicle Store")
|
||||
--
|
||||
-- -- add infantry unit called "Forward Ops Base" using template "FOB", of type FOB, size 4, i.e. needs four crates to be build:
|
||||
-- my_ctld:AddCratesCargo("Forward Ops Base",{"FOB"},CTLD_CARGO.Enum.FOB,4)
|
||||
@@ -757,6 +777,9 @@ do
|
||||
-- ["Hercules"] = {type="Hercules", crates=true, troops=true, cratelimit = 7, trooplimit = 64, length = 25, cargoweightlimit = 19000},
|
||||
-- ["UH-60L"] = {type="UH-60L", crates=true, troops=true, cratelimit = 2, trooplimit = 20, length = 16, cargoweightlimit = 3500},
|
||||
-- ["AH-64D_BLK_II"] = {type="AH-64D_BLK_II", crates=false, troops=true, cratelimit = 0, trooplimit = 2, length = 17, cargoweightlimit = 200},
|
||||
-- ["MH-60R"] = {type="MH-60R", crates=true, troops=true, cratelimit = 2, trooplimit = 20, length = 16, cargoweightlimit = 3500}, -- 4t cargo, 20 (unsec) seats
|
||||
-- ["SH-60B"] = {type="SH-60B", crates=true, troops=true, cratelimit = 2, trooplimit = 20, length = 16, cargoweightlimit = 3500}, -- 4t cargo, 20 (unsec) seats
|
||||
-- ["Bronco-OV-10A"] = {type="Bronco-OV-10A", crates= false, troops=true, cratelimit = 0, trooplimit = 5, length = 13, cargoweightlimit = 1450},
|
||||
--
|
||||
-- ### 2.1.2 Activate and deactivate zones
|
||||
--
|
||||
@@ -1222,13 +1245,16 @@ CTLD.UnitTypeCapabilities = {
|
||||
["Hercules"] = {type="Hercules", crates=true, troops=true, cratelimit = 7, trooplimit = 64, length = 25, cargoweightlimit = 19000}, -- 19t cargo, 64 paratroopers.
|
||||
--Actually it's longer, but the center coord is off-center of the model.
|
||||
["UH-60L"] = {type="UH-60L", crates=true, troops=true, cratelimit = 2, trooplimit = 20, length = 16, cargoweightlimit = 3500}, -- 4t cargo, 20 (unsec) seats
|
||||
["MH-60R"] = {type="MH-60R", crates=true, troops=true, cratelimit = 2, trooplimit = 20, length = 16, cargoweightlimit = 3500}, -- 4t cargo, 20 (unsec) seats
|
||||
["SH-60B"] = {type="SH-60B", crates=true, troops=true, cratelimit = 2, trooplimit = 20, length = 16, cargoweightlimit = 3500}, -- 4t cargo, 20 (unsec) seats
|
||||
["AH-64D_BLK_II"] = {type="AH-64D_BLK_II", crates=false, troops=true, cratelimit = 0, trooplimit = 2, length = 17, cargoweightlimit = 200}, -- 2 ppl **outside** the helo
|
||||
["Bronco-OV-10A"] = {type="Bronco-OV-10A", crates= false, troops=true, cratelimit = 0, trooplimit = 5, length = 13, cargoweightlimit = 1450},
|
||||
["OH-6A"] = {type="OH-6A", crates=false, troops=true, cratelimit = 0, trooplimit = 4, length = 7, cargoweightlimit = 550},
|
||||
}
|
||||
|
||||
--- CTLD class version.
|
||||
-- @field #string version
|
||||
CTLD.version="1.0.45"
|
||||
CTLD.version="1.0.52"
|
||||
|
||||
--- Instantiate a new CTLD.
|
||||
-- @param #CTLD self
|
||||
@@ -1433,7 +1459,7 @@ function CTLD:New(Coalition, Prefixes, Alias)
|
||||
--- Pseudo Functions ---
|
||||
------------------------
|
||||
|
||||
--- Triggers the FSM event "Start". Starts the CTLD. Initializes parameters and starts event handlers.
|
||||
--- Triggers the FSM event "Start". Starts the CTLD. Initializes parameters and starts event handlers.
|
||||
-- @function [parent=#CTLD] Start
|
||||
-- @param #CTLD self
|
||||
|
||||
@@ -2215,7 +2241,9 @@ end
|
||||
local extractdistance = self.CrateDistance * self.ExtractFactor
|
||||
for k,v in pairs(self.DroppedTroops) do
|
||||
local distance = self:_GetDistance(v:GetCoordinate(),unitcoord)
|
||||
if distance <= extractdistance and distance ~= -1 then
|
||||
local TNow = timer.getTime()
|
||||
local vtime = v.ExtractTime or TNow-310
|
||||
if distance <= extractdistance and distance ~= -1 and (TNow - vtime > 300) then
|
||||
nearestGroup = v
|
||||
nearestGroupIndex = k
|
||||
nearestDistance = distance
|
||||
@@ -2235,7 +2263,7 @@ end
|
||||
local secondarygroups = {}
|
||||
|
||||
for i=1,#distancekeys do
|
||||
local nearestGroup = nearestList[distancekeys[i]]
|
||||
local nearestGroup = nearestList[distancekeys[i]] -- Wrapper.Group#GROUP
|
||||
-- find matching cargo type
|
||||
local groupType = string.match(nearestGroup:GetName(), "(.+)-(.+)$")
|
||||
local Cargotype = nil
|
||||
@@ -2266,25 +2294,38 @@ end
|
||||
end
|
||||
if troopsize + numberonboard > trooplimit then
|
||||
self:_SendMessage("Sorry, we\'re crammed already!", 10, false, Group)
|
||||
nearestGroup.ExtractTime = 0
|
||||
--return self
|
||||
else
|
||||
self.CargoCounter = self.CargoCounter + 1
|
||||
nearestGroup.ExtractTime = timer.getTime()
|
||||
local loadcargotype = CTLD_CARGO:New(self.CargoCounter, Cargotype.Name, Cargotype.Templates, Cargotype.CargoType, true, true, Cargotype.CratesNeeded,nil,nil,Cargotype.PerCrateMass)
|
||||
self:T({cargotype=loadcargotype})
|
||||
local running = math.floor(nearestDistance / 4)+10 -- time run to helo plus boarding
|
||||
loaded.Troopsloaded = loaded.Troopsloaded + troopsize
|
||||
table.insert(loaded.Cargo,loadcargotype)
|
||||
self.Loaded_Cargo[unitname] = loaded
|
||||
self:_SendMessage("Troops boarded!", 10, false, Group)
|
||||
self:ScheduleOnce(running,self._SendMessage,self,"Troops boarded!", 10, false, Group)
|
||||
self:_SendMessage("Troops boarding!", 10, false, Group)
|
||||
self:_UpdateUnitCargoMass(Unit)
|
||||
self:__TroopsExtracted(1,Group, Unit, nearestGroup)
|
||||
|
||||
self:__TroopsExtracted(running,Group, Unit, nearestGroup)
|
||||
local coord = Unit:GetCoordinate() or Group:GetCoordinate() -- Core.Point#COORDINATE
|
||||
local Point
|
||||
if coord then
|
||||
local heading = unit:GetHeading() or 0
|
||||
local Angle = math.floor((heading+160)%360)
|
||||
Point = coord:Translate(8,Angle):GetVec2()
|
||||
if Point then
|
||||
nearestGroup:RouteToVec2(Point,4)
|
||||
end
|
||||
end
|
||||
-- clean up:
|
||||
if type(Cargotype.Templates) == "table" and Cargotype.Templates[2] then
|
||||
for _,_key in pairs (Cargotype.Templates) do
|
||||
table.insert(secondarygroups,_key)
|
||||
end
|
||||
end
|
||||
nearestGroup:Destroy(false)
|
||||
nearestGroup:Destroy(false,running)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -2294,7 +2335,7 @@ end
|
||||
if _group and _group:IsAlive() then
|
||||
local groupname = string.match(_group:GetName(), "(.+)-(.+)$")
|
||||
if _name == groupname then
|
||||
_group:Destroy(false)
|
||||
_group:Destroy(false,15)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -2350,7 +2391,21 @@ function CTLD:_GetCrates(Group, Unit, Cargo, number, drop, pack)
|
||||
self:_SendMessage("You are not close enough to a logistics zone!", 10, false, Group)
|
||||
if not self.debug then return self end
|
||||
end
|
||||
|
||||
|
||||
-- Check cargo location if available
|
||||
local location = Cargo:GetLocation()
|
||||
|
||||
if location then
|
||||
local unitcoord = Unit:GetCoordinate() or Group:GetCoordinate()
|
||||
if unitcoord then
|
||||
if not location:IsCoordinateInZone(unitcoord) then
|
||||
-- no we're not at the right spot
|
||||
self:_SendMessage("The requested cargo is not available in this zone!", 10, false, Group)
|
||||
if not self.debug then return self end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- avoid crate spam
|
||||
local capabilities = self:_GetUnitCapabilities(Unit) -- #CTLD.UnitTypeCapabilities
|
||||
local canloadcratesno = capabilities.cratelimit
|
||||
@@ -3024,9 +3079,10 @@ end
|
||||
function CTLD:_GetUnitPositions(Coordinate,Radius,Heading,Template)
|
||||
local Positions = {}
|
||||
local template = _DATABASE:GetGroupTemplate(Template)
|
||||
UTILS.PrintTableToLog(template)
|
||||
--UTILS.PrintTableToLog(template)
|
||||
local numbertroops = #template.units
|
||||
local newcenter = Coordinate:Translate(Radius,((Heading+270)%360))
|
||||
local slightshift = math.abs(math.random(0,200)/100)
|
||||
local newcenter = Coordinate:Translate(Radius+slightshift,((Heading+270)%360))
|
||||
for i=1,360,math.floor(360/numbertroops) do
|
||||
local phead = ((Heading+270+i)%360)
|
||||
local post = newcenter:Translate(Radius,phead)
|
||||
@@ -3038,7 +3094,7 @@ function CTLD:_GetUnitPositions(Coordinate,Radius,Heading,Template)
|
||||
}
|
||||
table.insert(Positions,p1t)
|
||||
end
|
||||
UTILS.PrintTableToLog(Positions)
|
||||
--UTILS.PrintTableToLog(Positions)
|
||||
return Positions
|
||||
end
|
||||
|
||||
@@ -3700,14 +3756,20 @@ function CTLD:_RefreshF10Menus()
|
||||
for _,_entry in pairs(self.Cargo_Troops) do
|
||||
local entry = _entry -- #CTLD_CARGO
|
||||
local subcat = entry.Subcategory
|
||||
menucount = menucount + 1
|
||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,entry.Name,subcatmenus[subcat],self._LoadTroops, self, _group, _unit, entry)
|
||||
local noshow = entry.DontShowInMenu
|
||||
if not noshow then
|
||||
menucount = menucount + 1
|
||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,entry.Name,subcatmenus[subcat],self._LoadTroops, self, _group, _unit, entry)
|
||||
end
|
||||
end
|
||||
else
|
||||
for _,_entry in pairs(self.Cargo_Troops) do
|
||||
local entry = _entry -- #CTLD_CARGO
|
||||
menucount = menucount + 1
|
||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,entry.Name,troopsmenu,self._LoadTroops, self, _group, _unit, entry)
|
||||
local noshow = entry.DontShowInMenu
|
||||
if not noshow then
|
||||
menucount = menucount + 1
|
||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,entry.Name,troopsmenu,self._LoadTroops, self, _group, _unit, entry)
|
||||
end
|
||||
end
|
||||
end
|
||||
local unloadmenu1 = MENU_GROUP_COMMAND:New(_group,"Drop troops",toptroops, self._UnloadTroops, self, _group, _unit):Refresh()
|
||||
@@ -3728,33 +3790,61 @@ function CTLD:_RefreshF10Menus()
|
||||
for _,_entry in pairs(self.Cargo_Crates) do
|
||||
local entry = _entry -- #CTLD_CARGO
|
||||
local subcat = entry.Subcategory
|
||||
menucount = menucount + 1
|
||||
local menutext = string.format("Crate %s (%dkg)",entry.Name,entry.PerCrateMass or 0)
|
||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,menutext,subcatmenus[subcat],self._GetCrates, self, _group, _unit, entry)
|
||||
local noshow = entry.DontShowInMenu
|
||||
local zone = entry.Location
|
||||
if not noshow then
|
||||
menucount = menucount + 1
|
||||
local menutext = string.format("Crate %s (%dkg)",entry.Name,entry.PerCrateMass or 0)
|
||||
if zone then
|
||||
menutext = string.format("Crate %s (%dkg)[R]",entry.Name,entry.PerCrateMass or 0)
|
||||
end
|
||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,menutext,subcatmenus[subcat],self._GetCrates, self, _group, _unit, entry)
|
||||
end
|
||||
end
|
||||
for _,_entry in pairs(self.Cargo_Statics) do
|
||||
local entry = _entry -- #CTLD_CARGO
|
||||
local subcat = entry.Subcategory
|
||||
menucount = menucount + 1
|
||||
local menutext = string.format("Crate %s (%dkg)",entry.Name,entry.PerCrateMass or 0)
|
||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,menutext,subcatmenus[subcat],self._GetCrates, self, _group, _unit, entry)
|
||||
local noshow = entry.DontShowInMenu
|
||||
local zone = entry.Location
|
||||
if not noshow then
|
||||
menucount = menucount + 1
|
||||
local menutext = string.format("Crate %s (%dkg)",entry.Name,entry.PerCrateMass or 0)
|
||||
if zone then
|
||||
menutext = string.format("Crate %s (%dkg)[R]",entry.Name,entry.PerCrateMass or 0)
|
||||
end
|
||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,menutext,subcatmenus[subcat],self._GetCrates, self, _group, _unit, entry)
|
||||
end
|
||||
end
|
||||
else
|
||||
for _,_entry in pairs(self.Cargo_Crates) do
|
||||
local entry = _entry -- #CTLD_CARGO
|
||||
menucount = menucount + 1
|
||||
local menutext = string.format("Crate %s (%dkg)",entry.Name,entry.PerCrateMass or 0)
|
||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,menutext,cratesmenu,self._GetCrates, self, _group, _unit, entry)
|
||||
local noshow = entry.DontShowInMenu
|
||||
local zone = entry.Location
|
||||
if not noshow then
|
||||
menucount = menucount + 1
|
||||
local menutext = string.format("Crate %s (%dkg)",entry.Name,entry.PerCrateMass or 0)
|
||||
if zone then
|
||||
menutext = string.format("Crate %s (%dkg)[R]",entry.Name,entry.PerCrateMass or 0)
|
||||
end
|
||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,menutext,cratesmenu,self._GetCrates, self, _group, _unit, entry)
|
||||
end
|
||||
end
|
||||
for _,_entry in pairs(self.Cargo_Statics) do
|
||||
local entry = _entry -- #CTLD_CARGO
|
||||
menucount = menucount + 1
|
||||
local menutext = string.format("Crate %s (%dkg)",entry.Name,entry.PerCrateMass or 0)
|
||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,menutext,cratesmenu,self._GetCrates, self, _group, _unit, entry)
|
||||
local noshow = entry.DontShowInMenu
|
||||
local zone = entry.Location
|
||||
if not noshow then
|
||||
menucount = menucount + 1
|
||||
local menutext = string.format("Crate %s (%dkg)",entry.Name,entry.PerCrateMass or 0)
|
||||
if zone then
|
||||
menutext = string.format("Crate %s (%dkg)[R]",entry.Name,entry.PerCrateMass or 0)
|
||||
end
|
||||
menus[menucount] = MENU_GROUP_COMMAND:New(_group,menutext,cratesmenu,self._GetCrates, self, _group, _unit, entry)
|
||||
end
|
||||
end
|
||||
end
|
||||
listmenu = MENU_GROUP_COMMAND:New(_group,"List crates nearby",topcrates, self._ListCratesNearby, self, _group, _unit)
|
||||
removecrates = MENU_GROUP_COMMAND:New(_group,"Remove crates nearby",removecratesmenu, self._RemoveCratesNearby, self, _group, _unit)
|
||||
local removecrates = MENU_GROUP_COMMAND:New(_group,"Remove crates nearby",removecratesmenu, self._RemoveCratesNearby, self, _group, _unit)
|
||||
local unloadmenu = MENU_GROUP_COMMAND:New(_group,"Drop crates",topcrates, self._UnloadCrates, self, _group, _unit)
|
||||
if not self.nobuildmenu then
|
||||
local buildmenu = MENU_GROUP_COMMAND:New(_group,"Build crates",topcrates, self._BuildCrates, self, _group, _unit)
|
||||
@@ -3829,7 +3919,9 @@ end
|
||||
-- @param #number PerCrateMass Mass in kg of each crate
|
||||
-- @param #number Stock Number of buildable groups in stock. Nil for unlimited.
|
||||
-- @param #string SubCategory Name of sub-category (optional).
|
||||
function CTLD:AddCratesCargo(Name,Templates,Type,NoCrates,PerCrateMass,Stock,SubCategory)
|
||||
-- @param #boolean DontShowInMenu (optional) If set to "true" this won't show up in the menu.
|
||||
-- @param Core.Zone#ZONE Location (optional) If set, the cargo item is **only** available here. Can be a #ZONE object or the name of a zone as #string.
|
||||
function CTLD:AddCratesCargo(Name,Templates,Type,NoCrates,PerCrateMass,Stock,SubCategory,DontShowInMenu,Location)
|
||||
self:T(self.lid .. " AddCratesCargo")
|
||||
if not self:_CheckTemplates(Templates) then
|
||||
self:E(self.lid .. "Crates Cargo for " .. Name .. " has missing template(s)!" )
|
||||
@@ -3837,7 +3929,7 @@ function CTLD:AddCratesCargo(Name,Templates,Type,NoCrates,PerCrateMass,Stock,Sub
|
||||
end
|
||||
self.CargoCounter = self.CargoCounter + 1
|
||||
-- Crates are not directly loadable
|
||||
local cargo = CTLD_CARGO:New(self.CargoCounter,Name,Templates,Type,false,false,NoCrates,nil,nil,PerCrateMass,Stock,SubCategory)
|
||||
local cargo = CTLD_CARGO:New(self.CargoCounter,Name,Templates,Type,false,false,NoCrates,nil,nil,PerCrateMass,Stock,SubCategory,DontShowInMenu,Location)
|
||||
table.insert(self.Cargo_Crates,cargo)
|
||||
return self
|
||||
end
|
||||
@@ -3848,13 +3940,15 @@ end
|
||||
-- @param #number Mass Mass in kg of each static in kg, e.g. 100.
|
||||
-- @param #number Stock Number of groups in stock. Nil for unlimited.
|
||||
-- @param #string SubCategory Name of sub-category (optional).
|
||||
function CTLD:AddStaticsCargo(Name,Mass,Stock,SubCategory)
|
||||
-- @param #boolean DontShowInMenu (optional) If set to "true" this won't show up in the menu.
|
||||
-- @param Core.Zone#ZONE Location (optional) If set, the cargo item is **only** available here. Can be a #ZONE object or the name of a zone as #string.
|
||||
function CTLD:AddStaticsCargo(Name,Mass,Stock,SubCategory,DontShowInMenu,Location)
|
||||
self:T(self.lid .. " AddStaticsCargo")
|
||||
self.CargoCounter = self.CargoCounter + 1
|
||||
local type = CTLD_CARGO.Enum.STATIC
|
||||
local template = STATIC:FindByName(Name,true):GetTypeName()
|
||||
-- Crates are not directly loadable
|
||||
local cargo = CTLD_CARGO:New(self.CargoCounter,Name,template,type,false,false,1,nil,nil,Mass,Stock,SubCategory)
|
||||
local cargo = CTLD_CARGO:New(self.CargoCounter,Name,template,type,false,false,1,nil,nil,Mass,Stock,SubCategory,DontShowInMenu,Location)
|
||||
table.insert(self.Cargo_Statics,cargo)
|
||||
return self
|
||||
end
|
||||
@@ -3884,7 +3978,9 @@ end
|
||||
-- @param #number PerCrateMass Mass in kg of each crate
|
||||
-- @param #number Stock Number of groups in stock. Nil for unlimited.
|
||||
-- @param #string SubCategory Name of the sub-category (optional).
|
||||
function CTLD:AddCratesRepair(Name,Template,Type,NoCrates, PerCrateMass,Stock,SubCategory)
|
||||
-- @param #boolean DontShowInMenu (optional) If set to "true" this won't show up in the menu.
|
||||
-- @param Core.Zone#ZONE Location (optional) If set, the cargo item is **only** available here. Can be a #ZONE object or the name of a zone as #string.
|
||||
function CTLD:AddCratesRepair(Name,Template,Type,NoCrates, PerCrateMass,Stock,SubCategory,DontShowInMenu,Location)
|
||||
self:T(self.lid .. " AddCratesRepair")
|
||||
if not self:_CheckTemplates(Template) then
|
||||
self:E(self.lid .. "Repair Cargo for " .. Name .. " has a missing template!" )
|
||||
@@ -3892,7 +3988,7 @@ function CTLD:AddCratesRepair(Name,Template,Type,NoCrates, PerCrateMass,Stock,Su
|
||||
end
|
||||
self.CargoCounter = self.CargoCounter + 1
|
||||
-- Crates are not directly loadable
|
||||
local cargo = CTLD_CARGO:New(self.CargoCounter,Name,Template,Type,false,false,NoCrates,nil,nil,PerCrateMass,Stock,SubCategory)
|
||||
local cargo = CTLD_CARGO:New(self.CargoCounter,Name,Template,Type,false,false,NoCrates,nil,nil,PerCrateMass,Stock,SubCategory,DontShowInMenu,Location)
|
||||
table.insert(self.Cargo_Crates,cargo)
|
||||
return self
|
||||
end
|
||||
@@ -5357,19 +5453,19 @@ end
|
||||
return self
|
||||
end
|
||||
|
||||
--- (Internal) FSM Function onbeforeTroopsExtracted.
|
||||
-- @param #CTLD self
|
||||
-- @param #string From State.
|
||||
-- @param #string Event Trigger.
|
||||
-- @param #string To State.
|
||||
-- @param Wrapper.Group#GROUP Group Group Object.
|
||||
-- @param Wrapper.Unit#UNIT Unit Unit Object.
|
||||
-- @param Wrapper.Group#GROUP Troops Troops #GROUP Object.
|
||||
-- @return #CTLD self
|
||||
function CTLD:onbeforeTroopsExtracted(From, Event, To, Group, Unit, Troops)
|
||||
self:T({From, Event, To})
|
||||
return self
|
||||
end
|
||||
--- (Internal) FSM Function onbeforeTroopsExtracted.
|
||||
-- @param #CTLD self
|
||||
-- @param #string From State.
|
||||
-- @param #string Event Trigger.
|
||||
-- @param #string To State.
|
||||
-- @param Wrapper.Group#GROUP Group Group Object.
|
||||
-- @param Wrapper.Unit#UNIT Unit Unit Object.
|
||||
-- @param Wrapper.Group#GROUP Troops Troops #GROUP Object.
|
||||
-- @return #CTLD self
|
||||
function CTLD:onbeforeTroopsExtracted(From, Event, To, Group, Unit, Troops)
|
||||
self:T({From, Event, To})
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- (Internal) FSM Function onbeforeTroopsDeployed.
|
||||
|
||||
3335
Moose Development/Moose/Ops/Chief.lua
Normal file
3335
Moose Development/Moose/Ops/Chief.lua
Normal file
File diff suppressed because it is too large
Load Diff
1600
Moose Development/Moose/Ops/Cohort.lua
Normal file
1600
Moose Development/Moose/Ops/Cohort.lua
Normal file
File diff suppressed because it is too large
Load Diff
2168
Moose Development/Moose/Ops/Commander.lua
Normal file
2168
Moose Development/Moose/Ops/Commander.lua
Normal file
File diff suppressed because it is too large
Load Diff
1396
Moose Development/Moose/Ops/EasyGCICAP.lua
Normal file
1396
Moose Development/Moose/Ops/EasyGCICAP.lua
Normal file
File diff suppressed because it is too large
Load Diff
425
Moose Development/Moose/Ops/Fleet.lua
Normal file
425
Moose Development/Moose/Ops/Fleet.lua
Normal file
@@ -0,0 +1,425 @@
|
||||
--- **Ops** - Fleet Warehouse.
|
||||
--
|
||||
-- **Main Features:**
|
||||
--
|
||||
-- * Manage flotillas
|
||||
-- * Carry out ARTY and PATROLZONE missions (AUFTRAG)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ## Example Missions:
|
||||
--
|
||||
-- Demo missions can be found on [github](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/Ops/Fleet).
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### Author: **funkyfranky**
|
||||
--
|
||||
-- ===
|
||||
-- @module Ops.Fleet
|
||||
-- @image OPS_Fleet.png
|
||||
|
||||
|
||||
--- FLEET class.
|
||||
-- @type FLEET
|
||||
-- @field #string ClassName Name of the class.
|
||||
-- @field #number verbose Verbosity of output.
|
||||
-- @field Core.Set#SET_ZONE retreatZones Retreat zone set.
|
||||
-- @field #boolean pathfinding Set pathfinding on for all spawned navy groups.
|
||||
-- @extends Ops.Legion#LEGION
|
||||
|
||||
--- *A fleet of British ships at war are the best negotiators.* -- Horatio Nelson
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- # The FLEET Concept
|
||||
--
|
||||
-- A FLEET consists of one or multiple FLOTILLAs. These flotillas "live" in a WAREHOUSE that has a phyiscal struction (STATIC or UNIT) and can be captured or destroyed.
|
||||
--
|
||||
-- # Basic Setup
|
||||
--
|
||||
-- A new `FLEET` object can be created with the @{#FLEET.New}(`WarehouseName`, `FleetName`) function, where `WarehouseName` is the name of the static or unit object hosting the fleet
|
||||
-- and `FleetName` is the name you want to give the fleet. This must be *unique*!
|
||||
--
|
||||
-- myFleet=FLEET:New("myWarehouseName", "1st Fleet")
|
||||
-- myFleet:SetPortZone(ZonePort1stFleet)
|
||||
-- myFleet:Start()
|
||||
--
|
||||
-- A fleet needs a *port zone*, which is set via the @{#FLEET.SetPortZone}(`PortZone`) function. This is the zone where the naval assets are spawned and return to.
|
||||
--
|
||||
-- Finally, the fleet needs to be started using the @{#FLEET.Start}() function. If the fleet is not started, it will not process any requests.
|
||||
--
|
||||
-- ## Adding Flotillas
|
||||
--
|
||||
-- Flotillas can be added via the @{#FLEET.AddFlotilla}(`Flotilla`) function. See @{Ops.Flotilla#FLOTILLA} for how to create a flotilla.
|
||||
--
|
||||
-- myFleet:AddFlotilla(FlotillaTiconderoga)
|
||||
-- myFleet:AddFlotilla(FlotillaPerry)
|
||||
--
|
||||
--
|
||||
--
|
||||
-- @field #FLEET
|
||||
FLEET = {
|
||||
ClassName = "FLEET",
|
||||
verbose = 0,
|
||||
pathfinding = false,
|
||||
}
|
||||
|
||||
--- Supply Zone.
|
||||
-- @type FLEET.SupplyZone
|
||||
-- @field Core.Zone#ZONE zone The zone.
|
||||
-- @field Ops.Auftrag#AUFTRAG mission Mission assigned to supply ammo or fuel.
|
||||
-- @field #boolean markerOn If `true`, marker is on.
|
||||
-- @field Wrapper.Marker#MARKER marker F10 marker.
|
||||
|
||||
--- FLEET class version.
|
||||
-- @field #string version
|
||||
FLEET.version="0.0.1"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- ToDo list
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- TODO: Add routes?
|
||||
-- DONE: Add weapon range.
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- Constructor
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--- Create a new FLEET class object.
|
||||
-- @param #FLEET self
|
||||
-- @param #string WarehouseName Name of the warehouse STATIC or UNIT object representing the warehouse.
|
||||
-- @param #string FleetName Name of the fleet.
|
||||
-- @return #FLEET self
|
||||
function FLEET:New(WarehouseName, FleetName)
|
||||
|
||||
-- Inherit everything from LEGION class.
|
||||
local self=BASE:Inherit(self, LEGION:New(WarehouseName, FleetName)) -- #FLEET
|
||||
|
||||
-- Nil check.
|
||||
if not self then
|
||||
BASE:E(string.format("ERROR: Could not find warehouse %s!", WarehouseName))
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Set some string id for output to DCS.log file.
|
||||
self.lid=string.format("FLEET %s | ", self.alias)
|
||||
|
||||
-- Defaults
|
||||
self:SetRetreatZones()
|
||||
|
||||
-- Turn ship into NAVYGROUP.
|
||||
if self:IsShip() then
|
||||
local wh=self.warehouse --Wrapper.Unit#UNIT
|
||||
local group=wh:GetGroup()
|
||||
self.warehouseOpsGroup=NAVYGROUP:New(group) --Ops.NavyGroup#NAVYGROUP
|
||||
self.warehouseOpsElement=self.warehouseOpsGroup:GetElementByName(wh:GetName())
|
||||
end
|
||||
|
||||
|
||||
-- Add FSM transitions.
|
||||
-- From State --> Event --> To State
|
||||
self:AddTransition("*", "NavyOnMission", "*") -- An NAVYGROUP was send on a Mission (AUFTRAG).
|
||||
|
||||
------------------------
|
||||
--- Pseudo Functions ---
|
||||
------------------------
|
||||
|
||||
--- Triggers the FSM event "Start". Starts the FLEET. Initializes parameters and starts event handlers.
|
||||
-- @function [parent=#FLEET] Start
|
||||
-- @param #FLEET self
|
||||
|
||||
--- Triggers the FSM event "Start" after a delay. Starts the FLEET. Initializes parameters and starts event handlers.
|
||||
-- @function [parent=#FLEET] __Start
|
||||
-- @param #FLEET self
|
||||
-- @param #number delay Delay in seconds.
|
||||
|
||||
|
||||
--- Triggers the FSM event "Stop". Stops the FLEET and all its event handlers.
|
||||
-- @param #FLEET self
|
||||
|
||||
--- Triggers the FSM event "Stop" after a delay. Stops the FLEET and all its event handlers.
|
||||
-- @function [parent=#FLEET] __Stop
|
||||
-- @param #FLEET self
|
||||
-- @param #number delay Delay in seconds.
|
||||
|
||||
|
||||
--- Triggers the FSM event "NavyOnMission".
|
||||
-- @function [parent=#FLEET] NavyOnMission
|
||||
-- @param #FLEET self
|
||||
-- @param Ops.NavyGroup#NAVYGROUP ArmyGroup The NAVYGROUP on mission.
|
||||
-- @param Ops.Auftrag#AUFTRAG Mission The mission.
|
||||
|
||||
--- Triggers the FSM event "NavyOnMission" after a delay.
|
||||
-- @function [parent=#FLEET] __NavyOnMission
|
||||
-- @param #FLEET self
|
||||
-- @param #number delay Delay in seconds.
|
||||
-- @param Ops.NavyGroup#NAVYGROUP ArmyGroup The NAVYGROUP on mission.
|
||||
-- @param Ops.Auftrag#AUFTRAG Mission The mission.
|
||||
|
||||
--- On after "NavyOnMission" event.
|
||||
-- @function [parent=#FLEET] OnAfterNavyOnMission
|
||||
-- @param #FLEET self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param Ops.NavyGroup#NAVYGROUP NavyGroup The NAVYGROUP on mission.
|
||||
-- @param Ops.Auftrag#AUFTRAG Mission The mission.
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- User Functions
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--- Add a flotilla to the fleet.
|
||||
-- @param #FLEET self
|
||||
-- @param Ops.Flotilla#FLOTILLA Flotilla The flotilla object.
|
||||
-- @return #FLEET self
|
||||
function FLEET:AddFlotilla(Flotilla)
|
||||
|
||||
-- Add flotilla to fleet.
|
||||
table.insert(self.cohorts, Flotilla)
|
||||
|
||||
-- Add assets to flotilla.
|
||||
self:AddAssetToFlotilla(Flotilla, Flotilla.Ngroups)
|
||||
|
||||
-- Set fleet of flotilla.
|
||||
Flotilla:SetFleet(self)
|
||||
|
||||
-- Start flotilla.
|
||||
if Flotilla:IsStopped() then
|
||||
Flotilla:Start()
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Add asset group(s) to flotilla.
|
||||
-- @param #FLEET self
|
||||
-- @param Ops.Flotilla#FLOTILLA Flotilla The flotilla object.
|
||||
-- @param #number Nassets Number of asset groups to add.
|
||||
-- @return #FLEET self
|
||||
function FLEET:AddAssetToFlotilla(Flotilla, Nassets)
|
||||
|
||||
if Flotilla then
|
||||
|
||||
-- Get the template group of the flotilla.
|
||||
local Group=GROUP:FindByName(Flotilla.templatename)
|
||||
|
||||
if Group then
|
||||
|
||||
-- Debug text.
|
||||
local text=string.format("Adding asset %s to flotilla %s", Group:GetName(), Flotilla.name)
|
||||
self:T(self.lid..text)
|
||||
|
||||
-- Add assets to airwing warehouse.
|
||||
self:AddAsset(Group, Nassets, nil, nil, nil, nil, Flotilla.skill, Flotilla.livery, Flotilla.name)
|
||||
|
||||
else
|
||||
self:E(self.lid.."ERROR: Group does not exist!")
|
||||
end
|
||||
|
||||
else
|
||||
self:E(self.lid.."ERROR: Flotilla does not exit!")
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set pathfinding for all spawned naval groups.
|
||||
-- @param #FLEET self
|
||||
-- @param #boolean Switch If `true`, pathfinding is used.
|
||||
-- @return #FLEET self
|
||||
function FLEET:SetPathfinding(Switch)
|
||||
self.pathfinding=Switch
|
||||
return self
|
||||
end
|
||||
|
||||
--- Define a set of retreat zones.
|
||||
-- @param #FLEET self
|
||||
-- @param Core.Set#SET_ZONE RetreatZoneSet Set of retreat zones.
|
||||
-- @return #FLEET self
|
||||
function FLEET:SetRetreatZones(RetreatZoneSet)
|
||||
self.retreatZones=RetreatZoneSet or SET_ZONE:New()
|
||||
return self
|
||||
end
|
||||
|
||||
--- Add a retreat zone.
|
||||
-- @param #FLEET self
|
||||
-- @param Core.Zone#ZONE RetreatZone Retreat zone.
|
||||
-- @return #FLEET self
|
||||
function FLEET:AddRetreatZone(RetreatZone)
|
||||
self.retreatZones:AddZone(RetreatZone)
|
||||
return self
|
||||
end
|
||||
|
||||
--- Get retreat zones.
|
||||
-- @param #FLEET self
|
||||
-- @return Core.Set#SET_ZONE Set of retreat zones.
|
||||
function FLEET:GetRetreatZones()
|
||||
return self.retreatZones
|
||||
end
|
||||
|
||||
--- Get flotilla by name.
|
||||
-- @param #FLEET self
|
||||
-- @param #string FlotillaName Name of the flotilla.
|
||||
-- @return Ops.Flotilla#FLOTILLA The Flotilla object.
|
||||
function FLEET:GetFlotilla(FlotillaName)
|
||||
local flotilla=self:_GetCohort(FlotillaName)
|
||||
return flotilla
|
||||
end
|
||||
|
||||
--- Get flotilla of an asset.
|
||||
-- @param #FLEET self
|
||||
-- @param Functional.Warehouse#WAREHOUSE.Assetitem Asset The flotilla asset.
|
||||
-- @return Ops.Flotilla#FLOTILLA The flotilla object.
|
||||
function FLEET:GetFlotillaOfAsset(Asset)
|
||||
local flotilla=self:GetFlotilla(Asset.squadname)
|
||||
return flotilla
|
||||
end
|
||||
|
||||
--- Remove asset from flotilla.
|
||||
-- @param #FLEET self
|
||||
-- @param Functional.Warehouse#WAREHOUSE.Assetitem Asset The flotilla asset.
|
||||
function FLEET:RemoveAssetFromFlotilla(Asset)
|
||||
local flotilla=self:GetFlotillaOfAsset(Asset)
|
||||
if flotilla then
|
||||
flotilla:DelAsset(Asset)
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- FSM Functions
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--- Start FLEET FSM.
|
||||
-- @param #FLEET self
|
||||
function FLEET:onafterStart(From, Event, To)
|
||||
|
||||
-- Start parent Warehouse.
|
||||
self:GetParent(self, FLEET).onafterStart(self, From, Event, To)
|
||||
|
||||
-- Info.
|
||||
self:I(self.lid..string.format("Starting FLEET v%s", FLEET.version))
|
||||
|
||||
end
|
||||
|
||||
--- Update status.
|
||||
-- @param #FLEET self
|
||||
function FLEET:onafterStatus(From, Event, To)
|
||||
|
||||
-- Status of parent Warehouse.
|
||||
self:GetParent(self).onafterStatus(self, From, Event, To)
|
||||
|
||||
-- FSM state.
|
||||
local fsmstate=self:GetState()
|
||||
|
||||
----------------
|
||||
-- Transport ---
|
||||
----------------
|
||||
|
||||
self:CheckTransportQueue()
|
||||
|
||||
--------------
|
||||
-- Mission ---
|
||||
--------------
|
||||
|
||||
-- Check if any missions should be cancelled.
|
||||
self:CheckMissionQueue()
|
||||
|
||||
-----------
|
||||
-- Info ---
|
||||
-----------
|
||||
|
||||
-- General info:
|
||||
if self.verbose>=1 then
|
||||
|
||||
-- Count missions not over yet.
|
||||
local Nmissions=self:CountMissionsInQueue()
|
||||
|
||||
-- Asset count.
|
||||
local Npq, Np, Nq=self:CountAssetsOnMission()
|
||||
|
||||
-- Asset string.
|
||||
local assets=string.format("%d [OnMission: Total=%d, Active=%d, Queued=%d]", self:CountAssets(), Npq, Np, Nq)
|
||||
|
||||
-- Output.
|
||||
local text=string.format("%s: Missions=%d, Flotillas=%d, Assets=%s", fsmstate, Nmissions, #self.cohorts, assets)
|
||||
self:I(self.lid..text)
|
||||
end
|
||||
|
||||
------------------
|
||||
-- Mission Info --
|
||||
------------------
|
||||
if self.verbose>=2 then
|
||||
local text=string.format("Missions Total=%d:", #self.missionqueue)
|
||||
for i,_mission in pairs(self.missionqueue) do
|
||||
local mission=_mission --Ops.Auftrag#AUFTRAG
|
||||
|
||||
local prio=string.format("%d/%s", mission.prio, tostring(mission.importance)) ; if mission.urgent then prio=prio.." (!)" end
|
||||
local assets=string.format("%d/%d", mission:CountOpsGroups(), mission.Nassets or 0)
|
||||
local target=string.format("%d/%d Damage=%.1f", mission:CountMissionTargets(), mission:GetTargetInitialNumber(), mission:GetTargetDamage())
|
||||
|
||||
text=text..string.format("\n[%d] %s %s: Status=%s, Prio=%s, Assets=%s, Targets=%s", i, mission.name, mission.type, mission.status, prio, assets, target)
|
||||
end
|
||||
self:I(self.lid..text)
|
||||
end
|
||||
|
||||
--------------------
|
||||
-- Transport Info --
|
||||
--------------------
|
||||
if self.verbose>=2 then
|
||||
local text=string.format("Transports Total=%d:", #self.transportqueue)
|
||||
for i,_transport in pairs(self.transportqueue) do
|
||||
local transport=_transport --Ops.OpsTransport#OPSTRANSPORT
|
||||
|
||||
local prio=string.format("%d/%s", transport.prio, tostring(transport.importance)) ; if transport.urgent then prio=prio.." (!)" end
|
||||
local carriers=string.format("Ncargo=%d/%d, Ncarriers=%d", transport.Ncargo, transport.Ndelivered, transport.Ncarrier)
|
||||
|
||||
text=text..string.format("\n[%d] UID=%d: Status=%s, Prio=%s, Cargo: %s", i, transport.uid, transport:GetState(), prio, carriers)
|
||||
end
|
||||
self:I(self.lid..text)
|
||||
end
|
||||
|
||||
-------------------
|
||||
-- Flotilla Info --
|
||||
-------------------
|
||||
if self.verbose>=3 then
|
||||
local text="Flotillas:"
|
||||
for i,_flotilla in pairs(self.cohorts) do
|
||||
local flotilla=_flotilla --Ops.Flotilla#FLOTILLA
|
||||
|
||||
local callsign=flotilla.callsignName and UTILS.GetCallsignName(flotilla.callsignName) or "N/A"
|
||||
local modex=flotilla.modex and flotilla.modex or -1
|
||||
local skill=flotilla.skill and tostring(flotilla.skill) or "N/A"
|
||||
|
||||
-- Flotilla text.
|
||||
text=text..string.format("\n* %s %s: %s*%d/%d, Callsign=%s, Modex=%d, Skill=%s", flotilla.name, flotilla:GetState(), flotilla.aircrafttype, flotilla:CountAssets(true), #flotilla.assets, callsign, modex, skill)
|
||||
end
|
||||
self:I(self.lid..text)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- FSM Functions
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--- On after "NavyOnMission".
|
||||
-- @param #FLEET self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
-- @param Ops.ArmyGroup#ARMYGROUP ArmyGroup Ops army group on mission.
|
||||
-- @param Ops.Auftrag#AUFTRAG Mission The requested mission.
|
||||
function FLEET:onafterNavyOnMission(From, Event, To, NavyGroup, Mission)
|
||||
-- Debug info.
|
||||
self:T(self.lid..string.format("Group %s on %s mission %s", NavyGroup:GetName(), Mission:GetType(), Mission:GetName()))
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
4713
Moose Development/Moose/Ops/FlightControl.lua
Normal file
4713
Moose Development/Moose/Ops/FlightControl.lua
Normal file
File diff suppressed because it is too large
Load Diff
5296
Moose Development/Moose/Ops/FlightGroup.lua
Normal file
5296
Moose Development/Moose/Ops/FlightGroup.lua
Normal file
File diff suppressed because it is too large
Load Diff
175
Moose Development/Moose/Ops/Flotilla.lua
Normal file
175
Moose Development/Moose/Ops/Flotilla.lua
Normal file
@@ -0,0 +1,175 @@
|
||||
--- **Ops** - Flotilla is a small naval group belonging to a fleet.
|
||||
--
|
||||
-- **Main Features:**
|
||||
--
|
||||
-- * Set parameters like livery, skill valid for all flotilla members.
|
||||
-- * Define mission types, this flotilla can perform (see Ops.Auftrag#AUFTRAG).
|
||||
-- * Pause/unpause flotilla operations.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### Author: **funkyfranky**
|
||||
--
|
||||
-- ===
|
||||
-- @module Ops.Flotilla
|
||||
-- @image OPS_Flotilla.png
|
||||
|
||||
|
||||
--- FLOTILLA class.
|
||||
-- @type FLOTILLA
|
||||
-- @field #string ClassName Name of the class.
|
||||
-- @field #number verbose Verbosity level.
|
||||
-- @field Ops.OpsGroup#OPSGROUP.WeaponData weaponData Weapon data table with key=BitType.
|
||||
-- @extends Ops.Cohort#COHORT
|
||||
|
||||
--- *No captain can do very wrong if he places his ship alongside that of an enemy.* -- Horation Nelson
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- # The FLOTILLA Concept
|
||||
--
|
||||
-- A FLOTILLA is an essential part of a FLEET.
|
||||
--
|
||||
--
|
||||
--
|
||||
-- @field #FLOTILLA
|
||||
FLOTILLA = {
|
||||
ClassName = "FLOTILLA",
|
||||
verbose = 0,
|
||||
weaponData = {},
|
||||
}
|
||||
|
||||
--- FLOTILLA class version.
|
||||
-- @field #string version
|
||||
FLOTILLA.version="0.1.0"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- TODO list
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- TODO: A lot.
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- Constructor
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--- Create a new FLOTILLA object and start the FSM.
|
||||
-- @param #FLOTILLA self
|
||||
-- @param #string TemplateGroupName Name of the template group.
|
||||
-- @param #number Ngroups Number of asset groups of this flotilla. Default 3.
|
||||
-- @param #string FlotillaName Name of the flotilla. Must be **unique**!
|
||||
-- @return #FLOTILLA self
|
||||
function FLOTILLA:New(TemplateGroupName, Ngroups, FlotillaName)
|
||||
|
||||
-- Inherit everything from COHORT class.
|
||||
local self=BASE:Inherit(self, COHORT:New(TemplateGroupName, Ngroups, FlotillaName)) -- #FLOTILLA
|
||||
|
||||
-- All flotillas get mission type Nothing.
|
||||
self:AddMissionCapability(AUFTRAG.Type.NOTHING, 50)
|
||||
|
||||
-- Is naval.
|
||||
self.isNaval=true
|
||||
|
||||
-- Get initial ammo.
|
||||
self.ammo=self:_CheckAmmo()
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- User functions
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- TODO: Flotilla specific user functions.
|
||||
|
||||
--- Set fleet of this flotilla.
|
||||
-- @param #FLOTILLA self
|
||||
-- @param Ops.Fleet#FLEET Fleet The fleet.
|
||||
-- @return #FLOTILLA self
|
||||
function FLOTILLA:SetFleet(Fleet)
|
||||
self.legion=Fleet
|
||||
return self
|
||||
end
|
||||
|
||||
--- Get fleet of this flotilla.
|
||||
-- @param #FLOTILLA self
|
||||
-- @return Ops.Fleet#FLEET The fleet.
|
||||
function FLOTILLA:GetFleet()
|
||||
return self.legion
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- Start & Status
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--- On after Start event. Starts the FLIGHTGROUP FSM and event handlers.
|
||||
-- @param #FLOTILLA self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
function FLOTILLA:onafterStart(From, Event, To)
|
||||
|
||||
-- Short info.
|
||||
local text=string.format("Starting %s v%s %s", self.ClassName, self.version, self.name)
|
||||
self:I(self.lid..text)
|
||||
|
||||
-- Start the status monitoring.
|
||||
self:__Status(-1)
|
||||
end
|
||||
|
||||
--- On after "Status" event.
|
||||
-- @param #FLOTILLA self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
function FLOTILLA:onafterStatus(From, Event, To)
|
||||
|
||||
if self.verbose>=1 then
|
||||
|
||||
-- FSM state.
|
||||
local fsmstate=self:GetState()
|
||||
|
||||
local callsign=self.callsignName and UTILS.GetCallsignName(self.callsignName) or "N/A"
|
||||
local skill=self.skill and tostring(self.skill) or "N/A"
|
||||
|
||||
local NassetsTot=#self.assets
|
||||
local NassetsInS=self:CountAssets(true)
|
||||
local NassetsQP=0 ; local NassetsP=0 ; local NassetsQ=0
|
||||
if self.legion then
|
||||
NassetsQP, NassetsP, NassetsQ=self.legion:CountAssetsOnMission(nil, self)
|
||||
end
|
||||
|
||||
-- Short info.
|
||||
local text=string.format("%s [Type=%s, Call=%s, Skill=%s]: Assets Total=%d, Stock=%d, Mission=%d [Active=%d, Queue=%d]",
|
||||
fsmstate, self.aircrafttype, callsign, skill, NassetsTot, NassetsInS, NassetsQP, NassetsP, NassetsQ)
|
||||
self:T(self.lid..text)
|
||||
|
||||
-- Weapon data info.
|
||||
if self.verbose>=3 and self.weaponData then
|
||||
local text="Weapon Data:"
|
||||
for bit,_weapondata in pairs(self.weaponData) do
|
||||
local weapondata=_weapondata --Ops.OpsGroup#OPSGROUP.WeaponData
|
||||
text=text..string.format("\n- Bit=%s: Rmin=%.1f km, Rmax=%.1f km", bit, weapondata.RangeMin/1000, weapondata.RangeMax/1000)
|
||||
end
|
||||
self:I(self.lid..text)
|
||||
end
|
||||
|
||||
-- Check if group has detected any units.
|
||||
self:_CheckAssetStatus()
|
||||
|
||||
end
|
||||
|
||||
if not self:IsStopped() then
|
||||
self:__Status(-60)
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- Misc Functions
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
2596
Moose Development/Moose/Ops/Intelligence.lua
Normal file
2596
Moose Development/Moose/Ops/Intelligence.lua
Normal file
File diff suppressed because it is too large
Load Diff
3379
Moose Development/Moose/Ops/Legion.lua
Normal file
3379
Moose Development/Moose/Ops/Legion.lua
Normal file
File diff suppressed because it is too large
Load Diff
2282
Moose Development/Moose/Ops/NavyGroup.lua
Normal file
2282
Moose Development/Moose/Ops/NavyGroup.lua
Normal file
File diff suppressed because it is too large
Load Diff
1377
Moose Development/Moose/Ops/Operation.lua
Normal file
1377
Moose Development/Moose/Ops/Operation.lua
Normal file
File diff suppressed because it is too large
Load Diff
13900
Moose Development/Moose/Ops/OpsGroup.lua
Normal file
13900
Moose Development/Moose/Ops/OpsGroup.lua
Normal file
File diff suppressed because it is too large
Load Diff
2546
Moose Development/Moose/Ops/OpsTransport.lua
Normal file
2546
Moose Development/Moose/Ops/OpsTransport.lua
Normal file
File diff suppressed because it is too large
Load Diff
1626
Moose Development/Moose/Ops/OpsZone.lua
Normal file
1626
Moose Development/Moose/Ops/OpsZone.lua
Normal file
File diff suppressed because it is too large
Load Diff
175
Moose Development/Moose/Ops/Platoon.lua
Normal file
175
Moose Development/Moose/Ops/Platoon.lua
Normal file
@@ -0,0 +1,175 @@
|
||||
--- **Ops** - Brigade Platoon.
|
||||
--
|
||||
-- **Main Features:**
|
||||
--
|
||||
-- * Set parameters like livery, skill valid for all platoon members.
|
||||
-- * Define modex and callsigns.
|
||||
-- * Define mission types, this platoon can perform (see Ops.Auftrag#AUFTRAG).
|
||||
-- * Pause/unpause platoon operations.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### Author: **funkyfranky**
|
||||
-- @module Ops.Platoon
|
||||
-- @image OPS_Platoon.png
|
||||
|
||||
|
||||
--- PLATOON class.
|
||||
-- @type PLATOON
|
||||
-- @field #string ClassName Name of the class.
|
||||
-- @field #number verbose Verbosity level.
|
||||
-- @field Ops.OpsGroup#OPSGROUP.WeaponData weaponData Weapon data table with key=BitType.
|
||||
-- @extends Ops.Cohort#COHORT
|
||||
|
||||
--- *Some cool cohort quote* -- Known Author
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- # The PLATOON Concept
|
||||
--
|
||||
-- A PLATOON is essential part of an BRIGADE.
|
||||
--
|
||||
--
|
||||
--
|
||||
-- @field #PLATOON
|
||||
PLATOON = {
|
||||
ClassName = "PLATOON",
|
||||
verbose = 0,
|
||||
weaponData = {},
|
||||
}
|
||||
|
||||
--- PLATOON class version.
|
||||
-- @field #string version
|
||||
PLATOON.version="0.1.0"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- TODO list
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- TODO: A lot.
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- Constructor
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--- Create a new PLATOON object and start the FSM.
|
||||
-- @param #PLATOON self
|
||||
-- @param #string TemplateGroupName Name of the template group.
|
||||
-- @param #number Ngroups Number of asset groups of this platoon. Default 3.
|
||||
-- @param #string PlatoonName Name of the platoon. Must be **unique**!
|
||||
-- @return #PLATOON self
|
||||
function PLATOON:New(TemplateGroupName, Ngroups, PlatoonName)
|
||||
|
||||
-- Inherit everything from COHORT class.
|
||||
local self=BASE:Inherit(self, COHORT:New(TemplateGroupName, Ngroups, PlatoonName)) -- #PLATOON
|
||||
|
||||
-- All platoons get mission type Nothing.
|
||||
self:AddMissionCapability(AUFTRAG.Type.NOTHING, 50)
|
||||
|
||||
-- Is ground.
|
||||
self.isGround=true
|
||||
|
||||
-- Get ammo.
|
||||
self.ammo=self:_CheckAmmo()
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- User functions
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- TODO: Platoon specific user functions.
|
||||
|
||||
--- Set brigade of this platoon.
|
||||
-- @param #PLATOON self
|
||||
-- @param Ops.Brigade#BRIGADE Brigade The brigade.
|
||||
-- @return #PLATOON self
|
||||
function PLATOON:SetBrigade(Brigade)
|
||||
self.legion=Brigade
|
||||
return self
|
||||
end
|
||||
|
||||
--- Get brigade of this platoon.
|
||||
-- @param #PLATOON self
|
||||
-- @return Ops.Brigade#BRIGADE The brigade.
|
||||
function PLATOON:GetBrigade()
|
||||
return self.legion
|
||||
end
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- Start & Status
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--[[
|
||||
--- On after Start event. Starts the FLIGHTGROUP FSM and event handlers.
|
||||
-- @param #PLATOON self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
function PLATOON:onafterStart(From, Event, To)
|
||||
|
||||
-- Short info.
|
||||
local text=string.format("Starting %s v%s %s", self.ClassName, self.version, self.name)
|
||||
self:I(self.lid..text)
|
||||
|
||||
-- Start the status monitoring.
|
||||
self:__Status(-1)
|
||||
end
|
||||
]]
|
||||
|
||||
--- On after "Status" event.
|
||||
-- @param #PLATOON self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
function PLATOON:onafterStatus(From, Event, To)
|
||||
|
||||
if self.verbose>=1 then
|
||||
|
||||
-- FSM state.
|
||||
local fsmstate=self:GetState()
|
||||
|
||||
local callsign=self.callsignName and UTILS.GetCallsignName(self.callsignName) or "N/A"
|
||||
local skill=self.skill and tostring(self.skill) or "N/A"
|
||||
|
||||
local NassetsTot=#self.assets
|
||||
local NassetsInS=self:CountAssets(true)
|
||||
local NassetsQP=0 ; local NassetsP=0 ; local NassetsQ=0
|
||||
if self.legion then
|
||||
NassetsQP, NassetsP, NassetsQ=self.legion:CountAssetsOnMission(nil, self)
|
||||
end
|
||||
|
||||
-- Short info.
|
||||
local text=string.format("%s [Type=%s, Call=%s, Skill=%s]: Assets Total=%d, Stock=%d, Mission=%d [Active=%d, Queue=%d]",
|
||||
fsmstate, self.aircrafttype, callsign, skill, NassetsTot, NassetsInS, NassetsQP, NassetsP, NassetsQ)
|
||||
self:T(self.lid..text)
|
||||
|
||||
-- Weapon data info.
|
||||
if self.verbose>=3 and self.weaponData then
|
||||
local text="Weapon Data:"
|
||||
for bit,_weapondata in pairs(self.weaponData) do
|
||||
local weapondata=_weapondata --Ops.OpsGroup#OPSGROUP.WeaponData
|
||||
text=text..string.format("\n- Bit=%s: Rmin=%.1f km, Rmax=%.1f km", bit, weapondata.RangeMin/1000, weapondata.RangeMax/1000)
|
||||
end
|
||||
self:I(self.lid..text)
|
||||
end
|
||||
|
||||
-- Check if group has detected any units.
|
||||
self:_CheckAssetStatus()
|
||||
|
||||
end
|
||||
|
||||
if not self:IsStopped() then
|
||||
self:__Status(-60)
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- Misc Functions
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- TODO: Misc functions.
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
2231
Moose Development/Moose/Ops/PlayerRecce.lua
Normal file
2231
Moose Development/Moose/Ops/PlayerRecce.lua
Normal file
File diff suppressed because it is too large
Load Diff
4344
Moose Development/Moose/Ops/PlayerTask.lua
Normal file
4344
Moose Development/Moose/Ops/PlayerTask.lua
Normal file
File diff suppressed because it is too large
Load Diff
324
Moose Development/Moose/Ops/Squadron.lua
Normal file
324
Moose Development/Moose/Ops/Squadron.lua
Normal file
@@ -0,0 +1,324 @@
|
||||
--- **Ops** - Airwing Squadron.
|
||||
--
|
||||
-- **Main Features:**
|
||||
--
|
||||
-- * Set parameters like livery, skill valid for all squadron members.
|
||||
-- * Define modex and callsigns.
|
||||
-- * Define mission types, this squadron can perform (see Ops.Auftrag#AUFTRAG).
|
||||
-- * Pause/unpause squadron operations.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### Author: **funkyfranky**
|
||||
-- @module Ops.Squadron
|
||||
-- @image OPS_Squadron.png
|
||||
|
||||
|
||||
--- SQUADRON class.
|
||||
-- @type SQUADRON
|
||||
-- @field #string ClassName Name of the class.
|
||||
-- @field #number verbose Verbosity level.
|
||||
-- @field #string lid Class id string for output to DCS log file.
|
||||
-- @field #string name Name of the squadron.
|
||||
-- @field #string templatename Name of the template group.
|
||||
-- @field #string aircrafttype Type of the airframe the squadron is using.
|
||||
-- @field Wrapper.Group#GROUP templategroup Template group.
|
||||
-- @field #number ngrouping User defined number of units in the asset group.
|
||||
-- @field #table assets Squadron assets.
|
||||
-- @field #table missiontypes Capabilities (mission types and performances) of the squadron.
|
||||
-- @field #number fuellow Low fuel threshold.
|
||||
-- @field #boolean fuellowRefuel If `true`, flight tries to refuel at the nearest tanker.
|
||||
-- @field #number maintenancetime Time in seconds needed for maintenance of a returned flight.
|
||||
-- @field #number repairtime Time in seconds for each
|
||||
-- @field #string livery Livery of the squadron.
|
||||
-- @field #number skill Skill of squadron members.
|
||||
-- @field #number modex Modex.
|
||||
-- @field #number modexcounter Counter to incease modex number for assets.
|
||||
-- @field #string callsignName Callsign name.
|
||||
-- @field #number callsigncounter Counter to increase callsign names for new assets.
|
||||
-- @field #number Ngroups Number of asset flight groups this squadron has.
|
||||
-- @field #number engageRange Mission range in meters.
|
||||
-- @field #string attribute Generalized attribute of the squadron template group.
|
||||
-- @field #number tankerSystem For tanker squads, the refuel system used (boom=0 or probpe=1). Default nil.
|
||||
-- @field #number refuelSystem For refuelable squads, the refuel system used (boom=0 or probe=1). Default nil.
|
||||
-- @field #table tacanChannel List of TACAN channels available to the squadron.
|
||||
-- @field #number radioFreq Radio frequency in MHz the squad uses.
|
||||
-- @field #number radioModu Radio modulation the squad uses.
|
||||
-- @field #string takeoffType Take of type.
|
||||
-- @field #table parkingIDs Parking IDs for this squadron.
|
||||
-- @field #boolean despawnAfterLanding Aircraft are despawned after landing.
|
||||
-- @field #boolean despawnAfterHolding Aircraft are despawned after holding.
|
||||
-- @extends Ops.Cohort#COHORT
|
||||
|
||||
--- *It is unbelievable what a squadron of twelve aircraft did to tip the balance* -- Adolf Galland
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- # The SQUADRON Concept
|
||||
--
|
||||
-- A SQUADRON is essential part of an @{Ops.Airwing#AIRWING} and consists of **one** type of aircraft.
|
||||
--
|
||||
--
|
||||
--
|
||||
-- @field #SQUADRON
|
||||
SQUADRON = {
|
||||
ClassName = "SQUADRON",
|
||||
verbose = 0,
|
||||
modex = nil,
|
||||
modexcounter = 0,
|
||||
callsignName = nil,
|
||||
callsigncounter= 11,
|
||||
tankerSystem = nil,
|
||||
refuelSystem = nil,
|
||||
}
|
||||
|
||||
--- SQUADRON class version.
|
||||
-- @field #string version
|
||||
SQUADRON.version="0.8.1"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- TODO list
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- DONE: Parking spots for squadrons?
|
||||
-- DONE: Engage radius.
|
||||
-- DONE: Modex.
|
||||
-- DONE: Call signs.
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- Constructor
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--- Create a new SQUADRON object and start the FSM.
|
||||
-- @param #SQUADRON self
|
||||
-- @param #string TemplateGroupName Name of the template group.
|
||||
-- @param #number Ngroups Number of asset groups of this squadron. Default 3.
|
||||
-- @param #string SquadronName Name of the squadron, e.g. "VFA-37". Must be **unique**!
|
||||
-- @return #SQUADRON self
|
||||
function SQUADRON:New(TemplateGroupName, Ngroups, SquadronName)
|
||||
|
||||
-- Inherit everything from FSM class.
|
||||
local self=BASE:Inherit(self, COHORT:New(TemplateGroupName, Ngroups, SquadronName)) -- #SQUADRON
|
||||
|
||||
-- Everyone can ORBIT.
|
||||
self:AddMissionCapability(AUFTRAG.Type.ORBIT)
|
||||
|
||||
-- Is air.
|
||||
self.isAir=true
|
||||
|
||||
-- Refueling system.
|
||||
self.refuelSystem=select(2, self.templategroup:GetUnit(1):IsRefuelable())
|
||||
self.tankerSystem=select(2, self.templategroup:GetUnit(1):IsTanker())
|
||||
|
||||
------------------------
|
||||
--- Pseudo Functions ---
|
||||
------------------------
|
||||
|
||||
-- See COHORT class
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- User functions
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--- Set number of units in groups.
|
||||
-- @param #SQUADRON self
|
||||
-- @param #number nunits Number of units. Must be >=1 and <=4. Default 2.
|
||||
-- @return #SQUADRON self
|
||||
function SQUADRON:SetGrouping(nunits)
|
||||
self.ngrouping=nunits or 2
|
||||
if self.ngrouping<1 then self.ngrouping=1 end
|
||||
if self.ngrouping>4 then self.ngrouping=4 end
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set valid parking spot IDs. Assets of this squad are only allowed to be spawned at these parking spots. **Note** that the IDs are different from the ones displayed in the mission editor!
|
||||
-- @param #SQUADRON self
|
||||
-- @param #table ParkingIDs Table of parking ID numbers or a single `#number`.
|
||||
-- @return #SQUADRON self
|
||||
function SQUADRON:SetParkingIDs(ParkingIDs)
|
||||
if type(ParkingIDs)~="table" then
|
||||
ParkingIDs={ParkingIDs}
|
||||
end
|
||||
self.parkingIDs=ParkingIDs
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Set takeoff type. All assets of this squadron will be spawned with cold (default) or hot engines.
|
||||
-- Spawning on runways is not supported.
|
||||
-- @param #SQUADRON self
|
||||
-- @param #string TakeoffType Take off type: "Cold" (default) or "Hot" with engines on or "Air" for spawning in air.
|
||||
-- @return #SQUADRON self
|
||||
function SQUADRON:SetTakeoffType(TakeoffType)
|
||||
TakeoffType=TakeoffType or "Cold"
|
||||
if TakeoffType:lower()=="hot" then
|
||||
self.takeoffType=COORDINATE.WaypointType.TakeOffParkingHot
|
||||
elseif TakeoffType:lower()=="cold" then
|
||||
self.takeoffType=COORDINATE.WaypointType.TakeOffParking
|
||||
elseif TakeoffType:lower()=="air" then
|
||||
self.takeoffType=COORDINATE.WaypointType.TurningPoint
|
||||
else
|
||||
self.takeoffType=COORDINATE.WaypointType.TakeOffParking
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set takeoff type cold (default). All assets of this squadron will be spawned with engines off (cold).
|
||||
-- @param #SQUADRON self
|
||||
-- @return #SQUADRON self
|
||||
function SQUADRON:SetTakeoffCold()
|
||||
self:SetTakeoffType("Cold")
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set takeoff type hot. All assets of this squadron will be spawned with engines on (hot).
|
||||
-- @param #SQUADRON self
|
||||
-- @return #SQUADRON self
|
||||
function SQUADRON:SetTakeoffHot()
|
||||
self:SetTakeoffType("Hot")
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set takeoff type air. All assets of this squadron will be spawned in air above the airbase.
|
||||
-- @param #SQUADRON self
|
||||
-- @return #SQUADRON self
|
||||
function SQUADRON:SetTakeoffAir()
|
||||
self:SetTakeoffType("Air")
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set despawn after landing. Aircraft will be despawned after the landing event.
|
||||
-- Can help to avoid DCS AI taxiing issues.
|
||||
-- @param #SQUADRON self
|
||||
-- @param #boolean Switch If `true` (default), activate despawn after landing.
|
||||
-- @return #SQUADRON self
|
||||
function SQUADRON:SetDespawnAfterLanding(Switch)
|
||||
if Switch then
|
||||
self.despawnAfterLanding=Switch
|
||||
else
|
||||
self.despawnAfterLanding=true
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set despawn after holding. Aircraft will be despawned when they arrive at their holding position at the airbase.
|
||||
-- Can help to avoid DCS AI taxiing issues.
|
||||
-- @param #SQUADRON self
|
||||
-- @param #boolean Switch If `true` (default), activate despawn after holding.
|
||||
-- @return #SQUADRON self
|
||||
function SQUADRON:SetDespawnAfterHolding(Switch)
|
||||
if Switch then
|
||||
self.despawnAfterHolding=Switch
|
||||
else
|
||||
self.despawnAfterHolding=true
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Set low fuel threshold.
|
||||
-- @param #SQUADRON self
|
||||
-- @param #number LowFuel Low fuel threshold in percent. Default 25.
|
||||
-- @return #SQUADRON self
|
||||
function SQUADRON:SetFuelLowThreshold(LowFuel)
|
||||
self.fuellow=LowFuel or 25
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set if low fuel threshold is reached, flight tries to refuel at the neares tanker.
|
||||
-- @param #SQUADRON self
|
||||
-- @param #boolean switch If true or nil, flight goes for refuelling. If false, turn this off.
|
||||
-- @return #SQUADRON self
|
||||
function SQUADRON:SetFuelLowRefuel(switch)
|
||||
if switch==false then
|
||||
self.fuellowRefuel=false
|
||||
else
|
||||
self.fuellowRefuel=true
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set airwing.
|
||||
-- @param #SQUADRON self
|
||||
-- @param Ops.Airwing#AIRWING Airwing The airwing.
|
||||
-- @return #SQUADRON self
|
||||
function SQUADRON:SetAirwing(Airwing)
|
||||
self.legion=Airwing
|
||||
return self
|
||||
end
|
||||
|
||||
--- Get airwing.
|
||||
-- @param #SQUADRON self
|
||||
-- @return Ops.Airwing#AIRWING The airwing.
|
||||
function SQUADRON:GetAirwing(Airwing)
|
||||
return self.legion
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- Start & Status
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--- On after Start event. Starts the FLIGHTGROUP FSM and event handlers.
|
||||
-- @param #SQUADRON self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
function SQUADRON:onafterStart(From, Event, To)
|
||||
|
||||
-- Short info.
|
||||
local text=string.format("Starting SQUADRON", self.name)
|
||||
self:T(self.lid..text)
|
||||
|
||||
-- Start the status monitoring.
|
||||
self:__Status(-1)
|
||||
end
|
||||
|
||||
--- On after "Status" event.
|
||||
-- @param #SQUADRON self
|
||||
-- @param #string From From state.
|
||||
-- @param #string Event Event.
|
||||
-- @param #string To To state.
|
||||
function SQUADRON:onafterStatus(From, Event, To)
|
||||
|
||||
if self.verbose>=1 then
|
||||
|
||||
-- FSM state.
|
||||
local fsmstate=self:GetState()
|
||||
|
||||
local callsign=self.callsignName and UTILS.GetCallsignName(self.callsignName) or "N/A"
|
||||
local modex=self.modex and self.modex or -1
|
||||
local skill=self.skill and tostring(self.skill) or "N/A"
|
||||
|
||||
local NassetsTot=#self.assets
|
||||
local NassetsInS=self:CountAssets(true)
|
||||
local NassetsQP=0 ; local NassetsP=0 ; local NassetsQ=0
|
||||
if self.legion then
|
||||
NassetsQP, NassetsP, NassetsQ=self.legion:CountAssetsOnMission(nil, self)
|
||||
end
|
||||
|
||||
-- Short info.
|
||||
local text=string.format("%s [Type=%s, Call=%s, Modex=%d, Skill=%s]: Assets Total=%d, Stock=%d, Mission=%d [Active=%d, Queue=%d]",
|
||||
fsmstate, self.aircrafttype, callsign, modex, skill, NassetsTot, NassetsInS, NassetsQP, NassetsP, NassetsQ)
|
||||
self:I(self.lid..text)
|
||||
|
||||
-- Check if group has detected any units.
|
||||
self:_CheckAssetStatus()
|
||||
|
||||
end
|
||||
|
||||
if not self:IsStopped() then
|
||||
self:__Status(-60)
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- Misc Functions
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
2002
Moose Development/Moose/Ops/Target.lua
Normal file
2002
Moose Development/Moose/Ops/Target.lua
Normal file
File diff suppressed because it is too large
Load Diff
260
Moose Development/Moose/Shapes/Circle.lua
Normal file
260
Moose Development/Moose/Shapes/Circle.lua
Normal file
@@ -0,0 +1,260 @@
|
||||
--
|
||||
--
|
||||
-- ### Author: **nielsvaes/coconutcockpit**
|
||||
--
|
||||
-- ===
|
||||
-- @module Shapes.CIRCLE
|
||||
-- @image MOOSE.JPG
|
||||
|
||||
--- CIRCLE class.
|
||||
-- @type CIRCLE
|
||||
-- @field #string ClassName Name of the class.
|
||||
-- @field #number Radius Radius of the circle
|
||||
|
||||
--- *It's NOT hip to be square* -- Someone, somewhere, probably
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- # CIRCLE
|
||||
-- CIRCLEs can be fetched from the drawings in the Mission Editor
|
||||
|
||||
---
|
||||
-- This class has some of the standard CIRCLE functions you'd expect. One function of interest is CIRCLE:PointInSector() that you can use if a point is
|
||||
-- within a certain sector (pizza slice) of a circle. This can be useful for many things, including rudimentary, "radar-like" searches from a unit.
|
||||
--
|
||||
-- CIRCLE class with properties and methods for handling circles.
|
||||
-- @field #CIRCLE
|
||||
CIRCLE = {
|
||||
ClassName = "CIRCLE",
|
||||
Radius = nil,
|
||||
}
|
||||
--- Finds a circle on the map by its name. The circle must have been added in the Mission Editor
|
||||
-- @param #string shape_name Name of the circle to find
|
||||
-- @return #CIRCLE The found circle, or nil if not found
|
||||
function CIRCLE:FindOnMap(shape_name)
|
||||
local self = BASE:Inherit(self, SHAPE_BASE:FindOnMap(shape_name))
|
||||
for _, layer in pairs(env.mission.drawings.layers) do
|
||||
for _, object in pairs(layer["objects"]) do
|
||||
if string.find(object["name"], shape_name, 1, true) then
|
||||
if object["polygonMode"] == "circle" then
|
||||
self.Radius = object["radius"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Finds a circle by its name in the database.
|
||||
-- @param #string shape_name Name of the circle to find
|
||||
-- @return #CIRCLE The found circle, or nil if not found
|
||||
function CIRCLE:Find(shape_name)
|
||||
return _DATABASE:FindShape(shape_name)
|
||||
end
|
||||
|
||||
--- Creates a new circle from a center point and a radius.
|
||||
-- @param #table vec2 The center point of the circle
|
||||
-- @param #number radius The radius of the circle
|
||||
-- @return #CIRCLE The new circle
|
||||
function CIRCLE:New(vec2, radius)
|
||||
local self = BASE:Inherit(self, SHAPE_BASE:New())
|
||||
self.CenterVec2 = vec2
|
||||
self.Radius = radius
|
||||
return self
|
||||
end
|
||||
|
||||
--- Gets the radius of the circle.
|
||||
-- @return #number The radius of the circle
|
||||
function CIRCLE:GetRadius()
|
||||
return self.Radius
|
||||
end
|
||||
|
||||
--- Checks if a point is contained within the circle.
|
||||
-- @param #table point The point to check
|
||||
-- @return #bool True if the point is contained, false otherwise
|
||||
function CIRCLE:ContainsPoint(point)
|
||||
if ((point.x - self.CenterVec2.x) ^ 2 + (point.y - self.CenterVec2.y) ^ 2) ^ 0.5 <= self.Radius then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
--- Checks if a point is contained within a sector of the circle. The start and end sector need to be clockwise
|
||||
-- @param #table point The point to check
|
||||
-- @param #table sector_start The start point of the sector
|
||||
-- @param #table sector_end The end point of the sector
|
||||
-- @param #table center The center point of the sector
|
||||
-- @param #number radius The radius of the sector
|
||||
-- @return #bool True if the point is contained, false otherwise
|
||||
function CIRCLE:PointInSector(point, sector_start, sector_end, center, radius)
|
||||
center = center or self.CenterVec2
|
||||
radius = radius or self.Radius
|
||||
|
||||
local function are_clockwise(v1, v2)
|
||||
return -v1.x * v2.y + v1.y * v2.x > 0
|
||||
end
|
||||
|
||||
local function is_in_radius(rp)
|
||||
return rp.x * rp.x + rp.y * rp.y <= radius ^ 2
|
||||
end
|
||||
|
||||
local rel_pt = {
|
||||
x = point.x - center.x,
|
||||
y = point.y - center.y
|
||||
}
|
||||
|
||||
local rel_sector_start = {
|
||||
x = sector_start.x - center.x,
|
||||
y = sector_start.y - center.y,
|
||||
}
|
||||
|
||||
local rel_sector_end = {
|
||||
x = sector_end.x - center.x,
|
||||
y = sector_end.y - center.y,
|
||||
}
|
||||
|
||||
return not are_clockwise(rel_sector_start, rel_pt) and
|
||||
are_clockwise(rel_sector_end, rel_pt) and
|
||||
is_in_radius(rel_pt, radius)
|
||||
end
|
||||
|
||||
--- Checks if a unit is contained within a sector of the circle. The start and end sector need to be clockwise
|
||||
-- @param #string unit_name The name of the unit to check
|
||||
-- @param #table sector_start The start point of the sector
|
||||
-- @param #table sector_end The end point of the sector
|
||||
-- @param #table center The center point of the sector
|
||||
-- @param #number radius The radius of the sector
|
||||
-- @return #bool True if the unit is contained, false otherwise
|
||||
function CIRCLE:UnitInSector(unit_name, sector_start, sector_end, center, radius)
|
||||
center = center or self.CenterVec2
|
||||
radius = radius or self.Radius
|
||||
|
||||
if self:PointInSector(UNIT:FindByName(unit_name):GetVec2(), sector_start, sector_end, center, radius) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
--- Checks if any unit of a group is contained within a sector of the circle. The start and end sector need to be clockwise
|
||||
-- @param #string group_name The name of the group to check
|
||||
-- @param #table sector_start The start point of the sector
|
||||
-- @param #table sector_end The end point of the sector
|
||||
-- @param #table center The center point of the sector
|
||||
-- @param #number radius The radius of the sector
|
||||
-- @return #bool True if any unit of the group is contained, false otherwise
|
||||
function CIRCLE:AnyOfGroupInSector(group_name, sector_start, sector_end, center, radius)
|
||||
center = center or self.CenterVec2
|
||||
radius = radius or self.Radius
|
||||
|
||||
for _, unit in pairs(GROUP:FindByName(group_name):GetUnits()) do
|
||||
if self:PointInSector(unit:GetVec2(), sector_start, sector_end, center, radius) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
--- Checks if all units of a group are contained within a sector of the circle. The start and end sector need to be clockwise
|
||||
-- @param #string group_name The name of the group to check
|
||||
-- @param #table sector_start The start point of the sector
|
||||
-- @param #table sector_end The end point of the sector
|
||||
-- @param #table center The center point of the sector
|
||||
-- @param #number radius The radius of the sector
|
||||
-- @return #bool True if all units of the group are contained, false otherwise
|
||||
function CIRCLE:AllOfGroupInSector(group_name, sector_start, sector_end, center, radius)
|
||||
center = center or self.CenterVec2
|
||||
radius = radius or self.Radius
|
||||
|
||||
for _, unit in pairs(GROUP:FindByName(group_name):GetUnits()) do
|
||||
if not self:PointInSector(unit:GetVec2(), sector_start, sector_end, center, radius) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
--- Checks if a unit is contained within a radius of the circle.
|
||||
-- @param #string unit_name The name of the unit to check
|
||||
-- @param #table center The center point of the radius
|
||||
-- @param #number radius The radius to check
|
||||
-- @return #bool True if the unit is contained, false otherwise
|
||||
function CIRCLE:UnitInRadius(unit_name, center, radius)
|
||||
center = center or self.CenterVec2
|
||||
radius = radius or self.Radius
|
||||
|
||||
if UTILS.IsInRadius(center, UNIT:FindByName(unit_name):GetVec2(), radius) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
--- Checks if any unit of a group is contained within a radius of the circle.
|
||||
-- @param #string group_name The name of the group to check
|
||||
-- @param #table center The center point of the radius
|
||||
-- @param #number radius The radius to check
|
||||
-- @return #bool True if any unit of the group is contained, false otherwise
|
||||
function CIRCLE:AnyOfGroupInRadius(group_name, center, radius)
|
||||
center = center or self.CenterVec2
|
||||
radius = radius or self.Radius
|
||||
|
||||
for _, unit in pairs(GROUP:FindByName(group_name):GetUnits()) do
|
||||
if UTILS.IsInRadius(center, unit:GetVec2(), radius) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
--- Checks if all units of a group are contained within a radius of the circle.
|
||||
-- @param #string group_name The name of the group to check
|
||||
-- @param #table center The center point of the radius
|
||||
-- @param #number radius The radius to check
|
||||
-- @return #bool True if all units of the group are contained, false otherwise
|
||||
function CIRCLE:AllOfGroupInRadius(group_name, center, radius)
|
||||
center = center or self.CenterVec2
|
||||
radius = radius or self.Radius
|
||||
|
||||
for _, unit in pairs(GROUP:FindByName(group_name):GetUnits()) do
|
||||
if not UTILS.IsInRadius(center, unit:GetVec2(), radius) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
--- Returns a random Vec2 within the circle.
|
||||
-- @return #table The random Vec2
|
||||
function CIRCLE:GetRandomVec2()
|
||||
local angle = math.random() * 2 * math.pi
|
||||
|
||||
local rx = math.random(0, self.Radius) * math.cos(angle) + self.CenterVec2.x
|
||||
local ry = math.random(0, self.Radius) * math.sin(angle) + self.CenterVec2.y
|
||||
|
||||
return {x=rx, y=ry}
|
||||
end
|
||||
|
||||
--- Returns a random Vec2 on the border of the circle.
|
||||
-- @return #table The random Vec2
|
||||
function CIRCLE:GetRandomVec2OnBorder()
|
||||
local angle = math.random() * 2 * math.pi
|
||||
|
||||
local rx = self.Radius * math.cos(angle) + self.CenterVec2.x
|
||||
local ry = self.Radius * math.sin(angle) + self.CenterVec2.y
|
||||
|
||||
return {x=rx, y=ry}
|
||||
end
|
||||
|
||||
--- Calculates the bounding box of the circle. The bounding box is the smallest rectangle that contains the circle.
|
||||
-- @return #table The bounding box of the circle
|
||||
function CIRCLE:GetBoundingBox()
|
||||
local min_x = self.CenterVec2.x - self.Radius
|
||||
local min_y = self.CenterVec2.y - self.Radius
|
||||
local max_x = self.CenterVec2.x + self.Radius
|
||||
local max_y = self.CenterVec2.y + self.Radius
|
||||
|
||||
return {
|
||||
{x=min_x, y=min_x}, {x=max_x, y=min_y}, {x=max_x, y=max_y}, {x=min_x, y=max_y}
|
||||
}
|
||||
end
|
||||
|
||||
85
Moose Development/Moose/Shapes/Cube.lua
Normal file
85
Moose Development/Moose/Shapes/Cube.lua
Normal file
@@ -0,0 +1,85 @@
|
||||
---
|
||||
--
|
||||
-- ### Author: **nielsvaes/coconutcockpit**
|
||||
--
|
||||
-- ===
|
||||
-- @module Shapes.CUBE
|
||||
-- @image MOOSE.JPG
|
||||
|
||||
--- LINE class.
|
||||
-- @type CUBE
|
||||
-- @field #string ClassName Name of the class.
|
||||
-- @field #number Points points of the line
|
||||
-- @field #number Coords coordinates of the line
|
||||
|
||||
--
|
||||
-- ===
|
||||
|
||||
---
|
||||
-- @field #CUBE
|
||||
CUBE = {
|
||||
ClassName = "CUBE",
|
||||
Points = {},
|
||||
Coords = {}
|
||||
}
|
||||
|
||||
--- Points need to be added in the following order:
|
||||
--- p1 -> p4 make up the front face of the cube
|
||||
--- p5 -> p8 make up the back face of the cube
|
||||
--- p1 connects to p5
|
||||
--- p2 connects to p6
|
||||
--- p3 connects to p7
|
||||
--- p4 connects to p8
|
||||
---
|
||||
--- 8-----------7
|
||||
--- /| /|
|
||||
--- / | / |
|
||||
--- 4--+--------3 |
|
||||
--- | | | |
|
||||
--- | | | |
|
||||
--- | | | |
|
||||
--- | 5--------+--6
|
||||
--- | / | /
|
||||
--- |/ |/
|
||||
--- 1-----------2
|
||||
---
|
||||
function CUBE:New(p1, p2, p3, p4, p5, p6, p7, p8)
|
||||
local self = BASE:Inherit(self, SHAPE_BASE)
|
||||
self.Points = {p1, p2, p3, p4, p5, p6, p7, p8}
|
||||
for _, point in spairs(self.Points) do
|
||||
table.insert(self.Coords, COORDINATE:NewFromVec3(point))
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
function CUBE:GetCenter()
|
||||
local center = { x=0, y=0, z=0 }
|
||||
for _, point in pairs(self.Points) do
|
||||
center.x = center.x + point.x
|
||||
center.y = center.y + point.y
|
||||
center.z = center.z + point.z
|
||||
end
|
||||
|
||||
center.x = center.x / 8
|
||||
center.y = center.y / 8
|
||||
center.z = center.z / 8
|
||||
return center
|
||||
end
|
||||
|
||||
function CUBE:ContainsPoint(point, cube_points)
|
||||
cube_points = cube_points or self.Points
|
||||
local min_x, min_y, min_z = math.huge, math.huge, math.huge
|
||||
local max_x, max_y, max_z = -math.huge, -math.huge, -math.huge
|
||||
|
||||
-- Find the minimum and maximum x, y, and z values of the cube points
|
||||
for _, p in ipairs(cube_points) do
|
||||
if p.x < min_x then min_x = p.x end
|
||||
if p.y < min_y then min_y = p.y end
|
||||
if p.z < min_z then min_z = p.z end
|
||||
if p.x > max_x then max_x = p.x end
|
||||
if p.y > max_y then max_y = p.y end
|
||||
if p.z > max_z then max_z = p.z end
|
||||
end
|
||||
|
||||
return point.x >= min_x and point.x <= max_x and point.y >= min_y and point.y <= max_y and point.z >= min_z and point.z <= max_z
|
||||
end
|
||||
333
Moose Development/Moose/Shapes/Line.lua
Normal file
333
Moose Development/Moose/Shapes/Line.lua
Normal file
@@ -0,0 +1,333 @@
|
||||
---
|
||||
--
|
||||
-- ### Author: **nielsvaes/coconutcockpit**
|
||||
--
|
||||
-- ===
|
||||
-- @module Shapes.LINE
|
||||
-- @image MOOSE.JPG
|
||||
|
||||
--- LINE class.
|
||||
-- @type LINE
|
||||
-- @field #string ClassName Name of the class.
|
||||
-- @field #number Points points of the line
|
||||
-- @field #number Coords coordinates of the line
|
||||
|
||||
--
|
||||
-- ===
|
||||
|
||||
---
|
||||
-- @field #LINE
|
||||
LINE = {
|
||||
ClassName = "LINE",
|
||||
Points = {},
|
||||
Coords = {},
|
||||
}
|
||||
|
||||
--- Finds a line on the map by its name. The line must be drawn in the Mission Editor
|
||||
-- @param #string line_name Name of the line to find
|
||||
-- @return #LINE The found line, or nil if not found
|
||||
function LINE:FindOnMap(line_name)
|
||||
local self = BASE:Inherit(self, SHAPE_BASE:FindOnMap(line_name))
|
||||
|
||||
for _, layer in pairs(env.mission.drawings.layers) do
|
||||
for _, object in pairs(layer["objects"]) do
|
||||
if object["name"] == line_name then
|
||||
if object["primitiveType"] == "Line" then
|
||||
for _, point in UTILS.spairs(object["points"]) do
|
||||
local p = {x = object["mapX"] + point["x"],
|
||||
y = object["mapY"] + point["y"] }
|
||||
local coord = COORDINATE:NewFromVec2(p)
|
||||
table.insert(self.Points, p)
|
||||
table.insert(self.Coords, coord)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
self:I(#self.Points)
|
||||
if #self.Points == 0 then
|
||||
return nil
|
||||
end
|
||||
|
||||
self.MarkIDs = {}
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Finds a line by its name in the database.
|
||||
-- @param #string shape_name Name of the line to find
|
||||
-- @return #LINE The found line, or nil if not found
|
||||
function LINE:Find(shape_name)
|
||||
return _DATABASE:FindShape(shape_name)
|
||||
end
|
||||
|
||||
--- Creates a new line from two points.
|
||||
-- @param #table vec2 The first point of the line
|
||||
-- @param #number radius The second point of the line
|
||||
-- @return #LINE The new line
|
||||
function LINE:New(...)
|
||||
local self = BASE:Inherit(self, SHAPE_BASE:New())
|
||||
self.Points = {...}
|
||||
self:I(self.Points)
|
||||
for _, point in UTILS.spairs(self.Points) do
|
||||
table.insert(self.Coords, COORDINATE:NewFromVec2(point))
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- Creates a new line from a circle.
|
||||
-- @param #table center_point center point of the circle
|
||||
-- @param #number radius radius of the circle, half length of the line
|
||||
-- @param #number angle_degrees degrees the line will form from center point
|
||||
-- @return #LINE The new line
|
||||
function LINE:NewFromCircle(center_point, radius, angle_degrees)
|
||||
local self = BASE:Inherit(self, SHAPE_BASE:New())
|
||||
self.CenterVec2 = center_point
|
||||
local angleRadians = math.rad(angle_degrees)
|
||||
|
||||
local point1 = {
|
||||
x = center_point.x + radius * math.cos(angleRadians),
|
||||
y = center_point.y + radius * math.sin(angleRadians)
|
||||
}
|
||||
|
||||
local point2 = {
|
||||
x = center_point.x + radius * math.cos(angleRadians + math.pi),
|
||||
y = center_point.y + radius * math.sin(angleRadians + math.pi)
|
||||
}
|
||||
|
||||
for _, point in pairs{point1, point2} do
|
||||
table.insert(self.Points, point)
|
||||
table.insert(self.Coords, COORDINATE:NewFromVec2(point))
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Gets the coordinates of the line.
|
||||
-- @return #table The coordinates of the line
|
||||
function LINE:Coordinates()
|
||||
return self.Coords
|
||||
end
|
||||
|
||||
--- Gets the start coordinate of the line. The start coordinate is the first point of the line.
|
||||
-- @return #COORDINATE The start coordinate of the line
|
||||
function LINE:GetStartCoordinate()
|
||||
return self.Coords[1]
|
||||
end
|
||||
|
||||
--- Gets the end coordinate of the line. The end coordinate is the last point of the line.
|
||||
-- @return #COORDINATE The end coordinate of the line
|
||||
function LINE:GetEndCoordinate()
|
||||
return self.Coords[#self.Coords]
|
||||
end
|
||||
|
||||
--- Gets the start point of the line. The start point is the first point of the line.
|
||||
-- @return #table The start point of the line
|
||||
function LINE:GetStartPoint()
|
||||
return self.Points[1]
|
||||
end
|
||||
|
||||
--- Gets the end point of the line. The end point is the last point of the line.
|
||||
-- @return #table The end point of the line
|
||||
function LINE:GetEndPoint()
|
||||
return self.Points[#self.Points]
|
||||
end
|
||||
|
||||
--- Gets the length of the line.
|
||||
-- @return #number The length of the line
|
||||
function LINE:GetLength()
|
||||
local total_length = 0
|
||||
for i=1, #self.Points - 1 do
|
||||
local x1, y1 = self.Points[i]["x"], self.Points[i]["y"]
|
||||
local x2, y2 = self.Points[i+1]["x"], self.Points[i+1]["y"]
|
||||
local segment_length = math.sqrt((x2 - x1)^2 + (y2 - y1)^2)
|
||||
total_length = total_length + segment_length
|
||||
end
|
||||
return total_length
|
||||
end
|
||||
|
||||
--- Returns a random point on the line.
|
||||
-- @param #table points (optional) The points of the line or 2 other points if you're just using the LINE class without an object of it
|
||||
-- @return #table The random point
|
||||
function LINE:GetRandomPoint(points)
|
||||
points = points or self.Points
|
||||
local rand = math.random() -- 0->1
|
||||
|
||||
local random_x = points[1].x + rand * (points[2].x - points[1].x)
|
||||
local random_y = points[1].y + rand * (points[2].y - points[1].y)
|
||||
|
||||
return { x= random_x, y= random_y }
|
||||
end
|
||||
|
||||
--- Gets the heading of the line.
|
||||
-- @param #table points (optional) The points of the line or 2 other points if you're just using the LINE class without an object of it
|
||||
-- @return #number The heading of the line
|
||||
function LINE:GetHeading(points)
|
||||
points = points or self.Points
|
||||
|
||||
local angle = math.atan2(points[2].y - points[1].y, points[2].x - points[1].x)
|
||||
|
||||
angle = math.deg(angle)
|
||||
if angle < 0 then
|
||||
angle = angle + 360
|
||||
end
|
||||
|
||||
return angle
|
||||
end
|
||||
|
||||
|
||||
--- Return each part of the line as a new line
|
||||
-- @return #table The points
|
||||
function LINE:GetIndividualParts()
|
||||
local parts = {}
|
||||
if #self.Points == 2 then
|
||||
parts = {self}
|
||||
end
|
||||
|
||||
for i=1, #self.Points -1 do
|
||||
local p1 = self.Points[i]
|
||||
local p2 = self.Points[i % #self.Points + 1]
|
||||
table.add(parts, LINE:New(p1, p2))
|
||||
end
|
||||
|
||||
return parts
|
||||
end
|
||||
|
||||
--- Gets a number of points in between the start and end points of the line.
|
||||
-- @param #number amount The number of points to get
|
||||
-- @param #table start_point (Optional) The start point of the line, defaults to the object's start point
|
||||
-- @param #table end_point (Optional) The end point of the line, defaults to the object's end point
|
||||
-- @return #table The points
|
||||
function LINE:GetPointsInbetween(amount, start_point, end_point)
|
||||
start_point = start_point or self:GetStartPoint()
|
||||
end_point = end_point or self:GetEndPoint()
|
||||
if amount == 0 then return {start_point, end_point} end
|
||||
|
||||
amount = amount + 1
|
||||
local points = {}
|
||||
|
||||
local difference = { x = end_point.x - start_point.x, y = end_point.y - start_point.y }
|
||||
local divided = { x = difference.x / amount, y = difference.y / amount }
|
||||
|
||||
for j=0, amount do
|
||||
local part_pos = {x = divided.x * j, y = divided.y * j}
|
||||
-- add part_pos vector to the start point so the new point is placed along in the line
|
||||
local point = {x = start_point.x + part_pos.x, y = start_point.y + part_pos.y}
|
||||
table.insert(points, point)
|
||||
end
|
||||
return points
|
||||
end
|
||||
|
||||
--- Gets a number of points in between the start and end points of the line.
|
||||
-- @param #number amount The number of points to get
|
||||
-- @param #table start_point (Optional) The start point of the line, defaults to the object's start point
|
||||
-- @param #table end_point (Optional) The end point of the line, defaults to the object's end point
|
||||
-- @return #table The points
|
||||
function LINE:GetCoordinatesInBetween(amount, start_point, end_point)
|
||||
local coords = {}
|
||||
for _, pt in pairs(self:GetPointsInbetween(amount, start_point, end_point)) do
|
||||
table.add(coords, COORDINATE:NewFromVec2(pt))
|
||||
end
|
||||
return coords
|
||||
end
|
||||
|
||||
|
||||
function LINE:GetRandomPoint(start_point, end_point)
|
||||
start_point = start_point or self:GetStartPoint()
|
||||
end_point = end_point or self:GetEndPoint()
|
||||
|
||||
local fraction = math.random()
|
||||
|
||||
local difference = { x = end_point.x - start_point.x, y = end_point.y - start_point.y }
|
||||
local part_pos = {x = difference.x * fraction, y = difference.y * fraction}
|
||||
local random_point = { x = start_point.x + part_pos.x, y = start_point.y + part_pos.y}
|
||||
|
||||
return random_point
|
||||
end
|
||||
|
||||
|
||||
function LINE:GetRandomCoordinate(start_point, end_point)
|
||||
start_point = start_point or self:GetStartPoint()
|
||||
end_point = end_point or self:GetEndPoint()
|
||||
|
||||
return COORDINATE:NewFromVec2(self:GetRandomPoint(start_point, end_point))
|
||||
end
|
||||
|
||||
|
||||
--- Gets a number of points on a sine wave between the start and end points of the line.
|
||||
-- @param #number amount The number of points to get
|
||||
-- @param #table start_point (Optional) The start point of the line, defaults to the object's start point
|
||||
-- @param #table end_point (Optional) The end point of the line, defaults to the object's end point
|
||||
-- @param #number frequency (Optional) The frequency of the sine wave, default 1
|
||||
-- @param #number phase (Optional) The phase of the sine wave, default 0
|
||||
-- @param #number amplitude (Optional) The amplitude of the sine wave, default 100
|
||||
-- @return #table The points
|
||||
function LINE:GetPointsBetweenAsSineWave(amount, start_point, end_point, frequency, phase, amplitude)
|
||||
amount = amount or 20
|
||||
start_point = start_point or self:GetStartPoint()
|
||||
end_point = end_point or self:GetEndPoint()
|
||||
frequency = frequency or 1 -- number of cycles per unit of x
|
||||
phase = phase or 0 -- offset in radians
|
||||
amplitude = amplitude or 100 -- maximum height of the wave
|
||||
|
||||
local points = {}
|
||||
|
||||
-- Returns the y-coordinate of the sine wave at x
|
||||
local function sine_wave(x)
|
||||
return amplitude * math.sin(2 * math.pi * frequency * (x - start_point.x) + phase)
|
||||
end
|
||||
|
||||
-- Plot x-amount of points on the sine wave between point_01 and point_02
|
||||
local x = start_point.x
|
||||
local step = (end_point.x - start_point.x) / 20
|
||||
for _=1, amount do
|
||||
local y = sine_wave(x)
|
||||
x = x + step
|
||||
table.add(points, {x=x, y=y})
|
||||
end
|
||||
return points
|
||||
end
|
||||
|
||||
--- Calculates the bounding box of the line. The bounding box is the smallest rectangle that contains the line.
|
||||
-- @return #table The bounding box of the line
|
||||
function LINE:GetBoundingBox()
|
||||
local min_x, min_y, max_x, max_y = self.Points[1].x, self.Points[1].y, self.Points[2].x, self.Points[2].y
|
||||
|
||||
for i = 2, #self.Points do
|
||||
local x, y = self.Points[i].x, self.Points[i].y
|
||||
|
||||
if x < min_x then
|
||||
min_x = x
|
||||
end
|
||||
if y < min_y then
|
||||
min_y = y
|
||||
end
|
||||
if x > max_x then
|
||||
max_x = x
|
||||
end
|
||||
if y > max_y then
|
||||
max_y = y
|
||||
end
|
||||
end
|
||||
return {
|
||||
{x=min_x, y=min_x}, {x=max_x, y=min_y}, {x=max_x, y=max_y}, {x=min_x, y=max_y}
|
||||
}
|
||||
end
|
||||
|
||||
--- Draws the line on the map.
|
||||
-- @param #table points The points of the line
|
||||
function LINE:Draw()
|
||||
for i=1, #self.Coords -1 do
|
||||
local c1 = self.Coords[i]
|
||||
local c2 = self.Coords[i % #self.Coords + 1]
|
||||
table.add(self.MarkIDs, c1:LineToAll(c2))
|
||||
end
|
||||
end
|
||||
|
||||
--- Removes the drawing of the line from the map.
|
||||
function LINE:RemoveDraw()
|
||||
for _, mark_id in pairs(self.MarkIDs) do
|
||||
UTILS.RemoveMark(mark_id)
|
||||
end
|
||||
end
|
||||
213
Moose Development/Moose/Shapes/Oval.lua
Normal file
213
Moose Development/Moose/Shapes/Oval.lua
Normal file
@@ -0,0 +1,213 @@
|
||||
---
|
||||
--
|
||||
-- ### Author: **nielsvaes/coconutcockpit**
|
||||
--
|
||||
-- ===
|
||||
-- @module Shapes.OVAL
|
||||
-- @image MOOSE.JPG
|
||||
|
||||
--- OVAL class.
|
||||
-- @type OVAL
|
||||
-- @field #string ClassName Name of the class.
|
||||
-- @field #number MajorAxis The major axis (radius) of the oval
|
||||
-- @field #number MinorAxis The minor axis (radius) of the oval
|
||||
-- @field #number Angle The angle the oval is rotated on
|
||||
|
||||
--- *The little man removed his hat, what an egg shaped head he had* -- Agatha Christie
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- # OVAL
|
||||
-- OVALs can be fetched from the drawings in the Mission Editor
|
||||
--
|
||||
-- The major and minor axes define how elongated the shape of an oval is. This class has some basic functions that the other SHAPE classes have as well.
|
||||
-- Since it's not possible to draw the shape of an oval while the mission is running, right now the draw function draws 2 cicles. One with the major axis and one with
|
||||
-- the minor axis. It then draws a diamond shape on an angle where the corners touch the major and minor axes to give an indication of what the oval actually
|
||||
-- looks like.
|
||||
--
|
||||
-- Using ovals can be handy to find an area on the ground that is actually an intersection of a cone and a plane. So imagine you're faking the view cone of
|
||||
-- a targeting pod and
|
||||
|
||||
--- OVAL class with properties and methods for handling ovals.
|
||||
-- @field #OVAL
|
||||
OVAL = {
|
||||
ClassName = "OVAL",
|
||||
MajorAxis = nil,
|
||||
MinorAxis = nil,
|
||||
Angle = 0,
|
||||
DrawPoly=nil
|
||||
}
|
||||
|
||||
--- Finds an oval on the map by its name. The oval must be drawn on the map.
|
||||
-- @param #string shape_name Name of the oval to find
|
||||
-- @return #OVAL The found oval, or nil if not found
|
||||
function OVAL:FindOnMap(shape_name)
|
||||
local self = BASE:Inherit(self, SHAPE_BASE:FindOnMap(shape_name))
|
||||
for _, layer in pairs(env.mission.drawings.layers) do
|
||||
for _, object in pairs(layer["objects"]) do
|
||||
if string.find(object["name"], shape_name, 1, true) then
|
||||
if object["polygonMode"] == "oval" then
|
||||
self.CenterVec2 = { x = object["mapX"], y = object["mapY"] }
|
||||
self.MajorAxis = object["r1"]
|
||||
self.MinorAxis = object["r2"]
|
||||
self.Angle = object["angle"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Finds an oval by its name in the database.
|
||||
-- @param #string shape_name Name of the oval to find
|
||||
-- @return #OVAL The found oval, or nil if not found
|
||||
function OVAL:Find(shape_name)
|
||||
return _DATABASE:FindShape(shape_name)
|
||||
end
|
||||
|
||||
--- Creates a new oval from a center point, major axis, minor axis, and angle.
|
||||
-- @param #table vec2 The center point of the oval
|
||||
-- @param #number major_axis The major axis of the oval
|
||||
-- @param #number minor_axis The minor axis of the oval
|
||||
-- @param #number angle The angle of the oval
|
||||
-- @return #OVAL The new oval
|
||||
function OVAL:New(vec2, major_axis, minor_axis, angle)
|
||||
local self = BASE:Inherit(self, SHAPE_BASE:New())
|
||||
self.CenterVec2 = vec2
|
||||
self.MajorAxis = major_axis
|
||||
self.MinorAxis = minor_axis
|
||||
self.Angle = angle or 0
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Gets the major axis of the oval.
|
||||
-- @return #number The major axis of the oval
|
||||
function OVAL:GetMajorAxis()
|
||||
return self.MajorAxis
|
||||
end
|
||||
|
||||
--- Gets the minor axis of the oval.
|
||||
-- @return #number The minor axis of the oval
|
||||
function OVAL:GetMinorAxis()
|
||||
return self.MinorAxis
|
||||
end
|
||||
|
||||
--- Gets the angle of the oval.
|
||||
-- @return #number The angle of the oval
|
||||
function OVAL:GetAngle()
|
||||
return self.Angle
|
||||
end
|
||||
|
||||
--- Sets the major axis of the oval.
|
||||
-- @param #number value The new major axis
|
||||
function OVAL:SetMajorAxis(value)
|
||||
self.MajorAxis = value
|
||||
end
|
||||
|
||||
--- Sets the minor axis of the oval.
|
||||
-- @param #number value The new minor axis
|
||||
function OVAL:SetMinorAxis(value)
|
||||
self.MinorAxis = value
|
||||
end
|
||||
|
||||
--- Sets the angle of the oval.
|
||||
-- @param #number value The new angle
|
||||
function OVAL:SetAngle(value)
|
||||
self.Angle = value
|
||||
end
|
||||
|
||||
--- Checks if a point is contained within the oval.
|
||||
-- @param #table point The point to check
|
||||
-- @return #bool True if the point is contained, false otherwise
|
||||
function OVAL:ContainsPoint(point)
|
||||
local cos, sin = math.cos, math.sin
|
||||
local dx = point.x - self.CenterVec2.x
|
||||
local dy = point.y - self.CenterVec2.y
|
||||
local rx = dx * cos(self.Angle) + dy * sin(self.Angle)
|
||||
local ry = -dx * sin(self.Angle) + dy * cos(self.Angle)
|
||||
return rx * rx / (self.MajorAxis * self.MajorAxis) + ry * ry / (self.MinorAxis * self.MinorAxis) <= 1
|
||||
end
|
||||
|
||||
--- Returns a random Vec2 within the oval.
|
||||
-- @return #table The random Vec2
|
||||
function OVAL:GetRandomVec2()
|
||||
local theta = math.rad(self.Angle)
|
||||
|
||||
local random_point = math.sqrt(math.random()) --> uniformly
|
||||
--local random_point = math.random() --> more clumped around center
|
||||
local phi = math.random() * 2 * math.pi
|
||||
local x_c = random_point * math.cos(phi)
|
||||
local y_c = random_point * math.sin(phi)
|
||||
local x_e = x_c * self.MajorAxis
|
||||
local y_e = y_c * self.MinorAxis
|
||||
local rx = (x_e * math.cos(theta) - y_e * math.sin(theta)) + self.CenterVec2.x
|
||||
local ry = (x_e * math.sin(theta) + y_e * math.cos(theta)) + self.CenterVec2.y
|
||||
|
||||
return {x=rx, y=ry}
|
||||
end
|
||||
|
||||
--- Calculates the bounding box of the oval. The bounding box is the smallest rectangle that contains the oval.
|
||||
-- @return #table The bounding box of the oval
|
||||
function OVAL:GetBoundingBox()
|
||||
local min_x = self.CenterVec2.x - self.MajorAxis
|
||||
local min_y = self.CenterVec2.y - self.MinorAxis
|
||||
local max_x = self.CenterVec2.x + self.MajorAxis
|
||||
local max_y = self.CenterVec2.y + self.MinorAxis
|
||||
|
||||
return {
|
||||
{x=min_x, y=min_x}, {x=max_x, y=min_y}, {x=max_x, y=max_y}, {x=min_x, y=max_y}
|
||||
}
|
||||
end
|
||||
|
||||
--- Draws the oval on the map, for debugging
|
||||
-- @param #number angle (Optional) The angle of the oval. If nil will use self.Angle
|
||||
function OVAL:Draw()
|
||||
--for pt in pairs(self:PointsOnEdge(20)) do
|
||||
-- COORDINATE:NewFromVec2(pt)
|
||||
--end
|
||||
|
||||
self.DrawPoly = POLYGON:NewFromPoints(self:PointsOnEdge(20))
|
||||
self.DrawPoly:Draw(true)
|
||||
|
||||
|
||||
|
||||
|
||||
---- TODO: draw a better shape using line segments
|
||||
--angle = angle or self.Angle
|
||||
--local coor = self:GetCenterCoordinate()
|
||||
--
|
||||
--table.add(self.MarkIDs, coor:CircleToAll(self.MajorAxis))
|
||||
--table.add(self.MarkIDs, coor:CircleToAll(self.MinorAxis))
|
||||
--table.add(self.MarkIDs, coor:LineToAll(coor:Translate(self.MajorAxis, self.Angle)))
|
||||
--
|
||||
--local pt_1 = coor:Translate(self.MajorAxis, self.Angle)
|
||||
--local pt_2 = coor:Translate(self.MinorAxis, self.Angle - 90)
|
||||
--local pt_3 = coor:Translate(self.MajorAxis, self.Angle - 180)
|
||||
--local pt_4 = coor:Translate(self.MinorAxis, self.Angle - 270)
|
||||
--table.add(self.MarkIDs, pt_1:QuadToAll(pt_2, pt_3, pt_4), -1, {0, 1, 0}, 1, {0, 1, 0})
|
||||
end
|
||||
|
||||
--- Removes the drawing of the oval from the map
|
||||
function OVAL:RemoveDraw()
|
||||
self.DrawPoly:RemoveDraw()
|
||||
end
|
||||
|
||||
|
||||
function OVAL:PointsOnEdge(num_points)
|
||||
num_points = num_points or 20
|
||||
local points = {}
|
||||
local dtheta = 2 * math.pi / num_points
|
||||
|
||||
for i = 0, num_points - 1 do
|
||||
local theta = i * dtheta
|
||||
local x = self.CenterVec2.x + self.MajorAxis * math.cos(theta) * math.cos(self.Angle) - self.MinorAxis * math.sin(theta) * math.sin(self.Angle)
|
||||
local y = self.CenterVec2.y + self.MajorAxis * math.cos(theta) * math.sin(self.Angle) + self.MinorAxis * math.sin(theta) * math.cos(self.Angle)
|
||||
table.insert(points, {x = x, y = y})
|
||||
end
|
||||
|
||||
return points
|
||||
end
|
||||
|
||||
|
||||
458
Moose Development/Moose/Shapes/Polygon.lua
Normal file
458
Moose Development/Moose/Shapes/Polygon.lua
Normal file
@@ -0,0 +1,458 @@
|
||||
---
|
||||
--
|
||||
-- ### Author: **nielsvaes/coconutcockpit**
|
||||
--
|
||||
-- ===
|
||||
-- @module Shapes.POLYGON
|
||||
-- @image MOOSE.JPG
|
||||
|
||||
--- POLYGON class.
|
||||
-- @type POLYGON
|
||||
-- @field #string ClassName Name of the class.
|
||||
-- @field #table Points List of 3D points defining the shape, this will be assigned automatically if you're passing in a drawing from the Mission Editor
|
||||
-- @field #table Coords List of COORDINATE defining the path, this will be assigned automatically if you're passing in a drawing from the Mission Editor
|
||||
-- @field #table MarkIDs List any MARKIDs this class use, this will be assigned automatically if you're passing in a drawing from the Mission Editor
|
||||
-- @field #table Triangles List of TRIANGLEs that make up the shape of the POLYGON after being triangulated
|
||||
-- @extends Core.Base#BASE
|
||||
|
||||
--- *Polygons are fashionable at the moment* -- Trip Hawkins
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- # POLYGON
|
||||
-- POLYGONs can be fetched from the drawings in the Mission Editor if the drawing is:
|
||||
-- * A closed shape made with line segments
|
||||
-- * A closed shape made with a freehand line
|
||||
-- * A freehand drawn polygon
|
||||
-- * A rect
|
||||
-- Use the POLYGON:FindOnMap() of POLYGON:Find() functions for this. You can also create a non existing polygon in memory using the POLYGON:New() function. Pass in a
|
||||
-- any number of Vec2s into this function to define the shape of the polygon you want.
|
||||
--
|
||||
-- You can draw very intricate and complex polygons in the Mission Editor to avoid (or include) map objects. You can then generate random points within this complex
|
||||
-- shape for spawning groups or checking positions.
|
||||
--
|
||||
-- When a POLYGON is made, it's automatically triangulated. The resulting triangles are stored in POLYGON.Triangles. This also immeadiately saves the surface area
|
||||
-- of the POLYGON. Because the POLYGON is triangulated, it's possible to generate random points within this POLYGON without having to use a trial and error method to see if
|
||||
-- the point is contained within the shape.
|
||||
-- Using POLYGON:GetRandomVec2() will result in a truly, non-biased, random Vec2 within the shape. You'll want to use this function most. There's also POLYGON:GetRandomNonWeightedVec2
|
||||
-- which ignores the size of the triangles in the polygon to pick a random points. This will result in more points clumping together in parts of the polygon where the triangles are
|
||||
-- the smallest.
|
||||
|
||||
---
|
||||
-- @field #POLYGON
|
||||
POLYGON = {
|
||||
ClassName = "POLYGON",
|
||||
Points = {},
|
||||
Coords = {},
|
||||
Triangles = {},
|
||||
SurfaceArea = 0,
|
||||
TriangleMarkIDs = {},
|
||||
OutlineMarkIDs = {},
|
||||
Angle = nil, -- for arrows
|
||||
Heading = nil -- for arrows
|
||||
}
|
||||
|
||||
--- Finds a polygon on the map by its name. The polygon must be added in the mission editor.
|
||||
-- @param #string shape_name Name of the polygon to find
|
||||
-- @return #POLYGON The found polygon, or nil if not found
|
||||
function POLYGON:FindOnMap(shape_name)
|
||||
local self = BASE:Inherit(self, SHAPE_BASE:FindOnMap(shape_name))
|
||||
|
||||
for _, layer in pairs(env.mission.drawings.layers) do
|
||||
for _, object in pairs(layer["objects"]) do
|
||||
if object["name"] == shape_name then
|
||||
if (object["primitiveType"] == "Line" and object["closed"] == true) or (object["polygonMode"] == "free") then
|
||||
for _, point in UTILS.spairs(object["points"]) do
|
||||
local p = {x = object["mapX"] + point["x"],
|
||||
y = object["mapY"] + point["y"] }
|
||||
local coord = COORDINATE:NewFromVec2(p)
|
||||
self.Points[#self.Points + 1] = p
|
||||
self.Coords[#self.Coords + 1] = coord
|
||||
end
|
||||
elseif object["polygonMode"] == "rect" then
|
||||
local angle = object["angle"]
|
||||
local half_width = object["width"] / 2
|
||||
local half_height = object["height"] / 2
|
||||
|
||||
local p1 = UTILS.RotatePointAroundPivot({ x = self.CenterVec2.x - half_height, y = self.CenterVec2.y + half_width }, self.CenterVec2, angle)
|
||||
local p2 = UTILS.RotatePointAroundPivot({ x = self.CenterVec2.x + half_height, y = self.CenterVec2.y + half_width }, self.CenterVec2, angle)
|
||||
local p3 = UTILS.RotatePointAroundPivot({ x = self.CenterVec2.x + half_height, y = self.CenterVec2.y - half_width }, self.CenterVec2, angle)
|
||||
local p4 = UTILS.RotatePointAroundPivot({ x = self.CenterVec2.x - half_height, y = self.CenterVec2.y - half_width }, self.CenterVec2, angle)
|
||||
|
||||
self.Points = {p1, p2, p3, p4}
|
||||
for _, point in pairs(self.Points) do
|
||||
self.Coords[#self.Coords + 1] = COORDINATE:NewFromVec2(point)
|
||||
end
|
||||
elseif object["polygonMode"] == "arrow" then
|
||||
for _, point in UTILS.spairs(object["points"]) do
|
||||
local p = {x = object["mapX"] + point["x"],
|
||||
y = object["mapY"] + point["y"] }
|
||||
local coord = COORDINATE:NewFromVec2(p)
|
||||
self.Points[#self.Points + 1] = p
|
||||
self.Coords[#self.Coords + 1] = coord
|
||||
end
|
||||
self.Angle = object["angle"]
|
||||
self.Heading = UTILS.ClampAngle(self.Angle + 90)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if #self.Points == 0 then
|
||||
return nil
|
||||
end
|
||||
|
||||
self.CenterVec2 = self:GetCentroid()
|
||||
self.Triangles = self:Triangulate()
|
||||
self.SurfaceArea = self:__CalculateSurfaceArea()
|
||||
|
||||
self.TriangleMarkIDs = {}
|
||||
self.OutlineMarkIDs = {}
|
||||
return self
|
||||
end
|
||||
|
||||
--- Creates a polygon from a zone. The zone must be defined in the mission.
|
||||
-- @param #string zone_name Name of the zone
|
||||
-- @return #POLYGON The polygon created from the zone, or nil if the zone is not found
|
||||
function POLYGON:FromZone(zone_name)
|
||||
for _, zone in pairs(env.mission.triggers.zones) do
|
||||
if zone["name"] == zone_name then
|
||||
return POLYGON:New(unpack(zone["verticies"] or {}))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- Finds a polygon by its name in the database.
|
||||
-- @param #string shape_name Name of the polygon to find
|
||||
-- @return #POLYGON The found polygon, or nil if not found
|
||||
function POLYGON:Find(shape_name)
|
||||
return _DATABASE:FindShape(shape_name)
|
||||
end
|
||||
|
||||
--- Creates a new polygon from a list of points. Each point is a table with 'x' and 'y' fields.
|
||||
-- @param #table ... Points of the polygon
|
||||
-- @return #POLYGON The new polygon
|
||||
function POLYGON:New(...)
|
||||
local self = BASE:Inherit(self, SHAPE_BASE:New())
|
||||
|
||||
self.Points = {...}
|
||||
self.Coords = {}
|
||||
for _, point in UTILS.spairs(self.Points) do
|
||||
table.insert(self.Coords, COORDINATE:NewFromVec2(point))
|
||||
end
|
||||
self.Triangles = self:Triangulate()
|
||||
self.SurfaceArea = self:__CalculateSurfaceArea()
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Calculates the centroid of the polygon. The centroid is the average of the 'x' and 'y' coordinates of the points.
|
||||
-- @return #table The centroid of the polygon
|
||||
function POLYGON:GetCentroid()
|
||||
local function sum(t)
|
||||
local total = 0
|
||||
for _, value in pairs(t) do
|
||||
total = total + value
|
||||
end
|
||||
return total
|
||||
end
|
||||
|
||||
local x_values = {}
|
||||
local y_values = {}
|
||||
local length = table.length(self.Points)
|
||||
|
||||
for _, point in pairs(self.Points) do
|
||||
table.insert(x_values, point.x)
|
||||
table.insert(y_values, point.y)
|
||||
end
|
||||
|
||||
local x = sum(x_values) / length
|
||||
local y = sum(y_values) / length
|
||||
|
||||
return {
|
||||
["x"] = x,
|
||||
["y"] = y
|
||||
}
|
||||
end
|
||||
|
||||
--- Returns the coordinates of the polygon. Each coordinate is a COORDINATE object.
|
||||
-- @return #table The coordinates of the polygon
|
||||
function POLYGON:GetCoordinates()
|
||||
return self.Coords
|
||||
end
|
||||
|
||||
--- Returns the start coordinate of the polygon. The start coordinate is the first point of the polygon.
|
||||
-- @return #COORDINATE The start coordinate of the polygon
|
||||
function POLYGON:GetStartCoordinate()
|
||||
return self.Coords[1]
|
||||
end
|
||||
|
||||
--- Returns the end coordinate of the polygon. The end coordinate is the last point of the polygon.
|
||||
-- @return #COORDINATE The end coordinate of the polygon
|
||||
function POLYGON:GetEndCoordinate()
|
||||
return self.Coords[#self.Coords]
|
||||
end
|
||||
|
||||
--- Returns the start point of the polygon. The start point is the first point of the polygon.
|
||||
-- @return #table The start point of the polygon
|
||||
function POLYGON:GetStartPoint()
|
||||
return self.Points[1]
|
||||
end
|
||||
|
||||
--- Returns the end point of the polygon. The end point is the last point of the polygon.
|
||||
-- @return #table The end point of the polygon
|
||||
function POLYGON:GetEndPoint()
|
||||
return self.Points[#self.Points]
|
||||
end
|
||||
|
||||
--- Returns the points of the polygon. Each point is a table with 'x' and 'y' fields.
|
||||
-- @return #table The points of the polygon
|
||||
function POLYGON:GetPoints()
|
||||
return self.Points
|
||||
end
|
||||
|
||||
--- Calculates the surface area of the polygon. The surface area is the sum of the areas of the triangles that make up the polygon.
|
||||
-- @return #number The surface area of the polygon
|
||||
function POLYGON:GetSurfaceArea()
|
||||
return self.SurfaceArea
|
||||
end
|
||||
|
||||
--- Calculates the bounding box of the polygon. The bounding box is the smallest rectangle that contains the polygon.
|
||||
-- @return #table The bounding box of the polygon
|
||||
function POLYGON:GetBoundingBox()
|
||||
local min_x, min_y, max_x, max_y = self.Points[1].x, self.Points[1].y, self.Points[1].x, self.Points[1].y
|
||||
|
||||
for i = 2, #self.Points do
|
||||
local x, y = self.Points[i].x, self.Points[i].y
|
||||
|
||||
if x < min_x then
|
||||
min_x = x
|
||||
end
|
||||
if y < min_y then
|
||||
min_y = y
|
||||
end
|
||||
if x > max_x then
|
||||
max_x = x
|
||||
end
|
||||
if y > max_y then
|
||||
max_y = y
|
||||
end
|
||||
end
|
||||
return {
|
||||
{x=min_x, y=min_x}, {x=max_x, y=min_y}, {x=max_x, y=max_y}, {x=min_x, y=max_y}
|
||||
}
|
||||
end
|
||||
|
||||
--- Triangulates the polygon. The polygon is divided into triangles.
|
||||
-- @param #table points (optional) Points of the polygon or other points if you're just using the POLYGON class without an object of it
|
||||
-- @return #table The triangles of the polygon
|
||||
function POLYGON:Triangulate(points)
|
||||
points = points or self.Points
|
||||
local triangles = {}
|
||||
|
||||
local function get_orientation(shape_points)
|
||||
local sum = 0
|
||||
for i = 1, #shape_points do
|
||||
local j = i % #shape_points + 1
|
||||
sum = sum + (shape_points[j].x - shape_points[i].x) * (shape_points[j].y + shape_points[i].y)
|
||||
end
|
||||
return sum >= 0 and "clockwise" or "counter-clockwise" -- sum >= 0, return "clockwise", else return "counter-clockwise"
|
||||
end
|
||||
|
||||
local function ensure_clockwise(shape_points)
|
||||
local orientation = get_orientation(shape_points)
|
||||
if orientation == "counter-clockwise" then
|
||||
-- Reverse the order of shape_points so they're clockwise
|
||||
local reversed = {}
|
||||
for i = #shape_points, 1, -1 do
|
||||
table.insert(reversed, shape_points[i])
|
||||
end
|
||||
return reversed
|
||||
end
|
||||
return shape_points
|
||||
end
|
||||
|
||||
local function is_clockwise(p1, p2, p3)
|
||||
local cross_product = (p2.x - p1.x) * (p3.y - p1.y) - (p2.y - p1.y) * (p3.x - p1.x)
|
||||
return cross_product < 0
|
||||
end
|
||||
|
||||
local function divide_recursively(shape_points)
|
||||
if #shape_points == 3 then
|
||||
table.insert(triangles, TRIANGLE:New(shape_points[1], shape_points[2], shape_points[3]))
|
||||
elseif #shape_points > 3 then -- find an ear -> a triangle with no other points inside it
|
||||
for i, p1 in ipairs(shape_points) do
|
||||
local p2 = shape_points[(i % #shape_points) + 1]
|
||||
local p3 = shape_points[(i + 1) % #shape_points + 1]
|
||||
local triangle = TRIANGLE:New(p1, p2, p3)
|
||||
local is_ear = true
|
||||
|
||||
if not is_clockwise(p1, p2, p3) then
|
||||
is_ear = false
|
||||
else
|
||||
for _, point in ipairs(shape_points) do
|
||||
if point ~= p1 and point ~= p2 and point ~= p3 and triangle:ContainsPoint(point) then
|
||||
is_ear = false
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if is_ear then
|
||||
-- Check if any point in the original polygon is inside the ear triangle
|
||||
local is_valid_triangle = true
|
||||
for _, point in ipairs(points) do
|
||||
if point ~= p1 and point ~= p2 and point ~= p3 and triangle:ContainsPoint(point) then
|
||||
is_valid_triangle = false
|
||||
break
|
||||
end
|
||||
end
|
||||
if is_valid_triangle then
|
||||
table.insert(triangles, triangle)
|
||||
local remaining_points = {}
|
||||
for j, point in ipairs(shape_points) do
|
||||
if point ~= p2 then
|
||||
table.insert(remaining_points, point)
|
||||
end
|
||||
end
|
||||
divide_recursively(remaining_points)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
points = ensure_clockwise(points)
|
||||
divide_recursively(points)
|
||||
return triangles
|
||||
end
|
||||
|
||||
function POLYGON:CovarianceMatrix()
|
||||
local cx, cy = self:GetCentroid()
|
||||
local covXX, covYY, covXY = 0, 0, 0
|
||||
for _, p in ipairs(self.points) do
|
||||
covXX = covXX + (p.x - cx)^2
|
||||
covYY = covYY + (p.y - cy)^2
|
||||
covXY = covXY + (p.x - cx) * (p.y - cy)
|
||||
end
|
||||
covXX = covXX / (#self.points - 1)
|
||||
covYY = covYY / (#self.points - 1)
|
||||
covXY = covXY / (#self.points - 1)
|
||||
return covXX, covYY, covXY
|
||||
end
|
||||
|
||||
function POLYGON:Direction()
|
||||
local covXX, covYY, covXY = self:CovarianceMatrix()
|
||||
-- Simplified calculation for the largest eigenvector's direction
|
||||
local theta = 0.5 * math.atan2(2 * covXY, covXX - covYY)
|
||||
return math.cos(theta), math.sin(theta)
|
||||
end
|
||||
|
||||
--- Returns a random Vec2 within the polygon. The Vec2 is weighted by the areas of the triangles that make up the polygon.
|
||||
-- @return #table The random Vec2
|
||||
function POLYGON:GetRandomVec2()
|
||||
local weights = {}
|
||||
for _, triangle in pairs(self.Triangles) do
|
||||
weights[triangle] = triangle.SurfaceArea / self.SurfaceArea
|
||||
end
|
||||
|
||||
local random_weight = math.random()
|
||||
local accumulated_weight = 0
|
||||
for triangle, weight in pairs(weights) do
|
||||
accumulated_weight = accumulated_weight + weight
|
||||
if accumulated_weight >= random_weight then
|
||||
return triangle:GetRandomVec2()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- Returns a random non-weighted Vec2 within the polygon. The Vec2 is chosen from one of the triangles that make up the polygon.
|
||||
-- @return #table The random non-weighted Vec2
|
||||
function POLYGON:GetRandomNonWeightedVec2()
|
||||
return self.Triangles[math.random(1, #self.Triangles)]:GetRandomVec2()
|
||||
end
|
||||
|
||||
--- Checks if a point is contained within the polygon. The point is a table with 'x' and 'y' fields.
|
||||
-- @param #table point The point to check
|
||||
-- @param #table points (optional) Points of the polygon or other points if you're just using the POLYGON class without an object of it
|
||||
-- @return #bool True if the point is contained, false otherwise
|
||||
function POLYGON:ContainsPoint(point, polygon_points)
|
||||
local x = point.x
|
||||
local y = point.y
|
||||
|
||||
polygon_points = polygon_points or self.Points
|
||||
|
||||
local counter = 0
|
||||
local num_points = #polygon_points
|
||||
for current_index = 1, num_points do
|
||||
local next_index = (current_index % num_points) + 1
|
||||
local current_x, current_y = polygon_points[current_index].x, polygon_points[current_index].y
|
||||
local next_x, next_y = polygon_points[next_index].x, polygon_points[next_index].y
|
||||
if ((current_y > y) ~= (next_y > y)) and (x < (next_x - current_x) * (y - current_y) / (next_y - current_y) + current_x) then
|
||||
counter = counter + 1
|
||||
end
|
||||
end
|
||||
return counter % 2 == 1
|
||||
end
|
||||
|
||||
--- Draws the polygon on the map. The polygon can be drawn with or without inner triangles. This is just for debugging
|
||||
-- @param #bool include_inner_triangles Whether to include inner triangles in the drawing
|
||||
function POLYGON:Draw(include_inner_triangles)
|
||||
include_inner_triangles = include_inner_triangles or false
|
||||
for i=1, #self.Coords do
|
||||
local c1 = self.Coords[i]
|
||||
local c2 = self.Coords[i % #self.Coords + 1]
|
||||
table.add(self.OutlineMarkIDs, c1:LineToAll(c2))
|
||||
end
|
||||
|
||||
|
||||
if include_inner_triangles then
|
||||
for _, triangle in ipairs(self.Triangles) do
|
||||
triangle:Draw()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- Removes the drawing of the polygon from the map.
|
||||
function POLYGON:RemoveDraw()
|
||||
for _, triangle in pairs(self.Triangles) do
|
||||
triangle:RemoveDraw()
|
||||
end
|
||||
for _, mark_id in pairs(self.OutlineMarkIDs) do
|
||||
UTILS.RemoveMark(mark_id)
|
||||
end
|
||||
end
|
||||
|
||||
--- Calculates the surface area of the polygon. The surface area is the sum of the areas of the triangles that make up the polygon.
|
||||
-- @return #number The surface area of the polygon
|
||||
function POLYGON:__CalculateSurfaceArea()
|
||||
local area = 0
|
||||
for _, triangle in pairs(self.Triangles) do
|
||||
area = area + triangle.SurfaceArea
|
||||
end
|
||||
return area
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
214
Moose Development/Moose/Shapes/ShapeBase.lua
Normal file
214
Moose Development/Moose/Shapes/ShapeBase.lua
Normal file
@@ -0,0 +1,214 @@
|
||||
--- **Shapes** - Class that serves as the base shapes drawn in the Mission Editor
|
||||
--
|
||||
--
|
||||
-- ### Author: **nielsvaes/coconutcockpit**
|
||||
--
|
||||
-- ===
|
||||
-- @module Shapes.SHAPE_BASE
|
||||
-- @image CORE_Pathline.png
|
||||
|
||||
|
||||
--- SHAPE_BASE class.
|
||||
-- @type SHAPE_BASE
|
||||
-- @field #string ClassName Name of the class.
|
||||
-- @field #string Name Name of the shape
|
||||
-- @field #table CenterVec2 Vec2 of the center of the shape, this will be assigned automatically
|
||||
-- @field #table Points List of 3D points defining the shape, this will be assigned automatically
|
||||
-- @field #table Coords List of COORDINATE defining the path, this will be assigned automatically
|
||||
-- @field #table MarkIDs List any MARKIDs this class use, this will be assigned automatically
|
||||
-- @extends Core.Base#BASE
|
||||
|
||||
--- *I'm in love with the shape of you -- Ed Sheeran
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- # SHAPE_BASE
|
||||
-- The class serves as the base class to deal with these shapes using MOOSE. You should never use this class on its own,
|
||||
-- rather use:
|
||||
-- CIRCLE
|
||||
-- LINE
|
||||
-- OVAL
|
||||
-- POLYGON
|
||||
-- TRIANGLE (although this one's a bit special as well)
|
||||
--
|
||||
-- ===
|
||||
-- The idea is that anything you draw on the map in the Mission Editor can be turned in a shape to work with in MOOSE.
|
||||
-- This is the base class that all other shape classes are built on. There are some shared functions, most of which are overridden in the derived classes
|
||||
--
|
||||
-- @field #SHAPE_BASE
|
||||
SHAPE_BASE = {
|
||||
ClassName = "SHAPE_BASE",
|
||||
Name = "",
|
||||
CenterVec2 = nil,
|
||||
Points = {},
|
||||
Coords = {},
|
||||
MarkIDs = {},
|
||||
ColorString = "",
|
||||
ColorRGBA = {}
|
||||
}
|
||||
|
||||
--- Creates a new instance of SHAPE_BASE.
|
||||
-- @return #SHAPE_BASE The new instance
|
||||
function SHAPE_BASE:New()
|
||||
local self = BASE:Inherit(self, BASE:New())
|
||||
return self
|
||||
end
|
||||
|
||||
--- Finds a shape on the map by its name.
|
||||
-- @param #string shape_name Name of the shape to find
|
||||
-- @return #SHAPE_BASE The found shape
|
||||
function SHAPE_BASE:FindOnMap(shape_name)
|
||||
local self = BASE:Inherit(self, BASE:New())
|
||||
|
||||
local found = false
|
||||
|
||||
for _, layer in pairs(env.mission.drawings.layers) do
|
||||
for _, object in pairs(layer["objects"]) do
|
||||
if object["name"] == shape_name then
|
||||
self.Name = object["name"]
|
||||
self.CenterVec2 = { x = object["mapX"], y = object["mapY"] }
|
||||
self.ColorString = object["colorString"]
|
||||
self.ColorRGBA = UTILS.HexToRGBA(self.ColorString)
|
||||
found = true
|
||||
end
|
||||
end
|
||||
end
|
||||
if not found then
|
||||
self:E("Can't find a shape with name " .. shape_name)
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
function SHAPE_BASE:GetAllShapes(filter)
|
||||
filter = filter or ""
|
||||
local return_shapes = {}
|
||||
for _, layer in pairs(env.mission.drawings.layers) do
|
||||
for _, object in pairs(layer["objects"]) do
|
||||
if string.contains(object["name"], filter) then
|
||||
table.add(return_shapes, object)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return return_shapes
|
||||
end
|
||||
|
||||
--- Offsets the shape to a new position.
|
||||
-- @param #table new_vec2 The new position
|
||||
function SHAPE_BASE:Offset(new_vec2)
|
||||
local offset_vec2 = UTILS.Vec2Subtract(new_vec2, self.CenterVec2)
|
||||
self.CenterVec2 = new_vec2
|
||||
if self.ClassName == "POLYGON" then
|
||||
for _, point in pairs(self.Points) do
|
||||
point.x = point.x + offset_vec2.x
|
||||
point.y = point.y + offset_vec2.y
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- Gets the name of the shape.
|
||||
-- @return #string The name of the shape
|
||||
function SHAPE_BASE:GetName()
|
||||
return self.Name
|
||||
end
|
||||
|
||||
function SHAPE_BASE:GetColorString()
|
||||
return self.ColorString
|
||||
end
|
||||
|
||||
function SHAPE_BASE:GetColorRGBA()
|
||||
return self.ColorRGBA
|
||||
end
|
||||
|
||||
function SHAPE_BASE:GetColorRed()
|
||||
return self.ColorRGBA.R
|
||||
end
|
||||
|
||||
function SHAPE_BASE:GetColorGreen()
|
||||
return self.ColorRGBA.G
|
||||
end
|
||||
|
||||
function SHAPE_BASE:GetColorBlue()
|
||||
return self.ColorRGBA.B
|
||||
end
|
||||
|
||||
function SHAPE_BASE:GetColorAlpha()
|
||||
return self.ColorRGBA.A
|
||||
end
|
||||
|
||||
--- Gets the center position of the shape.
|
||||
-- @return #table The center position
|
||||
function SHAPE_BASE:GetCenterVec2()
|
||||
return self.CenterVec2
|
||||
end
|
||||
|
||||
--- Gets the center coordinate of the shape.
|
||||
-- @return #COORDINATE The center coordinate
|
||||
function SHAPE_BASE:GetCenterCoordinate()
|
||||
return COORDINATE:NewFromVec2(self.CenterVec2)
|
||||
end
|
||||
|
||||
--- Gets the coordinate of the shape.
|
||||
-- @return #COORDINATE The coordinate
|
||||
function SHAPE_BASE:GetCoordinate()
|
||||
return self:GetCenterCoordinate()
|
||||
end
|
||||
|
||||
--- Checks if a point is contained within the shape.
|
||||
-- @param #table _ The point to check
|
||||
-- @return #bool True if the point is contained, false otherwise
|
||||
function SHAPE_BASE:ContainsPoint(_)
|
||||
self:E("This needs to be set in the derived class")
|
||||
end
|
||||
|
||||
--- Checks if a unit is contained within the shape.
|
||||
-- @param #string unit_name The name of the unit to check
|
||||
-- @return #bool True if the unit is contained, false otherwise
|
||||
function SHAPE_BASE:ContainsUnit(unit_name)
|
||||
local unit = UNIT:FindByName(unit_name)
|
||||
|
||||
if unit == nil or not unit:IsAlive() then
|
||||
return false
|
||||
end
|
||||
|
||||
if self:ContainsPoint(unit:GetVec2()) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
--- Checks if any unit of a group is contained within the shape.
|
||||
-- @param #string group_name The name of the group to check
|
||||
-- @return #bool True if any unit of the group is contained, false otherwise
|
||||
function SHAPE_BASE:ContainsAnyOfGroup(group_name)
|
||||
local group = GROUP:FindByName(group_name)
|
||||
|
||||
if group == nil or not group:IsAlive() then
|
||||
return false
|
||||
end
|
||||
|
||||
for _, unit in pairs(group:GetUnits()) do
|
||||
if self:ContainsPoint(unit:GetVec2()) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
--- Checks if all units of a group are contained within the shape.
|
||||
-- @param #string group_name The name of the group to check
|
||||
-- @return #bool True if all units of the group are contained, false otherwise
|
||||
function SHAPE_BASE:ContainsAllOfGroup(group_name)
|
||||
local group = GROUP:FindByName(group_name)
|
||||
|
||||
if group == nil or not group:IsAlive() then
|
||||
return false
|
||||
end
|
||||
|
||||
for _, unit in pairs(group:GetUnits()) do
|
||||
if not self:ContainsPoint(unit:GetVec2()) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
101
Moose Development/Moose/Shapes/Triangle.lua
Normal file
101
Moose Development/Moose/Shapes/Triangle.lua
Normal file
@@ -0,0 +1,101 @@
|
||||
--- TRIANGLE class with properties and methods for handling triangles. This class is mostly used by the POLYGON class, but you can use it on its own as well
|
||||
--
|
||||
-- ### Author: **nielsvaes/coconutcockpit**
|
||||
--
|
||||
--
|
||||
-- ===
|
||||
-- @module Shapes.TRIANGLE
|
||||
-- @image MOOSE.JPG
|
||||
|
||||
--- LINE class.
|
||||
-- @type CUBE
|
||||
-- @field #string ClassName Name of the class.
|
||||
-- @field #number Points points of the line
|
||||
-- @field #number Coords coordinates of the line
|
||||
|
||||
--
|
||||
-- ===
|
||||
|
||||
---
|
||||
-- @field #TRIANGLE
|
||||
TRIANGLE = {
|
||||
ClassName = "TRIANGLE",
|
||||
Points = {},
|
||||
Coords = {},
|
||||
SurfaceArea = 0
|
||||
}
|
||||
|
||||
--- Creates a new triangle from three points. The points need to be given as Vec2s
|
||||
-- @param #table p1 The first point of the triangle
|
||||
-- @param #table p2 The second point of the triangle
|
||||
-- @param #table p3 The third point of the triangle
|
||||
-- @return #TRIANGLE The new triangle
|
||||
function TRIANGLE:New(p1, p2, p3)
|
||||
local self = BASE:Inherit(self, SHAPE_BASE:New())
|
||||
self.Points = {p1, p2, p3}
|
||||
|
||||
local center_x = (p1.x + p2.x + p3.x) / 3
|
||||
local center_y = (p1.y + p2.y + p3.y) / 3
|
||||
self.CenterVec2 = {x=center_x, y=center_y}
|
||||
|
||||
for _, pt in pairs({p1, p2, p3}) do
|
||||
table.add(self.Coords, COORDINATE:NewFromVec2(pt))
|
||||
end
|
||||
|
||||
self.SurfaceArea = math.abs((p2.x - p1.x) * (p3.y - p1.y) - (p3.x - p1.x) * (p2.y - p1.y)) * 0.5
|
||||
|
||||
self.MarkIDs = {}
|
||||
return self
|
||||
end
|
||||
|
||||
--- Checks if a point is contained within the triangle.
|
||||
-- @param #table pt The point to check
|
||||
-- @param #table points (optional) The points of the triangle, or 3 other points if you're just using the TRIANGLE class without an object of it
|
||||
-- @return #bool True if the point is contained, false otherwise
|
||||
function TRIANGLE:ContainsPoint(pt, points)
|
||||
points = points or self.Points
|
||||
|
||||
local function sign(p1, p2, p3)
|
||||
return (p1.x - p3.x) * (p2.y - p3.y) - (p2.x - p3.x) * (p1.y - p3.y)
|
||||
end
|
||||
|
||||
local d1 = sign(pt, self.Points[1], self.Points[2])
|
||||
local d2 = sign(pt, self.Points[2], self.Points[3])
|
||||
local d3 = sign(pt, self.Points[3], self.Points[1])
|
||||
|
||||
local has_neg = (d1 < 0) or (d2 < 0) or (d3 < 0)
|
||||
local has_pos = (d1 > 0) or (d2 > 0) or (d3 > 0)
|
||||
|
||||
return not (has_neg and has_pos)
|
||||
end
|
||||
|
||||
--- Returns a random Vec2 within the triangle.
|
||||
-- @param #table points The points of the triangle, or 3 other points if you're just using the TRIANGLE class without an object of it
|
||||
-- @return #table The random Vec2
|
||||
function TRIANGLE:GetRandomVec2(points)
|
||||
points = points or self.Points
|
||||
local pt = {math.random(), math.random()}
|
||||
table.sort(pt)
|
||||
local s = pt[1]
|
||||
local t = pt[2] - pt[1]
|
||||
local u = 1 - pt[2]
|
||||
|
||||
return {x = s * points[1].x + t * points[2].x + u * points[3].x,
|
||||
y = s * points[1].y + t * points[2].y + u * points[3].y}
|
||||
end
|
||||
|
||||
--- Draws the triangle on the map, just for debugging
|
||||
function TRIANGLE:Draw()
|
||||
for i=1, #self.Coords do
|
||||
local c1 = self.Coords[i]
|
||||
local c2 = self.Coords[i % #self.Coords + 1]
|
||||
table.add(self.MarkIDs, c1:LineToAll(c2))
|
||||
end
|
||||
end
|
||||
|
||||
--- Removes the drawing of the triangle from the map.
|
||||
function TRIANGLE:RemoveDraw()
|
||||
for _, mark_id in pairs(self.MarkIDs) do
|
||||
UTILS.RemoveMark(mark_id)
|
||||
end
|
||||
end
|
||||
@@ -30,6 +30,10 @@
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_Demos/tree/master/Sound/Radio)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### Authors: Hugues "Grey_Echo" Bousquet, funkyfranky
|
||||
--
|
||||
-- @module Sound.Radio
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ## Example Missions: [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/Sound/MSRS).
|
||||
-- ## Example Missions: [GitHub](https://github.com/FlightControl-Master/MOOSE_Demos/tree/master/Sound/MSRS).
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
@@ -824,7 +824,7 @@ function MSRS:SetVoiceProvider(Voice, Provider)
|
||||
self:F( {Voice=Voice, Provider=Provider} )
|
||||
self.poptions=self.poptions or {}
|
||||
|
||||
self.poptions[Provider or self:GetProvider()]=Voice
|
||||
self.poptions[Provider or self:GetProvider()].voice=Voice
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -175,19 +175,19 @@ do -- TASK_A2G
|
||||
|
||||
end
|
||||
|
||||
--- @param #TASK_A2G self
|
||||
-- @param #TASK_A2G self
|
||||
-- @param Core.Set#SET_UNIT TargetSetUnit The set of targets.
|
||||
function TASK_A2G:SetTargetSetUnit( TargetSetUnit )
|
||||
|
||||
self.TargetSetUnit = TargetSetUnit
|
||||
end
|
||||
|
||||
--- @param #TASK_A2G self
|
||||
-- @param #TASK_A2G self
|
||||
function TASK_A2G:GetPlannedMenuText()
|
||||
return self:GetStateString() .. " - " .. self:GetTaskName() .. " ( " .. self.TargetSetUnit:GetUnitTypesText() .. " )"
|
||||
end
|
||||
|
||||
--- @param #TASK_A2G self
|
||||
-- @param #TASK_A2G self
|
||||
-- @param Core.Point#COORDINATE RendezVousCoordinate The Coordinate object referencing to the 2D point where the RendezVous point is located on the map.
|
||||
-- @param #number RendezVousRange The RendezVousRange that defines when the player is considered to have arrived at the RendezVous point.
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||
@@ -200,7 +200,7 @@ do -- TASK_A2G
|
||||
ActRouteRendezVous:SetRange( RendezVousRange )
|
||||
end
|
||||
|
||||
--- @param #TASK_A2G self
|
||||
-- @param #TASK_A2G self
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||
-- @return Core.Point#COORDINATE The Coordinate object referencing to the 2D point where the RendezVous point is located on the map.
|
||||
-- @return #number The RendezVousRange that defines when the player is considered to have arrived at the RendezVous point.
|
||||
@@ -212,7 +212,7 @@ do -- TASK_A2G
|
||||
return ActRouteRendezVous:GetCoordinate(), ActRouteRendezVous:GetRange()
|
||||
end
|
||||
|
||||
--- @param #TASK_A2G self
|
||||
-- @param #TASK_A2G self
|
||||
-- @param Core.Zone#ZONE_BASE RendezVousZone The Zone object where the RendezVous is located on the map.
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||
function TASK_A2G:SetRendezVousZone( RendezVousZone, TaskUnit )
|
||||
@@ -223,7 +223,7 @@ do -- TASK_A2G
|
||||
ActRouteRendezVous:SetZone( RendezVousZone )
|
||||
end
|
||||
|
||||
--- @param #TASK_A2G self
|
||||
-- @param #TASK_A2G self
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||
-- @return Core.Zone#ZONE_BASE The Zone object where the RendezVous is located on the map.
|
||||
function TASK_A2G:GetRendezVousZone( TaskUnit )
|
||||
@@ -234,7 +234,7 @@ do -- TASK_A2G
|
||||
return ActRouteRendezVous:GetZone()
|
||||
end
|
||||
|
||||
--- @param #TASK_A2G self
|
||||
-- @param #TASK_A2G self
|
||||
-- @param Core.Point#COORDINATE TargetCoordinate The Coordinate object where the Target is located on the map.
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||
function TASK_A2G:SetTargetCoordinate( TargetCoordinate, TaskUnit )
|
||||
@@ -245,7 +245,7 @@ do -- TASK_A2G
|
||||
ActRouteTarget:SetCoordinate( TargetCoordinate )
|
||||
end
|
||||
|
||||
--- @param #TASK_A2G self
|
||||
-- @param #TASK_A2G self
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||
-- @return Core.Point#COORDINATE The Coordinate object where the Target is located on the map.
|
||||
function TASK_A2G:GetTargetCoordinate( TaskUnit )
|
||||
@@ -256,7 +256,7 @@ do -- TASK_A2G
|
||||
return ActRouteTarget:GetCoordinate()
|
||||
end
|
||||
|
||||
--- @param #TASK_A2G self
|
||||
-- @param #TASK_A2G self
|
||||
-- @param Core.Zone#ZONE_BASE TargetZone The Zone object where the Target is located on the map.
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||
function TASK_A2G:SetTargetZone( TargetZone, TaskUnit )
|
||||
@@ -267,7 +267,7 @@ do -- TASK_A2G
|
||||
ActRouteTarget:SetZone( TargetZone )
|
||||
end
|
||||
|
||||
--- @param #TASK_A2G self
|
||||
-- @param #TASK_A2G self
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||
-- @return Core.Zone#ZONE_BASE The Zone object where the Target is located on the map.
|
||||
function TASK_A2G:GetTargetZone( TaskUnit )
|
||||
@@ -280,7 +280,7 @@ do -- TASK_A2G
|
||||
|
||||
function TASK_A2G:SetGoalTotal()
|
||||
|
||||
self.GoalTotal = self.TargetSetUnit:Count()
|
||||
self.GoalTotal = self.TargetSetUnit:CountAlive()
|
||||
end
|
||||
|
||||
function TASK_A2G:GetGoalTotal()
|
||||
@@ -304,14 +304,14 @@ do -- TASK_A2G
|
||||
function TASK_A2G:onafterGoal( TaskUnit, From, Event, To )
|
||||
local TargetSetUnit = self.TargetSetUnit -- Core.Set#SET_UNIT
|
||||
|
||||
if TargetSetUnit:Count() == 0 then
|
||||
if TargetSetUnit:CountAlive() == 0 then
|
||||
self:Success()
|
||||
end
|
||||
|
||||
self:__Goal( -10 )
|
||||
end
|
||||
|
||||
--- @param #TASK_A2G self
|
||||
-- @param #TASK_A2G self
|
||||
function TASK_A2G:UpdateTaskInfo( DetectedItem )
|
||||
|
||||
if self:IsStatePlanned() or self:IsStateAssigned() then
|
||||
@@ -328,7 +328,7 @@ do -- TASK_A2G
|
||||
self.TaskInfo:AddThreat( ThreatText, ThreatLevel, 10, "MOD", true )
|
||||
|
||||
if self.Detection then
|
||||
local DetectedItemsCount = self.TargetSetUnit:Count()
|
||||
local DetectedItemsCount = self.TargetSetUnit:CountAlive()
|
||||
local ReportTypes = REPORT:New()
|
||||
local TargetTypes = {}
|
||||
for TargetUnitName, TargetUnit in pairs( self.TargetSetUnit:GetSet() ) do
|
||||
@@ -341,7 +341,7 @@ do -- TASK_A2G
|
||||
self.TaskInfo:AddTargetCount( DetectedItemsCount, 11, "O", true )
|
||||
self.TaskInfo:AddTargets( DetectedItemsCount, ReportTypes:Text( ", " ), 20, "D", true )
|
||||
else
|
||||
local DetectedItemsCount = self.TargetSetUnit:Count()
|
||||
local DetectedItemsCount = self.TargetSetUnit:CountAlive()
|
||||
local DetectedItemsTypes = self.TargetSetUnit:GetTypeNames()
|
||||
self.TaskInfo:AddTargetCount( DetectedItemsCount, 11, "O", true )
|
||||
self.TaskInfo:AddTargets( DetectedItemsCount, DetectedItemsTypes, 20, "D", true )
|
||||
|
||||
@@ -444,10 +444,11 @@ end
|
||||
--- Print a table to log in a nice format
|
||||
-- @param #table table The table to print
|
||||
-- @param #number indent Number of indents
|
||||
-- @param #boolean noprint Don't log but return text
|
||||
-- @return #string text Text created on the fly of the log output
|
||||
function UTILS.PrintTableToLog(table, indent)
|
||||
function UTILS.PrintTableToLog(table, indent, noprint)
|
||||
local text = "\n"
|
||||
if not table then
|
||||
if not table or type(table) ~= "table" then
|
||||
env.warning("No table passed!")
|
||||
return nil
|
||||
end
|
||||
@@ -455,11 +456,16 @@ function UTILS.PrintTableToLog(table, indent)
|
||||
for k, v in pairs(table) do
|
||||
if string.find(k," ") then k='"'..k..'"'end
|
||||
if type(v) == "table" then
|
||||
env.info(string.rep(" ", indent) .. tostring(k) .. " = {")
|
||||
if not noprint then
|
||||
env.info(string.rep(" ", indent) .. tostring(k) .. " = {")
|
||||
end
|
||||
text = text ..string.rep(" ", indent) .. tostring(k) .. " = {\n"
|
||||
text = text .. tostring(UTILS.PrintTableToLog(v, indent + 1)).."\n"
|
||||
env.info(string.rep(" ", indent) .. "},")
|
||||
if not noprint then
|
||||
env.info(string.rep(" ", indent) .. "},")
|
||||
end
|
||||
text = text .. string.rep(" ", indent) .. "},\n"
|
||||
elseif type(v) == "function" then
|
||||
else
|
||||
local value
|
||||
if tostring(v) == "true" or tostring(v) == "false" or tonumber(v) ~= nil then
|
||||
@@ -467,7 +473,9 @@ function UTILS.PrintTableToLog(table, indent)
|
||||
else
|
||||
value = '"'..tostring(v)..'"'
|
||||
end
|
||||
env.info(string.rep(" ", indent) .. tostring(k) .. " = " .. tostring(value)..",\n")
|
||||
if not noprint then
|
||||
env.info(string.rep(" ", indent) .. tostring(k) .. " = " .. tostring(value)..",\n")
|
||||
end
|
||||
text = text .. string.rep(" ", indent) .. tostring(k) .. " = " .. tostring(value)..",\n"
|
||||
end
|
||||
end
|
||||
@@ -825,6 +833,64 @@ UTILS.tostringLL = function( lat, lon, acc, DMS)
|
||||
end
|
||||
end
|
||||
|
||||
--[[acc:
|
||||
in DM: decimal point of minutes.
|
||||
In DMS: decimal point of seconds.
|
||||
position after the decimal of the least significant digit:
|
||||
So:
|
||||
42.32 - acc of 2.
|
||||
]]
|
||||
UTILS.tostringLLM2KData = function( lat, lon, acc)
|
||||
|
||||
local latHemi, lonHemi
|
||||
if lat > 0 then
|
||||
latHemi = 'N'
|
||||
else
|
||||
latHemi = 'S'
|
||||
end
|
||||
|
||||
if lon > 0 then
|
||||
lonHemi = 'E'
|
||||
else
|
||||
lonHemi = 'W'
|
||||
end
|
||||
|
||||
lat = math.abs(lat)
|
||||
lon = math.abs(lon)
|
||||
|
||||
local latDeg = math.floor(lat)
|
||||
local latMin = (lat - latDeg)*60
|
||||
|
||||
local lonDeg = math.floor(lon)
|
||||
local lonMin = (lon - lonDeg)*60
|
||||
|
||||
-- degrees, decimal minutes.
|
||||
latMin = UTILS.Round(latMin, acc)
|
||||
lonMin = UTILS.Round(lonMin, acc)
|
||||
|
||||
if latMin == 60 then
|
||||
latMin = 0
|
||||
latDeg = latDeg + 1
|
||||
end
|
||||
|
||||
if lonMin == 60 then
|
||||
lonMin = 0
|
||||
lonDeg = lonDeg + 1
|
||||
end
|
||||
|
||||
local minFrmtStr -- create the formatting string for the minutes place
|
||||
if acc <= 0 then -- no decimal place.
|
||||
minFrmtStr = '%02d'
|
||||
else
|
||||
local width = 3 + acc -- 01.310 - that's a width of 6, for example.
|
||||
minFrmtStr = '%0' .. width .. '.' .. acc .. 'f'
|
||||
end
|
||||
|
||||
-- 024 23'N or 024 23.123'N
|
||||
return latHemi..string.format('%02d:', latDeg) .. string.format(minFrmtStr, latMin), lonHemi..string.format('%02d:', lonDeg) .. string.format(minFrmtStr, lonMin)
|
||||
|
||||
end
|
||||
|
||||
-- acc- the accuracy of each easting/northing. 0, 1, 2, 3, 4, or 5.
|
||||
UTILS.tostringMGRS = function(MGRS, acc) --R2.1
|
||||
|
||||
@@ -2171,6 +2237,11 @@ function UTILS.IsLoadingDoorOpen( unit_name )
|
||||
return true -- no doors on this one ;)
|
||||
end
|
||||
|
||||
if type_name == "MH-60R" and (unit:getDrawArgumentValue(403) > 0 or unit:getDrawArgumentValue(403) == -1) then
|
||||
BASE:T(unit_name .. " cargo door is open")
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
|
||||
end -- nil
|
||||
@@ -3442,6 +3513,25 @@ function string.contains(str, value)
|
||||
return string.match(str, value)
|
||||
end
|
||||
|
||||
|
||||
--- Moves an object from one table to another
|
||||
-- @param #obj object to move
|
||||
-- @param #from_table table to move from
|
||||
-- @param #to_table table to move to
|
||||
function table.move_object(obj, from_table, to_table)
|
||||
local index
|
||||
for i, v in pairs(from_table) do
|
||||
if v == obj then
|
||||
index = i
|
||||
end
|
||||
end
|
||||
|
||||
if index then
|
||||
local moved = table.remove(from_table, index)
|
||||
table.insert_unique(to_table, moved)
|
||||
end
|
||||
end
|
||||
|
||||
--- Given tbl is a indexed table ({"hello", "dcs", "world"}), checks if element exists in the table.
|
||||
--- The table can be made up out of complex tables or values as well
|
||||
-- @param #table tbl
|
||||
@@ -3659,3 +3749,135 @@ end
|
||||
function UTILS.OctalToDecimal(Number)
|
||||
return tonumber(Number,8)
|
||||
end
|
||||
|
||||
|
||||
--- HexToRGBA
|
||||
-- @param hex_string table
|
||||
-- @return #table R, G, B, A
|
||||
function UTILS.HexToRGBA(hex_string)
|
||||
local hexNumber = tonumber(string.sub(hex_string, 3), 16) -- convert the string to a number
|
||||
-- extract RGBA components
|
||||
local alpha = hexNumber % 256
|
||||
hexNumber = (hexNumber - alpha) / 256
|
||||
local blue = hexNumber % 256
|
||||
hexNumber = (hexNumber - blue) / 256
|
||||
local green = hexNumber % 256
|
||||
hexNumber = (hexNumber - green) / 256
|
||||
local red = hexNumber % 256
|
||||
|
||||
return {R = red, G = green, B = blue, A = alpha}
|
||||
end
|
||||
|
||||
|
||||
--- Function to save the position of a set of #OPSGROUP (ARMYGROUP) objects.
|
||||
-- @param Core.Set#SET_OPSGROUP Set of ops objects to save
|
||||
-- @param #string Path The path to use. Use double backslashes \\\\ on Windows filesystems.
|
||||
-- @param #string Filename The name of the file.
|
||||
-- @param #boolean Structured Append the data with a list of typenames in the group plus their count.
|
||||
-- @return #boolean outcome True if saving is successful, else false.
|
||||
function UTILS.SaveSetOfOpsGroups(Set,Path,Filename,Structured)
|
||||
local filename = Filename or "SetOfGroups"
|
||||
local data = "--Save SET of groups: (name,legion,template,alttemplate,units,position.x,position.y,position.z,strucdata) "..Filename .."\n"
|
||||
local List = Set:GetSetObjects()
|
||||
for _,_group in pairs (List) do
|
||||
local group = _group:GetGroup() -- Wrapper.Group#GROUP
|
||||
if group and group:IsAlive() then
|
||||
local name = group:GetName()
|
||||
local template = string.gsub(name,"(.AID.%d+$","")
|
||||
if string.find(template,"#") then
|
||||
template = string.gsub(name,"#(%d+)$","")
|
||||
end
|
||||
local alttemplate = _group.templatename or "none"
|
||||
local legiono = _group.legion -- Ops.Legion#LEGION
|
||||
local legion = "none"
|
||||
if legiono and type(legiono) == "table" and legiono.ClassName then
|
||||
legion = legiono:GetName()
|
||||
local asset = legiono:GetAssetByName(name) -- Functional.Warehouse#WAREHOUSE.Assetitem
|
||||
alttemplate=asset.templatename
|
||||
end
|
||||
local units = group:CountAliveUnits()
|
||||
local position = group:GetVec3()
|
||||
if Structured then
|
||||
local structure = UTILS.GetCountPerTypeName(group)
|
||||
local strucdata = ""
|
||||
for typen,anzahl in pairs (structure) do
|
||||
strucdata = strucdata .. typen .. "=="..anzahl..";"
|
||||
end
|
||||
data = string.format("%s%s,%s,%s,%s,%d,%d,%d,%d,%s\n",data,name,legion,template,alttemplate,units,position.x,position.y,position.z,strucdata)
|
||||
else
|
||||
data = string.format("%s%s,%s,%s,%s,%d,%d,%d,%d\n",data,name,legion,template,alttemplate,units,position.x,position.y,position.z)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- save the data
|
||||
local outcome = UTILS.SaveToFile(Path,Filename,data)
|
||||
return outcome
|
||||
end
|
||||
|
||||
--- Load back a #OPSGROUP (ARMYGROUP) data from file for use with @{Ops.Brigade#BRIGADE.LoadBackAssetInPosition}()
|
||||
-- @param #string Path The path to use. Use double backslashes \\\\ on Windows filesystems.
|
||||
-- @param #string Filename The name of the file.
|
||||
-- @return #table Returns a table of data entries: `{ groupname=groupname, size=size, coordinate=coordinate, template=template, structure=structure, legion=legion, alttemplate=alttemplate }`
|
||||
-- Returns nil when the file cannot be read.
|
||||
function UTILS.LoadSetOfOpsGroups(Path,Filename)
|
||||
|
||||
local filename = Filename or "SetOfGroups"
|
||||
local datatable = {}
|
||||
|
||||
if UTILS.CheckFileExists(Path,filename) then
|
||||
local outcome,loadeddata = UTILS.LoadFromFile(Path,Filename)
|
||||
-- remove header
|
||||
table.remove(loadeddata, 1)
|
||||
for _id,_entry in pairs (loadeddata) do
|
||||
local dataset = UTILS.Split(_entry,",")
|
||||
-- 1name,2legion,3template,4alttemplate,5units,6position.x,7position.y,8position.z,9strucdata
|
||||
local groupname = dataset[1]
|
||||
local legion = dataset[2]
|
||||
local template = dataset[3]
|
||||
local alttemplate = dataset[4]
|
||||
local size = tonumber(dataset[5])
|
||||
local posx = tonumber(dataset[6])
|
||||
local posy = tonumber(dataset[7])
|
||||
local posz = tonumber(dataset[8])
|
||||
local structure = dataset[9]
|
||||
local coordinate = COORDINATE:NewFromVec3({x=posx, y=posy, z=posz})
|
||||
if size > 0 then
|
||||
local data = { groupname=groupname, size=size, coordinate=coordinate, template=template, structure=structure, legion=legion, alttemplate=alttemplate }
|
||||
table.insert(datatable,data)
|
||||
end
|
||||
end
|
||||
else
|
||||
return nil
|
||||
end
|
||||
|
||||
return datatable
|
||||
end
|
||||
|
||||
--- Get the clock position from a relative heading
|
||||
-- @param #number refHdg The heading of the reference object (such as a Wrapper.UNIT) in 0-360
|
||||
-- @param #number tgtHdg The absolute heading from the reference object to the target object/point in 0-360
|
||||
-- @return #string text Text in clock heading such as "4 O'CLOCK"
|
||||
-- @usage Display the range and clock distance of a BTR in relation to REAPER 1-1's heading:
|
||||
--
|
||||
-- myUnit = UNIT:FindByName( "REAPER 1-1" )
|
||||
-- myTarget = GROUP:FindByName( "BTR-1" )
|
||||
--
|
||||
-- coordUnit = myUnit:GetCoordinate()
|
||||
-- coordTarget = myTarget:GetCoordinate()
|
||||
--
|
||||
-- hdgUnit = myUnit:GetHeading()
|
||||
-- hdgTarget = coordUnit:HeadingTo( coordTarget )
|
||||
-- distTarget = coordUnit:Get3DDistance( coordTarget )
|
||||
--
|
||||
-- clockString = UTILS.ClockHeadingString( hdgUnit, hdgTarget )
|
||||
--
|
||||
-- -- Will show this message to REAPER 1-1 in-game: Contact BTR at 3 o'clock for 1134m!
|
||||
-- MESSAGE:New("Contact BTR at " .. clockString .. " for " .. distTarget .. "m!):ToUnit( myUnit )
|
||||
function UTILS.ClockHeadingString(refHdg,tgtHdg)
|
||||
local relativeAngle = tgtHdg - refHdg
|
||||
if relativeAngle < 0 then
|
||||
relativeAngle = relativeAngle + 360
|
||||
end
|
||||
local clockPos = math.ceil((relativeAngle % 360) / 30)
|
||||
return clockPos.." o'clock"
|
||||
end
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -723,7 +723,7 @@ end
|
||||
--- Converts a JSON string to a lua value.
|
||||
-- @param #string Json Anything JSON
|
||||
-- @return #table Lua
|
||||
function NET.Lua2Json(Json)
|
||||
function NET.Json2Lua(Json)
|
||||
return net.json2lua(Json)
|
||||
end
|
||||
|
||||
|
||||
@@ -123,18 +123,38 @@ end
|
||||
|
||||
--- Check if SCENERY Object is alive.
|
||||
--@param #SCENERY self
|
||||
--@param #number Threshold (Optional) If given, SCENERY counts as alive above this relative life in percent (1..100).
|
||||
--@return #number life
|
||||
function SCENERY:IsAlive()
|
||||
return self:GetLife() >= 1 and true or false
|
||||
function SCENERY:IsAlive(Threshold)
|
||||
if not Threshold then
|
||||
return self:GetLife() >= 1 and true or false
|
||||
else
|
||||
return self:GetRelativeLife() > Threshold and true or false
|
||||
end
|
||||
end
|
||||
|
||||
--- Check if SCENERY Object is dead.
|
||||
--@param #SCENERY self
|
||||
--@param #number Threshold (Optional) If given, SCENERY counts as dead below this relative life in percent (1..100).
|
||||
--@return #number life
|
||||
function SCENERY:IsDead()
|
||||
return self:GetLife() < 1 and true or false
|
||||
function SCENERY:IsDead(Threshold)
|
||||
if not Threshold then
|
||||
return self:GetLife() < 1 and true or false
|
||||
else
|
||||
return self:GetRelativeLife() <= Threshold and true or false
|
||||
end
|
||||
end
|
||||
|
||||
--- Get SCENERY relative life in percent, e.g. 75.
|
||||
--@param #SCENERY self
|
||||
--@return #number rlife
|
||||
function SCENERY:GetRelativeLife()
|
||||
local life = self:GetLife()
|
||||
local life0 = self:GetLife0()
|
||||
local rlife = math.floor((life/life0)*100)
|
||||
return rlife
|
||||
end
|
||||
|
||||
--- Get the threat level of a SCENERY object. Always 0 as scenery does not pose a threat to anyone.
|
||||
--@param #SCENERY self
|
||||
--@return #number Threat level 0.
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
-- @image Wrapper_Static.JPG
|
||||
|
||||
|
||||
--- @type STATIC
|
||||
---
|
||||
-- @type STATIC
|
||||
-- @extends Wrapper.Positionable#POSITIONABLE
|
||||
|
||||
--- Wrapper class to handle Static objects.
|
||||
@@ -236,7 +237,7 @@ function STATIC:SpawnAt(Coordinate, Heading, Delay)
|
||||
end
|
||||
|
||||
|
||||
--- Respawn the @{Wrapper.Unit} at the same location with the same properties.
|
||||
--- Respawn the @{Wrapper.Static} at the same location with the same properties.
|
||||
-- This is useful to respawn a cargo after it has been destroyed.
|
||||
-- @param #STATIC self
|
||||
-- @param DCS#country.id CountryID (Optional) The country ID used for spawning the new static. Default is same as currently.
|
||||
@@ -248,7 +249,7 @@ function STATIC:ReSpawn(CountryID, Delay)
|
||||
else
|
||||
|
||||
CountryID=CountryID or self:GetCountry()
|
||||
|
||||
|
||||
local SpawnStatic=SPAWNSTATIC:NewFromStatic(self.StaticName, CountryID)
|
||||
|
||||
SpawnStatic:Spawn(nil, self.StaticName)
|
||||
@@ -270,8 +271,8 @@ function STATIC:ReSpawnAt(Coordinate, Heading, Delay)
|
||||
|
||||
if Delay and Delay>0 then
|
||||
SCHEDULER:New(nil, self.ReSpawnAt, {self, Coordinate, Heading}, Delay)
|
||||
else
|
||||
|
||||
else
|
||||
|
||||
local SpawnStatic=SPAWNSTATIC:NewFromStatic(self.StaticName, self:GetCountry())
|
||||
|
||||
SpawnStatic:SpawnFromCoordinate(Coordinate, Heading, self.StaticName)
|
||||
@@ -280,3 +281,52 @@ function STATIC:ReSpawnAt(Coordinate, Heading, Delay)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Find the first(!) STATIC matching using patterns. Note that this is **a lot** slower than `:FindByName()`!
|
||||
-- @param #STATIC self
|
||||
-- @param #string Pattern The pattern to look for. Refer to [LUA patterns](http://www.easyuo.com/openeuo/wiki/index.php/Lua_Patterns_and_Captures_\(Regular_Expressions\)) for regular expressions in LUA.
|
||||
-- @return #STATIC The STATIC.
|
||||
-- @usage
|
||||
-- -- Find a static with a partial static name
|
||||
-- local grp = STATIC:FindByMatching( "Apple" )
|
||||
-- -- will return e.g. a static named "Apple-1-1"
|
||||
--
|
||||
-- -- using a pattern
|
||||
-- local grp = STATIC:FindByMatching( ".%d.%d$" )
|
||||
-- -- will return the first static found ending in "-1-1" to "-9-9", but not e.g. "-10-1"
|
||||
function STATIC:FindByMatching( Pattern )
|
||||
local GroupFound = nil
|
||||
|
||||
for name,static in pairs(_DATABASE.STATICS) do
|
||||
if string.match(name, Pattern ) then
|
||||
GroupFound = static
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
return GroupFound
|
||||
end
|
||||
|
||||
--- Find all STATIC objects matching using patterns. Note that this is **a lot** slower than `:FindByName()`!
|
||||
-- @param #STATIC self
|
||||
-- @param #string Pattern The pattern to look for. Refer to [LUA patterns](http://www.easyuo.com/openeuo/wiki/index.php/Lua_Patterns_and_Captures_\(Regular_Expressions\)) for regular expressions in LUA.
|
||||
-- @return #table Groups Table of matching #STATIC objects found
|
||||
-- @usage
|
||||
-- -- Find all static with a partial static name
|
||||
-- local grptable = STATIC:FindAllByMatching( "Apple" )
|
||||
-- -- will return all statics with "Apple" in the name
|
||||
--
|
||||
-- -- using a pattern
|
||||
-- local grp = STATIC:FindAllByMatching( ".%d.%d$" )
|
||||
-- -- will return the all statics found ending in "-1-1" to "-9-9", but not e.g. "-10-1" or "-1-10"
|
||||
function STATIC:FindAllByMatching( Pattern )
|
||||
local GroupsFound = {}
|
||||
|
||||
for name,static in pairs(_DATABASE.STATICS) do
|
||||
if string.match(name, Pattern ) then
|
||||
GroupsFound[#GroupsFound+1] = static
|
||||
end
|
||||
end
|
||||
|
||||
return GroupsFound
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
--
|
||||
-- ## Example Missions:
|
||||
--
|
||||
-- Demo missions can be found on [github](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/Wrapper/Storage).
|
||||
-- Demo missions can be found on [github](https://github.com/FlightControl-Master/MOOSE_Demos/tree/master/Wrapper/Storage).
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
@@ -33,93 +33,93 @@
|
||||
-- ===
|
||||
--
|
||||
-- # The STORAGE Concept
|
||||
--
|
||||
-- The STORAGE class offers an easy-to-use wrapper interface to all DCS API functions of DCS warehouses.
|
||||
--
|
||||
-- The STORAGE class offers an easy-to-use wrapper interface to all DCS API functions of DCS warehouses.
|
||||
-- We named the class STORAGE, because the name WAREHOUSE is already taken by another MOOSE class.
|
||||
--
|
||||
--
|
||||
-- This class allows you to add and remove items to a DCS warehouse, such as aircraft, liquids, weapons and other equipment.
|
||||
--
|
||||
--
|
||||
-- # Constructor
|
||||
--
|
||||
--
|
||||
-- A DCS warehouse is associated with an airbase. Therefore, a `STORAGE` instance is automatically created, once an airbase is registered and added to the MOOSE database.
|
||||
--
|
||||
-- You can get the `STORAGE` object from the
|
||||
--
|
||||
-- -- Create a STORAGE instance of the Batumi warehouse
|
||||
--
|
||||
-- You can get the `STORAGE` object from the
|
||||
--
|
||||
-- -- Create a STORAGE instance of the Batumi warehouse
|
||||
-- local storage=STORAGE:FindByName("Batumi")
|
||||
--
|
||||
--
|
||||
-- An other way to get the `STORAGE` object is to retrieve it from the AIRBASE function `AIRBASE:GetStorage()`
|
||||
--
|
||||
--
|
||||
-- -- Get storage instance of Batumi airbase
|
||||
-- local Batumi=AIRBASE:FindByName("Batumi")
|
||||
-- local storage=Batumi:GetStorage()
|
||||
--
|
||||
--
|
||||
-- # Aircraft, Weapons and Equipment
|
||||
--
|
||||
--
|
||||
-- ## Adding Items
|
||||
--
|
||||
--
|
||||
-- To add aircraft, weapons and/or othe equipment, you can use the @{#STORAGE.AddItem}() function
|
||||
--
|
||||
--
|
||||
-- storage:AddItem("A-10C", 3)
|
||||
-- storage:AddItem("weapons.missiles.AIM_120C", 10)
|
||||
--
|
||||
--
|
||||
-- This will add three A-10Cs and ten AIM-120C missiles to the warehouse inventory.
|
||||
--
|
||||
--
|
||||
-- ## Setting Items
|
||||
--
|
||||
--
|
||||
-- You can also explicitly set, how many items are in the inventory with the @{#STORAGE.SetItem}() function.
|
||||
--
|
||||
--
|
||||
-- ## Removing Items
|
||||
--
|
||||
--
|
||||
-- Items can be removed from the inventory with the @{#STORAGE.RemoveItem}() function.
|
||||
--
|
||||
--
|
||||
-- ## Getting Amount
|
||||
--
|
||||
--
|
||||
-- The number of items currently in the inventory can be obtained with the @{#STORAGE.GetItemAmount}() function
|
||||
--
|
||||
--
|
||||
-- local N=storage:GetItemAmount("A-10C")
|
||||
-- env.info(string.format("We currently have %d A-10Cs available", N))
|
||||
--
|
||||
--
|
||||
-- # Liquids
|
||||
--
|
||||
--
|
||||
-- Liquids can be added and removed by slightly different functions as described below. Currently there are four types of liquids
|
||||
--
|
||||
--
|
||||
-- * Jet fuel `STORAGE.Liquid.JETFUEL`
|
||||
-- * Aircraft gasoline `STORAGE.Liquid.GASOLINE`
|
||||
-- * MW 50 `STORAGE.Liquid.MW50`
|
||||
-- * Diesel `STORAGE.Liquid.DIESEL`
|
||||
--
|
||||
--
|
||||
-- ## Adding Liquids
|
||||
--
|
||||
--
|
||||
-- To add a certain type of liquid, you can use the @{#STORAGE.AddItem}(Type, Amount) function
|
||||
--
|
||||
--
|
||||
-- storage:AddLiquid(STORAGE.Liquid.JETFUEL, 10000)
|
||||
-- storage:AddLiquid(STORAGE.Liquid.DIESEL, 20000)
|
||||
--
|
||||
--
|
||||
-- This will add 10,000 kg of jet fuel and 20,000 kg of diesel to the inventory.
|
||||
--
|
||||
--
|
||||
-- ## Setting Liquids
|
||||
--
|
||||
--
|
||||
-- You can also explicitly set the amount of liquid with the @{#STORAGE.SetLiquid}(Type, Amount) function.
|
||||
--
|
||||
--
|
||||
-- ## Removing Liquids
|
||||
--
|
||||
--
|
||||
-- Liquids can be removed with @{#STORAGE.RemoveLiquid}(Type, Amount) function.
|
||||
--
|
||||
--
|
||||
-- ## Getting Amount
|
||||
--
|
||||
--
|
||||
-- The current amount of a certain liquid can be obtained with the @{#STORAGE.GetLiquidAmount}(Type) function
|
||||
--
|
||||
--
|
||||
-- local N=storage:GetLiquidAmount(STORAGE.Liquid.DIESEL)
|
||||
-- env.info(string.format("We currently have %d kg of Diesel available", N))
|
||||
--
|
||||
--
|
||||
--
|
||||
--
|
||||
-- # Inventory
|
||||
--
|
||||
--
|
||||
-- The current inventory of the warehouse can be obtained with the @{#STORAGE.GetInventory}() function. This returns three tables with the aircraft, liquids and weapons:
|
||||
--
|
||||
--
|
||||
-- local aircraft, liquids, weapons=storage:GetInventory()
|
||||
--
|
||||
--
|
||||
-- UTILS.PrintTableToLog(aircraft)
|
||||
-- UTILS.PrintTableToLog(liquids)
|
||||
-- UTILS.PrintTableToLog(weapons)
|
||||
@@ -168,7 +168,7 @@ function STORAGE:New(AirbaseName)
|
||||
local self=BASE:Inherit(self, BASE:New()) -- #STORAGE
|
||||
|
||||
self.airbase=Airbase.getByName(AirbaseName)
|
||||
|
||||
|
||||
if Airbase.getWarehouse then
|
||||
self.warehouse=self.airbase:getWarehouse()
|
||||
end
|
||||
@@ -322,7 +322,7 @@ end
|
||||
function STORAGE:GetLiquidName(Type)
|
||||
|
||||
local name="Unknown"
|
||||
|
||||
|
||||
if Type==STORAGE.Liquid.JETFUEL then
|
||||
name = "Jet fuel"
|
||||
elseif Type==STORAGE.Liquid.GASOLINE then
|
||||
@@ -411,25 +411,25 @@ function STORAGE:IsUnlimited(Type)
|
||||
|
||||
-- Get current amount of type.
|
||||
local N=self:GetAmount(Type)
|
||||
|
||||
|
||||
local unlimited=false
|
||||
|
||||
|
||||
if N>0 then
|
||||
|
||||
|
||||
-- Remove one item.
|
||||
self:RemoveAmount(Type, 1)
|
||||
|
||||
|
||||
-- Get amount.
|
||||
local n=self:GetAmount(Type)
|
||||
|
||||
|
||||
-- If amount did not change, it is unlimited.
|
||||
unlimited=n==N
|
||||
|
||||
|
||||
-- Add item back.
|
||||
if not unlimited then
|
||||
self:AddAmount(Type, 1)
|
||||
end
|
||||
|
||||
|
||||
-- Debug info.
|
||||
self:I(self.lid..string.format("Type=%s: unlimited=%s (N=%d n=%d)", tostring(Type), tostring(unlimited), N, n))
|
||||
end
|
||||
@@ -523,7 +523,7 @@ end
|
||||
function STORAGE:GetInventory(Item)
|
||||
|
||||
local inventory=self.warehouse:getInventory(Item)
|
||||
|
||||
|
||||
return inventory.aircraft, inventory.liquids, inventory.weapon
|
||||
end
|
||||
|
||||
|
||||
@@ -1244,7 +1244,9 @@ function UNIT:GetThreatLevel()
|
||||
|
||||
if Attributes["Fighters"] then ThreatLevel = 10
|
||||
elseif Attributes["Multirole fighters"] then ThreatLevel = 9
|
||||
elseif Attributes["Interceptors"] then ThreatLevel = 9
|
||||
elseif Attributes["Battleplanes"] then ThreatLevel = 8
|
||||
elseif Attributes["Battle airplanes"] then ThreatLevel = 8
|
||||
elseif Attributes["Attack helicopters"] then ThreatLevel = 7
|
||||
elseif Attributes["Strategic bombers"] then ThreatLevel = 6
|
||||
elseif Attributes["Bombers"] then ThreatLevel = 5
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
--
|
||||
-- ## Additional Material:
|
||||
--
|
||||
-- * **Demo Missions:** [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/Wrapper/Weapon)
|
||||
-- * **Demo Missions:** [GitHub](https://github.com/FlightControl-Master/MOOSE_Demos/tree/master/Wrapper/Weapon)
|
||||
-- * **YouTube videos:** None
|
||||
-- * **Guides:** None
|
||||
--
|
||||
@@ -40,6 +40,7 @@
|
||||
-- @field #number coalition Coalition ID.
|
||||
-- @field #number country Country ID.
|
||||
-- @field DCS#Desc desc Descriptor table.
|
||||
-- @field DCS#Desc guidance Missile guidance descriptor.
|
||||
-- @field DCS#Unit launcher Launcher DCS unit.
|
||||
-- @field Wrapper.Unit#UNIT launcherUnit Launcher Unit.
|
||||
-- @field #string launcherName Name of launcher unit.
|
||||
@@ -69,77 +70,77 @@
|
||||
-- ===
|
||||
--
|
||||
-- # The WEAPON Concept
|
||||
--
|
||||
--
|
||||
-- The WEAPON class offers an easy-to-use wrapper interface to all DCS API functions.
|
||||
--
|
||||
--
|
||||
-- Probably, the most striking highlight is that the position of the weapon can be tracked and its impact position can be determined, which is not
|
||||
-- possible with the native DCS scripting engine functions.
|
||||
--
|
||||
-- **Note** that this wrapper class is different from most others as weapon objects cannot be found with a DCS API function like `getByName()`.
|
||||
-- They can only be found in DCS events like the "Shot" event, where the weapon object is contained in the event data.
|
||||
--
|
||||
--
|
||||
-- # Tracking
|
||||
--
|
||||
--
|
||||
-- The status of the weapon can be tracked with the @{#WEAPON.StartTrack} function. This function will try to determin the position of the weapon in (normally) relatively
|
||||
-- small time steps. The time step can be set via the @{#WEAPON.SetTimeStepTrack} function and is by default set to 0.01 seconds.
|
||||
--
|
||||
--
|
||||
-- Once the position cannot be retrieved any more, the weapon has impacted (or was destroyed otherwise) and the last known position is safed as the impact point.
|
||||
-- The impact point can be accessed with the @{#WEAPON.GetImpactVec3} or @{#WEAPON.GetImpactCoordinate} functions.
|
||||
--
|
||||
--
|
||||
-- ## Impact Point Marking
|
||||
--
|
||||
--
|
||||
-- You can mark the impact point on the F10 map with @{#WEAPON.SetMarkImpact}.
|
||||
--
|
||||
--
|
||||
-- You can also trigger coloured smoke at the impact point via @{#WEAPON.SetSmokeImpact}.
|
||||
--
|
||||
--
|
||||
-- ## Callback functions
|
||||
--
|
||||
--
|
||||
-- It is possible to define functions that are called during the tracking of the weapon and upon impact, which help you to customize further actions.
|
||||
--
|
||||
--
|
||||
-- ### Callback on Impact
|
||||
--
|
||||
--
|
||||
-- The function called on impact can be set with @{#WEAPON.SetFuncImpact}
|
||||
--
|
||||
--
|
||||
-- ### Callback when Tracking
|
||||
--
|
||||
--
|
||||
-- The function called each time the weapon status is tracked can be set with @{#WEAPON.SetFuncTrack}
|
||||
--
|
||||
--
|
||||
-- # Target
|
||||
--
|
||||
-- If the weapon has a specific target, you can get it with the @{#WEAPON.GetTarget} function. Note that the object, which is returned can vary. Normally, it is a UNIT
|
||||
--
|
||||
-- If the weapon has a specific target, you can get it with the @{#WEAPON.GetTarget} function. Note that the object, which is returned can vary. Normally, it is a UNIT
|
||||
-- but it could also be a STATIC object.
|
||||
--
|
||||
--
|
||||
-- Also note that the weapon does not always have a target, it can loose a target and re-aquire it and the target might change to another unit.
|
||||
--
|
||||
--
|
||||
-- You can get the target name with the @{#WEAPON.GetTargetName} function.
|
||||
--
|
||||
--
|
||||
-- The distance to the target is returned by the @{#WEAPON.GetTargetDistance} function.
|
||||
--
|
||||
--
|
||||
-- # Category
|
||||
--
|
||||
--
|
||||
-- The category (bomb, rocket, missile, shell, torpedo) of the weapon can be retrieved with the @{#WEAPON.GetCategory} function.
|
||||
--
|
||||
-- You can check if the weapon is a
|
||||
--
|
||||
--
|
||||
-- You can check if the weapon is a
|
||||
--
|
||||
-- * bomb with @{#WEAPON.IsBomb}
|
||||
-- * rocket with @{#WEAPON.IsRocket}
|
||||
-- * missile with @{#WEAPON.IsMissile}
|
||||
-- * shell with @{#WEAPON.IsShell}
|
||||
-- * torpedo with @{#WEAPON.IsTorpedo}
|
||||
--
|
||||
--
|
||||
-- # Parameters
|
||||
--
|
||||
--
|
||||
-- You can get various parameters of the weapon, *e.g.*
|
||||
--
|
||||
--
|
||||
-- * position: @{#WEAPON.GetVec3}, @{#WEAPON.GetVec2 }, @{#WEAPON.GetCoordinate}
|
||||
-- * speed: @{#WEAPON.GetSpeed}
|
||||
-- * coalition: @{#WEAPON.GetCoalition}
|
||||
-- * country: @{#WEAPON.GetCountry}
|
||||
--
|
||||
--
|
||||
-- # Dependencies
|
||||
--
|
||||
--
|
||||
-- This class is used (at least) in the MOOSE classes:
|
||||
--
|
||||
--
|
||||
-- * RANGE (to determine the impact points of bombs and missiles)
|
||||
-- * ARTY (to destroy and replace shells with smoke or illumination)
|
||||
-- * FOX (to destroy the missile before it hits the target)
|
||||
@@ -181,48 +182,51 @@ function WEAPON:New(WeaponObject)
|
||||
|
||||
-- Inherit everything from FSM class.
|
||||
local self=BASE:Inherit(self, POSITIONABLE:New("Weapon")) -- #WEAPON
|
||||
|
||||
|
||||
-- Set DCS weapon object.
|
||||
self.weapon=WeaponObject
|
||||
|
||||
|
||||
-- Descriptors containing a lot of info.
|
||||
self.desc=WeaponObject:getDesc()
|
||||
|
||||
-- This gives the object category which is always Object.Category.WEAPON!
|
||||
--self.category=WeaponObject:getCategory()
|
||||
|
||||
|
||||
-- Weapon category: 0=SHELL, 1=MISSILE, 2=ROCKET, 3=BOMB (Weapon.Category.X)
|
||||
self.category = self.desc.category
|
||||
|
||||
if self:IsMissile() and self.desc.missileCategory then
|
||||
if self:IsMissile() and self.desc.missileCategory then
|
||||
self.categoryMissile=self.desc.missileCategory
|
||||
if self.desc.guidance then
|
||||
self.guidance = self.desc.guidance
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Get type name.
|
||||
self.typeName=WeaponObject:getTypeName() or "Unknown Type"
|
||||
|
||||
|
||||
-- Get name of object. Usually a number like "1234567".
|
||||
self.name=WeaponObject:getName()
|
||||
|
||||
|
||||
-- Get coaliton of weapon.
|
||||
self.coalition=WeaponObject:getCoalition()
|
||||
|
||||
|
||||
-- Get country of weapon.
|
||||
self.country=WeaponObject:getCountry()
|
||||
|
||||
|
||||
-- Get DCS unit of the launcher.
|
||||
self.launcher=WeaponObject:getLauncher()
|
||||
|
||||
|
||||
-- Get launcher of weapon.
|
||||
self.launcherName="Unknown Launcher"
|
||||
if self.launcher then
|
||||
self.launcherName=self.launcher:getName()
|
||||
self.launcherUnit=UNIT:Find(self.launcher)
|
||||
end
|
||||
|
||||
|
||||
-- Init the coordinate of the weapon from that of the launcher.
|
||||
self.coordinate=COORDINATE:NewFromVec3(self.launcher:getPoint())
|
||||
|
||||
|
||||
-- Set log ID.
|
||||
self.lid=string.format("[%s] %s | ", self.typeName, self.name)
|
||||
|
||||
@@ -237,12 +241,12 @@ function WEAPON:New(WeaponObject)
|
||||
-- Set default parameters
|
||||
self:SetTimeStepTrack()
|
||||
self:SetDistanceInterceptPoint()
|
||||
|
||||
|
||||
-- Debug info.
|
||||
local text=string.format("Weapon v%s\nName=%s, TypeName=%s, Category=%s, Coalition=%d, Country=%d, Launcher=%s",
|
||||
local text=string.format("Weapon v%s\nName=%s, TypeName=%s, Category=%s, Coalition=%d, Country=%d, Launcher=%s",
|
||||
self.version, self.name, self.typeName, self.category, self.coalition, self.country, self.launcherName)
|
||||
self:T(self.lid..text)
|
||||
|
||||
|
||||
-- Descriptors.
|
||||
self:T2(self.desc)
|
||||
|
||||
@@ -312,13 +316,13 @@ function WEAPON:SetSmokeImpact(Switch, SmokeColor)
|
||||
else
|
||||
self.impactSmoke=true
|
||||
end
|
||||
|
||||
|
||||
self.impactSmokeColor=SmokeColor or SMOKECOLOR.Red
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set callback function when weapon is tracked and still alive. The first argument will be the WEAPON object.
|
||||
--- Set callback function when weapon is tracked and still alive. The first argument will be the WEAPON object.
|
||||
-- Note that this can be called many times per second. So be careful for performance reasons.
|
||||
-- @param #WEAPON self
|
||||
-- @param #function FuncTrack Function called during tracking.
|
||||
@@ -335,19 +339,19 @@ end
|
||||
-- @param #function FuncImpact Function called once the weapon impacted.
|
||||
-- @param ... Optional function arguments.
|
||||
-- @return #WEAPON self
|
||||
--
|
||||
--
|
||||
-- @usage
|
||||
-- -- Function called on impact.
|
||||
-- local function OnImpact(Weapon)
|
||||
-- Weapon:GetImpactCoordinate():MarkToAll("Impact Coordinate of weapon")
|
||||
-- end
|
||||
--
|
||||
--
|
||||
-- -- Set which function to call.
|
||||
-- myweapon:SetFuncImpact(OnImpact)
|
||||
--
|
||||
--
|
||||
-- -- Start tracking.
|
||||
-- myweapon:Track()
|
||||
--
|
||||
--
|
||||
function WEAPON:SetFuncImpact(FuncImpact, ...)
|
||||
self.impactFunc=FuncImpact
|
||||
self.impactArg=arg or {}
|
||||
@@ -368,37 +372,37 @@ end
|
||||
function WEAPON:GetTarget()
|
||||
|
||||
local target=nil --Wrapper.Object#OBJECT
|
||||
|
||||
|
||||
if self.weapon then
|
||||
|
||||
|
||||
-- Get the DCS target object, which can be a Unit, Weapon, Static, Scenery, Airbase.
|
||||
local object=self.weapon:getTarget()
|
||||
|
||||
|
||||
if object then
|
||||
|
||||
|
||||
-- Get object category.
|
||||
local category=Object.getCategory(object)
|
||||
|
||||
|
||||
--Target name
|
||||
local name=object:getName()
|
||||
|
||||
|
||||
-- Debug info.
|
||||
self:T(self.lid..string.format("Got Target Object %s, category=%d", object:getName(), category))
|
||||
|
||||
self:T(self.lid..string.format("Got Target Object %s, category=%d", object:getName(), category))
|
||||
|
||||
if category==Object.Category.UNIT then
|
||||
|
||||
|
||||
target=UNIT:FindByName(name)
|
||||
|
||||
|
||||
elseif category==Object.Category.STATIC then
|
||||
|
||||
|
||||
target=STATIC:FindByName(name, false)
|
||||
|
||||
|
||||
elseif category==Object.Category.SCENERY then
|
||||
self:E(self.lid..string.format("ERROR: Scenery target not implemented yet!"))
|
||||
else
|
||||
self:E(self.lid..string.format("ERROR: Object category=%d is not implemented yet!", category))
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -413,25 +417,25 @@ function WEAPON:GetTargetDistance(ConversionFunction)
|
||||
|
||||
-- Get the target of the weapon.
|
||||
local target=self:GetTarget() --Wrapper.Unit#UNIT
|
||||
|
||||
|
||||
local distance=nil
|
||||
if target then
|
||||
|
||||
-- Current position of target.
|
||||
local tv3=target:GetVec3()
|
||||
|
||||
|
||||
-- Current position of weapon.
|
||||
local wv3=self:GetVec3()
|
||||
|
||||
|
||||
if tv3 and wv3 then
|
||||
distance=UTILS.VecDist3D(tv3, wv3)
|
||||
|
||||
|
||||
if ConversionFunction then
|
||||
distance=ConversionFunction(distance)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
return distance
|
||||
@@ -445,10 +449,10 @@ function WEAPON:GetTargetName()
|
||||
|
||||
-- Get the target of the weapon.
|
||||
local target=self:GetTarget() --Wrapper.Unit#UNIT
|
||||
|
||||
|
||||
local name="None"
|
||||
if target then
|
||||
name=target:GetName()
|
||||
name=target:GetName()
|
||||
end
|
||||
|
||||
return name
|
||||
@@ -476,13 +480,13 @@ function WEAPON:GetSpeed(ConversionFunction)
|
||||
if self.weapon then
|
||||
|
||||
local v=self:GetVelocityVec3()
|
||||
|
||||
|
||||
speed=UTILS.VecNorm(v)
|
||||
|
||||
|
||||
if ConversionFunction then
|
||||
speed=ConversionFunction(speed)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
return speed
|
||||
@@ -508,11 +512,11 @@ end
|
||||
function WEAPON:GetVec2()
|
||||
|
||||
local vec3=self:GetVec3()
|
||||
|
||||
|
||||
if vec3 then
|
||||
|
||||
|
||||
local vec2={x=vec3.x, y=vec3.z}
|
||||
|
||||
|
||||
return vec2
|
||||
end
|
||||
|
||||
@@ -521,28 +525,28 @@ end
|
||||
|
||||
--- Get type name.
|
||||
-- @param #WEAPON self
|
||||
-- @return #string The type name.
|
||||
-- @return #string The type name.
|
||||
function WEAPON:GetTypeName()
|
||||
return self.typeName
|
||||
end
|
||||
|
||||
--- Get coalition.
|
||||
-- @param #WEAPON self
|
||||
-- @return #number Coalition ID.
|
||||
-- @return #number Coalition ID.
|
||||
function WEAPON:GetCoalition()
|
||||
return self.coalition
|
||||
end
|
||||
|
||||
--- Get country.
|
||||
-- @param #WEAPON self
|
||||
-- @return #number Country ID.
|
||||
-- @return #number Country ID.
|
||||
function WEAPON:GetCountry()
|
||||
return self.country
|
||||
end
|
||||
|
||||
--- Get DCS object.
|
||||
-- @param #WEAPON self
|
||||
-- @return DCS#Weapon The weapon object.
|
||||
-- @return DCS#Weapon The weapon object.
|
||||
function WEAPON:GetDCSObject()
|
||||
-- This polymorphic function is used in Wrapper.Identifiable#IDENTIFIABLE
|
||||
return self.weapon
|
||||
@@ -667,6 +671,26 @@ function WEAPON:IsTorpedo()
|
||||
return self.category==Weapon.Category.TORPEDO
|
||||
end
|
||||
|
||||
--- Check if weapon is a Fox One missile (Radar Semi-Active).
|
||||
-- @param #WEAPON self
|
||||
-- @return #boolean If `true`, is a Fox One.
|
||||
function WEAPON:IsFoxOne()
|
||||
return self.guidance==Weapon.GuidanceType.RADAR_SEMI_ACTIVE
|
||||
end
|
||||
|
||||
--- Check if weapon is a Fox Two missile (IR guided).
|
||||
-- @param #WEAPON self
|
||||
-- @return #boolean If `true`, is a Fox Two.
|
||||
function WEAPON:IsFoxTwo()
|
||||
return self.guidance==Weapon.GuidanceType.IR
|
||||
end
|
||||
|
||||
--- Check if weapon is a Fox Three missile (Radar Active).
|
||||
-- @param #WEAPON self
|
||||
-- @return #boolean If `true`, is a Fox Three.
|
||||
function WEAPON:IsFoxThree()
|
||||
return self.guidance==Weapon.GuidanceType.RADAR_ACTIVE
|
||||
end
|
||||
|
||||
--- Destroy the weapon object.
|
||||
-- @param #WEAPON self
|
||||
@@ -675,23 +699,23 @@ end
|
||||
function WEAPON:Destroy(Delay)
|
||||
|
||||
if Delay and Delay>0 then
|
||||
self:ScheduleOnce(Delay, WEAPON.Destroy, self, 0)
|
||||
self:ScheduleOnce(Delay, WEAPON.Destroy, self, 0)
|
||||
else
|
||||
if self.weapon then
|
||||
self:T(self.lid.."Destroying Weapon NOW!")
|
||||
self:StopTrack()
|
||||
self.weapon:destroy()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Start tracking the weapon until it impacts or is destroyed otherwise.
|
||||
-- The position of the weapon is monitored in small time steps. Once the position cannot be determined anymore, the monitoring is stopped and the last known position is
|
||||
-- the (approximate) impact point. Of course, the smaller the time step, the better the position can be determined. However, this can hit the performance as many
|
||||
-- The position of the weapon is monitored in small time steps. Once the position cannot be determined anymore, the monitoring is stopped and the last known position is
|
||||
-- the (approximate) impact point. Of course, the smaller the time step, the better the position can be determined. However, this can hit the performance as many
|
||||
-- calculations per second need to be carried out.
|
||||
-- @param #WEAPON self
|
||||
-- @param #WEAPON self
|
||||
-- @param #number Delay Delay in seconds before the tracking starts. Default 0.001 sec.
|
||||
-- @return #WEAPON self
|
||||
function WEAPON:StartTrack(Delay)
|
||||
@@ -700,8 +724,8 @@ function WEAPON:StartTrack(Delay)
|
||||
Delay=math.max(Delay or 0.001, 0.001)
|
||||
|
||||
-- Debug info.
|
||||
self:T(self.lid..string.format("Start tracking weapon in %.4f sec", Delay))
|
||||
|
||||
self:T(self.lid..string.format("Start tracking weapon in %.4f sec", Delay))
|
||||
|
||||
-- Weapon is not yet "alife" just yet. Start timer in 0.001 seconds.
|
||||
self.trackScheduleID=timer.scheduleFunction(WEAPON._TrackWeapon, self, timer.getTime() + Delay)
|
||||
|
||||
@@ -710,7 +734,7 @@ end
|
||||
|
||||
|
||||
--- Stop tracking the weapon by removing the scheduler function.
|
||||
-- @param #WEAPON self
|
||||
-- @param #WEAPON self
|
||||
-- @param #number Delay (Optional) Delay in seconds before the tracking is stopped.
|
||||
-- @return #WEAPON self
|
||||
function WEAPON:StopTrack(Delay)
|
||||
@@ -719,13 +743,13 @@ function WEAPON:StopTrack(Delay)
|
||||
-- Delayed call.
|
||||
self:ScheduleOnce(Delay, WEAPON.StopTrack, self, 0)
|
||||
else
|
||||
|
||||
|
||||
if self.trackScheduleID then
|
||||
|
||||
timer.removeFunction(self.trackScheduleID)
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
return self
|
||||
@@ -762,10 +786,10 @@ function WEAPON:_TrackWeapon(time)
|
||||
|
||||
-- Update last known position.
|
||||
self.pos3 = pos3
|
||||
|
||||
|
||||
-- Update last known vec3.
|
||||
self.vec3 = UTILS.DeepCopy(self.pos3.p)
|
||||
|
||||
|
||||
-- Update coordinate.
|
||||
self.coordinate:UpdateFromVec3(self.vec3)
|
||||
|
||||
@@ -774,70 +798,70 @@ function WEAPON:_TrackWeapon(time)
|
||||
|
||||
-- Keep on tracking by returning the next time below.
|
||||
self.tracking=true
|
||||
|
||||
|
||||
-- Callback function.
|
||||
if self.trackFunc then
|
||||
self.trackFunc(self, unpack(self.trackArg))
|
||||
end
|
||||
|
||||
|
||||
-- Verbose output.
|
||||
if self.verbose>=5 then
|
||||
|
||||
|
||||
-- Get vec2 of current position.
|
||||
local vec2={x=self.vec3.x, y=self.vec3.z}
|
||||
|
||||
|
||||
-- Land hight.
|
||||
local height=land.getHeight(vec2)
|
||||
|
||||
-- Current height above ground level.
|
||||
-- Current height above ground level.
|
||||
local agl=self.vec3.y-height
|
||||
|
||||
|
||||
-- Estimated IP (if any)
|
||||
local ip=self:_GetIP(self.distIP)
|
||||
|
||||
|
||||
-- Distance between positon and estimated impact.
|
||||
local d=0
|
||||
if ip then
|
||||
d=UTILS.VecDist3D(self.vec3, ip)
|
||||
end
|
||||
|
||||
|
||||
-- Output.
|
||||
self:I(self.lid..string.format("T=%.3f: Height=%.3f m AGL=%.3f m, dIP=%.3f", time, height, agl, d))
|
||||
|
||||
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
|
||||
---------------------------
|
||||
-- Weapon does NOT exist --
|
||||
---------------------------
|
||||
|
||||
---------------------------
|
||||
|
||||
-- Get intercept point from position (p) and direction (x) in 50 meters.
|
||||
local ip = self:_GetIP(self.distIP)
|
||||
|
||||
|
||||
if self.verbose>=10 and ip then
|
||||
|
||||
|
||||
-- Output.
|
||||
self:I(self.lid.."Got intercept point!")
|
||||
|
||||
|
||||
-- Coordinate of the impact point.
|
||||
local coord=COORDINATE:NewFromVec3(ip)
|
||||
|
||||
|
||||
-- Mark coordinate.
|
||||
coord:MarkToAll("Intercept point")
|
||||
coord:SmokeBlue()
|
||||
|
||||
|
||||
-- Distance to last known pos.
|
||||
local d=UTILS.VecDist3D(ip, self.vec3)
|
||||
|
||||
|
||||
-- Output.
|
||||
self:I(self.lid..string.format("FF d(ip, vec3)=%.3f meters", d))
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
-- Safe impact vec3.
|
||||
self.impactVec3=ip or self.vec3
|
||||
|
||||
|
||||
-- Safe impact coordinate.
|
||||
self.impactCoord=COORDINATE:NewFromVec3(self.vec3)
|
||||
|
||||
@@ -848,22 +872,22 @@ function WEAPON:_TrackWeapon(time)
|
||||
if self.impactMark then
|
||||
self.impactCoord:MarkToAll(string.format("Impact point of weapon %s\ntype=%s\nlauncher=%s", self.name, self.typeName, self.launcherName))
|
||||
end
|
||||
|
||||
|
||||
-- Smoke on impact point.
|
||||
if self.impactSmoke then
|
||||
self.impactCoord:Smoke(self.impactSmokeColor)
|
||||
end
|
||||
|
||||
|
||||
-- Call callback function.
|
||||
if self.impactFunc then
|
||||
self.impactFunc(self, unpack(self.impactArg or {}))
|
||||
end
|
||||
|
||||
|
||||
-- Stop tracking by returning nil below.
|
||||
self.tracking=false
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
-- Return next time the function is called or nil to stop the scheduler.
|
||||
if self.tracking then
|
||||
if self.dtTrack and self.dtTrack>=0.00001 then
|
||||
@@ -885,12 +909,12 @@ function WEAPON:_GetIP(Distance)
|
||||
Distance=Distance or 50
|
||||
|
||||
local ip=nil --DCS#Vec3
|
||||
|
||||
|
||||
if Distance>0 and self.pos3 then
|
||||
|
||||
-- Get intercept point from position (p) and direction (x) in 20 meters.
|
||||
ip = land.getIP(self.pos3.p, self.pos3.x, Distance or 20) --DCS#Vec3
|
||||
|
||||
|
||||
end
|
||||
|
||||
return ip
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="C:\ProgramData\chocolatey\lib\lua51\tools\lua5.1.exe"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value=""Moose Setup\Moose_Create.lua" "D" "LOCAL" "${resource_loc:/MOOSE/Moose Development/Moose}" "${resource_loc:/MOOSE/Moose Setup}" ${resource_loc:/MOOSE_INCLUDE/Moose_Include_Dynamic}"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/MOOSE}"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/Moose_Framework/lua54/lua54.exe}"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value=""Moose Setup/Moose_Create.lua" "D" "LOCAL" "${workspace_loc:/Moose_Framework/Moose Development/Moose}" "${workspace_loc:/Moose_Framework/Moose Setup}" "${workspace_loc:/Moose_Framework/MOOSE_INCLUDE\Moose_Include_Dynamic}" 1"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/Moose_Framework}"/>
|
||||
</launchConfiguration>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="C:\ProgramData\chocolatey\lib\lua51\tools\lua5.1.exe"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value=""Moose Setup\Moose_Create.lua" "S" "LOCAL" "${resource_loc:/MOOSE/Moose Development/Moose}" "${resource_loc:/MOOSE/Moose Setup}" ${resource_loc:/MOOSE_INCLUDE/Moose_Include_Static}"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/MOOSE}"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/Moose_Framework/lua54/lua54.exe}"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value=""Moose Setup\Moose_Create.lua" "S" "LOCAL" "${workspace_loc:/Moose_Framework/Moose Development/Moose}" "${workspace_loc:/Moose_Framework/Moose Setup}" "${workspace_loc:/Moose_Framework/MOOSE_INCLUDE\Moose_Include_Static}" 1"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/Moose_Framework}"/>
|
||||
</launchConfiguration>
|
||||
|
||||
@@ -29,11 +29,12 @@ Core/SpawnStatic.lua
|
||||
Core/Timer.lua
|
||||
Core/Goal.lua
|
||||
Core/Spot.lua
|
||||
Core/MarkerOps_Base.lua
|
||||
Core/Astar.lua
|
||||
Core/Condition.lua
|
||||
Core/TextAndSound.lua
|
||||
Core/Condition.lua
|
||||
Core/Pathline.lua
|
||||
Core/ClientMenu.lua
|
||||
Core/Astar.lua
|
||||
Core/MarkerOps_Base.lua
|
||||
|
||||
Wrapper/Object.lua
|
||||
Wrapper/Identifiable.lua
|
||||
@@ -78,13 +79,44 @@ Functional/Warehouse.lua
|
||||
Functional/Fox.lua
|
||||
Functional/Mantis.lua
|
||||
Functional/Shorad.lua
|
||||
Functional/Autolase.lua
|
||||
Functional/AICSAR.lua
|
||||
Functional/AmmoTruck.lua
|
||||
Functional/ZoneGoalCargo.lua
|
||||
Functional/Tiresias.lua
|
||||
Functional/Stratego.lua
|
||||
|
||||
Ops/Airboss.lua
|
||||
Ops/RecoveryTanker.lua
|
||||
Ops/RescueHelo.lua
|
||||
Ops/ATIS.lua
|
||||
Ops/CTLD.lua
|
||||
Ops/Auftrag.lua
|
||||
Ops/OpsGroup.lua
|
||||
Ops/FlightGroup.lua
|
||||
Ops/NavyGroup.lua
|
||||
Ops/Cohort.lua
|
||||
Ops/Squadron.lua
|
||||
Ops/Platoon.lua
|
||||
Ops/Flotilla.lua
|
||||
Ops/Legion.lua
|
||||
Ops/AirWing.lua
|
||||
Ops/Brigade.lua
|
||||
Ops/Fleet.lua
|
||||
Ops/Intelligence.lua
|
||||
Ops/Commander.lua
|
||||
Ops/Chief.lua
|
||||
Ops/CSAR.lua
|
||||
Ops/CTLD.lua
|
||||
Ops/Awacs.lua
|
||||
Ops/Operation.lua
|
||||
Ops/FlightControl.lua
|
||||
Ops/PlayerTask.lua
|
||||
Ops/PlayerRecce.lua
|
||||
Ops/EasyGCICAP.lua
|
||||
Ops/OpsZone.lua
|
||||
Ops/ArmyGroup.lua
|
||||
Ops/OpsTransport.lua
|
||||
Ops/Target.lua
|
||||
|
||||
AI/AI_Balancer.lua
|
||||
AI/AI_Air.lua
|
||||
|
||||
263
docs/advanced/concepts.md
Normal file
263
docs/advanced/concepts.md
Normal file
@@ -0,0 +1,263 @@
|
||||
---
|
||||
title: Concepts
|
||||
parent: Advanced
|
||||
nav_order: 01
|
||||
---
|
||||
|
||||
# Concepts
|
||||
{: .no_toc }
|
||||
|
||||
1. Table of contents
|
||||
{:toc}
|
||||
|
||||
If you want to get deeper into Moose, you will encounter a few terms and
|
||||
concepts that we will explain here. You will need them for the later pages.
|
||||
|
||||
# Git and GitHub
|
||||
|
||||
Moose has about 260.000 lines of code and the amount is increasing each week.
|
||||
To maintain such a big code base a vcs (version control system) is needed.
|
||||
Moose uses [GitHub] as developer platform to create, store, and manage the code.
|
||||
[GitHub] uses [Git] as version control system and provides additional
|
||||
functionality like access control, bug tracking, feature requests and much more.
|
||||
|
||||
As a Moose user you don't need to learn how to use [Git]. You can download the
|
||||
files on [GitHub] with a browser. But using [Git] will ease up the steps to keep
|
||||
the Moose version on your hard disk up to date.
|
||||
|
||||
You will need to interact with [GitHub]. At least to download the Moose files.
|
||||
For non-developers the page can be confusing. Take your time and read this
|
||||
documentation. We are not able to explain every single detail on using [GitHub]
|
||||
and [Git]. Especially because it is changing really quick and this documentation
|
||||
will not. So try to use the help system of [GitHub] or find some videos on
|
||||
[YouTube]. If you get stuck ask for help in the [Moose Discord].
|
||||
|
||||
Moose uses more than one repository on [GitHub] which doesn't exactly make it
|
||||
any clearer. A list can be found on the [reposities] page.
|
||||
|
||||
# Branches: master & develop
|
||||
|
||||
As already explained in the [overview] two branches are used:
|
||||
|
||||
- Branch [master]: Stable release branch.
|
||||
- Branch [develop]: Newest development with more OPS classes.
|
||||
|
||||
As a starter it is okay to begin your journey with the `master` branch.
|
||||
If you are interested in some newer classes you need to use the `develop`
|
||||
branch. The later one is also very stable, but it's missing more detailed
|
||||
documentation and example missions for some of the new OPS classes.
|
||||
|
||||
You can switch between these branches with a drop down in the upper left corner
|
||||
of the [GitHub] repository page. The list of branches is long. So it is a best
|
||||
practice to save a bookmark in your browser with the links above.
|
||||
Both branches are available on most of the different repositories. But because
|
||||
of a limitation of [GitHub pages], we had to split the documentation in two
|
||||
different repositories:
|
||||
|
||||
- Documentation of `master` branch: [MOOSE_DOCS]
|
||||
- Documentation of `develop` branch: [MOOSE_DOCS_DEVELOP]
|
||||
|
||||
# Build result vs. source files
|
||||
|
||||
Moose consists of more than 140 individual files with the file extension `.lua`.
|
||||
They are places in a [directory tree], which makes it more organized and its
|
||||
semantic is pre-defined for [IntelliSense] to work.
|
||||
|
||||
On every change which is pushed to [GitHub] a build job will combine all of
|
||||
these files to a single file called `Moose.lua`. In a second step all
|
||||
comments will be removed to decrease the file size and the result will be saved
|
||||
as `Moose_.lua`. These both files are created for users of Moose to include in
|
||||
your missions.
|
||||
|
||||
The individual `.lua` files are used by the Moose developers and power users.
|
||||
It is complicated to use them, but in combination with an IDE and a debugger it
|
||||
is very useful to analyze even complex problems or write new additions to the
|
||||
Moose framework.
|
||||
|
||||
# Static loading
|
||||
|
||||
If you add a script file with a `DO SCRIPT FILE` trigger, like we described in
|
||||
[Create your own Hello world], the script file will be copied into the mission
|
||||
file. This mission file (file extension .MIZ) is only a compressed ZIP archive
|
||||
with another file ending.
|
||||
|
||||
If you change the script file after adding it to the mission, the changes are
|
||||
not available on mission start. You have to re-add the script after each change.
|
||||
This can be very annoying and often leads to forgetting to add the change again.
|
||||
Then you wonder why the mission does not deliver the desired result.
|
||||
|
||||
But when the mission is finished you can upload it to your dedicated DCS server
|
||||
or give it to a friend and it should run without problems. This way of embedding
|
||||
the scripts do we call `static loading` and the resulting mission is very
|
||||
portable.
|
||||
|
||||
# Dynamic loading of mission scripts
|
||||
|
||||
The other way of loading scripts is by using `DO SCRIPT`. This time the mission
|
||||
editor don't show a file browse button. Instead you see a (very small) text
|
||||
field to enter the code directly into it. It is only useful for very small
|
||||
script snippets. But we can use it to load a file from your hard drive like
|
||||
this:
|
||||
|
||||
```lua
|
||||
dofile('C:/MyScripts/hello-world.lua')
|
||||
dofile('C:\\MyScripts\\hello-world.lua')
|
||||
dofile([[C:\MyScripts\hello-world.lua]])
|
||||
```
|
||||
|
||||
So all lines above do the same. In [Lua] you need to specify the path with
|
||||
slashes, escape backslashes or use double square brackets around the string.
|
||||
Double square brackets are usefull, because you can copy paste the path
|
||||
without any modification.
|
||||
|
||||
If you upload a mission with this code, you need to create the folder
|
||||
`C:\MyScripts\` on the server file system and upload the newest version of
|
||||
`hello-world.lua`, too. The same applies, if you give the mission to a friend.
|
||||
This makes the mission less portable, but on the other hand the mission uses the
|
||||
file on the hard disk, without the need to add it to the mission again.
|
||||
All you need to do is save the file and restart the mission.
|
||||
|
||||
The following can be used to increase portability:
|
||||
|
||||
```lua
|
||||
dofile(lfs.writedir() .. '/Missions/hello-world.lua')
|
||||
```
|
||||
|
||||
The function `lfs.writedir()` will return your [Saved Games folder].
|
||||
So you place the scripts in the subfolder Missions. This way the folder
|
||||
structure is already available on all target systems. But you need to ensure
|
||||
mission and script are both in sync to avoid problems. If you changed both and
|
||||
upload only one of them to your server, you may get trouble.
|
||||
|
||||
There is another method you may find useful to dynamically load scripts:
|
||||
|
||||
```lua
|
||||
assert(loadfile('C:/MyScripts/hello-world.lua'))()
|
||||
assert(loadfile('C:\\MyScripts\\hello-world.lua'))()
|
||||
assert(loadfile([[C:\MyScripts\hello-world.lua]]))()
|
||||
```
|
||||
|
||||
It is a little bit harder to read and write because of all these different
|
||||
brackets. Especially the one on line 3. But it is a little safer than `dofile`.
|
||||
Because of readability I prefer to use `dofile`.
|
||||
|
||||
# Dynamic loading of Moose
|
||||
|
||||
Of course you can use the same method to load Moose. This way you can place one
|
||||
Moose file in your [Saved Games folder], which is used by multiple missions.
|
||||
If you want to update Moose you just need to replace the file and all missions
|
||||
will use the new version. But I prefer to add Moose by a `DO SCRIPT FILE`
|
||||
trigger so I can add and test the new version for each mission step by step.
|
||||
|
||||
But we added two different ways to load the Moose source files automatically.
|
||||
This is useful for Moose developers and it is a requirement to use a debugger.
|
||||
This will be explained later in the [Debugger Guide].
|
||||
|
||||
# Automatic dynamic loading
|
||||
|
||||
With the code below you can have the advantages of both approaches.
|
||||
- Copy the code into your mission script at the beginning.
|
||||
- Save the mission script into the folder Missions in your [Saved Games folder].
|
||||
- Change script filename in line 2 to match to your script.
|
||||
- [De-Sanitize] your `MissionScripting.lua`.
|
||||
|
||||
Now the mission will use the script on your hard drive instead of the script
|
||||
embedded in th MIZ file, as long as it is available. So you can chnge the
|
||||
script, save it and restart the mission, without the need to readd it after each
|
||||
change.
|
||||
|
||||
If you reach a stable state in your script development and want to upload the
|
||||
mission to your server or give it to a friend, then just add the script again
|
||||
like in the static method and save the mission.
|
||||
|
||||
{: .important }
|
||||
> Do not forget to readd the script, prior uploading or sharing the mission,
|
||||
> or it will run with an outdated version of your script and may fail if the
|
||||
> objects in the mission don't match to this old version.
|
||||
|
||||
```lua
|
||||
-- Use script file from hard disk instead of the one included in the .miz file
|
||||
if lfs and io then
|
||||
MissionScript = lfs.writedir() .. '/Missions/hello-world-autodyn.lua'
|
||||
-- Check if the running skript is from temp directory to avoid an endless loop
|
||||
if string.find( debug.getinfo(1).source, lfs.tempdir() ) then
|
||||
local f=io.open(MissionScript,"r")
|
||||
if f~=nil then
|
||||
io.close(f)
|
||||
|
||||
env.info( '*** LOAD MISSION SCRIPT FROM HARD DISK *** ' )
|
||||
dofile(MissionScript)
|
||||
do return end
|
||||
end
|
||||
end
|
||||
else
|
||||
env.error( '*** LOAD MISSION SCRIPT FROM HARD DISK FAILED (Desanitize lfs and io)*** ' )
|
||||
end
|
||||
|
||||
--
|
||||
-- Simple example mission to show the very basics of MOOSE
|
||||
--
|
||||
MESSAGE:New( "Hello World! This messages is printed by MOOSE!", 35, "INFO" ):ToAll():ToLog()
|
||||
```
|
||||
|
||||
# IDE vs. Notepad++
|
||||
|
||||
As a beginner you should start with a good text editor, which supports syntax
|
||||
highlighting of [Lua] code. This must not be [Notepad++]. It can be any other
|
||||
powerful editor of your choice. Do yourself a favor and don't use the Windows
|
||||
editor.
|
||||
|
||||
If you are a developer of [Lua] or another programming language, then your are
|
||||
most likely familiar with an IDE (Integrated Develop Environment).
|
||||
|
||||
Otherwise you should know, that an IDE may help you with code completion,
|
||||
Refactoring, Autocorrection, Formatting Source Code, showing documentation
|
||||
as popup on mouse hover over keywords and Debugging.
|
||||
|
||||
There are different IDEs available. And not all IDEs support all features.
|
||||
The three most important for Moose are:
|
||||
|
||||
- [Eclipse LDT]
|
||||
- [Visual Studio Code]
|
||||
- [PyCharm] (or [IntelliJ IDEA])
|
||||
|
||||
Eclipse has the best support for hover documentation and [IntelliSense] with
|
||||
Moose. The Inventor of Moose (FlightControl) did an amazing job by adding an
|
||||
integration to Eclipse LDT (a special version for Lua).
|
||||
Unfortunately Eclipse LDT is not maintained any longer (last release 2018).
|
||||
And the debugger doesn't work anymore, since an update of DCS.
|
||||
|
||||
In Visual Studio Code the support of Lua can be added by an addon.
|
||||
The debugger works with Moose and DCS, but showing the LuaDoc and [IntelliSense]
|
||||
is very limited.
|
||||
|
||||
PyCharm supports Lua also with an addon. The debugger works with Moose and DCS,
|
||||
but showing the LuaDoc and [IntelliSense] is very limited.
|
||||
|
||||
It is up to you to choose the IDE according to your taste. Guides on how to
|
||||
setup Moose with different IDEs and Debuggers are provided later in this
|
||||
documentation.
|
||||
|
||||
[Git]: https://en.wikipedia.org/wiki/Git
|
||||
[GitHub]: https://github.com/
|
||||
[YouTube]: https://www.youtube.com/
|
||||
[Moose Discord]: https://discord.gg/gj68fm969S
|
||||
[overview]: ../index.md
|
||||
[reposities]: ../repositories.md
|
||||
[master]: https://github.com/FlightControl-Master/MOOSE/tree/master
|
||||
[develop]: https://github.com/FlightControl-Master/MOOSE/tree/develop
|
||||
[GitHub pages]: https://pages.github.com/
|
||||
[MOOSE_DOCS]: https://flightcontrol-master.github.io/MOOSE_DOCS/
|
||||
[MOOSE_DOCS_DEVELOP]: https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/
|
||||
[directory tree]: https://github.com/FlightControl-Master/MOOSE/tree/master/Moose%20Development/Moose
|
||||
[Saved Games folder]: ../beginner/tipps-and-tricks.md#find-the-saved-games-folder
|
||||
[Lua]: https://www.lua.org/
|
||||
[Create your own Hello world]: ../beginner/hello-world-build.md
|
||||
[Debugger Guide]: debugger.md
|
||||
[IntelliSense]: https://en.wikipedia.org/wiki/IntelliSense
|
||||
[De-Sanitize]: desanitize-dcs.md
|
||||
[Notepad++]: https://notepad-plus-plus.org/downloads/
|
||||
[Eclipse LDT]: https://projects.eclipse.org/projects/tools.ldt
|
||||
[Visual Studio Code]: https://code.visualstudio.com/
|
||||
[PyCharm]: https://www.jetbrains.com/pycharm/
|
||||
[IntelliJ IDEA]: https://www.jetbrains.com/idea/
|
||||
8
docs/advanced/debugger.md
Normal file
8
docs/advanced/debugger.md
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
title: Debugger
|
||||
parent: Advanced
|
||||
nav_order: 100
|
||||
---
|
||||
|
||||
{: .warning }
|
||||
> THIS DOCUMENT IS STILL WORK IN PROGRESS!
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: De-Sanitize DCS
|
||||
parent: Advanced
|
||||
nav_order: 2
|
||||
nav_order: 98
|
||||
---
|
||||
# De-Sanitize the DCS scripting environment
|
||||
{: .no_toc }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
parent: Advanced
|
||||
nav_order: 1
|
||||
nav_order: 97
|
||||
---
|
||||
# Eclipse Installation
|
||||
{: .no_toc }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
parent: Advanced
|
||||
nav_order: 2
|
||||
nav_order: 99
|
||||
---
|
||||
# Text to Speech
|
||||
{: .no_toc }
|
||||
|
||||
@@ -35,16 +35,24 @@ Please remember when posting a question:
|
||||
- Before posting anything follow the [troubleshooting steps].
|
||||
- **Read your logs**.
|
||||
|
||||
### Formulate a good description
|
||||
|
||||
A post should contain the following:
|
||||
|
||||
1. A describtion what you expected to happen and what actually happened.
|
||||
- Do not use vague words this stuff is hard to help with! Be specific.
|
||||
- A description what you expected to happen and what actually happened.
|
||||
- Do not use vague words this stuff is hard to help with! Be specific.
|
||||
|
||||
2. Describe what happens instead.
|
||||
- The less detail you offer, the less chance you can be helped.
|
||||
- Don’t say it doesn’t work. Or is it broken. Say what it actually does.
|
||||
- Describe what happens instead.
|
||||
- The less detail you offer, the less chance you can be helped.
|
||||
- Don't say it doesn't work. Or is it broken. Say what it actually does.
|
||||
|
||||
3. Post your code in Discord as formatted code:
|
||||
### Format your code
|
||||
|
||||
The easier your code is to read, the more likely you are to get a helpful answer. If your code is hard to read, some
|
||||
people who could help you may not even bother to read your code. Syntax Highlighting makes the code much clearer and
|
||||
easier to understand. Therefore:
|
||||
|
||||
- Post your code in Discord as formatted code:
|
||||
|
||||
- Wrap a single line of code in backticks \` like this:
|
||||
|
||||
@@ -54,14 +62,31 @@ A post should contain the following:
|
||||
|
||||

|
||||
|
||||
- Post your log lines with the error or warning messages. Format them like this:
|
||||
### Do not post a screenshot of your code
|
||||
|
||||

|
||||
Your code is easy to read on a screenshot if you are using a good text editor or IDE, but if someone discovers an error
|
||||
in your code and wants to post a corrected version, they will have to type out the entire code. This could lead to them
|
||||
not helping you because it's too much work for them.
|
||||
|
||||
### Post your log
|
||||
|
||||
If the error message in the `dcs.log` does not tell you anything, then post it in the Discord.
|
||||
|
||||
- Post the important log lines with the error or warning messages. Format them like this:
|
||||
|
||||

|
||||
|
||||
### Send your mission when requested
|
||||
|
||||
Please don't just send your mission file. You have to manually extract the script from the file.
|
||||
It is better to send your script code and log lines beforehand.
|
||||
If this does not help, you may be asked to send your mission.
|
||||
|
||||
- Some complex problems need the mission (.miz file) also.
|
||||
|
||||
- But post your mission only when requested.
|
||||
- Try to simplify your mission if it is complex!
|
||||
- Try to avoid or delete MODs, because could prevent people from helping you.
|
||||
|
||||
There are people in the Discord and in the forum, who spend their free time to
|
||||
help you. <br />
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user