mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Compare commits
2033 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
21aadc14b1 | ||
|
|
eed6119193 | ||
|
|
6db2e333ad | ||
|
|
0eb9dfc7de | ||
|
|
4eb0f8e9ca | ||
|
|
5a583671a7 | ||
|
|
e560c3ffdd | ||
|
|
74bd41743b | ||
|
|
56d4143a05 | ||
|
|
1093e55ea8 | ||
|
|
cc95c45fb0 | ||
|
|
6c36910ac7 | ||
|
|
d60f20a162 | ||
|
|
dc26134845 | ||
|
|
adad7ef901 | ||
|
|
bb6bb20179 | ||
|
|
07cac604cf | ||
|
|
28cb44874f | ||
|
|
616f204f5b | ||
|
|
211e1b41b0 | ||
|
|
cd316e6719 | ||
|
|
0fb8fd8886 | ||
|
|
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 |
11
.github/workflows/build-includes.yml
vendored
11
.github/workflows/build-includes.yml
vendored
@@ -5,8 +5,6 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
- develop
|
- develop
|
||||||
- Apple/Develop
|
|
||||||
|
|
||||||
paths:
|
paths:
|
||||||
- 'Moose Setup/**/*.lua'
|
- 'Moose Setup/**/*.lua'
|
||||||
- 'Moose Development/**/*.lua'
|
- 'Moose Development/**/*.lua'
|
||||||
@@ -49,7 +47,6 @@ jobs:
|
|||||||
|
|
||||||
- name: Update apt-get (needed for act docker image)
|
- name: Update apt-get (needed for act docker image)
|
||||||
run: |
|
run: |
|
||||||
sudo rm /etc/apt/sources.list.d/microsoft-prod.list
|
|
||||||
sudo apt-get -qq update
|
sudo apt-get -qq update
|
||||||
|
|
||||||
- name: Install tree
|
- name: Install tree
|
||||||
@@ -98,6 +95,10 @@ jobs:
|
|||||||
export COMMIT_TIME=$(git show -s --format=%cd ${{ github.sha }} --date=iso-strict)
|
export COMMIT_TIME=$(git show -s --format=%cd ${{ github.sha }} --date=iso-strict)
|
||||||
lua5.3 "./Moose Setup/Moose_Create.lua" D "$COMMIT_TIME-${{ github.sha }}" "./Moose Development/Moose" "./Moose Setup" "./build/result/Moose_Include_Dynamic"
|
lua5.3 "./Moose Setup/Moose_Create.lua" D "$COMMIT_TIME-${{ github.sha }}" "./Moose Development/Moose" "./Moose Setup" "./build/result/Moose_Include_Dynamic"
|
||||||
|
|
||||||
|
- name: Run LuaSrcDiet
|
||||||
|
run: |
|
||||||
|
luasrcdiet --basic --opt-emptylines ./build/result/Moose_Include_Static/Moose.lua -o ./build/result/Moose_Include_Static/Moose_.lua
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# Run LuaCheck
|
# Run LuaCheck
|
||||||
#########################################################################
|
#########################################################################
|
||||||
@@ -107,10 +108,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
luacheck --std=lua51c --config=.luacheckrc -gurasqq "Moose Development/Moose"
|
luacheck --std=lua51c --config=.luacheckrc -gurasqq "Moose Development/Moose"
|
||||||
|
|
||||||
- name: Run LuaSrcDiet
|
|
||||||
run: |
|
|
||||||
luasrcdiet --basic --opt-emptylines ./build/result/Moose_Include_Static/Moose.lua -o ./build/result/Moose_Include_Static/Moose_.lua
|
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# Push to MOOSE_INCLUDE
|
# Push to MOOSE_INCLUDE
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
|||||||
12
.github/workflows/gh-pages.yml
vendored
12
.github/workflows/gh-pages.yml
vendored
@@ -33,7 +33,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
- name: Setup Ruby
|
- name: Setup Ruby
|
||||||
uses: ruby/setup-ruby@v1
|
uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
@@ -43,7 +43,7 @@ jobs:
|
|||||||
working-directory: docs/
|
working-directory: docs/
|
||||||
- name: Setup Pages
|
- name: Setup Pages
|
||||||
id: pages
|
id: pages
|
||||||
uses: actions/configure-pages@v4
|
uses: actions/configure-pages@v3
|
||||||
- name: Build with Jekyll
|
- name: Build with Jekyll
|
||||||
# Outputs to the './_site' directory by default
|
# Outputs to the './_site' directory by default
|
||||||
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
|
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
|
||||||
@@ -52,7 +52,7 @@ jobs:
|
|||||||
working-directory: docs/
|
working-directory: docs/
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
# Automatically uploads an artifact from the './_site' directory by default
|
# Automatically uploads an artifact from the './_site' directory by default
|
||||||
uses: actions/upload-pages-artifact@v3
|
uses: actions/upload-pages-artifact@v1
|
||||||
with:
|
with:
|
||||||
path: docs/_site/
|
path: docs/_site/
|
||||||
|
|
||||||
@@ -66,13 +66,13 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Deploy to GitHub Pages
|
- name: Deploy to GitHub Pages
|
||||||
id: deployment
|
id: deployment
|
||||||
uses: actions/deploy-pages@v4
|
uses: actions/deploy-pages@v1
|
||||||
|
|
||||||
check:
|
check:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: deploy
|
needs: deploy
|
||||||
steps:
|
steps:
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v3
|
||||||
- run: npm install linkinator
|
- 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
|
- run: npx linkinator https://flightcontrol-master.github.io/MOOSE/ --verbosity error --timeout 5000 --recurse --skip "(java.com)"
|
||||||
|
|||||||
10
.gitignore
vendored
10
.gitignore
vendored
@@ -28,6 +28,13 @@ local.properties
|
|||||||
.buildpath
|
.buildpath
|
||||||
|
|
||||||
|
|
||||||
|
#####################
|
||||||
|
## Visual Studio Code
|
||||||
|
#####################
|
||||||
|
*.code-workspace
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
|
||||||
#################
|
#################
|
||||||
## Visual Studio
|
## Visual Studio
|
||||||
#################
|
#################
|
||||||
@@ -221,9 +228,6 @@ pip-log.txt
|
|||||||
#Goodsync
|
#Goodsync
|
||||||
_gsdata_/
|
_gsdata_/
|
||||||
|
|
||||||
# PyCharm
|
|
||||||
.idea
|
|
||||||
|
|
||||||
#GITHUB
|
#GITHUB
|
||||||
Moose Test Missions/MOOSE_Test_Template.miz
|
Moose Test Missions/MOOSE_Test_Template.miz
|
||||||
Moose Development/Moose/.vscode/launch.json
|
Moose Development/Moose/.vscode/launch.json
|
||||||
|
|||||||
@@ -1953,7 +1953,7 @@ local function refct_from_id(id) -- refct = refct_from_id(CTypeID)
|
|||||||
unsigned = refct.unsigned,
|
unsigned = refct.unsigned,
|
||||||
size = bit.band(bit.rshift(ctype.info, 16), 127),
|
size = bit.band(bit.rshift(ctype.info, 16), 127),
|
||||||
}
|
}
|
||||||
refct.bool, refct.const, refct.volatile, refct.unsigned = nil, nil, nil, nil
|
refct.bool, refct.const, refct.volatile, refct.unsigned = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
if CT[4] then -- Merge sibling attributes onto this type.
|
if CT[4] then -- Merge sibling attributes onto this type.
|
||||||
|
|||||||
@@ -17,9 +17,7 @@
|
|||||||
|
|
||||||
--- The AI_A2A_CAP class implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Group} or @{Wrapper.Group}
|
--- The AI_A2A_CAP class implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Group} or @{Wrapper.Group}
|
||||||
-- and automatically engage any airborne enemies that are within a certain range or within a certain zone.
|
-- and automatically engage any airborne enemies that are within a certain range or within a certain zone.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
-- The AI_A2A_CAP is assigned a @{Wrapper.Group} and this must be done before the AI_A2A_CAP process can be started using the **Start** event.
|
-- The AI_A2A_CAP is assigned a @{Wrapper.Group} and this must be done before the AI_A2A_CAP process can be started using the **Start** event.
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [AID-A2A - AI A2A Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher)
|
-- [AID-A2A - AI A2A Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-A2A%20-%20AI%20A2A%20Dispatching)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -32,9 +32,7 @@
|
|||||||
-- [DCS WORLD - MOOSE - A2A GCICAP - Build an automatic A2A Defense System](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl0S4KMNUUJpaUs6zZHjLKNx)
|
-- [DCS WORLD - MOOSE - A2A GCICAP - Build an automatic A2A Defense System](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl0S4KMNUUJpaUs6zZHjLKNx)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- # QUICK START GUIDE
|
-- # QUICK START GUIDE
|
||||||
--
|
--
|
||||||
-- There are basically two classes available to model an A2A defense system.
|
-- There are basically two classes available to model an A2A defense system.
|
||||||
@@ -312,7 +310,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
-- Use the method @{#AI_A2A_DISPATCHER.SetEngageRadius}() to set a specific Engage Radius.
|
-- Use the method @{#AI_A2A_DISPATCHER.SetEngageRadius}() to set a specific Engage Radius.
|
||||||
-- **The Engage Radius is defined for ALL squadrons which are operational.**
|
-- **The Engage Radius is defined for ALL squadrons which are operational.**
|
||||||
--
|
--
|
||||||
-- Demonstration Mission: [AID-019 - AI_A2A - Engage Range Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher/AID-A2A-019%20-%20Engage%20Range%20Test)
|
-- Demonstration Mission: [AID-019 - AI_A2A - Engage Range Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-A2A%20-%20AI%20A2A%20Dispatching/AID-A2A-019%20-%20Engage%20Range%20Test)
|
||||||
--
|
--
|
||||||
-- In this example an Engage Radius is set to various values.
|
-- In this example an Engage Radius is set to various values.
|
||||||
--
|
--
|
||||||
@@ -335,7 +333,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
-- Use the method @{#AI_A2A_DISPATCHER.SetGciRadius}() to set a specific controlled ground intercept radius.
|
-- Use the method @{#AI_A2A_DISPATCHER.SetGciRadius}() to set a specific controlled ground intercept radius.
|
||||||
-- **The Ground Controlled Intercept radius is defined for ALL squadrons which are operational.**
|
-- **The Ground Controlled Intercept radius is defined for ALL squadrons which are operational.**
|
||||||
--
|
--
|
||||||
-- Demonstration Mission: [AID-013 - AI_A2A - Intercept Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher/AID-A2A-013%20-%20Intercept%20Test)
|
-- Demonstration Mission: [AID-013 - AI_A2A - Intercept Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-A2A%20-%20AI%20A2A%20Dispatching/AID-A2A-013%20-%20Intercept%20Test)
|
||||||
--
|
--
|
||||||
-- In these examples, the Gci Radius is set to various values:
|
-- In these examples, the Gci Radius is set to various values:
|
||||||
--
|
--
|
||||||
@@ -368,7 +366,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
-- it makes it easier sometimes for the mission maker to envisage where the red and blue territories roughly are.
|
-- it makes it easier sometimes for the mission maker to envisage where the red and blue territories roughly are.
|
||||||
-- In a hot war the borders are effectively defined by the ground based radar coverage of a coalition.
|
-- In a hot war the borders are effectively defined by the ground based radar coverage of a coalition.
|
||||||
--
|
--
|
||||||
-- Demonstration Mission: [AID-009 - AI_A2A - Border Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher/AID-A2A-009%20-%20Border%20Test)
|
-- Demonstration Mission: [AID-009 - AI_A2A - Border Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-A2A%20-%20AI%20A2A%20Dispatching/AID-A2A-009%20-%20Border%20Test)
|
||||||
--
|
--
|
||||||
-- In this example a border is set for the CCCP A2A dispatcher:
|
-- In this example a border is set for the CCCP A2A dispatcher:
|
||||||
--
|
--
|
||||||
@@ -1153,14 +1151,14 @@ do -- AI_A2A_DISPATCHER
|
|||||||
|
|
||||||
local AirbaseName = EventData.PlaceName -- The name of the airbase that was captured.
|
local AirbaseName = EventData.PlaceName -- The name of the airbase that was captured.
|
||||||
|
|
||||||
self:T( "Captured " .. AirbaseName )
|
self:I( "Captured " .. AirbaseName )
|
||||||
|
|
||||||
-- Now search for all squadrons located at the airbase, and sanitize them.
|
-- Now search for all squadrons located at the airbase, and sanitize them.
|
||||||
for SquadronName, Squadron in pairs( self.DefenderSquadrons ) do
|
for SquadronName, Squadron in pairs( self.DefenderSquadrons ) do
|
||||||
if Squadron.AirbaseName == AirbaseName then
|
if Squadron.AirbaseName == AirbaseName then
|
||||||
Squadron.ResourceCount = -999 -- The base has been captured, and the resources are eliminated. No more spawning.
|
Squadron.ResourceCount = -999 -- The base has been captured, and the resources are eliminated. No more spawning.
|
||||||
Squadron.Captured = true
|
Squadron.Captured = true
|
||||||
self:T( "Squadron " .. SquadronName .. " captured." )
|
self:I( "Squadron " .. SquadronName .. " captured." )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1235,7 +1233,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
--
|
--
|
||||||
-- **Use the method @{#AI_A2A_DISPATCHER.SetEngageRadius}() to modify the default Engage Radius for ALL squadrons.**
|
-- **Use the method @{#AI_A2A_DISPATCHER.SetEngageRadius}() to modify the default Engage Radius for ALL squadrons.**
|
||||||
--
|
--
|
||||||
-- Demonstration Mission: [AID-019 - AI_A2A - Engage Range Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher/AID-A2A-019%20-%20Engage%20Range%20Test)
|
-- Demonstration Mission: [AID-019 - AI_A2A - Engage Range Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-A2A%20-%20AI%20A2A%20Dispatching/AID-A2A-019%20-%20Engage%20Range%20Test)
|
||||||
--
|
--
|
||||||
-- @param #AI_A2A_DISPATCHER self
|
-- @param #AI_A2A_DISPATCHER self
|
||||||
-- @param #number EngageRadius (Optional, Default = 100000) The radius to report friendlies near the target.
|
-- @param #number EngageRadius (Optional, Default = 100000) The radius to report friendlies near the target.
|
||||||
@@ -1285,7 +1283,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
-- Use the method @{#AI_A2A_DISPATCHER.SetGciRadius}() to set a specific controlled ground intercept radius.
|
-- Use the method @{#AI_A2A_DISPATCHER.SetGciRadius}() to set a specific controlled ground intercept radius.
|
||||||
-- **The Ground Controlled Intercept radius is defined for ALL squadrons which are operational.**
|
-- **The Ground Controlled Intercept radius is defined for ALL squadrons which are operational.**
|
||||||
--
|
--
|
||||||
-- Demonstration Mission: [AID-013 - AI_A2A - Intercept Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher/AID-A2A-013%20-%20Intercept%20Test)
|
-- Demonstration Mission: [AID-013 - AI_A2A - Intercept Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-A2A%20-%20AI%20A2A%20Dispatching/AID-A2A-013%20-%20Intercept%20Test)
|
||||||
--
|
--
|
||||||
-- @param #AI_A2A_DISPATCHER self
|
-- @param #AI_A2A_DISPATCHER self
|
||||||
-- @param #number GciRadius (Optional, Default = 200000) The radius to ground control intercept detected targets from the nearest airbase.
|
-- @param #number GciRadius (Optional, Default = 200000) The radius to ground control intercept detected targets from the nearest airbase.
|
||||||
@@ -1830,7 +1828,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
|
|
||||||
self:SetSquadronCapInterval( SquadronName, self.DefenderDefault.CapLimit, self.DefenderDefault.CapMinSeconds, self.DefenderDefault.CapMaxSeconds, 1 )
|
self:SetSquadronCapInterval( SquadronName, self.DefenderDefault.CapLimit, self.DefenderDefault.CapMinSeconds, self.DefenderDefault.CapMaxSeconds, 1 )
|
||||||
|
|
||||||
self:T( { CAP = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, Zone, PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageAltType } } )
|
self:I( { CAP = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, Zone, PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageAltType } } )
|
||||||
|
|
||||||
-- Add the CAP to the EWR network.
|
-- Add the CAP to the EWR network.
|
||||||
|
|
||||||
@@ -2087,7 +2085,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
Intercept.EngageCeilingAltitude = EngageCeilingAltitude
|
Intercept.EngageCeilingAltitude = EngageCeilingAltitude
|
||||||
Intercept.EngageAltType = EngageAltType
|
Intercept.EngageAltType = EngageAltType
|
||||||
|
|
||||||
self:T( { GCI = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
self:I( { GCI = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set squadron GCI.
|
--- Set squadron GCI.
|
||||||
@@ -3002,17 +3000,17 @@ do -- AI_A2A_DISPATCHER
|
|||||||
for FriendlyDistance, AIFriendly in UTILS.spairs( DefenderFriendlies or {} ) do
|
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.
|
-- We only allow to ENGAGE targets as long as the Units on both sides are balanced.
|
||||||
if AttackerCount > DefenderCount then
|
if AttackerCount > DefenderCount then
|
||||||
--self:T("***** AI_A2A_DISPATCHER:CountDefendersToBeEngaged() *****\nThis is supposed to be a UNIT:")
|
--self:I("***** AI_A2A_DISPATCHER:CountDefendersToBeEngaged() *****\nThis is supposed to be a UNIT:")
|
||||||
if AIFriendly then
|
if AIFriendly then
|
||||||
local classname = AIFriendly.ClassName or "No Class Name"
|
local classname = AIFriendly.ClassName or "No Class Name"
|
||||||
local unitname = AIFriendly.IdentifiableName or "No Unit Name"
|
local unitname = AIFriendly.IdentifiableName or "No Unit Name"
|
||||||
--self:T("Class Name: " .. classname)
|
--self:I("Class Name: " .. classname)
|
||||||
--self:T("Unit Name: " .. unitname)
|
--self:I("Unit Name: " .. unitname)
|
||||||
--self:T({AIFriendly})
|
--self:I({AIFriendly})
|
||||||
end
|
end
|
||||||
local Friendly = nil
|
local Friendly = nil
|
||||||
if AIFriendly and AIFriendly:IsAlive() then
|
if AIFriendly and AIFriendly:IsAlive() then
|
||||||
--self:T("AIFriendly alive, getting GROUP")
|
--self:I("AIFriendly alive, getting GROUP")
|
||||||
Friendly = AIFriendly:GetGroup() -- Wrapper.Group#GROUP
|
Friendly = AIFriendly:GetGroup() -- Wrapper.Group#GROUP
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -3259,8 +3257,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- AI_A2A_Fsm:onafterHome
|
--- @param #AI_A2A_DISPATCHER self
|
||||||
-- @param #AI_A2A_DISPATCHER self
|
|
||||||
function AI_A2A_Fsm:onafterHome( Defender, From, Event, To, Action )
|
function AI_A2A_Fsm:onafterHome( Defender, From, Event, To, Action )
|
||||||
if Defender and Defender:IsAlive() then
|
if Defender and Defender:IsAlive() then
|
||||||
self:F( { "CAP Home", Defender:GetName() } )
|
self:F( { "CAP Home", Defender:GetName() } )
|
||||||
@@ -3508,8 +3505,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- function Fsm:onafterLostControl
|
--- @param #AI_A2A_DISPATCHER self
|
||||||
-- @param #AI_A2A_DISPATCHER self
|
|
||||||
function Fsm:onafterLostControl( Defender, From, Event, To )
|
function Fsm:onafterLostControl( Defender, From, Event, To )
|
||||||
self:F( { "GCI LostControl", Defender:GetName() } )
|
self:F( { "GCI LostControl", Defender:GetName() } )
|
||||||
self:GetParent( self ).onafterHome( self, Defender, From, Event, To )
|
self:GetParent( self ).onafterHome( self, Defender, From, Event, To )
|
||||||
@@ -3522,8 +3518,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- function Fsm:onafterHome
|
--- @param #AI_A2A_DISPATCHER self
|
||||||
-- @param #AI_A2A_DISPATCHER self
|
|
||||||
function Fsm:onafterHome( DefenderGroup, From, Event, To, Action )
|
function Fsm:onafterHome( DefenderGroup, From, Event, To, Action )
|
||||||
self:F( { "GCI Home", DefenderGroup:GetName() } )
|
self:F( { "GCI Home", DefenderGroup:GetName() } )
|
||||||
self:GetParent( self ).onafterHome( self, DefenderGroup, From, Event, To )
|
self:GetParent( self ).onafterHome( self, DefenderGroup, From, Event, To )
|
||||||
@@ -3954,7 +3949,7 @@ end
|
|||||||
|
|
||||||
do
|
do
|
||||||
|
|
||||||
-- @type AI_A2A_GCICAP
|
--- @type AI_A2A_GCICAP
|
||||||
-- @extends #AI_A2A_DISPATCHER
|
-- @extends #AI_A2A_DISPATCHER
|
||||||
|
|
||||||
--- Create an automatic air defence system for a coalition setting up GCI and CAP air defenses.
|
--- Create an automatic air defence system for a coalition setting up GCI and CAP air defenses.
|
||||||
@@ -3964,7 +3959,7 @@ do
|
|||||||
--
|
--
|
||||||
-- # Demo Missions
|
-- # Demo Missions
|
||||||
--
|
--
|
||||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher)
|
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-A2A%20-%20AI%20A2A%20Dispatching)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -4324,23 +4319,23 @@ do
|
|||||||
|
|
||||||
-- Setup squadrons
|
-- Setup squadrons
|
||||||
|
|
||||||
self:T( { Airbases = AirbaseNames } )
|
self:I( { Airbases = AirbaseNames } )
|
||||||
|
|
||||||
self:T( "Defining Templates for Airbases ..." )
|
self:I( "Defining Templates for Airbases ..." )
|
||||||
for AirbaseID, AirbaseName in pairs( AirbaseNames ) do
|
for AirbaseID, AirbaseName in pairs( AirbaseNames ) do
|
||||||
local Airbase = _DATABASE:FindAirbase( AirbaseName ) -- Wrapper.Airbase#AIRBASE
|
local Airbase = _DATABASE:FindAirbase( AirbaseName ) -- Wrapper.Airbase#AIRBASE
|
||||||
local AirbaseName = Airbase:GetName()
|
local AirbaseName = Airbase:GetName()
|
||||||
local AirbaseCoord = Airbase:GetCoordinate()
|
local AirbaseCoord = Airbase:GetCoordinate()
|
||||||
local AirbaseZone = ZONE_RADIUS:New( "Airbase", AirbaseCoord:GetVec2(), 3000 )
|
local AirbaseZone = ZONE_RADIUS:New( "Airbase", AirbaseCoord:GetVec2(), 3000 )
|
||||||
local Templates = nil
|
local Templates = nil
|
||||||
self:T( { Airbase = AirbaseName } )
|
self:I( { Airbase = AirbaseName } )
|
||||||
for TemplateID, Template in pairs( self.Templates:GetSet() ) do
|
for TemplateID, Template in pairs( self.Templates:GetSet() ) do
|
||||||
local Template = Template -- Wrapper.Group#GROUP
|
local Template = Template -- Wrapper.Group#GROUP
|
||||||
local TemplateCoord = Template:GetCoordinate()
|
local TemplateCoord = Template:GetCoordinate()
|
||||||
if AirbaseZone:IsVec2InZone( TemplateCoord:GetVec2() ) then
|
if AirbaseZone:IsVec2InZone( TemplateCoord:GetVec2() ) then
|
||||||
Templates = Templates or {}
|
Templates = Templates or {}
|
||||||
table.insert( Templates, Template:GetName() )
|
table.insert( Templates, Template:GetName() )
|
||||||
self:T( { Template = Template:GetName() } )
|
self:I( { Template = Template:GetName() } )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if Templates then
|
if Templates then
|
||||||
@@ -4356,13 +4351,13 @@ do
|
|||||||
self.CAPTemplates:FilterPrefixes( CapPrefixes )
|
self.CAPTemplates:FilterPrefixes( CapPrefixes )
|
||||||
self.CAPTemplates:FilterOnce()
|
self.CAPTemplates:FilterOnce()
|
||||||
|
|
||||||
self:T( "Setting up CAP ..." )
|
self:I( "Setting up CAP ..." )
|
||||||
for CAPID, CAPTemplate in pairs( self.CAPTemplates:GetSet() ) do
|
for CAPID, CAPTemplate in pairs( self.CAPTemplates:GetSet() ) do
|
||||||
local CAPZone = ZONE_POLYGON:New( CAPTemplate:GetName(), CAPTemplate )
|
local CAPZone = ZONE_POLYGON:New( CAPTemplate:GetName(), CAPTemplate )
|
||||||
-- Now find the closest airbase from the ZONE (start or center)
|
-- Now find the closest airbase from the ZONE (start or center)
|
||||||
local AirbaseDistance = 99999999
|
local AirbaseDistance = 99999999
|
||||||
local AirbaseClosest = nil -- Wrapper.Airbase#AIRBASE
|
local AirbaseClosest = nil -- Wrapper.Airbase#AIRBASE
|
||||||
self:T( { CAPZoneGroup = CAPID } )
|
self:I( { CAPZoneGroup = CAPID } )
|
||||||
for AirbaseID, AirbaseName in pairs( AirbaseNames ) do
|
for AirbaseID, AirbaseName in pairs( AirbaseNames ) do
|
||||||
local Airbase = _DATABASE:FindAirbase( AirbaseName ) -- Wrapper.Airbase#AIRBASE
|
local Airbase = _DATABASE:FindAirbase( AirbaseName ) -- Wrapper.Airbase#AIRBASE
|
||||||
local AirbaseName = Airbase:GetName()
|
local AirbaseName = Airbase:GetName()
|
||||||
@@ -4370,7 +4365,7 @@ do
|
|||||||
local Squadron = self.DefenderSquadrons[AirbaseName]
|
local Squadron = self.DefenderSquadrons[AirbaseName]
|
||||||
if Squadron then
|
if Squadron then
|
||||||
local Distance = AirbaseCoord:Get2DDistance( CAPZone:GetCoordinate() )
|
local Distance = AirbaseCoord:Get2DDistance( CAPZone:GetCoordinate() )
|
||||||
self:T( { AirbaseDistance = Distance } )
|
self:I( { AirbaseDistance = Distance } )
|
||||||
if Distance < AirbaseDistance then
|
if Distance < AirbaseDistance then
|
||||||
AirbaseDistance = Distance
|
AirbaseDistance = Distance
|
||||||
AirbaseClosest = Airbase
|
AirbaseClosest = Airbase
|
||||||
@@ -4378,7 +4373,7 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if AirbaseClosest then
|
if AirbaseClosest then
|
||||||
self:T( { CAPAirbase = AirbaseClosest:GetName() } )
|
self:I( { CAPAirbase = AirbaseClosest:GetName() } )
|
||||||
self:SetSquadronCap( AirbaseClosest:GetName(), CAPZone, 6000, 10000, 500, 800, 800, 1200, "RADIO" )
|
self:SetSquadronCap( AirbaseClosest:GetName(), CAPZone, 6000, 10000, 500, 800, 800, 1200, "RADIO" )
|
||||||
self:SetSquadronCapInterval( AirbaseClosest:GetName(), CapLimit, 300, 600, 1 )
|
self:SetSquadronCapInterval( AirbaseClosest:GetName(), CapLimit, 300, 600, 1 )
|
||||||
end
|
end
|
||||||
@@ -4386,14 +4381,14 @@ do
|
|||||||
|
|
||||||
-- Setup GCI.
|
-- Setup GCI.
|
||||||
-- GCI is setup for all Squadrons.
|
-- GCI is setup for all Squadrons.
|
||||||
self:T( "Setting up GCI ..." )
|
self:I( "Setting up GCI ..." )
|
||||||
for AirbaseID, AirbaseName in pairs( AirbaseNames ) do
|
for AirbaseID, AirbaseName in pairs( AirbaseNames ) do
|
||||||
local Airbase = _DATABASE:FindAirbase( AirbaseName ) -- Wrapper.Airbase#AIRBASE
|
local Airbase = _DATABASE:FindAirbase( AirbaseName ) -- Wrapper.Airbase#AIRBASE
|
||||||
local AirbaseName = Airbase:GetName()
|
local AirbaseName = Airbase:GetName()
|
||||||
local Squadron = self.DefenderSquadrons[AirbaseName]
|
local Squadron = self.DefenderSquadrons[AirbaseName]
|
||||||
self:F( { Airbase = AirbaseName } )
|
self:F( { Airbase = AirbaseName } )
|
||||||
if Squadron then
|
if Squadron then
|
||||||
self:T( { GCIAirbase = AirbaseName } )
|
self:I( { GCIAirbase = AirbaseName } )
|
||||||
self:SetSquadronGci( AirbaseName, 800, 1200 )
|
self:SetSquadronGci( AirbaseName, 800, 1200 )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -19,8 +19,6 @@
|
|||||||
|
|
||||||
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
|
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- The AI_A2A_GCI is assigned a @{Wrapper.Group} and this must be done before the AI_A2A_GCI process can be started using the **Start** event.
|
-- The AI_A2A_GCI is assigned a @{Wrapper.Group} and this must be done before the AI_A2A_GCI process can be started using the **Start** event.
|
||||||
--
|
--
|
||||||
-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits.
|
-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits.
|
||||||
|
|||||||
@@ -15,8 +15,6 @@
|
|||||||
|
|
||||||
--- Implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Group} or @{Wrapper.Group}.
|
--- Implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Group} or @{Wrapper.Group}.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
-- The AI_A2A_PATROL is assigned a @{Wrapper.Group} and this must be done before the AI_A2A_PATROL process can be started using the **Start** event.
|
-- The AI_A2A_PATROL is assigned a @{Wrapper.Group} and this must be done before the AI_A2A_PATROL process can be started using the **Start** event.
|
||||||
|
|||||||
@@ -16,9 +16,7 @@
|
|||||||
-- @extends AI.AI_Air_Engage#AI_AIR_ENGAGE
|
-- @extends AI.AI_Air_Engage#AI_AIR_ENGAGE
|
||||||
|
|
||||||
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
|
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- # Developer Note
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
||||||
|
|||||||
@@ -19,8 +19,6 @@
|
|||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
||||||
-- Therefore, this class is considered to be deprecated
|
-- Therefore, this class is considered to be deprecated
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [AID-A2G - AI A2G Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2G_Dispatcher)
|
-- [AID-A2G - AI A2G Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-A2G%20-%20AI%20A2G%20Dispatching)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -36,8 +36,6 @@
|
|||||||
--
|
--
|
||||||
-- # QUICK START GUIDE
|
-- # QUICK START GUIDE
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- The following class is available to model an A2G defense system.
|
-- The following class is available to model an A2G defense system.
|
||||||
--
|
--
|
||||||
-- AI_A2G_DISPATCHER is the main A2G defense class that models the A2G defense system.
|
-- AI_A2G_DISPATCHER is the main A2G defense class that models the A2G defense system.
|
||||||
@@ -906,14 +904,14 @@ do -- AI_A2G_DISPATCHER
|
|||||||
-- @type AI_A2G_DISPATCHER.DefenseCoordinates
|
-- @type AI_A2G_DISPATCHER.DefenseCoordinates
|
||||||
-- @map <#string,Core.Point#COORDINATE> A list of all defense coordinates mapped per defense coordinate name.
|
-- @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 = {}
|
AI_A2G_DISPATCHER.DefenseCoordinates = {}
|
||||||
|
|
||||||
--- Enumerator for spawns at airbases.
|
--- Enumerator for spawns at airbases.
|
||||||
-- @type AI_A2G_DISPATCHER.Takeoff
|
-- @type AI_A2G_DISPATCHER.Takeoff
|
||||||
-- @extends Wrapper.Group#GROUP.Takeoff
|
-- @extends Wrapper.Group#GROUP.Takeoff
|
||||||
|
|
||||||
-- @field #AI_A2G_DISPATCHER.Takeoff Takeoff
|
--- @field #AI_A2G_DISPATCHER.Takeoff Takeoff
|
||||||
AI_A2G_DISPATCHER.Takeoff = GROUP.Takeoff
|
AI_A2G_DISPATCHER.Takeoff = GROUP.Takeoff
|
||||||
|
|
||||||
--- Defines Landing location.
|
--- Defines Landing location.
|
||||||
@@ -944,7 +942,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
-- @type AI_A2G_DISPATCHER.DefenseQueue
|
-- @type AI_A2G_DISPATCHER.DefenseQueue
|
||||||
-- @list<#AI_A2G_DISPATCHER.DefenseQueueItem> DefenseQueueItem A list of all defenses being queued ...
|
-- @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 = {}
|
AI_A2G_DISPATCHER.DefenseQueue = {}
|
||||||
|
|
||||||
--- Defense approach types.
|
--- Defense approach types.
|
||||||
@@ -1138,7 +1136,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
--- @param #AI_A2G_DISPATCHER self
|
||||||
function AI_A2G_DISPATCHER:onafterStart( From, Event, To )
|
function AI_A2G_DISPATCHER:onafterStart( From, Event, To )
|
||||||
|
|
||||||
self:GetParent( self ).onafterStart( self, From, Event, To )
|
self:GetParent( self ).onafterStart( self, From, Event, To )
|
||||||
@@ -1149,7 +1147,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
for Resource = 1, DefenderSquadron.ResourceCount or 0 do
|
for Resource = 1, DefenderSquadron.ResourceCount or 0 do
|
||||||
self:ResourcePark( DefenderSquadron )
|
self:ResourcePark( DefenderSquadron )
|
||||||
end
|
end
|
||||||
self:T( "Parked resources for squadron " .. DefenderSquadron.Name )
|
self:I( "Parked resources for squadron " .. DefenderSquadron.Name )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -1203,7 +1201,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
--- @param #AI_A2G_DISPATCHER self
|
||||||
function AI_A2G_DISPATCHER:ResourcePark( DefenderSquadron )
|
function AI_A2G_DISPATCHER:ResourcePark( DefenderSquadron )
|
||||||
local TemplateID = math.random( 1, #DefenderSquadron.Spawn )
|
local TemplateID = math.random( 1, #DefenderSquadron.Spawn )
|
||||||
local Spawn = DefenderSquadron.Spawn[ TemplateID ] -- Core.Spawn#SPAWN
|
local Spawn = DefenderSquadron.Spawn[ TemplateID ] -- Core.Spawn#SPAWN
|
||||||
@@ -1220,33 +1218,33 @@ do -- AI_A2G_DISPATCHER
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
--- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_A2G_DISPATCHER:OnEventBaseCaptured( EventData )
|
function AI_A2G_DISPATCHER:OnEventBaseCaptured( EventData )
|
||||||
|
|
||||||
local AirbaseName = EventData.PlaceName -- The name of the airbase that was captured.
|
local AirbaseName = EventData.PlaceName -- The name of the airbase that was captured.
|
||||||
|
|
||||||
self:T( "Captured " .. AirbaseName )
|
self:I( "Captured " .. AirbaseName )
|
||||||
|
|
||||||
-- Now search for all squadrons located at the airbase, and sanitize them.
|
-- Now search for all squadrons located at the airbase, and sanitize them.
|
||||||
for SquadronName, Squadron in pairs( self.DefenderSquadrons ) do
|
for SquadronName, Squadron in pairs( self.DefenderSquadrons ) do
|
||||||
if Squadron.AirbaseName == AirbaseName then
|
if Squadron.AirbaseName == AirbaseName then
|
||||||
Squadron.ResourceCount = -999 -- The base has been captured, and the resources are eliminated. No more spawning.
|
Squadron.ResourceCount = -999 -- The base has been captured, and the resources are eliminated. No more spawning.
|
||||||
Squadron.Captured = true
|
Squadron.Captured = true
|
||||||
self:T( "Squadron " .. SquadronName .. " captured." )
|
self:I( "Squadron " .. SquadronName .. " captured." )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
--- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_A2G_DISPATCHER:OnEventCrashOrDead( EventData )
|
function AI_A2G_DISPATCHER:OnEventCrashOrDead( EventData )
|
||||||
self.Detection:ForgetDetectedUnit( EventData.IniUnitName )
|
self.Detection:ForgetDetectedUnit( EventData.IniUnitName )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
--- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_A2G_DISPATCHER:OnEventLand( EventData )
|
function AI_A2G_DISPATCHER:OnEventLand( EventData )
|
||||||
self:F( "Landed" )
|
self:F( "Landed" )
|
||||||
@@ -1263,7 +1261,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||||
end
|
end
|
||||||
DefenderUnit:Destroy()
|
DefenderUnit:Destroy()
|
||||||
self:ResourcePark( Squadron )
|
self:ResourcePark( Squadron, Defender )
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if DefenderUnit:GetLife() ~= DefenderUnit:GetLife0() then
|
if DefenderUnit:GetLife() ~= DefenderUnit:GetLife0() then
|
||||||
@@ -1275,7 +1273,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
--- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_A2G_DISPATCHER:OnEventEngineShutdown( EventData )
|
function AI_A2G_DISPATCHER:OnEventEngineShutdown( EventData )
|
||||||
local DefenderUnit = EventData.IniUnit
|
local DefenderUnit = EventData.IniUnit
|
||||||
@@ -1291,7 +1289,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||||
end
|
end
|
||||||
DefenderUnit:Destroy()
|
DefenderUnit:Destroy()
|
||||||
self:ResourcePark( Squadron )
|
self:ResourcePark( Squadron, Defender )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1299,7 +1297,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
|
|
||||||
do -- Manage the defensive behaviour
|
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 #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.
|
-- @param Core.Point#COORDINATE DefenseCoordinate The coordinate to be defended by A2G defenses.
|
||||||
function AI_A2G_DISPATCHER:AddDefenseCoordinate( DefenseCoordinateName, DefenseCoordinate )
|
function AI_A2G_DISPATCHER:AddDefenseCoordinate( DefenseCoordinateName, DefenseCoordinate )
|
||||||
@@ -1307,19 +1305,19 @@ do -- AI_A2G_DISPATCHER
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
--- @param #AI_A2G_DISPATCHER self
|
||||||
function AI_A2G_DISPATCHER:SetDefenseReactivityLow()
|
function AI_A2G_DISPATCHER:SetDefenseReactivityLow()
|
||||||
self.DefenseReactivity = 0.05
|
self.DefenseReactivity = 0.05
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
--- @param #AI_A2G_DISPATCHER self
|
||||||
function AI_A2G_DISPATCHER:SetDefenseReactivityMedium()
|
function AI_A2G_DISPATCHER:SetDefenseReactivityMedium()
|
||||||
self.DefenseReactivity = 0.15
|
self.DefenseReactivity = 0.15
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
--- @param #AI_A2G_DISPATCHER self
|
||||||
function AI_A2G_DISPATCHER:SetDefenseReactivityHigh()
|
function AI_A2G_DISPATCHER:SetDefenseReactivityHigh()
|
||||||
self.DefenseReactivity = 0.5
|
self.DefenseReactivity = 0.5
|
||||||
end
|
end
|
||||||
@@ -1353,14 +1351,14 @@ do -- AI_A2G_DISPATCHER
|
|||||||
-- 1. the **distance of the closest airbase to target**, being smaller than the **Defend Radius**.
|
-- 1. the **distance of the closest airbase to target**, being smaller than the **Defend Radius**.
|
||||||
-- 2. the **distance to any defense reference point**.
|
-- 2. the **distance to any defense reference point**.
|
||||||
--
|
--
|
||||||
-- The **default** defense radius is defined as **40000** or **40km**. Override the default defense radius when the era of the warfare is early, or,
|
-- The **default** defense radius is defined as **400000** 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.
|
-- 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,
|
-- 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.**
|
-- **the Defense Radius is defined for ALL squadrons which are operational.**
|
||||||
--
|
--
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param #number DefenseRadius (Optional, Default = 20000) The defense radius to engage detected targets from the nearest capable and available squadron airbase.
|
-- @param #number DefenseRadius (Optional, Default = 200000) The defense radius to engage detected targets from the nearest capable and available squadron airbase.
|
||||||
-- @return #AI_A2G_DISPATCHER
|
-- @return #AI_A2G_DISPATCHER
|
||||||
-- @usage
|
-- @usage
|
||||||
--
|
--
|
||||||
@@ -1375,7 +1373,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
--
|
--
|
||||||
function AI_A2G_DISPATCHER:SetDefenseRadius( DefenseRadius )
|
function AI_A2G_DISPATCHER:SetDefenseRadius( DefenseRadius )
|
||||||
|
|
||||||
self.DefenseRadius = DefenseRadius or 40000
|
self.DefenseRadius = DefenseRadius or 100000
|
||||||
|
|
||||||
self.Detection:SetAcceptRange( self.DefenseRadius )
|
self.Detection:SetAcceptRange( self.DefenseRadius )
|
||||||
|
|
||||||
@@ -1870,7 +1868,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
--- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param #string SquadronName The squadron name.
|
-- @param #string SquadronName The squadron name.
|
||||||
-- @param #number TakeoffInterval Only Takeoff new units each specified interval in seconds in 10 seconds steps.
|
-- @param #number TakeoffInterval Only Takeoff new units each specified interval in seconds in 10 seconds steps.
|
||||||
-- @usage
|
-- @usage
|
||||||
@@ -2146,7 +2144,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
Sead.EngageAltType = EngageAltType
|
Sead.EngageAltType = EngageAltType
|
||||||
Sead.Defend = true
|
Sead.Defend = true
|
||||||
|
|
||||||
self:T( { SEAD = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
self:I( { SEAD = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -2236,7 +2234,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
|
|
||||||
self:SetSquadronPatrolInterval( SquadronName, self.DefenderDefault.PatrolLimit, self.DefenderDefault.PatrolMinSeconds, self.DefenderDefault.PatrolMaxSeconds, 1, "SEAD" )
|
self:SetSquadronPatrolInterval( SquadronName, self.DefenderDefault.PatrolLimit, self.DefenderDefault.PatrolMinSeconds, self.DefenderDefault.PatrolMaxSeconds, 1, "SEAD" )
|
||||||
|
|
||||||
self:T( { SEAD = { Zone:GetName(), PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
self:I( { SEAD = { Zone:GetName(), PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -2297,7 +2295,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
Cas.EngageAltType = EngageAltType
|
Cas.EngageAltType = EngageAltType
|
||||||
Cas.Defend = true
|
Cas.Defend = true
|
||||||
|
|
||||||
self:T( { CAS = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
self:I( { CAS = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -2387,7 +2385,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
|
|
||||||
self:SetSquadronPatrolInterval( SquadronName, self.DefenderDefault.PatrolLimit, self.DefenderDefault.PatrolMinSeconds, self.DefenderDefault.PatrolMaxSeconds, 1, "CAS" )
|
self:SetSquadronPatrolInterval( SquadronName, self.DefenderDefault.PatrolLimit, self.DefenderDefault.PatrolMinSeconds, self.DefenderDefault.PatrolMaxSeconds, 1, "CAS" )
|
||||||
|
|
||||||
self:T( { CAS = { Zone:GetName(), PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
self:I( { CAS = { Zone:GetName(), PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -2448,7 +2446,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
Bai.EngageAltType = EngageAltType
|
Bai.EngageAltType = EngageAltType
|
||||||
Bai.Defend = true
|
Bai.Defend = true
|
||||||
|
|
||||||
self:T( { BAI = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
self:I( { BAI = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -2538,7 +2536,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
|
|
||||||
self:SetSquadronPatrolInterval( SquadronName, self.DefenderDefault.PatrolLimit, self.DefenderDefault.PatrolMinSeconds, self.DefenderDefault.PatrolMaxSeconds, 1, "BAI" )
|
self:SetSquadronPatrolInterval( SquadronName, self.DefenderDefault.PatrolLimit, self.DefenderDefault.PatrolMinSeconds, self.DefenderDefault.PatrolMaxSeconds, 1, "BAI" )
|
||||||
|
|
||||||
self:T( { BAI = { Zone:GetName(), PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
self:I( { BAI = { Zone:GetName(), PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -3371,7 +3369,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
--- @param #AI_A2G_DISPATCHER self
|
||||||
function AI_A2G_DISPATCHER:AddDefenderToSquadron( Squadron, Defender, Size )
|
function AI_A2G_DISPATCHER:AddDefenderToSquadron( Squadron, Defender, Size )
|
||||||
self.Defenders = self.Defenders or {}
|
self.Defenders = self.Defenders or {}
|
||||||
local DefenderName = Defender:GetName()
|
local DefenderName = Defender:GetName()
|
||||||
@@ -3382,7 +3380,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
self:F( { DefenderName = DefenderName, SquadronResourceCount = Squadron.ResourceCount } )
|
self:F( { DefenderName = DefenderName, SquadronResourceCount = Squadron.ResourceCount } )
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
--- @param #AI_A2G_DISPATCHER self
|
||||||
function AI_A2G_DISPATCHER:RemoveDefenderFromSquadron( Squadron, Defender )
|
function AI_A2G_DISPATCHER:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||||
self.Defenders = self.Defenders or {}
|
self.Defenders = self.Defenders or {}
|
||||||
local DefenderName = Defender:GetName()
|
local DefenderName = Defender:GetName()
|
||||||
@@ -3798,7 +3796,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
--- @param #AI_A2G_DISPATCHER self
|
||||||
function AI_A2G_Fsm:onafterLostControl( DefenderGroup, From, Event, To )
|
function AI_A2G_Fsm:onafterLostControl( DefenderGroup, From, Event, To )
|
||||||
self:F({"LostControl", DefenderGroup:GetName()})
|
self:F({"LostControl", DefenderGroup:GetName()})
|
||||||
self:GetParent(self).onafterHome( self, DefenderGroup, From, Event, To )
|
self:GetParent(self).onafterHome( self, DefenderGroup, From, Event, To )
|
||||||
@@ -3815,7 +3813,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
--- @param #AI_A2G_DISPATCHER self
|
||||||
function AI_A2G_Fsm:onafterHome( DefenderGroup, From, Event, To, Action )
|
function AI_A2G_Fsm:onafterHome( DefenderGroup, From, Event, To, Action )
|
||||||
self:F({"Home", DefenderGroup:GetName()})
|
self:F({"Home", DefenderGroup:GetName()})
|
||||||
self:GetParent(self).onafterHome( self, DefenderGroup, From, Event, To )
|
self:GetParent(self).onafterHome( self, DefenderGroup, From, Event, To )
|
||||||
@@ -3896,15 +3894,11 @@ do -- AI_A2G_DISPATCHER
|
|||||||
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
||||||
|
|
||||||
if Squadron then
|
if Squadron then
|
||||||
local FirstUnit = AttackSetUnit:GetRandomSurely()
|
local FirstUnit = AttackSetUnit:GetFirst()
|
||||||
if FirstUnit then
|
|
||||||
local Coordinate = FirstUnit:GetCoordinate() -- Core.Point#COORDINATE
|
local Coordinate = FirstUnit:GetCoordinate() -- Core.Point#COORDINATE
|
||||||
if self.SetSendPlayerMessages then
|
if self.SetSendPlayerMessages then
|
||||||
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", on route to ground target at " .. Coordinate:ToStringA2G( DefenderGroup ), DefenderGroup )
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", on route to ground target at " .. Coordinate:ToStringA2G( DefenderGroup ), DefenderGroup )
|
||||||
end
|
end
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
self:GetParent(self).onafterEngageRoute( self, DefenderGroup, From, Event, To, AttackSetUnit )
|
self:GetParent(self).onafterEngageRoute( self, DefenderGroup, From, Event, To, AttackSetUnit )
|
||||||
end
|
end
|
||||||
@@ -3939,7 +3933,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
--- @param #AI_A2G_DISPATCHER self
|
||||||
function AI_A2G_Fsm:onafterLostControl( DefenderGroup, From, Event, To )
|
function AI_A2G_Fsm:onafterLostControl( DefenderGroup, From, Event, To )
|
||||||
self:F({"Defender LostControl", DefenderGroup:GetName()})
|
self:F({"Defender LostControl", DefenderGroup:GetName()})
|
||||||
self:GetParent(self).onafterHome( self, DefenderGroup, From, Event, To )
|
self:GetParent(self).onafterHome( self, DefenderGroup, From, Event, To )
|
||||||
@@ -3956,7 +3950,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
--- @param #AI_A2G_DISPATCHER self
|
||||||
function AI_A2G_Fsm:onafterHome( DefenderGroup, From, Event, To, Action )
|
function AI_A2G_Fsm:onafterHome( DefenderGroup, From, Event, To, Action )
|
||||||
self:F({"Defender Home", DefenderGroup:GetName()})
|
self:F({"Defender Home", DefenderGroup:GetName()})
|
||||||
self:GetParent(self).onafterHome( self, DefenderGroup, From, Event, To )
|
self:GetParent(self).onafterHome( self, DefenderGroup, From, Event, To )
|
||||||
@@ -4790,5 +4784,4 @@ end
|
|||||||
Squadron.ResourceCount = Squadron.ResourceCount - Amount
|
Squadron.ResourceCount = Squadron.ResourceCount - Amount
|
||||||
end
|
end
|
||||||
self:T({Squadron = Squadron.Name,SquadronResourceCount = Squadron.ResourceCount})
|
self:T({Squadron = Squadron.Name,SquadronResourceCount = Squadron.ResourceCount})
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -20,8 +20,6 @@
|
|||||||
|
|
||||||
--- Implements the core functions to SEAD intruders. Use the Engage trigger to intercept intruders.
|
--- Implements the core functions to SEAD intruders. Use the Engage trigger to intercept intruders.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- The AI_A2G_SEAD is assigned a @{Wrapper.Group} and this must be done before the AI_A2G_SEAD process can be started using the **Start** event.
|
-- The AI_A2G_SEAD is assigned a @{Wrapper.Group} and this must be done before the AI_A2G_SEAD process can be started using the **Start** event.
|
||||||
--
|
--
|
||||||
-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits.
|
-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits.
|
||||||
|
|||||||
@@ -9,13 +9,11 @@
|
|||||||
-- @module AI.AI_Air
|
-- @module AI.AI_Air
|
||||||
-- @image MOOSE.JPG
|
-- @image MOOSE.JPG
|
||||||
|
|
||||||
---
|
--- @type AI_AIR
|
||||||
-- @type AI_AIR
|
|
||||||
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
||||||
|
|
||||||
--- The AI_AIR class implements the core functions to operate an AI @{Wrapper.Group}.
|
--- The AI_AIR class implements the core functions to operate an AI @{Wrapper.Group}.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
--
|
||||||
-- # 1) AI_AIR constructor
|
-- # 1) AI_AIR constructor
|
||||||
--
|
--
|
||||||
@@ -266,7 +264,7 @@ function AI_AIR:New( AIGroup )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param Wrapper.Group#GROUP self
|
--- @param Wrapper.Group#GROUP self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function GROUP:OnEventTakeoff( EventData, Fsm )
|
function GROUP:OnEventTakeoff( EventData, Fsm )
|
||||||
Fsm:Takeoff()
|
Fsm:Takeoff()
|
||||||
@@ -448,13 +446,13 @@ function AI_AIR:onafterReturn( Controllable, From, Event, To )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_AIR self
|
--- @param #AI_AIR self
|
||||||
function AI_AIR:onbeforeStatus()
|
function AI_AIR:onbeforeStatus()
|
||||||
|
|
||||||
return self.CheckStatus
|
return self.CheckStatus
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_AIR self
|
--- @param #AI_AIR self
|
||||||
function AI_AIR:onafterStatus()
|
function AI_AIR:onafterStatus()
|
||||||
|
|
||||||
if self.Controllable and self.Controllable:IsAlive() then
|
if self.Controllable and self.Controllable:IsAlive() then
|
||||||
@@ -467,7 +465,7 @@ function AI_AIR:onafterStatus()
|
|||||||
local DistanceFromHomeBase = self.HomeAirbase:GetCoordinate():Get2DDistance( self.Controllable:GetCoordinate() )
|
local DistanceFromHomeBase = self.HomeAirbase:GetCoordinate():Get2DDistance( self.Controllable:GetCoordinate() )
|
||||||
|
|
||||||
if DistanceFromHomeBase > self.DisengageRadius then
|
if DistanceFromHomeBase > self.DisengageRadius then
|
||||||
self:T( self.Controllable:GetName() .. " is too far from home base, RTB!" )
|
self:I( self.Controllable:GetName() .. " is too far from home base, RTB!" )
|
||||||
self:Hold( 300 )
|
self:Hold( 300 )
|
||||||
RTB = false
|
RTB = false
|
||||||
end
|
end
|
||||||
@@ -491,10 +489,10 @@ function AI_AIR:onafterStatus()
|
|||||||
if Fuel < self.FuelThresholdPercentage then
|
if Fuel < self.FuelThresholdPercentage then
|
||||||
|
|
||||||
if self.TankerName then
|
if self.TankerName then
|
||||||
self:T( self.Controllable:GetName() .. " is out of fuel: " .. Fuel .. " ... Refuelling at Tanker!" )
|
self:I( self.Controllable:GetName() .. " is out of fuel: " .. Fuel .. " ... Refuelling at Tanker!" )
|
||||||
self:Refuel()
|
self:Refuel()
|
||||||
else
|
else
|
||||||
self:T( self.Controllable:GetName() .. " is out of fuel: " .. Fuel .. " ... RTB!" )
|
self:I( self.Controllable:GetName() .. " is out of fuel: " .. Fuel .. " ... RTB!" )
|
||||||
local OldAIControllable = self.Controllable
|
local OldAIControllable = self.Controllable
|
||||||
|
|
||||||
local OrbitTask = OldAIControllable:TaskOrbitCircle( math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude ), self.PatrolMinSpeed )
|
local OrbitTask = OldAIControllable:TaskOrbitCircle( math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude ), self.PatrolMinSpeed )
|
||||||
@@ -520,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.
|
-- Note that a group can consist of more units, so if one unit is damaged of a group, the mission may continue.
|
||||||
-- The damaged unit will RTB due to DCS logic, and the others will continue to engage.
|
-- The damaged unit will RTB due to DCS logic, and the others will continue to engage.
|
||||||
if ( Damage / InitialLife ) < self.PatrolDamageThreshold then
|
if ( Damage / InitialLife ) < self.PatrolDamageThreshold then
|
||||||
self:T( self.Controllable:GetName() .. " is damaged: " .. Damage .. " ... RTB!" )
|
self:I( self.Controllable:GetName() .. " is damaged: " .. Damage .. " ... RTB!" )
|
||||||
self:Damaged()
|
self:Damaged()
|
||||||
RTB = true
|
RTB = true
|
||||||
self:SetStatusOff()
|
self:SetStatusOff()
|
||||||
@@ -538,7 +536,7 @@ function AI_AIR:onafterStatus()
|
|||||||
if Damage ~= InitialLife then
|
if Damage ~= InitialLife then
|
||||||
self:Damaged()
|
self:Damaged()
|
||||||
else
|
else
|
||||||
self:T( self.Controllable:GetName() .. " control lost! " )
|
self:I( self.Controllable:GetName() .. " control lost! " )
|
||||||
|
|
||||||
self:LostControl()
|
self:LostControl()
|
||||||
end
|
end
|
||||||
@@ -562,7 +560,7 @@ function AI_AIR:onafterStatus()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- @param Wrapper.Group#GROUP AIGroup
|
--- @param Wrapper.Group#GROUP AIGroup
|
||||||
function AI_AIR.RTBRoute( AIGroup, Fsm )
|
function AI_AIR.RTBRoute( AIGroup, Fsm )
|
||||||
|
|
||||||
AIGroup:F( { "AI_AIR.RTBRoute:", AIGroup:GetName() } )
|
AIGroup:F( { "AI_AIR.RTBRoute:", AIGroup:GetName() } )
|
||||||
@@ -573,7 +571,7 @@ function AI_AIR.RTBRoute( AIGroup, Fsm )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param Wrapper.Group#GROUP AIGroup
|
--- @param Wrapper.Group#GROUP AIGroup
|
||||||
function AI_AIR.RTBHold( AIGroup, Fsm )
|
function AI_AIR.RTBHold( AIGroup, Fsm )
|
||||||
|
|
||||||
AIGroup:F( { "AI_AIR.RTBHold:", AIGroup:GetName() } )
|
AIGroup:F( { "AI_AIR.RTBHold:", AIGroup:GetName() } )
|
||||||
@@ -600,7 +598,7 @@ function AI_AIR:SetRTBSpeedFactors(MinFactor,MaxFactor)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- @param #AI_AIR self
|
--- @param #AI_AIR self
|
||||||
-- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
function AI_AIR:onafterRTB( AIGroup, From, Event, To )
|
function AI_AIR:onafterRTB( AIGroup, From, Event, To )
|
||||||
self:F( { AIGroup, From, Event, To } )
|
self:F( { AIGroup, From, Event, To } )
|
||||||
@@ -619,10 +617,7 @@ function AI_AIR:onafterRTB( AIGroup, From, Event, To )
|
|||||||
--- Calculate the target route point.
|
--- Calculate the target route point.
|
||||||
|
|
||||||
local FromCoord = AIGroup:GetCoordinate()
|
local FromCoord = AIGroup:GetCoordinate()
|
||||||
if not FromCoord then return end
|
|
||||||
|
|
||||||
local ToTargetCoord = self.HomeAirbase:GetCoordinate() -- coordinate is on land height(!)
|
local ToTargetCoord = self.HomeAirbase:GetCoordinate() -- coordinate is on land height(!)
|
||||||
|
|
||||||
local ToTargetVec3 = ToTargetCoord:GetVec3()
|
local ToTargetVec3 = ToTargetCoord:GetVec3()
|
||||||
ToTargetVec3.y = ToTargetCoord:GetLandHeight()+3000 -- let's set this 1000m/3000 feet above ground
|
ToTargetVec3.y = ToTargetCoord:GetLandHeight()+3000 -- let's set this 1000m/3000 feet above ground
|
||||||
local ToTargetCoord2 = COORDINATE:NewFromVec3( ToTargetVec3 )
|
local ToTargetCoord2 = COORDINATE:NewFromVec3( ToTargetVec3 )
|
||||||
@@ -643,13 +638,13 @@ function AI_AIR:onafterRTB( AIGroup, From, Event, To )
|
|||||||
local ToAirbaseCoord = ToTargetCoord2
|
local ToAirbaseCoord = ToTargetCoord2
|
||||||
|
|
||||||
if Distance < 5000 then
|
if Distance < 5000 then
|
||||||
self:T( "RTB and near the airbase!" )
|
self:I( "RTB and near the airbase!" )
|
||||||
self:Home()
|
self:Home()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if not AIGroup:InAir() == true then
|
if not AIGroup:InAir() == true then
|
||||||
self:T( "Not anymore in the air, considered Home." )
|
self:I( "Not anymore in the air, considered Home." )
|
||||||
self:Home()
|
self:Home()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -658,8 +653,8 @@ function AI_AIR:onafterRTB( AIGroup, From, Event, To )
|
|||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local FromRTBRoutePoint = FromCoord:WaypointAir(
|
local FromRTBRoutePoint = FromCoord:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType,
|
||||||
COORDINATE.WaypointType.TurningPoint,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
COORDINATE.WaypointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
RTBSpeed,
|
RTBSpeed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
@@ -667,8 +662,8 @@ function AI_AIR:onafterRTB( AIGroup, From, Event, To )
|
|||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local ToRTBRoutePoint = ToAirbaseCoord:WaypointAir(
|
local ToRTBRoutePoint = ToAirbaseCoord:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType,
|
||||||
COORDINATE.WaypointType.TurningPoint,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
COORDINATE.WaypointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
RTBSpeed,
|
RTBSpeed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
@@ -691,12 +686,12 @@ function AI_AIR:onafterRTB( AIGroup, From, Event, To )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_AIR self
|
--- @param #AI_AIR self
|
||||||
-- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
function AI_AIR:onafterHome( AIGroup, From, Event, To )
|
function AI_AIR:onafterHome( AIGroup, From, Event, To )
|
||||||
self:F( { AIGroup, From, Event, To } )
|
self:F( { AIGroup, From, Event, To } )
|
||||||
|
|
||||||
self:T( "Group " .. self.Controllable:GetName() .. " ... Home! ( " .. self:GetState() .. " )" )
|
self:I( "Group " .. self.Controllable:GetName() .. " ... Home! ( " .. self:GetState() .. " )" )
|
||||||
|
|
||||||
if AIGroup and AIGroup:IsAlive() then
|
if AIGroup and AIGroup:IsAlive() then
|
||||||
end
|
end
|
||||||
@@ -705,17 +700,15 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- @param #AI_AIR self
|
--- @param #AI_AIR self
|
||||||
-- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
function AI_AIR:onafterHold( AIGroup, From, Event, To, HoldTime )
|
function AI_AIR:onafterHold( AIGroup, From, Event, To, HoldTime )
|
||||||
self:F( { AIGroup, From, Event, To } )
|
self:F( { AIGroup, From, Event, To } )
|
||||||
|
|
||||||
self:T( "Group " .. self.Controllable:GetName() .. " ... Holding! ( " .. self:GetState() .. " )" )
|
self:I( "Group " .. self.Controllable:GetName() .. " ... Holding! ( " .. self:GetState() .. " )" )
|
||||||
|
|
||||||
if AIGroup and AIGroup:IsAlive() then
|
if AIGroup and AIGroup:IsAlive() then
|
||||||
local Coordinate = AIGroup:GetCoordinate()
|
local OrbitTask = AIGroup:TaskOrbitCircle( math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude ), self.PatrolMinSpeed )
|
||||||
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 TimedOrbitTask = AIGroup:TaskControlled( OrbitTask, AIGroup:TaskCondition( nil, nil, nil, nil, HoldTime , nil ) )
|
||||||
|
|
||||||
local RTBTask = AIGroup:TaskFunction( "AI_AIR.RTBHold", self )
|
local RTBTask = AIGroup:TaskFunction( "AI_AIR.RTBHold", self )
|
||||||
@@ -729,17 +722,17 @@ function AI_AIR:onafterHold( AIGroup, From, Event, To, HoldTime )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param Wrapper.Group#GROUP AIGroup
|
--- @param Wrapper.Group#GROUP AIGroup
|
||||||
function AI_AIR.Resume( AIGroup, Fsm )
|
function AI_AIR.Resume( AIGroup, Fsm )
|
||||||
|
|
||||||
AIGroup:T( { "AI_AIR.Resume:", AIGroup:GetName() } )
|
AIGroup:I( { "AI_AIR.Resume:", AIGroup:GetName() } )
|
||||||
if AIGroup:IsAlive() then
|
if AIGroup:IsAlive() then
|
||||||
Fsm:__RTB( Fsm.TaskDelay )
|
Fsm:__RTB( Fsm.TaskDelay )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_AIR self
|
--- @param #AI_AIR self
|
||||||
-- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
function AI_AIR:onafterRefuel( AIGroup, From, Event, To )
|
function AI_AIR:onafterRefuel( AIGroup, From, Event, To )
|
||||||
self:F( { AIGroup, From, Event, To } )
|
self:F( { AIGroup, From, Event, To } )
|
||||||
@@ -751,7 +744,7 @@ function AI_AIR:onafterRefuel( AIGroup, From, Event, To )
|
|||||||
|
|
||||||
if Tanker and Tanker:IsAlive() and Tanker:IsAirPlane() then
|
if Tanker and Tanker:IsAlive() and Tanker:IsAirPlane() then
|
||||||
|
|
||||||
self:T( "Group " .. self.Controllable:GetName() .. " ... Refuelling! State=" .. self:GetState() .. ", Refuelling tanker " .. self.TankerName )
|
self:I( "Group " .. self.Controllable:GetName() .. " ... Refuelling! State=" .. self:GetState() .. ", Refuelling tanker " .. self.TankerName )
|
||||||
|
|
||||||
local RefuelRoute = {}
|
local RefuelRoute = {}
|
||||||
|
|
||||||
@@ -762,10 +755,10 @@ function AI_AIR:onafterRefuel( AIGroup, From, Event, To )
|
|||||||
local ToRefuelSpeed = math.random( self.PatrolMinSpeed, self.PatrolMaxSpeed )
|
local ToRefuelSpeed = math.random( self.PatrolMinSpeed, self.PatrolMaxSpeed )
|
||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local FromRefuelRoutePoint = FromRefuelCoord:WaypointAir(self.PatrolAltType, COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, ToRefuelSpeed, true)
|
local FromRefuelRoutePoint = FromRefuelCoord:WaypointAir(self.PatrolAltType, POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, ToRefuelSpeed, true)
|
||||||
|
|
||||||
--- Create a route point of type air. NOT used!
|
--- Create a route point of type air. NOT used!
|
||||||
local ToRefuelRoutePoint = Tanker:GetCoordinate():WaypointAir(self.PatrolAltType, COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, ToRefuelSpeed, true)
|
local ToRefuelRoutePoint = Tanker:GetCoordinate():WaypointAir(self.PatrolAltType, POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, ToRefuelSpeed, true)
|
||||||
|
|
||||||
self:F( { ToRefuelSpeed = ToRefuelSpeed } )
|
self:F( { ToRefuelSpeed = ToRefuelSpeed } )
|
||||||
|
|
||||||
@@ -805,13 +798,13 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- @param #AI_AIR self
|
--- @param #AI_AIR self
|
||||||
function AI_AIR:onafterDead()
|
function AI_AIR:onafterDead()
|
||||||
self:SetStatusOff()
|
self:SetStatusOff()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- @param #AI_AIR self
|
--- @param #AI_AIR self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_AIR:OnCrash( EventData )
|
function AI_AIR:OnCrash( EventData )
|
||||||
|
|
||||||
@@ -822,7 +815,7 @@ function AI_AIR:OnCrash( EventData )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_AIR self
|
--- @param #AI_AIR self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_AIR:OnEjection( EventData )
|
function AI_AIR:OnEjection( EventData )
|
||||||
|
|
||||||
@@ -831,7 +824,7 @@ function AI_AIR:OnEjection( EventData )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_AIR self
|
--- @param #AI_AIR self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_AIR:OnPilotDead( EventData )
|
function AI_AIR:OnPilotDead( EventData )
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [AI_A2A_Dispatcher](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher)
|
-- [AID-AIR - AI AIR Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -36,8 +36,6 @@
|
|||||||
--
|
--
|
||||||
-- # QUICK START GUIDE
|
-- # QUICK START GUIDE
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- The following class is available to model an AIR defense system.
|
-- The following class is available to model an AIR defense system.
|
||||||
--
|
--
|
||||||
-- AI_AIR_DISPATCHER is the main AIR defense class that models the AIR defense system.
|
-- AI_AIR_DISPATCHER is the main AIR defense class that models the AIR defense system.
|
||||||
@@ -902,14 +900,14 @@ do -- AI_AIR_DISPATCHER
|
|||||||
-- @type AI_AIR_DISPATCHER.DefenseCoordinates
|
-- @type AI_AIR_DISPATCHER.DefenseCoordinates
|
||||||
-- @map <#string,Core.Point#COORDINATE> A list of all defense coordinates mapped per defense coordinate name.
|
-- @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 = {}
|
AI_AIR_DISPATCHER.DefenseCoordinates = {}
|
||||||
|
|
||||||
--- Enumerator for spawns at airbases
|
--- Enumerator for spawns at airbases
|
||||||
-- @type AI_AIR_DISPATCHER.Takeoff
|
-- @type AI_AIR_DISPATCHER.Takeoff
|
||||||
-- @extends Wrapper.Group#GROUP.Takeoff
|
-- @extends Wrapper.Group#GROUP.Takeoff
|
||||||
|
|
||||||
-- @field #AI_AIR_DISPATCHER.Takeoff Takeoff
|
--- @field #AI_AIR_DISPATCHER.Takeoff Takeoff
|
||||||
AI_AIR_DISPATCHER.Takeoff = GROUP.Takeoff
|
AI_AIR_DISPATCHER.Takeoff = GROUP.Takeoff
|
||||||
|
|
||||||
--- Defnes Landing location.
|
--- Defnes Landing location.
|
||||||
@@ -940,7 +938,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
-- @type AI_AIR_DISPATCHER.DefenseQueue
|
-- @type AI_AIR_DISPATCHER.DefenseQueue
|
||||||
-- @list<#AI_AIR_DISPATCHER.DefenseQueueItem> DefenseQueueItem A list of all defenses being queued ...
|
-- @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 = {}
|
AI_AIR_DISPATCHER.DefenseQueue = {}
|
||||||
|
|
||||||
--- Defense approach types
|
--- Defense approach types
|
||||||
@@ -1132,7 +1130,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- @param #AI_AIR_DISPATCHER self
|
--- @param #AI_AIR_DISPATCHER self
|
||||||
function AI_AIR_DISPATCHER:onafterStart( From, Event, To )
|
function AI_AIR_DISPATCHER:onafterStart( From, Event, To )
|
||||||
|
|
||||||
self:GetParent( self ).onafterStart( self, From, Event, To )
|
self:GetParent( self ).onafterStart( self, From, Event, To )
|
||||||
@@ -1143,7 +1141,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
for Resource = 1, DefenderSquadron.ResourceCount or 0 do
|
for Resource = 1, DefenderSquadron.ResourceCount or 0 do
|
||||||
self:ResourcePark( DefenderSquadron )
|
self:ResourcePark( DefenderSquadron )
|
||||||
end
|
end
|
||||||
self:T( "Parked resources for squadron " .. DefenderSquadron.Name )
|
self:I( "Parked resources for squadron " .. DefenderSquadron.Name )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -1196,7 +1194,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- @param #AI_AIR_DISPATCHER self
|
--- @param #AI_AIR_DISPATCHER self
|
||||||
function AI_AIR_DISPATCHER:ResourcePark( DefenderSquadron )
|
function AI_AIR_DISPATCHER:ResourcePark( DefenderSquadron )
|
||||||
local TemplateID = math.random( 1, #DefenderSquadron.Spawn )
|
local TemplateID = math.random( 1, #DefenderSquadron.Spawn )
|
||||||
local Spawn = DefenderSquadron.Spawn[ TemplateID ] -- Core.Spawn#SPAWN
|
local Spawn = DefenderSquadron.Spawn[ TemplateID ] -- Core.Spawn#SPAWN
|
||||||
@@ -1213,31 +1211,31 @@ do -- AI_AIR_DISPATCHER
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- @param #AI_AIR_DISPATCHER self
|
--- @param #AI_AIR_DISPATCHER self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_AIR_DISPATCHER:OnEventBaseCaptured( EventData )
|
function AI_AIR_DISPATCHER:OnEventBaseCaptured( EventData )
|
||||||
|
|
||||||
local AirbaseName = EventData.PlaceName -- The name of the airbase that was captured.
|
local AirbaseName = EventData.PlaceName -- The name of the airbase that was captured.
|
||||||
|
|
||||||
self:T( "Captured " .. AirbaseName )
|
self:I( "Captured " .. AirbaseName )
|
||||||
|
|
||||||
-- Now search for all squadrons located at the airbase, and sanitize them.
|
-- Now search for all squadrons located at the airbase, and sanitize them.
|
||||||
for SquadronName, Squadron in pairs( self.DefenderSquadrons ) do
|
for SquadronName, Squadron in pairs( self.DefenderSquadrons ) do
|
||||||
if Squadron.AirbaseName == AirbaseName then
|
if Squadron.AirbaseName == AirbaseName then
|
||||||
Squadron.ResourceCount = -999 -- The base has been captured, and the resources are eliminated. No more spawning.
|
Squadron.ResourceCount = -999 -- The base has been captured, and the resources are eliminated. No more spawning.
|
||||||
Squadron.Captured = true
|
Squadron.Captured = true
|
||||||
self:T( "Squadron " .. SquadronName .. " captured." )
|
self:I( "Squadron " .. SquadronName .. " captured." )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_AIR_DISPATCHER self
|
--- @param #AI_AIR_DISPATCHER self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_AIR_DISPATCHER:OnEventCrashOrDead( EventData )
|
function AI_AIR_DISPATCHER:OnEventCrashOrDead( EventData )
|
||||||
self.Detection:ForgetDetectedUnit( EventData.IniUnitName )
|
self.Detection:ForgetDetectedUnit( EventData.IniUnitName )
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_AIR_DISPATCHER self
|
--- @param #AI_AIR_DISPATCHER self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_AIR_DISPATCHER:OnEventLand( EventData )
|
function AI_AIR_DISPATCHER:OnEventLand( EventData )
|
||||||
self:F( "Landed" )
|
self:F( "Landed" )
|
||||||
@@ -1254,7 +1252,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||||
end
|
end
|
||||||
DefenderUnit:Destroy()
|
DefenderUnit:Destroy()
|
||||||
self:ResourcePark( Squadron )
|
self:ResourcePark( Squadron, Defender )
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if DefenderUnit:GetLife() ~= DefenderUnit:GetLife0() then
|
if DefenderUnit:GetLife() ~= DefenderUnit:GetLife0() then
|
||||||
@@ -1265,7 +1263,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_AIR_DISPATCHER self
|
--- @param #AI_AIR_DISPATCHER self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_AIR_DISPATCHER:OnEventEngineShutdown( EventData )
|
function AI_AIR_DISPATCHER:OnEventEngineShutdown( EventData )
|
||||||
local DefenderUnit = EventData.IniUnit
|
local DefenderUnit = EventData.IniUnit
|
||||||
@@ -1281,31 +1279,31 @@ do -- AI_AIR_DISPATCHER
|
|||||||
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||||
end
|
end
|
||||||
DefenderUnit:Destroy()
|
DefenderUnit:Destroy()
|
||||||
self:ResourcePark( Squadron )
|
self:ResourcePark( Squadron, Defender )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
do -- Manage the defensive behaviour
|
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 #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.
|
-- @param Core.Point#COORDINATE DefenseCoordinate The coordinate to be defended by AIR defenses.
|
||||||
function AI_AIR_DISPATCHER:AddDefenseCoordinate( DefenseCoordinateName, DefenseCoordinate )
|
function AI_AIR_DISPATCHER:AddDefenseCoordinate( DefenseCoordinateName, DefenseCoordinate )
|
||||||
self.DefenseCoordinates[DefenseCoordinateName] = DefenseCoordinate
|
self.DefenseCoordinates[DefenseCoordinateName] = DefenseCoordinate
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_AIR_DISPATCHER self
|
--- @param #AI_AIR_DISPATCHER self
|
||||||
function AI_AIR_DISPATCHER:SetDefenseReactivityLow()
|
function AI_AIR_DISPATCHER:SetDefenseReactivityLow()
|
||||||
self.DefenseReactivity = 0.05
|
self.DefenseReactivity = 0.05
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_AIR_DISPATCHER self
|
--- @param #AI_AIR_DISPATCHER self
|
||||||
function AI_AIR_DISPATCHER:SetDefenseReactivityMedium()
|
function AI_AIR_DISPATCHER:SetDefenseReactivityMedium()
|
||||||
self.DefenseReactivity = 0.15
|
self.DefenseReactivity = 0.15
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_AIR_DISPATCHER self
|
--- @param #AI_AIR_DISPATCHER self
|
||||||
function AI_AIR_DISPATCHER:SetDefenseReactivityHigh()
|
function AI_AIR_DISPATCHER:SetDefenseReactivityHigh()
|
||||||
self.DefenseReactivity = 0.5
|
self.DefenseReactivity = 0.5
|
||||||
end
|
end
|
||||||
@@ -1869,7 +1867,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_AIR_DISPATCHER self
|
--- @param #AI_AIR_DISPATCHER self
|
||||||
-- @param #string SquadronName The squadron name.
|
-- @param #string SquadronName The squadron name.
|
||||||
-- @param #number TakeoffInterval Only Takeoff new units each specified interval in seconds in 10 seconds steps.
|
-- @param #number TakeoffInterval Only Takeoff new units each specified interval in seconds in 10 seconds steps.
|
||||||
-- @usage
|
-- @usage
|
||||||
@@ -2771,7 +2769,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
|
|
||||||
-- TODO: Need to model the resources in a squadron.
|
-- 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
|
-- @param AI.AI_Air_Squadron#AI_AIR_SQUADRON Squadron
|
||||||
function AI_AIR_DISPATCHER:AddDefenderToSquadron( Squadron, Defender, Size )
|
function AI_AIR_DISPATCHER:AddDefenderToSquadron( Squadron, Defender, Size )
|
||||||
self.Defenders = self.Defenders or {}
|
self.Defenders = self.Defenders or {}
|
||||||
@@ -2784,7 +2782,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
self:F( { DefenderName = DefenderName, SquadronResourceCount = Squadron.ResourceCount } )
|
self:F( { DefenderName = DefenderName, SquadronResourceCount = Squadron.ResourceCount } )
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_AIR_DISPATCHER self
|
--- @param #AI_AIR_DISPATCHER self
|
||||||
-- @param AI.AI_Air_Squadron#AI_AIR_SQUADRON Squadron
|
-- @param AI.AI_Air_Squadron#AI_AIR_SQUADRON Squadron
|
||||||
function AI_AIR_DISPATCHER:RemoveDefenderFromSquadron( Squadron, Defender )
|
function AI_AIR_DISPATCHER:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||||
self.Defenders = self.Defenders or {}
|
self.Defenders = self.Defenders or {}
|
||||||
@@ -2797,7 +2795,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
self:F( { DefenderName = DefenderName, SquadronResourceCount = SquadronResourceCount } )
|
self:F( { DefenderName = DefenderName, SquadronResourceCount = SquadronResourceCount } )
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_AIR_DISPATCHER self
|
--- @param #AI_AIR_DISPATCHER self
|
||||||
-- @param Wrapper.Group#GROUP Defender
|
-- @param Wrapper.Group#GROUP Defender
|
||||||
-- @return AI.AI_Air_Squadron#AI_AIR_SQUADRON The Squadron.
|
-- @return AI.AI_Air_Squadron#AI_AIR_SQUADRON The Squadron.
|
||||||
function AI_AIR_DISPATCHER:GetSquadronFromDefender( Defender )
|
function AI_AIR_DISPATCHER:GetSquadronFromDefender( Defender )
|
||||||
|
|||||||
@@ -14,13 +14,11 @@
|
|||||||
|
|
||||||
|
|
||||||
--- @type AI_AIR_ENGAGE
|
--- @type AI_AIR_ENGAGE
|
||||||
-- @extends AI.AI_AIR#AI_AIR
|
-- @extends AI.AI_Air#AI_AIR
|
||||||
|
|
||||||
|
|
||||||
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
|
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- The AI_AIR_ENGAGE is assigned a @{Wrapper.Group} and this must be done before the AI_AIR_ENGAGE process can be started using the **Start** event.
|
-- The AI_AIR_ENGAGE is assigned a @{Wrapper.Group} and this must be done before the AI_AIR_ENGAGE process can be started using the **Start** event.
|
||||||
--
|
--
|
||||||
-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits.
|
-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits.
|
||||||
@@ -353,7 +351,7 @@ function AI_AIR_ENGAGE:onafterAbort( AIGroup, From, Event, To )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- @param #AI_AIR_ENGAGE self
|
--- @param #AI_AIR_ENGAGE self
|
||||||
-- @param Wrapper.Group#GROUP AIGroup The Group Object managed by the FSM.
|
-- @param Wrapper.Group#GROUP AIGroup The Group Object managed by the FSM.
|
||||||
-- @param #string From The From State string.
|
-- @param #string From The From State string.
|
||||||
-- @param #string Event The Event string.
|
-- @param #string Event The Event string.
|
||||||
@@ -363,7 +361,7 @@ function AI_AIR_ENGAGE:onafterAccomplish( AIGroup, From, Event, To )
|
|||||||
--self:SetDetectionOff()
|
--self:SetDetectionOff()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_AIR_ENGAGE self
|
--- @param #AI_AIR_ENGAGE self
|
||||||
-- @param Wrapper.Group#GROUP AIGroup The Group Object managed by the FSM.
|
-- @param Wrapper.Group#GROUP AIGroup The Group Object managed by the FSM.
|
||||||
-- @param #string From The From State string.
|
-- @param #string From The From State string.
|
||||||
-- @param #string Event The Event string.
|
-- @param #string Event The Event string.
|
||||||
@@ -376,7 +374,7 @@ function AI_AIR_ENGAGE:onafterDestroy( AIGroup, From, Event, To, EventData )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_AIR_ENGAGE self
|
--- @param #AI_AIR_ENGAGE self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_AIR_ENGAGE:OnEventDead( EventData )
|
function AI_AIR_ENGAGE:OnEventDead( EventData )
|
||||||
self:F( { "EventDead", EventData } )
|
self:F( { "EventDead", EventData } )
|
||||||
@@ -389,9 +387,9 @@ function AI_AIR_ENGAGE:OnEventDead( EventData )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- @param Wrapper.Group#GROUP AIControllable
|
--- @param Wrapper.Group#GROUP AIControllable
|
||||||
function AI_AIR_ENGAGE.___EngageRoute( AIGroup, Fsm, AttackSetUnit )
|
function AI_AIR_ENGAGE.___EngageRoute( AIGroup, Fsm, AttackSetUnit )
|
||||||
Fsm:T(string.format("AI_AIR_ENGAGE.___EngageRoute: %s", tostring(AIGroup:GetName())))
|
Fsm:I(string.format("AI_AIR_ENGAGE.___EngageRoute: %s", tostring(AIGroup:GetName())))
|
||||||
|
|
||||||
if AIGroup and AIGroup:IsAlive() then
|
if AIGroup and AIGroup:IsAlive() then
|
||||||
Fsm:__EngageRoute( Fsm.TaskDelay or 0.1, AttackSetUnit )
|
Fsm:__EngageRoute( Fsm.TaskDelay or 0.1, AttackSetUnit )
|
||||||
@@ -399,14 +397,14 @@ function AI_AIR_ENGAGE.___EngageRoute( AIGroup, Fsm, AttackSetUnit )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- @param #AI_AIR_ENGAGE self
|
--- @param #AI_AIR_ENGAGE self
|
||||||
-- @param Wrapper.Group#GROUP DefenderGroup The GroupGroup managed by the FSM.
|
-- @param Wrapper.Group#GROUP DefenderGroup The GroupGroup managed by the FSM.
|
||||||
-- @param #string From The From State string.
|
-- @param #string From The From State string.
|
||||||
-- @param #string Event The Event string.
|
-- @param #string Event The Event string.
|
||||||
-- @param #string To The To State string.
|
-- @param #string To The To State string.
|
||||||
-- @param Core.Set#SET_UNIT AttackSetUnit Unit set to be attacked.
|
-- @param Core.Set#SET_UNIT AttackSetUnit Unit set to be attacked.
|
||||||
function AI_AIR_ENGAGE:onafterEngageRoute( DefenderGroup, From, Event, To, AttackSetUnit )
|
function AI_AIR_ENGAGE:onafterEngageRoute( DefenderGroup, From, Event, To, AttackSetUnit )
|
||||||
self:T( { DefenderGroup, From, Event, To, AttackSetUnit } )
|
self:I( { DefenderGroup, From, Event, To, AttackSetUnit } )
|
||||||
|
|
||||||
local DefenderGroupName = DefenderGroup:GetName()
|
local DefenderGroupName = DefenderGroup:GetName()
|
||||||
|
|
||||||
@@ -428,13 +426,7 @@ function AI_AIR_ENGAGE:onafterEngageRoute( DefenderGroup, From, Event, To, Attac
|
|||||||
local DefenderCoord = DefenderGroup:GetPointVec3()
|
local DefenderCoord = DefenderGroup:GetPointVec3()
|
||||||
DefenderCoord:SetY( EngageAltitude ) -- Ground targets don't have an altitude.
|
DefenderCoord:SetY( EngageAltitude ) -- Ground targets don't have an altitude.
|
||||||
|
|
||||||
local TargetCoord = AttackSetUnit:GetRandomSurely():GetPointVec3()
|
local TargetCoord = AttackSetUnit:GetFirst():GetPointVec3()
|
||||||
|
|
||||||
if TargetCoord == nil then
|
|
||||||
self:Return()
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
TargetCoord:SetY( EngageAltitude ) -- Ground targets don't have an altitude.
|
TargetCoord:SetY( EngageAltitude ) -- Ground targets don't have an altitude.
|
||||||
|
|
||||||
local TargetDistance = DefenderCoord:Get2DDistance( TargetCoord )
|
local TargetDistance = DefenderCoord:Get2DDistance( TargetCoord )
|
||||||
@@ -443,19 +435,19 @@ function AI_AIR_ENGAGE:onafterEngageRoute( DefenderGroup, From, Event, To, Attac
|
|||||||
-- TODO: A factor of * 3 is way too close. This causes the AI not to engange until merged sometimes!
|
-- TODO: A factor of * 3 is way too close. This causes the AI not to engange until merged sometimes!
|
||||||
if TargetDistance <= EngageDistance * 9 then
|
if TargetDistance <= EngageDistance * 9 then
|
||||||
|
|
||||||
--self:T(string.format("AI_AIR_ENGAGE onafterEngageRoute ==> __Engage - target distance = %.1f km", TargetDistance/1000))
|
--self:I(string.format("AI_AIR_ENGAGE onafterEngageRoute ==> __Engage - target distance = %.1f km", TargetDistance/1000))
|
||||||
self:__Engage( 0.1, AttackSetUnit )
|
self:__Engage( 0.1, AttackSetUnit )
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
--self:T(string.format("FF AI_AIR_ENGAGE onafterEngageRoute ==> Routing - target distance = %.1f km", TargetDistance/1000))
|
--self:I(string.format("FF AI_AIR_ENGAGE onafterEngageRoute ==> Routing - target distance = %.1f km", TargetDistance/1000))
|
||||||
|
|
||||||
local EngageRoute = {}
|
local EngageRoute = {}
|
||||||
local AttackTasks = {}
|
local AttackTasks = {}
|
||||||
|
|
||||||
--- Calculate the target route point.
|
--- Calculate the target route point.
|
||||||
|
|
||||||
local FromWP = DefenderCoord:WaypointAir(self.PatrolAltType or "RADIO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, EngageSpeed, true)
|
local FromWP = DefenderCoord:WaypointAir(self.PatrolAltType or "RADIO", POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, EngageSpeed, true)
|
||||||
|
|
||||||
EngageRoute[#EngageRoute+1] = FromWP
|
EngageRoute[#EngageRoute+1] = FromWP
|
||||||
|
|
||||||
@@ -464,7 +456,7 @@ function AI_AIR_ENGAGE:onafterEngageRoute( DefenderGroup, From, Event, To, Attac
|
|||||||
local FromEngageAngle = DefenderCoord:GetAngleDegrees( DefenderCoord:GetDirectionVec3( TargetCoord ) )
|
local FromEngageAngle = DefenderCoord:GetAngleDegrees( DefenderCoord:GetDirectionVec3( TargetCoord ) )
|
||||||
local ToCoord=DefenderCoord:Translate( EngageDistance, FromEngageAngle, true )
|
local ToCoord=DefenderCoord:Translate( EngageDistance, FromEngageAngle, true )
|
||||||
|
|
||||||
local ToWP = ToCoord:WaypointAir(self.PatrolAltType or "RADIO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, EngageSpeed, true)
|
local ToWP = ToCoord:WaypointAir(self.PatrolAltType or "RADIO", POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, EngageSpeed, true)
|
||||||
|
|
||||||
EngageRoute[#EngageRoute+1] = ToWP
|
EngageRoute[#EngageRoute+1] = ToWP
|
||||||
|
|
||||||
@@ -480,16 +472,16 @@ function AI_AIR_ENGAGE:onafterEngageRoute( DefenderGroup, From, Event, To, Attac
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- TODO: This will make an A2A Dispatcher CAP flight to return rather than going back to patrolling!
|
-- TODO: This will make an A2A Dispatcher CAP flight to return rather than going back to patrolling!
|
||||||
self:T( DefenderGroupName .. ": No targets found -> Going RTB")
|
self:I( DefenderGroupName .. ": No targets found -> Going RTB")
|
||||||
self:Return()
|
self:Return()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- @param Wrapper.Group#GROUP AIControllable
|
--- @param Wrapper.Group#GROUP AIControllable
|
||||||
function AI_AIR_ENGAGE.___Engage( AIGroup, Fsm, AttackSetUnit )
|
function AI_AIR_ENGAGE.___Engage( AIGroup, Fsm, AttackSetUnit )
|
||||||
|
|
||||||
Fsm:T(string.format("AI_AIR_ENGAGE.___Engage: %s", tostring(AIGroup:GetName())))
|
Fsm:I(string.format("AI_AIR_ENGAGE.___Engage: %s", tostring(AIGroup:GetName())))
|
||||||
|
|
||||||
if AIGroup and AIGroup:IsAlive() then
|
if AIGroup and AIGroup:IsAlive() then
|
||||||
local delay=Fsm.TaskDelay or 0.1
|
local delay=Fsm.TaskDelay or 0.1
|
||||||
@@ -498,7 +490,7 @@ function AI_AIR_ENGAGE.___Engage( AIGroup, Fsm, AttackSetUnit )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- @param #AI_AIR_ENGAGE self
|
--- @param #AI_AIR_ENGAGE self
|
||||||
-- @param Wrapper.Group#GROUP DefenderGroup The GroupGroup managed by the FSM.
|
-- @param Wrapper.Group#GROUP DefenderGroup The GroupGroup managed by the FSM.
|
||||||
-- @param #string From The From State string.
|
-- @param #string From The From State string.
|
||||||
-- @param #string Event The Event string.
|
-- @param #string Event The Event string.
|
||||||
@@ -524,7 +516,7 @@ function AI_AIR_ENGAGE:onafterEngage( DefenderGroup, From, Event, To, AttackSetU
|
|||||||
local DefenderCoord = DefenderGroup:GetPointVec3()
|
local DefenderCoord = DefenderGroup:GetPointVec3()
|
||||||
DefenderCoord:SetY( EngageAltitude ) -- Ground targets don't have an altitude.
|
DefenderCoord:SetY( EngageAltitude ) -- Ground targets don't have an altitude.
|
||||||
|
|
||||||
local TargetCoord = AttackSetUnit:GetRandomSurely():GetPointVec3()
|
local TargetCoord = AttackSetUnit:GetFirst():GetPointVec3()
|
||||||
if not TargetCoord then
|
if not TargetCoord then
|
||||||
self:Return()
|
self:Return()
|
||||||
return
|
return
|
||||||
@@ -538,7 +530,7 @@ function AI_AIR_ENGAGE:onafterEngage( DefenderGroup, From, Event, To, AttackSetU
|
|||||||
local EngageRoute = {}
|
local EngageRoute = {}
|
||||||
local AttackTasks = {}
|
local AttackTasks = {}
|
||||||
|
|
||||||
local FromWP = DefenderCoord:WaypointAir(self.EngageAltType or "RADIO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, EngageSpeed, true)
|
local FromWP = DefenderCoord:WaypointAir(self.EngageAltType or "RADIO", POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, EngageSpeed, true)
|
||||||
EngageRoute[#EngageRoute+1] = FromWP
|
EngageRoute[#EngageRoute+1] = FromWP
|
||||||
|
|
||||||
self:SetTargetDistance( TargetCoord ) -- For RTB status check
|
self:SetTargetDistance( TargetCoord ) -- For RTB status check
|
||||||
@@ -546,7 +538,7 @@ function AI_AIR_ENGAGE:onafterEngage( DefenderGroup, From, Event, To, AttackSetU
|
|||||||
local FromEngageAngle = DefenderCoord:GetAngleDegrees( DefenderCoord:GetDirectionVec3( TargetCoord ) )
|
local FromEngageAngle = DefenderCoord:GetAngleDegrees( DefenderCoord:GetDirectionVec3( TargetCoord ) )
|
||||||
local ToCoord=DefenderCoord:Translate( EngageDistance, FromEngageAngle, true )
|
local ToCoord=DefenderCoord:Translate( EngageDistance, FromEngageAngle, true )
|
||||||
|
|
||||||
local ToWP = ToCoord:WaypointAir(self.EngageAltType or "RADIO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, EngageSpeed, true)
|
local ToWP = ToCoord:WaypointAir(self.EngageAltType or "RADIO", POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, EngageSpeed, true)
|
||||||
EngageRoute[#EngageRoute+1] = ToWP
|
EngageRoute[#EngageRoute+1] = ToWP
|
||||||
|
|
||||||
-- TODO: A factor of * 3 this way too low. This causes the AI NOT to engage until very close or even merged sometimes. Some A2A missiles have a much longer range! Needs more frequent updates of the task!
|
-- TODO: A factor of * 3 this way too low. This causes the AI NOT to engage until very close or even merged sometimes. Some A2A missiles have a much longer range! Needs more frequent updates of the task!
|
||||||
@@ -555,12 +547,12 @@ function AI_AIR_ENGAGE:onafterEngage( DefenderGroup, From, Event, To, AttackSetU
|
|||||||
local AttackUnitTasks = self:CreateAttackUnitTasks( AttackSetUnit, DefenderGroup, EngageAltitude ) -- Polymorphic
|
local AttackUnitTasks = self:CreateAttackUnitTasks( AttackSetUnit, DefenderGroup, EngageAltitude ) -- Polymorphic
|
||||||
|
|
||||||
if #AttackUnitTasks == 0 then
|
if #AttackUnitTasks == 0 then
|
||||||
self:T( DefenderGroupName .. ": No valid targets found -> Going RTB")
|
self:I( DefenderGroupName .. ": No valid targets found -> Going RTB")
|
||||||
self:Return()
|
self:Return()
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
local text=string.format("%s: Engaging targets at distance %.2f NM", DefenderGroupName, UTILS.MetersToNM(TargetDistance))
|
local text=string.format("%s: Engaging targets at distance %.2f NM", DefenderGroupName, UTILS.MetersToNM(TargetDistance))
|
||||||
self:T(text)
|
self:I(text)
|
||||||
DefenderGroup:OptionROEOpenFire()
|
DefenderGroup:OptionROEOpenFire()
|
||||||
DefenderGroup:OptionROTEvadeFire()
|
DefenderGroup:OptionROTEvadeFire()
|
||||||
DefenderGroup:OptionKeepWeaponsOnThreat()
|
DefenderGroup:OptionKeepWeaponsOnThreat()
|
||||||
@@ -577,13 +569,13 @@ function AI_AIR_ENGAGE:onafterEngage( DefenderGroup, From, Event, To, AttackSetU
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- TODO: This will make an A2A Dispatcher CAP flight to return rather than going back to patrolling!
|
-- TODO: This will make an A2A Dispatcher CAP flight to return rather than going back to patrolling!
|
||||||
self:T( DefenderGroupName .. ": No targets found -> returning.")
|
self:I( DefenderGroupName .. ": No targets found -> returning.")
|
||||||
self:Return()
|
self:Return()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param Wrapper.Group#GROUP AIEngage
|
--- @param Wrapper.Group#GROUP AIEngage
|
||||||
function AI_AIR_ENGAGE.Resume( AIEngage, Fsm )
|
function AI_AIR_ENGAGE.Resume( AIEngage, Fsm )
|
||||||
|
|
||||||
AIEngage:F( { "Resume:", AIEngage:GetName() } )
|
AIEngage:F( { "Resume:", AIEngage:GetName() } )
|
||||||
|
|||||||
@@ -15,8 +15,6 @@
|
|||||||
--- The AI_AIR_PATROL class implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Group}
|
--- The AI_AIR_PATROL class implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Group}
|
||||||
-- and automatically engage any airborne enemies that are within a certain range or within a certain zone.
|
-- and automatically engage any airborne enemies that are within a certain range or within a certain zone.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
-- The AI_AIR_PATROL is assigned a @{Wrapper.Group} and this must be done before the AI_AIR_PATROL process can be started using the **Start** event.
|
-- The AI_AIR_PATROL is assigned a @{Wrapper.Group} and this must be done before the AI_AIR_PATROL process can be started using the **Start** event.
|
||||||
@@ -311,7 +309,7 @@ function AI_AIR_PATROL:onafterPatrolRoute( AIPatrol, From, Event, To )
|
|||||||
local ToTargetSpeed = math.random( self.PatrolMinSpeed, self.PatrolMaxSpeed )
|
local ToTargetSpeed = math.random( self.PatrolMinSpeed, self.PatrolMaxSpeed )
|
||||||
local speedkmh=ToTargetSpeed
|
local speedkmh=ToTargetSpeed
|
||||||
|
|
||||||
local FromWP = CurrentCoord:WaypointAir(self.PatrolAltType or "RADIO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, ToTargetSpeed, true)
|
local FromWP = CurrentCoord:WaypointAir(self.PatrolAltType or "RADIO", POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, ToTargetSpeed, true)
|
||||||
PatrolRoute[#PatrolRoute+1] = FromWP
|
PatrolRoute[#PatrolRoute+1] = FromWP
|
||||||
|
|
||||||
if self.racetrack then
|
if self.racetrack then
|
||||||
@@ -361,9 +359,9 @@ function AI_AIR_PATROL:onafterPatrolRoute( AIPatrol, From, Event, To )
|
|||||||
else
|
else
|
||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local ToWP = ToTargetCoord:WaypointAir(self.PatrolAltType, COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, ToTargetSpeed, true)
|
local ToWP = ToTargetCoord:WaypointAir(self.PatrolAltType, POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, ToTargetSpeed, true)
|
||||||
PatrolRoute[#PatrolRoute+1] = ToWP
|
PatrolRoute[#PatrolRoute+1] = ToWP
|
||||||
|
|
||||||
local Tasks = {}
|
local Tasks = {}
|
||||||
Tasks[#Tasks+1] = AIPatrol:TaskFunction("AI_AIR_PATROL.___PatrolRoute", self)
|
Tasks[#Tasks+1] = AIPatrol:TaskFunction("AI_AIR_PATROL.___PatrolRoute", self)
|
||||||
PatrolRoute[#PatrolRoute].task = AIPatrol:TaskCombo( Tasks )
|
PatrolRoute[#PatrolRoute].task = AIPatrol:TaskCombo( Tasks )
|
||||||
|
|||||||
@@ -21,8 +21,6 @@
|
|||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
||||||
-- Therefore, this class is considered to be deprecated
|
-- Therefore, this class is considered to be deprecated
|
||||||
--
|
--
|
||||||
@@ -40,7 +38,7 @@ AI_AIR_SQUADRON = {
|
|||||||
-- @return #AI_AIR_SQUADRON
|
-- @return #AI_AIR_SQUADRON
|
||||||
function AI_AIR_SQUADRON:New( SquadronName, AirbaseName, TemplatePrefixes, ResourceCount )
|
function AI_AIR_SQUADRON:New( SquadronName, AirbaseName, TemplatePrefixes, ResourceCount )
|
||||||
|
|
||||||
self:T( { Air_Squadron = { SquadronName, AirbaseName, TemplatePrefixes, ResourceCount } } )
|
self:I( { Air_Squadron = { SquadronName, AirbaseName, TemplatePrefixes, ResourceCount } } )
|
||||||
|
|
||||||
local AI_Air_Squadron = BASE:New() -- #AI_AIR_SQUADRON
|
local AI_Air_Squadron = BASE:New() -- #AI_AIR_SQUADRON
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_BAI)
|
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/BAI%20-%20Battlefield%20Air%20Interdiction)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -38,8 +38,6 @@
|
|||||||
|
|
||||||
--- Implements the core functions to provide BattleGround Air Interdiction in an Engage @{Core.Zone} by an AIR @{Wrapper.Controllable} or @{Wrapper.Group}.
|
--- Implements the core functions to provide BattleGround Air Interdiction in an Engage @{Core.Zone} by an AIR @{Wrapper.Controllable} or @{Wrapper.Group}.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- The AI_BAI_ZONE runs a process. It holds an AI in a Patrol Zone and when the AI is commanded to engage, it will fly to an Engage Zone.
|
-- The AI_BAI_ZONE runs a process. It holds an AI in a Patrol Zone and when the AI is commanded to engage, it will fly to an Engage Zone.
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
@@ -176,7 +174,8 @@ function AI_BAI_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
|
|||||||
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
|
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
|
||||||
-- @param #string From The From State string.
|
-- @param #string From The From State string.
|
||||||
-- @param #string Event The Event string.
|
-- @param #string Event The Event string.
|
||||||
-- @param #string To The To State string.
|
-- @param #string To The To State string.
|
||||||
|
|
||||||
-- @return #boolean Return false to cancel Transition.
|
-- @return #boolean Return false to cancel Transition.
|
||||||
|
|
||||||
--- OnAfter Transition Handler for Event Engage.
|
--- OnAfter Transition Handler for Event Engage.
|
||||||
@@ -523,12 +522,12 @@ function AI_BAI_ZONE:onafterEngage( Controllable, From, Event, To,
|
|||||||
|
|
||||||
--DONE: Create GetAltitude function for GROUP, and delete GetUnit(1).
|
--DONE: Create GetAltitude function for GROUP, and delete GetUnit(1).
|
||||||
local CurrentAltitude = self.Controllable:GetAltitude()
|
local CurrentAltitude = self.Controllable:GetAltitude()
|
||||||
local CurrentPointVec3 = COORDINATE:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
|
local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
|
||||||
local ToEngageZoneSpeed = self.PatrolMaxSpeed
|
local ToEngageZoneSpeed = self.PatrolMaxSpeed
|
||||||
local CurrentRoutePoint = CurrentPointVec3:WaypointAir(
|
local CurrentRoutePoint = CurrentPointVec3:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType,
|
||||||
COORDINATE.WaypointType.TurningPoint,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
COORDINATE.WaypointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
self.EngageSpeed,
|
self.EngageSpeed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
@@ -579,13 +578,13 @@ function AI_BAI_ZONE:onafterEngage( Controllable, From, Event, To,
|
|||||||
self:T2( ToTargetVec2 )
|
self:T2( ToTargetVec2 )
|
||||||
|
|
||||||
--- Obtain a 3D @{Point} from the 2D point + altitude.
|
--- Obtain a 3D @{Point} from the 2D point + altitude.
|
||||||
local ToTargetPointVec3 = COORDINATE:New( ToTargetVec2.x, self.EngageAltitude, ToTargetVec2.y )
|
local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, self.EngageAltitude, ToTargetVec2.y )
|
||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local ToTargetRoutePoint = ToTargetPointVec3:WaypointAir(
|
local ToTargetRoutePoint = ToTargetPointVec3:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType,
|
||||||
COORDINATE.WaypointType.TurningPoint,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
COORDINATE.WaypointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
self.EngageSpeed,
|
self.EngageSpeed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Balancer)
|
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AIB%20-%20AI%20Balancing)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -33,9 +33,8 @@
|
|||||||
-- @field Wrapper.Group#GROUP Test
|
-- @field Wrapper.Group#GROUP Test
|
||||||
-- @extends Core.Fsm#FSM_SET
|
-- @extends Core.Fsm#FSM_SET
|
||||||
|
|
||||||
--- 
|
|
||||||
--
|
--- Monitors and manages as many replacement AI groups as there are
|
||||||
-- Monitors and manages as many replacement AI groups as there are
|
|
||||||
-- CLIENTS in a SET\_CLIENT collection, which are not occupied by human players.
|
-- CLIENTS in a SET\_CLIENT collection, which are not occupied by human players.
|
||||||
-- In other words, use AI_BALANCER to simulate human behaviour by spawning in replacement AI in multi player missions.
|
-- In other words, use AI_BALANCER to simulate human behaviour by spawning in replacement AI in multi player missions.
|
||||||
--
|
--
|
||||||
@@ -169,8 +168,7 @@ function AI_BALANCER:ReturnToHomeAirbase( ReturnThresholdRange )
|
|||||||
self.ReturnThresholdRange = ReturnThresholdRange
|
self.ReturnThresholdRange = ReturnThresholdRange
|
||||||
end
|
end
|
||||||
|
|
||||||
--- AI_BALANCER:onenterSpawning
|
--- @param #AI_BALANCER self
|
||||||
-- @param #AI_BALANCER self
|
|
||||||
-- @param Core.Set#SET_GROUP SetGroup
|
-- @param Core.Set#SET_GROUP SetGroup
|
||||||
-- @param #string ClientName
|
-- @param #string ClientName
|
||||||
-- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
@@ -192,8 +190,7 @@ function AI_BALANCER:onenterSpawning( SetGroup, From, Event, To, ClientName )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- AI_BALANCER:onenterDestroying
|
--- @param #AI_BALANCER self
|
||||||
-- @param #AI_BALANCER self
|
|
||||||
-- @param Core.Set#SET_GROUP SetGroup
|
-- @param Core.Set#SET_GROUP SetGroup
|
||||||
-- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
function AI_BALANCER:onenterDestroying( SetGroup, From, Event, To, ClientName, AIGroup )
|
function AI_BALANCER:onenterDestroying( SetGroup, From, Event, To, ClientName, AIGroup )
|
||||||
@@ -221,24 +218,30 @@ function AI_BALANCER:onenterReturning( SetGroup, From, Event, To, AIGroup )
|
|||||||
AIGroup:MessageToRed( "Returning to home base ...", 30 )
|
AIGroup:MessageToRed( "Returning to home base ...", 30 )
|
||||||
else
|
else
|
||||||
-- Okay, we need to send this Group back to the nearest base of the Coalition of the AI.
|
-- Okay, we need to send this Group back to the nearest base of the Coalition of the AI.
|
||||||
local PointVec2 = COORDINATE:New(AIGroup:GetVec2().x, 0, AIGroup:GetVec2().y)
|
--TODO: i need to rework the POINT_VEC2 thing.
|
||||||
|
local PointVec2 = POINT_VEC2:New( AIGroup:GetVec2().x, AIGroup:GetVec2().y )
|
||||||
local ClosestAirbase = self.ReturnAirbaseSet:FindNearestAirbaseFromPointVec2( PointVec2 )
|
local ClosestAirbase = self.ReturnAirbaseSet:FindNearestAirbaseFromPointVec2( PointVec2 )
|
||||||
self:T( ClosestAirbase.AirbaseName )
|
self:T( ClosestAirbase.AirbaseName )
|
||||||
|
--[[
|
||||||
|
AIGroup:MessageToRed( "Returning to " .. ClosestAirbase:GetName().. " ...", 30 )
|
||||||
|
local RTBRoute = AIGroup:RouteReturnToAirbase( ClosestAirbase )
|
||||||
|
AIGroupTemplate.route = RTBRoute
|
||||||
|
AIGroup:Respawn( AIGroupTemplate )
|
||||||
|
]]
|
||||||
AIGroup:RouteRTB(ClosestAirbase)
|
AIGroup:RouteRTB(ClosestAirbase)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- AI_BALANCER:onenterMonitoring
|
|
||||||
-- @param #AI_BALANCER self
|
--- @param #AI_BALANCER self
|
||||||
function AI_BALANCER:onenterMonitoring( SetGroup )
|
function AI_BALANCER:onenterMonitoring( SetGroup )
|
||||||
|
|
||||||
self:T2( { self.SetClient:Count() } )
|
self:T2( { self.SetClient:Count() } )
|
||||||
--self.SetClient:Flush()
|
--self.SetClient:Flush()
|
||||||
|
|
||||||
self.SetClient:ForEachClient(
|
self.SetClient:ForEachClient(
|
||||||
--- SetClient:ForEachClient
|
--- @param Wrapper.Client#CLIENT Client
|
||||||
-- @param Wrapper.Client#CLIENT Client
|
|
||||||
function( Client )
|
function( Client )
|
||||||
self:T3(Client.ClientName)
|
self:T3(Client.ClientName)
|
||||||
|
|
||||||
@@ -261,8 +264,7 @@ function AI_BALANCER:onenterMonitoring( SetGroup )
|
|||||||
self:T2( RangeZone )
|
self:T2( RangeZone )
|
||||||
|
|
||||||
_DATABASE:ForEachPlayerUnit(
|
_DATABASE:ForEachPlayerUnit(
|
||||||
--- Nameless function
|
--- @param Wrapper.Unit#UNIT RangeTestUnit
|
||||||
-- @param Wrapper.Unit#UNIT RangeTestUnit
|
|
||||||
function( RangeTestUnit, RangeZone, AIGroup, PlayerInRange )
|
function( RangeTestUnit, RangeZone, AIGroup, PlayerInRange )
|
||||||
self:T2( { PlayerInRange, RangeTestUnit.UnitName, RangeZone.ZoneName } )
|
self:T2( { PlayerInRange, RangeTestUnit.UnitName, RangeZone.ZoneName } )
|
||||||
if RangeTestUnit:IsInZone( RangeZone ) == true then
|
if RangeTestUnit:IsInZone( RangeZone ) == true then
|
||||||
@@ -274,8 +276,7 @@ function AI_BALANCER:onenterMonitoring( SetGroup )
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
--- Nameless function
|
--- @param Core.Zone#ZONE_RADIUS RangeZone
|
||||||
-- @param Core.Zone#ZONE_RADIUS RangeZone
|
|
||||||
-- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
function( RangeZone, AIGroup, PlayerInRange )
|
function( RangeZone, AIGroup, PlayerInRange )
|
||||||
if PlayerInRange.Value == false then
|
if PlayerInRange.Value == false then
|
||||||
@@ -306,3 +307,6 @@ function AI_BALANCER:onenterMonitoring( SetGroup )
|
|||||||
|
|
||||||
self:__Monitor( 10 )
|
self:__Monitor( 10 )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_CAP)
|
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CAP%20-%20Combat%20Air%20Patrol)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -39,8 +39,6 @@
|
|||||||
--- Implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Controllable} or @{Wrapper.Group}
|
--- Implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Controllable} or @{Wrapper.Group}
|
||||||
-- and automatically engage any airborne enemies that are within a certain range or within a certain zone.
|
-- and automatically engage any airborne enemies that are within a certain range or within a certain zone.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
-- The AI_CAP_ZONE is assigned a @{Wrapper.Group} and this must be done before the AI_CAP_ZONE process can be started using the **Start** event.
|
-- The AI_CAP_ZONE is assigned a @{Wrapper.Group} and this must be done before the AI_CAP_ZONE process can be started using the **Start** event.
|
||||||
@@ -425,12 +423,12 @@ function AI_CAP_ZONE:onafterEngage( Controllable, From, Event, To )
|
|||||||
|
|
||||||
--DONE: Create GetAltitude function for GROUP, and delete GetUnit(1).
|
--DONE: Create GetAltitude function for GROUP, and delete GetUnit(1).
|
||||||
local CurrentAltitude = self.Controllable:GetAltitude()
|
local CurrentAltitude = self.Controllable:GetAltitude()
|
||||||
local CurrentPointVec3 = COORDINATE:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
|
local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
|
||||||
local ToEngageZoneSpeed = self.PatrolMaxSpeed
|
local ToEngageZoneSpeed = self.PatrolMaxSpeed
|
||||||
local CurrentRoutePoint = CurrentPointVec3:WaypointAir(
|
local CurrentRoutePoint = CurrentPointVec3:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType,
|
||||||
COORDINATE.WaypointType.TurningPoint,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
COORDINATE.WaypointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
ToEngageZoneSpeed,
|
ToEngageZoneSpeed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
@@ -447,13 +445,13 @@ function AI_CAP_ZONE:onafterEngage( Controllable, From, Event, To )
|
|||||||
self:T2( { self.PatrolMinSpeed, self.PatrolMaxSpeed, ToTargetSpeed } )
|
self:T2( { self.PatrolMinSpeed, self.PatrolMaxSpeed, ToTargetSpeed } )
|
||||||
|
|
||||||
--- Obtain a 3D @{Point} from the 2D point + altitude.
|
--- Obtain a 3D @{Point} from the 2D point + altitude.
|
||||||
local ToTargetPointVec3 = COORDINATE:New( ToTargetVec2.x, ToTargetAltitude, ToTargetVec2.y )
|
local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, ToTargetAltitude, ToTargetVec2.y )
|
||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local ToPatrolRoutePoint = ToTargetPointVec3:WaypointAir(
|
local ToPatrolRoutePoint = ToTargetPointVec3:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType,
|
||||||
COORDINATE.WaypointType.TurningPoint,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
COORDINATE.WaypointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
ToTargetSpeed,
|
ToTargetSpeed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_CAS)
|
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CAS%20-%20Close%20Air%20Support)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -38,9 +38,6 @@
|
|||||||
-- @extends AI.AI_Patrol#AI_PATROL_ZONE
|
-- @extends AI.AI_Patrol#AI_PATROL_ZONE
|
||||||
|
|
||||||
--- Implements the core functions to provide Close Air Support in an Engage @{Core.Zone} by an AIR @{Wrapper.Controllable} or @{Wrapper.Group}.
|
--- Implements the core functions to provide Close Air Support in an Engage @{Core.Zone} by an AIR @{Wrapper.Controllable} or @{Wrapper.Group}.
|
||||||
--
|
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- The AI_CAS_ZONE runs a process. It holds an AI in a Patrol Zone and when the AI is commanded to engage, it will fly to an Engage Zone.
|
-- The AI_CAS_ZONE runs a process. It holds an AI in a Patrol Zone and when the AI is commanded to engage, it will fly to an Engage Zone.
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
@@ -469,12 +466,12 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To,
|
|||||||
|
|
||||||
--DONE: Create GetAltitude function for GROUP, and delete GetUnit(1).
|
--DONE: Create GetAltitude function for GROUP, and delete GetUnit(1).
|
||||||
local CurrentAltitude = self.Controllable:GetAltitude()
|
local CurrentAltitude = self.Controllable:GetAltitude()
|
||||||
local CurrentPointVec3 = COORDINATE:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
|
local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
|
||||||
local ToEngageZoneSpeed = self.PatrolMaxSpeed
|
local ToEngageZoneSpeed = self.PatrolMaxSpeed
|
||||||
local CurrentRoutePoint = CurrentPointVec3:WaypointAir(
|
local CurrentRoutePoint = CurrentPointVec3:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType,
|
||||||
COORDINATE.WaypointType.TurningPoint,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
COORDINATE.WaypointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
self.EngageSpeed,
|
self.EngageSpeed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
@@ -511,13 +508,13 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To,
|
|||||||
self:T2( ToTargetVec2 )
|
self:T2( ToTargetVec2 )
|
||||||
|
|
||||||
--- Obtain a 3D @{Point} from the 2D point + altitude.
|
--- Obtain a 3D @{Point} from the 2D point + altitude.
|
||||||
local ToTargetPointVec3 = COORDINATE:New( ToTargetVec2.x, self.EngageAltitude, ToTargetVec2.y )
|
local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, self.EngageAltitude, ToTargetVec2.y )
|
||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local ToTargetRoutePoint = ToTargetPointVec3:WaypointAir(
|
local ToTargetRoutePoint = ToTargetPointVec3:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType,
|
||||||
COORDINATE.WaypointType.TurningPoint,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
COORDINATE.WaypointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
self.EngageSpeed,
|
self.EngageSpeed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -15,8 +15,6 @@
|
|||||||
|
|
||||||
--- Base class for the dynamic cargo handling capability for AI groups.
|
--- Base class for the dynamic cargo handling capability for AI groups.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- Carriers can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
-- Carriers can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
||||||
-- The AI_CARGO module uses the @{Cargo.Cargo} capabilities within the MOOSE framework.
|
-- The AI_CARGO module uses the @{Cargo.Cargo} capabilities within the MOOSE framework.
|
||||||
-- CARGO derived objects must be declared within the mission to make the AI_CARGO object recognize the cargo.
|
-- CARGO derived objects must be declared within the mission to make the AI_CARGO object recognize the cargo.
|
||||||
@@ -549,7 +547,7 @@ function AI_CARGO:onafterUnloaded( Carrier, From, Event, To, Cargo, CarrierUnit,
|
|||||||
for _, CarrierUnit in pairs( Carrier:GetUnits() ) do
|
for _, CarrierUnit in pairs( Carrier:GetUnits() ) do
|
||||||
local CarrierUnit = CarrierUnit -- Wrapper.Unit#UNIT
|
local CarrierUnit = CarrierUnit -- Wrapper.Unit#UNIT
|
||||||
local IsEmpty = CarrierUnit:IsCargoEmpty()
|
local IsEmpty = CarrierUnit:IsCargoEmpty()
|
||||||
self:T({ IsEmpty = IsEmpty })
|
self:I({ IsEmpty = IsEmpty })
|
||||||
if not IsEmpty then
|
if not IsEmpty then
|
||||||
AllUnloaded = false
|
AllUnloaded = false
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -15,8 +15,6 @@
|
|||||||
|
|
||||||
--- Brings a dynamic cargo handling capability for an AI vehicle group.
|
--- Brings a dynamic cargo handling capability for an AI vehicle group.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- Armoured Personnel Carriers (APC), Trucks, Jeeps and other ground based carrier equipment can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
-- Armoured Personnel Carriers (APC), Trucks, Jeeps and other ground based carrier equipment can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
||||||
--
|
--
|
||||||
-- The AI_CARGO_APC class uses the @{Cargo.Cargo} capabilities within the MOOSE framework.
|
-- The AI_CARGO_APC class uses the @{Cargo.Cargo} capabilities within the MOOSE framework.
|
||||||
|
|||||||
@@ -14,8 +14,6 @@
|
|||||||
|
|
||||||
|
|
||||||
--- Brings a dynamic cargo handling capability for an AI airplane group.
|
--- Brings a dynamic cargo handling capability for an AI airplane group.
|
||||||
--
|
|
||||||
-- 
|
|
||||||
--
|
--
|
||||||
-- Airplane carrier equipment can be mobilized to intelligently transport infantry and other cargo within the simulation between airbases.
|
-- Airplane carrier equipment can be mobilized to intelligently transport infantry and other cargo within the simulation between airbases.
|
||||||
--
|
--
|
||||||
@@ -442,7 +440,7 @@ function AI_CARGO_AIRPLANE:Route( Airplane, Airbase, Speed, Height, Uncontrolled
|
|||||||
|
|
||||||
-- To point.
|
-- To point.
|
||||||
local AirbasePointVec2 = Airbase:GetPointVec2()
|
local AirbasePointVec2 = Airbase:GetPointVec2()
|
||||||
local ToWaypoint = AirbasePointVec2:WaypointAir(COORDINATE.WaypointAltType.BARO, "Land", "Landing", Speed or Airplane:GetSpeedMax()*0.8, true, Airbase)
|
local ToWaypoint = AirbasePointVec2:WaypointAir(POINT_VEC3.RoutePointAltType.BARO, "Land", "Landing", Speed or Airplane:GetSpeedMax()*0.8, true, Airbase)
|
||||||
|
|
||||||
--ToWaypoint["airdromeId"] = Airbase:GetID()
|
--ToWaypoint["airdromeId"] = Airbase:GetID()
|
||||||
--ToWaypoint["speed_locked"] = true
|
--ToWaypoint["speed_locked"] = true
|
||||||
|
|||||||
@@ -18,12 +18,10 @@
|
|||||||
--
|
--
|
||||||
-- Test missions can be located on the main GITHUB site.
|
-- Test missions can be located on the main GITHUB site.
|
||||||
--
|
--
|
||||||
-- [FlightControl-Master/MOOSE_MISSIONS/AID - AI Dispatching/AID-CGO - AI Cargo Dispatching/](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Cargo_Dispatcher)
|
-- [FlightControl-Master/MOOSE_MISSIONS/AID - AI Dispatching/AID-CGO - AI Cargo Dispatching/](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/AID%20-%20AI%20Dispatching/AID-CGO%20-%20AI%20Cargo%20Dispatching)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- # The dispatcher concept.
|
-- # The dispatcher concept.
|
||||||
--
|
--
|
||||||
-- Carrier equipment can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
-- Carrier equipment can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
||||||
@@ -118,7 +116,7 @@
|
|||||||
-- @image AI_Cargo_Dispatcher.JPG
|
-- @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_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.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.
|
-- @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.
|
||||||
@@ -574,7 +572,7 @@
|
|||||||
-- A home zone can be specified to where the Carriers will move when there isn't any cargo left for pickup.
|
-- A home zone can be specified to where the Carriers will move when there isn't any cargo left for pickup.
|
||||||
-- Use @{#AI_CARGO_DISPATCHER.SetHomeZone}() to specify the home zone.
|
-- Use @{#AI_CARGO_DISPATCHER.SetHomeZone}() to specify the home zone.
|
||||||
--
|
--
|
||||||
-- If no home zone is specified, the carriers will wait near the deploy zone for a new pickup command.
|
-- If no home zone is specified, the carriers will wait near the deploy zone for a new pickup command.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -585,12 +583,10 @@ AI_CARGO_DISPATCHER = {
|
|||||||
PickupCargo = {}
|
PickupCargo = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
--- List of AI_Cargo
|
--- @field #list
|
||||||
-- @field #list
|
|
||||||
AI_CARGO_DISPATCHER.AI_Cargo = {}
|
AI_CARGO_DISPATCHER.AI_Cargo = {}
|
||||||
|
|
||||||
--- List of PickupCargo
|
--- @field #list
|
||||||
-- @field #list
|
|
||||||
AI_CARGO_DISPATCHER.PickupCargo = {}
|
AI_CARGO_DISPATCHER.PickupCargo = {}
|
||||||
|
|
||||||
|
|
||||||
@@ -1163,7 +1159,7 @@ function AI_CARGO_DISPATCHER:onafterMonitor()
|
|||||||
else
|
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.",
|
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()))
|
tostring(Cargo:GetName()), Cargo:GetWeight(), LargestLoadCapacity, tostring(Carrier:GetName()))
|
||||||
self:T(text)
|
self:I(text)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -36,8 +36,6 @@
|
|||||||
|
|
||||||
--- A dynamic cargo transportation capability for AI groups.
|
--- A dynamic cargo transportation capability for AI groups.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- Armoured Personnel APCs (APC), Trucks, Jeeps and other carrier equipment can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
-- Armoured Personnel APCs (APC), Trucks, Jeeps and other carrier equipment can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
||||||
--
|
--
|
||||||
-- The AI_CARGO_DISPATCHER_APC module is derived from the AI_CARGO_DISPATCHER module.
|
-- The AI_CARGO_DISPATCHER_APC module is derived from the AI_CARGO_DISPATCHER module.
|
||||||
|
|||||||
@@ -30,8 +30,6 @@
|
|||||||
|
|
||||||
--- Brings a dynamic cargo handling capability for AI groups.
|
--- Brings a dynamic cargo handling capability for AI groups.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- Airplanes can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
-- Airplanes can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
||||||
--
|
--
|
||||||
-- The AI_CARGO_DISPATCHER_AIRPLANE module is derived from the AI_CARGO_DISPATCHER module.
|
-- The AI_CARGO_DISPATCHER_AIRPLANE module is derived from the AI_CARGO_DISPATCHER module.
|
||||||
|
|||||||
@@ -31,8 +31,6 @@
|
|||||||
|
|
||||||
--- A dynamic cargo handling capability for AI helicopter groups.
|
--- A dynamic cargo handling capability for AI helicopter groups.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- Helicopters can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
-- Helicopters can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -29,8 +29,6 @@
|
|||||||
|
|
||||||
--- A dynamic cargo transportation capability for AI groups.
|
--- A dynamic cargo transportation capability for AI groups.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- Naval vessels can be mobilized to semi-intelligently transport cargo within the simulation.
|
-- Naval vessels can be mobilized to semi-intelligently transport cargo within the simulation.
|
||||||
--
|
--
|
||||||
-- The AI_CARGO_DISPATCHER_SHIP module is derived from the AI_CARGO_DISPATCHER module.
|
-- The AI_CARGO_DISPATCHER_SHIP module is derived from the AI_CARGO_DISPATCHER module.
|
||||||
|
|||||||
@@ -15,8 +15,6 @@
|
|||||||
|
|
||||||
--- Brings a dynamic cargo handling capability for an AI helicopter group.
|
--- Brings a dynamic cargo handling capability for an AI helicopter group.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- Helicopter carriers can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
-- Helicopter carriers can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
||||||
--
|
--
|
||||||
-- The AI_CARGO_HELICOPTER class uses the @{Cargo.Cargo} capabilities within the MOOSE framework.
|
-- The AI_CARGO_HELICOPTER class uses the @{Cargo.Cargo} capabilities within the MOOSE framework.
|
||||||
@@ -369,8 +367,8 @@ function AI_CARGO_HELICOPTER:onafterQueue( Helicopter, From, Event, To, Coordina
|
|||||||
-- local CoordinateFrom = Helicopter:GetCoordinate()
|
-- local CoordinateFrom = Helicopter:GetCoordinate()
|
||||||
-- local WaypointFrom = CoordinateFrom:WaypointAir(
|
-- local WaypointFrom = CoordinateFrom:WaypointAir(
|
||||||
-- "RADIO",
|
-- "RADIO",
|
||||||
-- COORDINATE.WaypointType.TurningPoint,
|
-- POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
-- COORDINATE.WaypointAction.TurningPoint,
|
-- POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
-- Speed,
|
-- Speed,
|
||||||
-- true
|
-- true
|
||||||
-- )
|
-- )
|
||||||
@@ -382,8 +380,8 @@ function AI_CARGO_HELICOPTER:onafterQueue( Helicopter, From, Event, To, Coordina
|
|||||||
|
|
||||||
local WaypointTo = CoordinateTo:WaypointAir(
|
local WaypointTo = CoordinateTo:WaypointAir(
|
||||||
"RADIO",
|
"RADIO",
|
||||||
COORDINATE.WaypointType.TurningPoint,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
COORDINATE.WaypointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
50,
|
50,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
@@ -429,7 +427,7 @@ function AI_CARGO_HELICOPTER:onafterOrbit( Helicopter, From, Event, To, Coordina
|
|||||||
local landheight = CoordinateTo:GetLandHeight() -- get target height
|
local landheight = CoordinateTo:GetLandHeight() -- get target height
|
||||||
CoordinateTo.y = landheight + 50 -- flight height should be 50m above ground
|
CoordinateTo.y = landheight + 50 -- flight height should be 50m above ground
|
||||||
|
|
||||||
local WaypointTo = CoordinateTo:WaypointAir("RADIO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, 50, true)
|
local WaypointTo = CoordinateTo:WaypointAir("RADIO", POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, 50, true)
|
||||||
Route[#Route+1] = WaypointTo
|
Route[#Route+1] = WaypointTo
|
||||||
|
|
||||||
local Tasks = {}
|
local Tasks = {}
|
||||||
@@ -498,14 +496,14 @@ function AI_CARGO_HELICOPTER:onafterPickup( Helicopter, From, Event, To, Coordin
|
|||||||
local CoordinateFrom = Helicopter:GetCoordinate()
|
local CoordinateFrom = Helicopter:GetCoordinate()
|
||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local WaypointFrom = CoordinateFrom:WaypointAir("RADIO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, _speed, true)
|
local WaypointFrom = CoordinateFrom:WaypointAir("RADIO", POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, _speed, true)
|
||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local CoordinateTo = Coordinate
|
local CoordinateTo = Coordinate
|
||||||
local landheight = CoordinateTo:GetLandHeight() -- get target height
|
local landheight = CoordinateTo:GetLandHeight() -- get target height
|
||||||
CoordinateTo.y = landheight + 50 -- flight height should be 50m above ground
|
CoordinateTo.y = landheight + 50 -- flight height should be 50m above ground
|
||||||
|
|
||||||
local WaypointTo = CoordinateTo:WaypointAir("RADIO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint,_speed, true)
|
local WaypointTo = CoordinateTo:WaypointAir("RADIO", POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint,_speed, true)
|
||||||
|
|
||||||
Route[#Route+1] = WaypointFrom
|
Route[#Route+1] = WaypointFrom
|
||||||
Route[#Route+1] = WaypointTo
|
Route[#Route+1] = WaypointTo
|
||||||
@@ -565,7 +563,7 @@ function AI_CARGO_HELICOPTER:onafterDeploy( Helicopter, From, Event, To, Coordin
|
|||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local CoordinateFrom = Helicopter:GetCoordinate()
|
local CoordinateFrom = Helicopter:GetCoordinate()
|
||||||
local WaypointFrom = CoordinateFrom:WaypointAir("RADIO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, _speed, true)
|
local WaypointFrom = CoordinateFrom:WaypointAir("RADIO", POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, _speed, true)
|
||||||
Route[#Route+1] = WaypointFrom
|
Route[#Route+1] = WaypointFrom
|
||||||
Route[#Route+1] = WaypointFrom
|
Route[#Route+1] = WaypointFrom
|
||||||
|
|
||||||
@@ -575,7 +573,7 @@ function AI_CARGO_HELICOPTER:onafterDeploy( Helicopter, From, Event, To, Coordin
|
|||||||
local landheight = CoordinateTo:GetLandHeight() -- get target height
|
local landheight = CoordinateTo:GetLandHeight() -- get target height
|
||||||
CoordinateTo.y = landheight + 50 -- flight height should be 50m above ground
|
CoordinateTo.y = landheight + 50 -- flight height should be 50m above ground
|
||||||
|
|
||||||
local WaypointTo = CoordinateTo:WaypointAir("RADIO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, _speed, true)
|
local WaypointTo = CoordinateTo:WaypointAir("RADIO", POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, _speed, true)
|
||||||
|
|
||||||
Route[#Route+1] = WaypointTo
|
Route[#Route+1] = WaypointTo
|
||||||
Route[#Route+1] = WaypointTo
|
Route[#Route+1] = WaypointTo
|
||||||
@@ -633,7 +631,7 @@ function AI_CARGO_HELICOPTER:onafterHome( Helicopter, From, Event, To, Coordinat
|
|||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local CoordinateFrom = Helicopter:GetCoordinate()
|
local CoordinateFrom = Helicopter:GetCoordinate()
|
||||||
|
|
||||||
local WaypointFrom = CoordinateFrom:WaypointAir("RADIO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, Speed, true)
|
local WaypointFrom = CoordinateFrom:WaypointAir("RADIO", POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, Speed, true)
|
||||||
Route[#Route+1] = WaypointFrom
|
Route[#Route+1] = WaypointFrom
|
||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
@@ -641,7 +639,7 @@ function AI_CARGO_HELICOPTER:onafterHome( Helicopter, From, Event, To, Coordinat
|
|||||||
local landheight = CoordinateTo:GetLandHeight() -- get target height
|
local landheight = CoordinateTo:GetLandHeight() -- get target height
|
||||||
CoordinateTo.y = landheight + Height -- flight height should be 50m above ground
|
CoordinateTo.y = landheight + Height -- flight height should be 50m above ground
|
||||||
|
|
||||||
local WaypointTo = CoordinateTo:WaypointAir("RADIO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, Speed, true)
|
local WaypointTo = CoordinateTo:WaypointAir("RADIO", POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, Speed, true)
|
||||||
|
|
||||||
Route[#Route+1] = WaypointTo
|
Route[#Route+1] = WaypointTo
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,6 @@
|
|||||||
|
|
||||||
--- Brings a dynamic cargo handling capability for an AI naval group.
|
--- Brings a dynamic cargo handling capability for an AI naval group.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- Naval ships can be utilized to transport cargo around the map following naval shipping lanes.
|
-- Naval ships can be utilized to transport cargo around the map following naval shipping lanes.
|
||||||
-- The AI_CARGO_SHIP class uses the @{Cargo.Cargo} capabilities within the MOOSE framework.
|
-- The AI_CARGO_SHIP class uses the @{Cargo.Cargo} capabilities within the MOOSE framework.
|
||||||
-- @{Cargo.Cargo} must be declared within the mission or warehouse to make the AI_CARGO_SHIP recognize the cargo.
|
-- @{Cargo.Cargo} must be declared within the mission or warehouse to make the AI_CARGO_SHIP recognize the cargo.
|
||||||
|
|||||||
@@ -19,14 +19,12 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Escort)
|
-- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/ESC%20-%20Escorting)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- Allows you to interact with escorting AI on your flight and take the lead.
|
-- Allows you to interact with escorting AI on your flight and take the lead.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- Each escorting group can be commanded with a complete set of radio commands (radio menu in your flight, and then F10).
|
-- Each escorting group can be commanded with a complete set of radio commands (radio menu in your flight, and then F10).
|
||||||
--
|
--
|
||||||
-- The radio commands will vary according the category of the group. The richest set of commands are with helicopters and airPlanes.
|
-- The radio commands will vary according the category of the group. The richest set of commands are with helicopters and airPlanes.
|
||||||
@@ -558,7 +556,7 @@ function AI_ESCORT:SetFlightMenuFormation( Formation )
|
|||||||
|
|
||||||
if MenuFormation then
|
if MenuFormation then
|
||||||
local Arguments = MenuFormation.Arguments
|
local Arguments = MenuFormation.Arguments
|
||||||
--self:T({Arguments=unpack(Arguments)})
|
--self:I({Arguments=unpack(Arguments)})
|
||||||
local FlightMenuFormation = MENU_GROUP:New( self.PlayerGroup, "Formation", self.MainMenu )
|
local FlightMenuFormation = MENU_GROUP:New( self.PlayerGroup, "Formation", self.MainMenu )
|
||||||
local MenuFlightFormationID = MENU_GROUP_COMMAND:New( self.PlayerGroup, Formation, FlightMenuFormation,
|
local MenuFlightFormationID = MENU_GROUP_COMMAND:New( self.PlayerGroup, Formation, FlightMenuFormation,
|
||||||
function ( self, Formation, ... )
|
function ( self, Formation, ... )
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
-- @image MOOSE.JPG
|
-- @image MOOSE.JPG
|
||||||
|
|
||||||
|
|
||||||
-- @type AI_ESCORT_DISPATCHER
|
--- @type AI_ESCORT_DISPATCHER
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
|
|
||||||
@@ -23,8 +23,6 @@
|
|||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
||||||
-- Therefore, this class is considered to be deprecated
|
-- Therefore, this class is considered to be deprecated
|
||||||
--
|
--
|
||||||
@@ -35,7 +33,7 @@ AI_ESCORT_DISPATCHER = {
|
|||||||
ClassName = "AI_ESCORT_DISPATCHER",
|
ClassName = "AI_ESCORT_DISPATCHER",
|
||||||
}
|
}
|
||||||
|
|
||||||
-- @field #list
|
--- @field #list
|
||||||
AI_ESCORT_DISPATCHER.AI_Escorts = {}
|
AI_ESCORT_DISPATCHER.AI_Escorts = {}
|
||||||
|
|
||||||
|
|
||||||
@@ -104,7 +102,7 @@ function AI_ESCORT_DISPATCHER:onafterStart( From, Event, To )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_ESCORT_DISPATCHER self
|
--- @param #AI_ESCORT_DISPATCHER self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_ESCORT_DISPATCHER:OnEventExit( EventData )
|
function AI_ESCORT_DISPATCHER:OnEventExit( EventData )
|
||||||
|
|
||||||
@@ -112,11 +110,11 @@ function AI_ESCORT_DISPATCHER:OnEventExit( EventData )
|
|||||||
local PlayerGroup = EventData.IniGroup
|
local PlayerGroup = EventData.IniGroup
|
||||||
local PlayerUnit = EventData.IniUnit
|
local PlayerUnit = EventData.IniUnit
|
||||||
|
|
||||||
self:T({EscortAirbase= self.EscortAirbase } )
|
self:I({EscortAirbase= self.EscortAirbase } )
|
||||||
self:T({PlayerGroupName = PlayerGroupName } )
|
self:I({PlayerGroupName = PlayerGroupName } )
|
||||||
self:T({PlayerGroup = PlayerGroup})
|
self:I({PlayerGroup = PlayerGroup})
|
||||||
self:T({FirstGroup = self.CarrierSet:GetFirst()})
|
self:I({FirstGroup = self.CarrierSet:GetFirst()})
|
||||||
self:T({FindGroup = self.CarrierSet:FindGroup( PlayerGroupName )})
|
self:I({FindGroup = self.CarrierSet:FindGroup( PlayerGroupName )})
|
||||||
|
|
||||||
if self.CarrierSet:FindGroup( PlayerGroupName ) then
|
if self.CarrierSet:FindGroup( PlayerGroupName ) then
|
||||||
if self.AI_Escorts[PlayerGroupName] then
|
if self.AI_Escorts[PlayerGroupName] then
|
||||||
@@ -127,7 +125,7 @@ function AI_ESCORT_DISPATCHER:OnEventExit( EventData )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_ESCORT_DISPATCHER self
|
--- @param #AI_ESCORT_DISPATCHER self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_ESCORT_DISPATCHER:OnEventBirth( EventData )
|
function AI_ESCORT_DISPATCHER:OnEventBirth( EventData )
|
||||||
|
|
||||||
@@ -135,17 +133,17 @@ function AI_ESCORT_DISPATCHER:OnEventBirth( EventData )
|
|||||||
local PlayerGroup = EventData.IniGroup
|
local PlayerGroup = EventData.IniGroup
|
||||||
local PlayerUnit = EventData.IniUnit
|
local PlayerUnit = EventData.IniUnit
|
||||||
|
|
||||||
self:T({EscortAirbase= self.EscortAirbase } )
|
self:I({EscortAirbase= self.EscortAirbase } )
|
||||||
self:T({PlayerGroupName = PlayerGroupName } )
|
self:I({PlayerGroupName = PlayerGroupName } )
|
||||||
self:T({PlayerGroup = PlayerGroup})
|
self:I({PlayerGroup = PlayerGroup})
|
||||||
self:T({FirstGroup = self.CarrierSet:GetFirst()})
|
self:I({FirstGroup = self.CarrierSet:GetFirst()})
|
||||||
self:T({FindGroup = self.CarrierSet:FindGroup( PlayerGroupName )})
|
self:I({FindGroup = self.CarrierSet:FindGroup( PlayerGroupName )})
|
||||||
|
|
||||||
if self.CarrierSet:FindGroup( PlayerGroupName ) then
|
if self.CarrierSet:FindGroup( PlayerGroupName ) then
|
||||||
if not self.AI_Escorts[PlayerGroupName] then
|
if not self.AI_Escorts[PlayerGroupName] then
|
||||||
local LeaderUnit = PlayerUnit
|
local LeaderUnit = PlayerUnit
|
||||||
local EscortGroup = self.EscortSpawn:SpawnAtAirbase( self.EscortAirbase, SPAWN.Takeoff.Hot )
|
local EscortGroup = self.EscortSpawn:SpawnAtAirbase( self.EscortAirbase, SPAWN.Takeoff.Hot )
|
||||||
self:T({EscortGroup = EscortGroup})
|
self:I({EscortGroup = EscortGroup})
|
||||||
|
|
||||||
self:ScheduleOnce( 1,
|
self:ScheduleOnce( 1,
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
|
|||||||
@@ -21,8 +21,6 @@
|
|||||||
|
|
||||||
--- Models the assignment of AI escorts to player flights upon request using the radio menu.
|
--- Models the assignment of AI escorts to player flights upon request using the radio menu.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- # Developer Note
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
||||||
|
|||||||
@@ -19,14 +19,12 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Escort)
|
-- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/ESC%20-%20Escorting)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- Allows you to interact with escorting AI on your flight and take the lead.
|
-- Allows you to interact with escorting AI on your flight and take the lead.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- Each escorting group can be commanded with a complete set of radio commands (radio menu in your flight, and then F10).
|
-- Each escorting group can be commanded with a complete set of radio commands (radio menu in your flight, and then F10).
|
||||||
--
|
--
|
||||||
-- The radio commands will vary according the category of the group. The richest set of commands are with helicopters and airPlanes.
|
-- The radio commands will vary according the category of the group. The richest set of commands are with helicopters and airPlanes.
|
||||||
|
|||||||
@@ -7,13 +7,13 @@
|
|||||||
-- * Assign a group leader that will guide the large formation path.
|
-- * Assign a group leader that will guide the large formation path.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ## Additional Material:
|
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/FOR%20-%20AI%20Group%20Formation)
|
||||||
--
|
--
|
||||||
-- * **Demo Missions:** [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Formation)
|
-- ===
|
||||||
-- * **YouTube videos:** [Playlist](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl0bFIJ9jIdYM22uaWmIN4oz)
|
--
|
||||||
-- * **Guides:** None
|
-- ### [YouTube Playlist](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl0bFIJ9jIdYM22uaWmIN4oz)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
@@ -40,8 +40,6 @@
|
|||||||
|
|
||||||
|
|
||||||
--- Build large formations, make AI follow a @{Wrapper.Client#CLIENT} (player) leader or a @{Wrapper.Unit#UNIT} (AI) leader.
|
--- Build large formations, make AI follow a @{Wrapper.Client#CLIENT} (player) leader or a @{Wrapper.Unit#UNIT} (AI) leader.
|
||||||
--
|
|
||||||
-- 
|
|
||||||
--
|
--
|
||||||
-- AI_FORMATION makes AI @{Wrapper.Group#GROUP}s fly in formation of various compositions.
|
-- AI_FORMATION makes AI @{Wrapper.Group#GROUP}s fly in formation of various compositions.
|
||||||
-- The AI_FORMATION class models formations in a different manner than the internal DCS formation logic!!!
|
-- The AI_FORMATION class models formations in a different manner than the internal DCS formation logic!!!
|
||||||
@@ -160,6 +158,7 @@ AI_FORMATION.__Enum.Mode = {
|
|||||||
-- @field #number GroundRadar
|
-- @field #number GroundRadar
|
||||||
-- @field #number Ground
|
-- @field #number Ground
|
||||||
AI_FORMATION.__Enum.ReportType = {
|
AI_FORMATION.__Enum.ReportType = {
|
||||||
|
Airborne = "*",
|
||||||
Airborne = "A",
|
Airborne = "A",
|
||||||
GroundRadar = "R",
|
GroundRadar = "R",
|
||||||
Ground = "G",
|
Ground = "G",
|
||||||
@@ -726,7 +725,7 @@ function AI_FORMATION:onafterFormationLine( FollowGroupSet, From , Event , To, X
|
|||||||
|
|
||||||
for FollowID, FollowGroup in pairs( FollowSet ) do
|
for FollowID, FollowGroup in pairs( FollowSet ) do
|
||||||
|
|
||||||
local PointVec3 = COORDINATE:New()
|
local PointVec3 = POINT_VEC3:New()
|
||||||
PointVec3:SetX( XStart + i * XSpace )
|
PointVec3:SetX( XStart + i * XSpace )
|
||||||
PointVec3:SetY( YStart + i * YSpace )
|
PointVec3:SetY( YStart + i * YSpace )
|
||||||
PointVec3:SetZ( ZStart + i * ZSpace )
|
PointVec3:SetZ( ZStart + i * ZSpace )
|
||||||
@@ -878,7 +877,7 @@ function AI_FORMATION:onafterFormationCenterWing( FollowGroupSet, From , Event ,
|
|||||||
|
|
||||||
for FollowID, FollowGroup in pairs( FollowSet ) do
|
for FollowID, FollowGroup in pairs( FollowSet ) do
|
||||||
|
|
||||||
local PointVec3 = COORDINATE:New()
|
local PointVec3 = POINT_VEC3:New()
|
||||||
|
|
||||||
local Side = ( i % 2 == 0 ) and 1 or -1
|
local Side = ( i % 2 == 0 ) and 1 or -1
|
||||||
local Row = i / 2 + 1
|
local Row = i / 2 + 1
|
||||||
@@ -937,7 +936,7 @@ function AI_FORMATION:onafterFormationBox( FollowGroupSet, From , Event , To, XS
|
|||||||
|
|
||||||
for FollowID, FollowGroup in pairs( FollowSet ) do
|
for FollowID, FollowGroup in pairs( FollowSet ) do
|
||||||
|
|
||||||
local PointVec3 = COORDINATE:New()
|
local PointVec3 = POINT_VEC3:New()
|
||||||
|
|
||||||
local ZIndex = i % ZLevels
|
local ZIndex = i % ZLevels
|
||||||
local XIndex = math.floor( i / ZLevels )
|
local XIndex = math.floor( i / ZLevels )
|
||||||
@@ -1223,6 +1222,7 @@ function AI_FORMATION:FollowMe(FollowGroup, ClientUnit, CT1, CV1, CT2, CV2)
|
|||||||
local CVI = {
|
local CVI = {
|
||||||
x = CV2.x + CS * 10 * math.sin(Ca),
|
x = CV2.x + CS * 10 * math.sin(Ca),
|
||||||
y = GH2.y + Inclination, -- + FollowFormation.y,
|
y = GH2.y + Inclination, -- + FollowFormation.y,
|
||||||
|
y = GH2.y,
|
||||||
z = CV2.z + CS * 10 * math.cos(Ca),
|
z = CV2.z + CS * 10 * math.cos(Ca),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Patrol)
|
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/PAT%20-%20Patrolling)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -48,8 +48,6 @@
|
|||||||
|
|
||||||
--- Implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Controllable} or @{Wrapper.Group}.
|
--- Implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Controllable} or @{Wrapper.Group}.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
-- The AI_PATROL_ZONE is assigned a @{Wrapper.Group} and this must be done before the AI_PATROL_ZONE process can be started using the **Start** event.
|
-- The AI_PATROL_ZONE is assigned a @{Wrapper.Group} and this must be done before the AI_PATROL_ZONE process can be started using the **Start** event.
|
||||||
@@ -654,15 +652,15 @@ function AI_PATROL_ZONE:onafterStart( Controllable, From, Event, To )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- @param #AI_PATROL_ZONE self
|
--- @param #AI_PATROL_ZONE self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE Controllable+
|
--- @param Wrapper.Controllable#CONTROLLABLE Controllable
|
||||||
function AI_PATROL_ZONE:onbeforeDetect( Controllable, From, Event, To )
|
function AI_PATROL_ZONE:onbeforeDetect( Controllable, From, Event, To )
|
||||||
|
|
||||||
return self.DetectOn and self.DetectActivated
|
return self.DetectOn and self.DetectActivated
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_PATROL_ZONE self
|
--- @param #AI_PATROL_ZONE self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
|
--- @param Wrapper.Controllable#CONTROLLABLE Controllable
|
||||||
function AI_PATROL_ZONE:onafterDetect( Controllable, From, Event, To )
|
function AI_PATROL_ZONE:onafterDetect( Controllable, From, Event, To )
|
||||||
|
|
||||||
local Detected = false
|
local Detected = false
|
||||||
@@ -707,7 +705,7 @@ function AI_PATROL_ZONE:onafterDetect( Controllable, From, Event, To )
|
|||||||
|
|
||||||
end
|
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.
|
-- This static method is called from the route path within the last task at the last waypoint of the Controllable.
|
||||||
-- Note that this method is required, as triggers the next route when patrolling for the Controllable.
|
-- Note that this method is required, as triggers the next route when patrolling for the Controllable.
|
||||||
function AI_PATROL_ZONE:_NewPatrolRoute( AIControllable )
|
function AI_PATROL_ZONE:_NewPatrolRoute( AIControllable )
|
||||||
@@ -753,12 +751,12 @@ function AI_PATROL_ZONE:onafterRoute( Controllable, From, Event, To )
|
|||||||
if not CurrentVec2 then return end
|
if not CurrentVec2 then return end
|
||||||
--Done: Create GetAltitude function for GROUP, and delete GetUnit(1).
|
--Done: Create GetAltitude function for GROUP, and delete GetUnit(1).
|
||||||
local CurrentAltitude = self.Controllable:GetAltitude()
|
local CurrentAltitude = self.Controllable:GetAltitude()
|
||||||
local CurrentPointVec3 = COORDINATE:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
|
local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
|
||||||
local ToPatrolZoneSpeed = self.PatrolMaxSpeed
|
local ToPatrolZoneSpeed = self.PatrolMaxSpeed
|
||||||
local CurrentRoutePoint = CurrentPointVec3:WaypointAir(
|
local CurrentRoutePoint = CurrentPointVec3:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType,
|
||||||
COORDINATE.WaypointType.TakeOffParking,
|
POINT_VEC3.RoutePointType.TakeOffParking,
|
||||||
COORDINATE.WaypointAction.FromParkingArea,
|
POINT_VEC3.RoutePointAction.FromParkingArea,
|
||||||
ToPatrolZoneSpeed,
|
ToPatrolZoneSpeed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
@@ -769,12 +767,12 @@ function AI_PATROL_ZONE:onafterRoute( Controllable, From, Event, To )
|
|||||||
if not CurrentVec2 then return end
|
if not CurrentVec2 then return end
|
||||||
--DONE: Create GetAltitude function for GROUP, and delete GetUnit(1).
|
--DONE: Create GetAltitude function for GROUP, and delete GetUnit(1).
|
||||||
local CurrentAltitude = self.Controllable:GetAltitude()
|
local CurrentAltitude = self.Controllable:GetAltitude()
|
||||||
local CurrentPointVec3 = COORDINATE:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
|
local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
|
||||||
local ToPatrolZoneSpeed = self.PatrolMaxSpeed
|
local ToPatrolZoneSpeed = self.PatrolMaxSpeed
|
||||||
local CurrentRoutePoint = CurrentPointVec3:WaypointAir(
|
local CurrentRoutePoint = CurrentPointVec3:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType,
|
||||||
COORDINATE.WaypointType.TurningPoint,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
COORDINATE.WaypointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
ToPatrolZoneSpeed,
|
ToPatrolZoneSpeed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
@@ -794,13 +792,13 @@ function AI_PATROL_ZONE:onafterRoute( Controllable, From, Event, To )
|
|||||||
self:T2( { self.PatrolMinSpeed, self.PatrolMaxSpeed, ToTargetSpeed } )
|
self:T2( { self.PatrolMinSpeed, self.PatrolMaxSpeed, ToTargetSpeed } )
|
||||||
|
|
||||||
--- Obtain a 3D @{Point} from the 2D point + altitude.
|
--- Obtain a 3D @{Point} from the 2D point + altitude.
|
||||||
local ToTargetPointVec3 = COORDINATE:New( ToTargetVec2.x, ToTargetAltitude, ToTargetVec2.y )
|
local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, ToTargetAltitude, ToTargetVec2.y )
|
||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local ToTargetRoutePoint = ToTargetPointVec3:WaypointAir(
|
local ToTargetRoutePoint = ToTargetPointVec3:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType,
|
||||||
COORDINATE.WaypointType.TurningPoint,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
COORDINATE.WaypointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
ToTargetSpeed,
|
ToTargetSpeed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
@@ -824,13 +822,13 @@ function AI_PATROL_ZONE:onafterRoute( Controllable, From, Event, To )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_PATROL_ZONE self
|
--- @param #AI_PATROL_ZONE self
|
||||||
function AI_PATROL_ZONE:onbeforeStatus()
|
function AI_PATROL_ZONE:onbeforeStatus()
|
||||||
|
|
||||||
return self.CheckStatus
|
return self.CheckStatus
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_PATROL_ZONE self
|
--- @param #AI_PATROL_ZONE self
|
||||||
function AI_PATROL_ZONE:onafterStatus()
|
function AI_PATROL_ZONE:onafterStatus()
|
||||||
self:F2()
|
self:F2()
|
||||||
|
|
||||||
@@ -840,7 +838,7 @@ function AI_PATROL_ZONE:onafterStatus()
|
|||||||
|
|
||||||
local Fuel = self.Controllable:GetFuelMin()
|
local Fuel = self.Controllable:GetFuelMin()
|
||||||
if Fuel < self.PatrolFuelThresholdPercentage then
|
if Fuel < self.PatrolFuelThresholdPercentage then
|
||||||
self:T( self.Controllable:GetName() .. " is out of fuel:" .. Fuel .. ", RTB!" )
|
self:I( self.Controllable:GetName() .. " is out of fuel:" .. Fuel .. ", RTB!" )
|
||||||
local OldAIControllable = self.Controllable
|
local OldAIControllable = self.Controllable
|
||||||
|
|
||||||
local OrbitTask = OldAIControllable:TaskOrbitCircle( math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude ), self.PatrolMinSpeed )
|
local OrbitTask = OldAIControllable:TaskOrbitCircle( math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude ), self.PatrolMinSpeed )
|
||||||
@@ -848,25 +846,16 @@ function AI_PATROL_ZONE:onafterStatus()
|
|||||||
OldAIControllable:SetTask( TimedOrbitTask, 10 )
|
OldAIControllable:SetTask( TimedOrbitTask, 10 )
|
||||||
|
|
||||||
RTB = true
|
RTB = true
|
||||||
|
else
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TODO: Check GROUP damage function.
|
-- TODO: Check GROUP damage function.
|
||||||
local Damage = self.Controllable:GetLife()
|
local Damage = self.Controllable:GetLife()
|
||||||
if Damage <= self.PatrolDamageThreshold then
|
if Damage <= self.PatrolDamageThreshold then
|
||||||
self:T( self.Controllable:GetName() .. " is damaged:" .. Damage .. ", RTB!" )
|
self:I( self.Controllable:GetName() .. " is damaged:" .. Damage .. ", RTB!" )
|
||||||
RTB = true
|
RTB = true
|
||||||
end
|
end
|
||||||
|
|
||||||
if self:IsInstanceOf("AI_CAS") or self:IsInstanceOf("AI_BAI") then
|
|
||||||
local atotal,shells,rockets,bombs,missiles = self.Controllable:GetAmmunition()
|
|
||||||
local arelevant = rockets+bombs
|
|
||||||
if arelevant == 0 or missiles == 0 then
|
|
||||||
RTB = true
|
|
||||||
self:T({total=atotal,shells=shells,rockets=rockets,bombs=bombs,missiles=missiles})
|
|
||||||
self:T( self.Controllable:GetName() .. " is out of ammo, RTB!" )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if RTB == true then
|
if RTB == true then
|
||||||
self:RTB()
|
self:RTB()
|
||||||
else
|
else
|
||||||
@@ -875,7 +864,7 @@ function AI_PATROL_ZONE:onafterStatus()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_PATROL_ZONE self
|
--- @param #AI_PATROL_ZONE self
|
||||||
function AI_PATROL_ZONE:onafterRTB()
|
function AI_PATROL_ZONE:onafterRTB()
|
||||||
self:F2()
|
self:F2()
|
||||||
|
|
||||||
@@ -892,12 +881,12 @@ function AI_PATROL_ZONE:onafterRTB()
|
|||||||
--DONE: Create GetAltitude function for GROUP, and delete GetUnit(1).
|
--DONE: Create GetAltitude function for GROUP, and delete GetUnit(1).
|
||||||
--local CurrentAltitude = self.Controllable:GetUnit(1):GetAltitude()
|
--local CurrentAltitude = self.Controllable:GetUnit(1):GetAltitude()
|
||||||
local CurrentAltitude = self.Controllable:GetAltitude()
|
local CurrentAltitude = self.Controllable:GetAltitude()
|
||||||
local CurrentPointVec3 = COORDINATE:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
|
local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
|
||||||
local ToPatrolZoneSpeed = self.PatrolMaxSpeed
|
local ToPatrolZoneSpeed = self.PatrolMaxSpeed
|
||||||
local CurrentRoutePoint = CurrentPointVec3:WaypointAir(
|
local CurrentRoutePoint = CurrentPointVec3:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType,
|
||||||
COORDINATE.WaypointType.TurningPoint,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
COORDINATE.WaypointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
ToPatrolZoneSpeed,
|
ToPatrolZoneSpeed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
@@ -914,13 +903,13 @@ function AI_PATROL_ZONE:onafterRTB()
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_PATROL_ZONE self
|
--- @param #AI_PATROL_ZONE self
|
||||||
function AI_PATROL_ZONE:onafterDead()
|
function AI_PATROL_ZONE:onafterDead()
|
||||||
self:SetDetectionOff()
|
self:SetDetectionOff()
|
||||||
self:SetStatusOff()
|
self:SetStatusOff()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_PATROL_ZONE self
|
--- @param #AI_PATROL_ZONE self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_PATROL_ZONE:OnCrash( EventData )
|
function AI_PATROL_ZONE:OnCrash( EventData )
|
||||||
|
|
||||||
@@ -931,7 +920,7 @@ function AI_PATROL_ZONE:OnCrash( EventData )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_PATROL_ZONE self
|
--- @param #AI_PATROL_ZONE self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_PATROL_ZONE:OnEjection( EventData )
|
function AI_PATROL_ZONE:OnEjection( EventData )
|
||||||
|
|
||||||
@@ -940,7 +929,7 @@ function AI_PATROL_ZONE:OnEjection( EventData )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #AI_PATROL_ZONE self
|
--- @param #AI_PATROL_ZONE self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_PATROL_ZONE:OnPilotDead( EventData )
|
function AI_PATROL_ZONE:OnPilotDead( EventData )
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- **Actions** - ACT_ACCOUNT_ classes **account for** (detect, count & report) various DCS events occurring on UNITs.
|
--- **Actions** - ACT_ACCOUNT_ classes **account for** (detect, count & report) various DCS events occurring on UNITs.
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -8,11 +8,9 @@
|
|||||||
-- @image MOOSE.JPG
|
-- @image MOOSE.JPG
|
||||||
|
|
||||||
do -- ACT_ACCOUNT
|
do -- ACT_ACCOUNT
|
||||||
|
|
||||||
--- # @{#ACT_ACCOUNT} FSM class, extends @{Core.Fsm#FSM_PROCESS}
|
--- # @{#ACT_ACCOUNT} FSM class, extends @{Core.Fsm#FSM_PROCESS}
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- ## ACT_ACCOUNT state machine:
|
-- ## ACT_ACCOUNT state machine:
|
||||||
--
|
--
|
||||||
-- This class is a state machine: it manages a process that is triggered by events causing state transitions to occur.
|
-- This class is a state machine: it manages a process that is triggered by events causing state transitions to occur.
|
||||||
@@ -135,7 +133,7 @@ do -- ACT_ACCOUNT
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function ACT_ACCOUNT:onafterEvent( ProcessUnit, From, Event, To )
|
function ACT_ACCOUNT:onafterEvent( ProcessUnit, From, Event, To, Event )
|
||||||
|
|
||||||
self:__NoMore( 1 )
|
self:__NoMore( 1 )
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
--- (SP) (MP) (FSM) Accept or reject process for player (task) assignments.
|
--- (SP) (MP) (FSM) Accept or reject process for player (task) assignments.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
|
||||||
-- 
|
|
||||||
--
|
--
|
||||||
-- # @{#ACT_ASSIGN} FSM template class, extends @{Core.Fsm#FSM_PROCESS}
|
-- # @{#ACT_ASSIGN} FSM template class, extends @{Core.Fsm#FSM_PROCESS}
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
--- (SP) (MP) (FSM) Route AI or players through waypoints or to zones.
|
--- (SP) (MP) (FSM) Route AI or players through waypoints or to zones.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
-- ## ACT_ASSIST state machine:
|
-- ## ACT_ASSIST state machine:
|
||||||
--
|
--
|
||||||
-- This class is a state machine: it manages a process that is triggered by events causing state transitions to occur.
|
-- This class is a state machine: it manages a process that is triggered by events causing state transitions to occur.
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- # @{#ACT_ROUTE} FSM class, extends @{Core.Fsm#FSM_PROCESS}
|
-- # @{#ACT_ROUTE} FSM class, extends @{Core.Fsm#FSM_PROCESS}
|
||||||
--
|
--
|
||||||
-- ## ACT_ROUTE state machine:
|
-- ## ACT_ROUTE state machine:
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- # 1) MOOSE Cargo System.
|
-- # 1) MOOSE Cargo System.
|
||||||
--
|
--
|
||||||
-- #### Those who have used the mission editor, know that the DCS mission editor provides cargo facilities.
|
-- #### Those who have used the mission editor, know that the DCS mission editor provides cargo facilities.
|
||||||
@@ -277,14 +275,14 @@
|
|||||||
-- The cargo must be in the **Loaded** state.
|
-- The cargo must be in the **Loaded** state.
|
||||||
-- @function [parent=#CARGO] UnBoard
|
-- @function [parent=#CARGO] UnBoard
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param Core.Point#COORDINATE ToPointVec2 (optional) @{Core.Point#COORDINATE) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
|
-- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Core.Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
|
||||||
|
|
||||||
--- UnBoards the cargo to a Carrier. The event will create a movement (= running or driving) of the cargo from the Carrier.
|
--- UnBoards the cargo to a Carrier. The event will create a movement (= running or driving) of the cargo from the Carrier.
|
||||||
-- The cargo must be in the **Loaded** state.
|
-- The cargo must be in the **Loaded** state.
|
||||||
-- @function [parent=#CARGO] __UnBoard
|
-- @function [parent=#CARGO] __UnBoard
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param #number DelaySeconds The amount of seconds to delay the action.
|
-- @param #number DelaySeconds The amount of seconds to delay the action.
|
||||||
-- @param Core.Point#COORDINATE ToPointVec2 (optional) @{Core.Point#COORDINATE) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
|
-- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Core.Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
|
||||||
|
|
||||||
|
|
||||||
-- Load
|
-- Load
|
||||||
@@ -309,14 +307,14 @@
|
|||||||
-- The cargo must be in the **Loaded** state.
|
-- The cargo must be in the **Loaded** state.
|
||||||
-- @function [parent=#CARGO] UnLoad
|
-- @function [parent=#CARGO] UnLoad
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param Core.Point#COORDINATE ToPointVec2 (optional) @{Core.Point#COORDINATE) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
|
-- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Core.Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
|
||||||
|
|
||||||
--- UnLoads the cargo to a Carrier. The event will unload the cargo from the Carrier. There will be no movement simulated of the cargo loading.
|
--- UnLoads the cargo to a Carrier. The event will unload the cargo from the Carrier. There will be no movement simulated of the cargo loading.
|
||||||
-- The cargo must be in the **Loaded** state.
|
-- The cargo must be in the **Loaded** state.
|
||||||
-- @function [parent=#CARGO] __UnLoad
|
-- @function [parent=#CARGO] __UnLoad
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param #number DelaySeconds The amount of seconds to delay the action.
|
-- @param #number DelaySeconds The amount of seconds to delay the action.
|
||||||
-- @param Core.Point#COORDINATE ToPointVec2 (optional) @{Core.Point#COORDINATE) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
|
-- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Core.Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
|
||||||
|
|
||||||
-- State Transition Functions
|
-- State Transition Functions
|
||||||
|
|
||||||
@@ -372,7 +370,7 @@ CARGOS = {}
|
|||||||
|
|
||||||
do -- CARGO
|
do -- CARGO
|
||||||
|
|
||||||
-- @type CARGO
|
--- @type CARGO
|
||||||
-- @extends Core.Fsm#FSM_PROCESS
|
-- @extends Core.Fsm#FSM_PROCESS
|
||||||
-- @field #string Type A string defining the type of the cargo. eg. Engineers, Equipment, Screwdrivers.
|
-- @field #string Type A string defining the type of the cargo. eg. Engineers, Equipment, Screwdrivers.
|
||||||
-- @field #string Name A string defining the name of the cargo. The name is the unique identifier of the cargo.
|
-- @field #string Name A string defining the name of the cargo. The name is the unique identifier of the cargo.
|
||||||
@@ -435,7 +433,7 @@ do -- CARGO
|
|||||||
Reported = {},
|
Reported = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- @type CARGO.CargoObjects
|
--- @type CARGO.CargoObjects
|
||||||
-- @map < #string, Wrapper.Positionable#POSITIONABLE > The alive POSITIONABLE objects representing the the cargo.
|
-- @map < #string, Wrapper.Positionable#POSITIONABLE > The alive POSITIONABLE objects representing the the cargo.
|
||||||
|
|
||||||
--- CARGO Constructor. This class is an abstract class and should not be instantiated.
|
--- CARGO Constructor. This class is an abstract class and should not be instantiated.
|
||||||
@@ -449,7 +447,7 @@ do -- CARGO
|
|||||||
function CARGO:New( Type, Name, Weight, LoadRadius, NearRadius ) --R2.1
|
function CARGO:New( Type, Name, Weight, LoadRadius, NearRadius ) --R2.1
|
||||||
|
|
||||||
local self = BASE:Inherit( self, FSM:New() ) -- #CARGO
|
local self = BASE:Inherit( self, FSM:New() ) -- #CARGO
|
||||||
self:T( { Type, Name, Weight, LoadRadius, NearRadius } )
|
self:F( { Type, Name, Weight, LoadRadius, NearRadius } )
|
||||||
|
|
||||||
self:SetStartState( "UnLoaded" )
|
self:SetStartState( "UnLoaded" )
|
||||||
self:AddTransition( { "UnLoaded", "Boarding" }, "Board", "Boarding" )
|
self:AddTransition( { "UnLoaded", "Boarding" }, "Board", "Boarding" )
|
||||||
@@ -469,7 +467,7 @@ do -- CARGO
|
|||||||
self.Type = Type
|
self.Type = Type
|
||||||
self.Name = Name
|
self.Name = Name
|
||||||
self.Weight = Weight or 0
|
self.Weight = Weight or 0
|
||||||
self.CargoObject = nil -- Wrapper.Group#GROUP
|
self.CargoObject = nil
|
||||||
self.CargoCarrier = nil -- Wrapper.Client#CLIENT
|
self.CargoCarrier = nil -- Wrapper.Client#CLIENT
|
||||||
self.Representable = false
|
self.Representable = false
|
||||||
self.Slingloadable = false
|
self.Slingloadable = false
|
||||||
@@ -713,7 +711,7 @@ do -- CARGO
|
|||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return #CARGO
|
-- @return #CARGO
|
||||||
function CARGO:Spawn( PointVec2 )
|
function CARGO:Spawn( PointVec2 )
|
||||||
self:T()
|
self:F()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -814,7 +812,7 @@ do -- CARGO
|
|||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
-- @return #boolean true if the CargoGroup is within the loading radius.
|
-- @return #boolean true if the CargoGroup is within the loading radius.
|
||||||
function CARGO:IsInLoadRadius( Coordinate )
|
function CARGO:IsInLoadRadius( Coordinate )
|
||||||
self:T( { Coordinate, LoadRadius = self.LoadRadius } )
|
self:F( { Coordinate, LoadRadius = self.LoadRadius } )
|
||||||
|
|
||||||
local Distance = 0
|
local Distance = 0
|
||||||
if self:IsUnLoaded() then
|
if self:IsUnLoaded() then
|
||||||
@@ -834,7 +832,7 @@ do -- CARGO
|
|||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
-- @return #boolean true if the Cargo can report itself.
|
-- @return #boolean true if the Cargo can report itself.
|
||||||
function CARGO:IsInReportRadius( Coordinate )
|
function CARGO:IsInReportRadius( Coordinate )
|
||||||
self:T( { Coordinate } )
|
self:F( { Coordinate } )
|
||||||
|
|
||||||
local Distance = 0
|
local Distance = 0
|
||||||
if self:IsUnLoaded() then
|
if self:IsUnLoaded() then
|
||||||
@@ -855,23 +853,23 @@ do -- CARGO
|
|||||||
-- @param #number NearRadius The radius when the cargo will board the Carrier (to avoid collision).
|
-- @param #number NearRadius The radius when the cargo will board the Carrier (to avoid collision).
|
||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
function CARGO:IsNear( Coordinate, NearRadius )
|
function CARGO:IsNear( Coordinate, NearRadius )
|
||||||
--self:T( { PointVec2 = PointVec2, NearRadius = NearRadius } )
|
--self:F( { PointVec2 = PointVec2, NearRadius = NearRadius } )
|
||||||
|
|
||||||
if self.CargoObject:IsAlive() then
|
if self.CargoObject:IsAlive() then
|
||||||
--local Distance = PointVec2:Get2DDistance( self.CargoObject:GetPointVec2() )
|
--local Distance = PointVec2:Get2DDistance( self.CargoObject:GetPointVec2() )
|
||||||
--self:T( { CargoObjectName = self.CargoObject:GetName() } )
|
--self:F( { CargoObjectName = self.CargoObject:GetName() } )
|
||||||
--self:T( { CargoObjectVec2 = self.CargoObject:GetVec2() } )
|
--self:F( { CargoObjectVec2 = self.CargoObject:GetVec2() } )
|
||||||
--self:T( { PointVec2 = PointVec2:GetVec2() } )
|
--self:F( { PointVec2 = PointVec2:GetVec2() } )
|
||||||
local Distance = Coordinate:Get2DDistance( self.CargoObject:GetCoordinate() )
|
local Distance = Coordinate:Get2DDistance( self.CargoObject:GetCoordinate() )
|
||||||
--self:T( { Distance = Distance, NearRadius = NearRadius or "nil" } )
|
--self:F( { Distance = Distance, NearRadius = NearRadius or "nil" } )
|
||||||
|
|
||||||
if Distance <= NearRadius then
|
if Distance <= NearRadius then
|
||||||
--self:T( { PointVec2 = PointVec2, NearRadius = NearRadius, IsNear = true } )
|
--self:F( { PointVec2 = PointVec2, NearRadius = NearRadius, IsNear = true } )
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--self:T( { PointVec2 = PointVec2, NearRadius = NearRadius, IsNear = false } )
|
--self:F( { PointVec2 = PointVec2, NearRadius = NearRadius, IsNear = false } )
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -880,12 +878,12 @@ do -- CARGO
|
|||||||
-- @param Core.Zone#ZONE_BASE Zone
|
-- @param Core.Zone#ZONE_BASE Zone
|
||||||
-- @return #boolean **true** if cargo is in the Zone, **false** if cargo is not in the Zone.
|
-- @return #boolean **true** if cargo is in the Zone, **false** if cargo is not in the Zone.
|
||||||
function CARGO:IsInZone( Zone )
|
function CARGO:IsInZone( Zone )
|
||||||
--self:T( { Zone } )
|
--self:F( { Zone } )
|
||||||
|
|
||||||
if self:IsLoaded() then
|
if self:IsLoaded() then
|
||||||
return Zone:IsPointVec2InZone( self.CargoCarrier:GetPointVec2() )
|
return Zone:IsPointVec2InZone( self.CargoCarrier:GetPointVec2() )
|
||||||
else
|
else
|
||||||
--self:T( { Size = self.CargoObject:GetSize(), Units = self.CargoObject:GetUnits() } )
|
--self:F( { Size = self.CargoObject:GetSize(), Units = self.CargoObject:GetUnits() } )
|
||||||
if self.CargoObject:GetSize() ~= 0 then
|
if self.CargoObject:GetSize() ~= 0 then
|
||||||
return Zone:IsPointVec2InZone( self.CargoObject:GetPointVec2() )
|
return Zone:IsPointVec2InZone( self.CargoObject:GetPointVec2() )
|
||||||
else
|
else
|
||||||
@@ -899,7 +897,7 @@ do -- CARGO
|
|||||||
|
|
||||||
--- Get the current PointVec2 of the cargo.
|
--- Get the current PointVec2 of the cargo.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return Core.Point#COORDINATE
|
-- @return Core.Point#POINT_VEC2
|
||||||
function CARGO:GetPointVec2()
|
function CARGO:GetPointVec2()
|
||||||
return self.CargoObject:GetPointVec2()
|
return self.CargoObject:GetPointVec2()
|
||||||
end
|
end
|
||||||
@@ -1036,7 +1034,7 @@ end -- CARGO
|
|||||||
|
|
||||||
do -- CARGO_REPRESENTABLE
|
do -- CARGO_REPRESENTABLE
|
||||||
|
|
||||||
-- @type CARGO_REPRESENTABLE
|
--- @type CARGO_REPRESENTABLE
|
||||||
-- @extends #CARGO
|
-- @extends #CARGO
|
||||||
-- @field test
|
-- @field test
|
||||||
|
|
||||||
@@ -1058,7 +1056,7 @@ do -- CARGO_REPRESENTABLE
|
|||||||
|
|
||||||
-- Inherit CARGO.
|
-- Inherit CARGO.
|
||||||
local self = BASE:Inherit( self, CARGO:New( Type, Name, 0, LoadRadius, NearRadius ) ) -- #CARGO_REPRESENTABLE
|
local self = BASE:Inherit( self, CARGO:New( Type, Name, 0, LoadRadius, NearRadius ) ) -- #CARGO_REPRESENTABLE
|
||||||
self:T( { Type, Name, LoadRadius, NearRadius } )
|
self:F( { Type, Name, LoadRadius, NearRadius } )
|
||||||
|
|
||||||
-- Descriptors.
|
-- Descriptors.
|
||||||
local Desc=CargoObject:GetDesc()
|
local Desc=CargoObject:GetDesc()
|
||||||
@@ -1088,7 +1086,7 @@ do -- CARGO_REPRESENTABLE
|
|||||||
function CARGO_REPRESENTABLE:Destroy()
|
function CARGO_REPRESENTABLE:Destroy()
|
||||||
|
|
||||||
-- Cargo objects are deleted from the _DATABASE and SET_CARGO objects.
|
-- Cargo objects are deleted from the _DATABASE and SET_CARGO objects.
|
||||||
self:T( { CargoName = self:GetName() } )
|
self:F( { CargoName = self:GetName() } )
|
||||||
--_EVENTDISPATCHER:CreateEventDeleteCargo( self )
|
--_EVENTDISPATCHER:CreateEventDeleteCargo( self )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -1096,7 +1094,7 @@ do -- CARGO_REPRESENTABLE
|
|||||||
|
|
||||||
--- Route a cargo unit to a PointVec2.
|
--- Route a cargo unit to a PointVec2.
|
||||||
-- @param #CARGO_REPRESENTABLE self
|
-- @param #CARGO_REPRESENTABLE self
|
||||||
-- @param Core.Point#COORDINATE ToPointVec2
|
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
||||||
-- @param #number Speed
|
-- @param #number Speed
|
||||||
-- @return #CARGO_REPRESENTABLE
|
-- @return #CARGO_REPRESENTABLE
|
||||||
function CARGO_REPRESENTABLE:RouteTo( ToPointVec2, Speed )
|
function CARGO_REPRESENTABLE:RouteTo( ToPointVec2, Speed )
|
||||||
@@ -1125,12 +1123,12 @@ do -- CARGO_REPRESENTABLE
|
|||||||
CoordinateZone:Scan( { Object.Category.UNIT } )
|
CoordinateZone:Scan( { Object.Category.UNIT } )
|
||||||
for _, DCSUnit in pairs( CoordinateZone:GetScannedUnits() ) do
|
for _, DCSUnit in pairs( CoordinateZone:GetScannedUnits() ) do
|
||||||
local NearUnit = UNIT:Find( DCSUnit )
|
local NearUnit = UNIT:Find( DCSUnit )
|
||||||
self:T({NearUnit=NearUnit})
|
self:F({NearUnit=NearUnit})
|
||||||
local NearUnitCoalition = NearUnit:GetCoalition()
|
local NearUnitCoalition = NearUnit:GetCoalition()
|
||||||
local CargoCoalition = self:GetCoalition()
|
local CargoCoalition = self:GetCoalition()
|
||||||
if NearUnitCoalition == CargoCoalition then
|
if NearUnitCoalition == CargoCoalition then
|
||||||
local Attributes = NearUnit:GetDesc()
|
local Attributes = NearUnit:GetDesc()
|
||||||
self:T({Desc=Attributes})
|
self:F({Desc=Attributes})
|
||||||
if NearUnit:HasAttribute( "Trucks" ) then
|
if NearUnit:HasAttribute( "Trucks" ) then
|
||||||
MESSAGE:New( Message, 20, NearUnit:GetCallsign() .. " reporting - Cargo " .. self:GetName() ):ToGroup( TaskGroup )
|
MESSAGE:New( Message, 20, NearUnit:GetCallsign() .. " reporting - Cargo " .. self:GetName() ):ToGroup( TaskGroup )
|
||||||
break
|
break
|
||||||
@@ -1144,7 +1142,7 @@ end -- CARGO_REPRESENTABLE
|
|||||||
|
|
||||||
do -- CARGO_REPORTABLE
|
do -- CARGO_REPORTABLE
|
||||||
|
|
||||||
-- @type CARGO_REPORTABLE
|
--- @type CARGO_REPORTABLE
|
||||||
-- @extends #CARGO
|
-- @extends #CARGO
|
||||||
CARGO_REPORTABLE = {
|
CARGO_REPORTABLE = {
|
||||||
ClassName = "CARGO_REPORTABLE"
|
ClassName = "CARGO_REPORTABLE"
|
||||||
@@ -1160,7 +1158,7 @@ do -- CARGO_REPORTABLE
|
|||||||
-- @return #CARGO_REPORTABLE
|
-- @return #CARGO_REPORTABLE
|
||||||
function CARGO_REPORTABLE:New( Type, Name, Weight, LoadRadius, NearRadius )
|
function CARGO_REPORTABLE:New( Type, Name, Weight, LoadRadius, NearRadius )
|
||||||
local self = BASE:Inherit( self, CARGO:New( Type, Name, Weight, LoadRadius, NearRadius ) ) -- #CARGO_REPORTABLE
|
local self = BASE:Inherit( self, CARGO:New( Type, Name, Weight, LoadRadius, NearRadius ) ) -- #CARGO_REPORTABLE
|
||||||
self:T( { Type, Name, Weight, LoadRadius, NearRadius } )
|
self:F( { Type, Name, Weight, LoadRadius, NearRadius } )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -1180,7 +1178,7 @@ end
|
|||||||
|
|
||||||
do -- CARGO_PACKAGE
|
do -- CARGO_PACKAGE
|
||||||
|
|
||||||
-- @type CARGO_PACKAGE
|
--- @type CARGO_PACKAGE
|
||||||
-- @extends #CARGO_REPRESENTABLE
|
-- @extends #CARGO_REPRESENTABLE
|
||||||
CARGO_PACKAGE = {
|
CARGO_PACKAGE = {
|
||||||
ClassName = "CARGO_PACKAGE"
|
ClassName = "CARGO_PACKAGE"
|
||||||
@@ -1197,7 +1195,7 @@ do -- CARGO_PACKAGE
|
|||||||
-- @return #CARGO_PACKAGE
|
-- @return #CARGO_PACKAGE
|
||||||
function CARGO_PACKAGE:New( CargoCarrier, Type, Name, Weight, LoadRadius, NearRadius )
|
function CARGO_PACKAGE:New( CargoCarrier, Type, Name, Weight, LoadRadius, NearRadius )
|
||||||
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoCarrier, Type, Name, Weight, LoadRadius, NearRadius ) ) -- #CARGO_PACKAGE
|
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoCarrier, Type, Name, Weight, LoadRadius, NearRadius ) ) -- #CARGO_PACKAGE
|
||||||
self:T( { Type, Name, Weight, LoadRadius, NearRadius } )
|
self:F( { Type, Name, Weight, LoadRadius, NearRadius } )
|
||||||
|
|
||||||
self:T( CargoCarrier )
|
self:T( CargoCarrier )
|
||||||
self.CargoCarrier = CargoCarrier
|
self.CargoCarrier = CargoCarrier
|
||||||
@@ -1215,7 +1213,7 @@ end
|
|||||||
-- @param #number BoardDistance
|
-- @param #number BoardDistance
|
||||||
-- @param #number Angle
|
-- @param #number Angle
|
||||||
function CARGO_PACKAGE:onafterOnBoard( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
|
function CARGO_PACKAGE:onafterOnBoard( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
|
||||||
self:T()
|
self:F()
|
||||||
|
|
||||||
self.CargoInAir = self.CargoCarrier:InAir()
|
self.CargoInAir = self.CargoCarrier:InAir()
|
||||||
|
|
||||||
@@ -1248,7 +1246,7 @@ end
|
|||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
function CARGO_PACKAGE:IsNear( CargoCarrier )
|
function CARGO_PACKAGE:IsNear( CargoCarrier )
|
||||||
self:T()
|
self:F()
|
||||||
|
|
||||||
local CargoCarrierPoint = CargoCarrier:GetCoordinate()
|
local CargoCarrierPoint = CargoCarrier:GetCoordinate()
|
||||||
|
|
||||||
@@ -1273,7 +1271,7 @@ end
|
|||||||
-- @param #number LoadDistance
|
-- @param #number LoadDistance
|
||||||
-- @param #number Angle
|
-- @param #number Angle
|
||||||
function CARGO_PACKAGE:onafterOnBoarded( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
|
function CARGO_PACKAGE:onafterOnBoarded( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
|
||||||
self:T()
|
self:F()
|
||||||
|
|
||||||
if self:IsNear( CargoCarrier ) then
|
if self:IsNear( CargoCarrier ) then
|
||||||
self:__Load( 1, CargoCarrier, Speed, LoadDistance, Angle )
|
self:__Load( 1, CargoCarrier, Speed, LoadDistance, Angle )
|
||||||
@@ -1294,7 +1292,7 @@ end
|
|||||||
-- @param #number Radius
|
-- @param #number Radius
|
||||||
-- @param #number Angle
|
-- @param #number Angle
|
||||||
function CARGO_PACKAGE:onafterUnBoard( From, Event, To, CargoCarrier, Speed, UnLoadDistance, UnBoardDistance, Radius, Angle )
|
function CARGO_PACKAGE:onafterUnBoard( From, Event, To, CargoCarrier, Speed, UnLoadDistance, UnBoardDistance, Radius, Angle )
|
||||||
self:T()
|
self:F()
|
||||||
|
|
||||||
self.CargoInAir = self.CargoCarrier:InAir()
|
self.CargoInAir = self.CargoCarrier:InAir()
|
||||||
|
|
||||||
@@ -1333,7 +1331,7 @@ end
|
|||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
-- @param #number Speed
|
-- @param #number Speed
|
||||||
function CARGO_PACKAGE:onafterUnBoarded( From, Event, To, CargoCarrier, Speed )
|
function CARGO_PACKAGE:onafterUnBoarded( From, Event, To, CargoCarrier, Speed )
|
||||||
self:T()
|
self:F()
|
||||||
|
|
||||||
if self:IsNear( CargoCarrier ) then
|
if self:IsNear( CargoCarrier ) then
|
||||||
self:__UnLoad( 1, CargoCarrier, Speed )
|
self:__UnLoad( 1, CargoCarrier, Speed )
|
||||||
@@ -1352,7 +1350,7 @@ end
|
|||||||
-- @param #number LoadDistance
|
-- @param #number LoadDistance
|
||||||
-- @param #number Angle
|
-- @param #number Angle
|
||||||
function CARGO_PACKAGE:onafterLoad( From, Event, To, CargoCarrier, Speed, LoadDistance, Angle )
|
function CARGO_PACKAGE:onafterLoad( From, Event, To, CargoCarrier, Speed, LoadDistance, Angle )
|
||||||
self:T()
|
self:F()
|
||||||
|
|
||||||
self.CargoCarrier = CargoCarrier
|
self.CargoCarrier = CargoCarrier
|
||||||
|
|
||||||
@@ -1380,7 +1378,7 @@ end
|
|||||||
-- @param #number Distance
|
-- @param #number Distance
|
||||||
-- @param #number Angle
|
-- @param #number Angle
|
||||||
function CARGO_PACKAGE:onafterUnLoad( From, Event, To, CargoCarrier, Speed, Distance, Angle )
|
function CARGO_PACKAGE:onafterUnLoad( From, Event, To, CargoCarrier, Speed, Distance, Angle )
|
||||||
self:T()
|
self:F()
|
||||||
|
|
||||||
local StartPointVec2 = self.CargoCarrier:GetPointVec2()
|
local StartPointVec2 = self.CargoCarrier:GetPointVec2()
|
||||||
local CargoCarrierHeading = self.CargoCarrier:GetHeading() -- Get Heading of object in degrees.
|
local CargoCarrierHeading = self.CargoCarrier:GetHeading() -- Get Heading of object in degrees.
|
||||||
|
|||||||
@@ -22,9 +22,6 @@ do -- CARGO_CRATE
|
|||||||
-- @type CARGO_CRATE
|
-- @type CARGO_CRATE
|
||||||
-- @extends Cargo.Cargo#CARGO_REPRESENTABLE
|
-- @extends Cargo.Cargo#CARGO_REPRESENTABLE
|
||||||
|
|
||||||
---
|
|
||||||
-- 
|
|
||||||
--
|
|
||||||
--- Defines a cargo that is represented by a UNIT object within the simulator, and can be transported by a carrier.
|
--- Defines a cargo that is represented by a UNIT object within the simulator, and can be transported by a carrier.
|
||||||
-- Use the event functions as described above to Load, UnLoad, Board, UnBoard the CARGO\_CRATE objects to and from carriers.
|
-- Use the event functions as described above to Load, UnLoad, Board, UnBoard the CARGO\_CRATE objects to and from carriers.
|
||||||
--
|
--
|
||||||
@@ -62,7 +59,7 @@ do -- CARGO_CRATE
|
|||||||
-- @return #CARGO_CRATE
|
-- @return #CARGO_CRATE
|
||||||
function CARGO_CRATE:New( CargoStatic, Type, Name, LoadRadius, NearRadius )
|
function CARGO_CRATE:New( CargoStatic, Type, Name, LoadRadius, NearRadius )
|
||||||
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoStatic, Type, Name, nil, LoadRadius, NearRadius ) ) -- #CARGO_CRATE
|
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoStatic, Type, Name, nil, LoadRadius, NearRadius ) ) -- #CARGO_CRATE
|
||||||
self:T( { Type, Name, NearRadius } )
|
self:F( { Type, Name, NearRadius } )
|
||||||
|
|
||||||
self.CargoObject = CargoStatic -- Wrapper.Static#STATIC
|
self.CargoObject = CargoStatic -- Wrapper.Static#STATIC
|
||||||
|
|
||||||
@@ -117,9 +114,9 @@ do -- CARGO_CRATE
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#COORDINATE
|
-- @param Core.Point#POINT_VEC2
|
||||||
function CARGO_CRATE:onenterUnLoaded( From, Event, To, ToPointVec2 )
|
function CARGO_CRATE:onenterUnLoaded( From, Event, To, ToPointVec2 )
|
||||||
--self:T( { ToPointVec2, From, Event, To } )
|
--self:F( { ToPointVec2, From, Event, To } )
|
||||||
|
|
||||||
local Angle = 180
|
local Angle = 180
|
||||||
local Speed = 10
|
local Speed = 10
|
||||||
@@ -156,7 +153,7 @@ do -- CARGO_CRATE
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
function CARGO_CRATE:onenterLoaded( From, Event, To, CargoCarrier )
|
function CARGO_CRATE:onenterLoaded( From, Event, To, CargoCarrier )
|
||||||
--self:T( { From, Event, To, CargoCarrier } )
|
--self:F( { From, Event, To, CargoCarrier } )
|
||||||
|
|
||||||
self.CargoCarrier = CargoCarrier
|
self.CargoCarrier = CargoCarrier
|
||||||
|
|
||||||
@@ -193,7 +190,7 @@ do -- CARGO_CRATE
|
|||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
-- @return #boolean true if the Cargo Crate is within the report radius.
|
-- @return #boolean true if the Cargo Crate is within the report radius.
|
||||||
function CARGO_CRATE:IsInReportRadius( Coordinate )
|
function CARGO_CRATE:IsInReportRadius( Coordinate )
|
||||||
--self:T( { Coordinate, LoadRadius = self.LoadRadius } )
|
--self:F( { Coordinate, LoadRadius = self.LoadRadius } )
|
||||||
|
|
||||||
local Distance = 0
|
local Distance = 0
|
||||||
if self:IsUnLoaded() then
|
if self:IsUnLoaded() then
|
||||||
@@ -213,7 +210,7 @@ do -- CARGO_CRATE
|
|||||||
-- @param Core.Point#Coordinate Coordinate
|
-- @param Core.Point#Coordinate Coordinate
|
||||||
-- @return #boolean true if the Cargo Crate is within the loading radius.
|
-- @return #boolean true if the Cargo Crate is within the loading radius.
|
||||||
function CARGO_CRATE:IsInLoadRadius( Coordinate )
|
function CARGO_CRATE:IsInLoadRadius( Coordinate )
|
||||||
--self:T( { Coordinate, LoadRadius = self.NearRadius } )
|
--self:F( { Coordinate, LoadRadius = self.NearRadius } )
|
||||||
|
|
||||||
local Distance = 0
|
local Distance = 0
|
||||||
if self:IsUnLoaded() then
|
if self:IsUnLoaded() then
|
||||||
@@ -234,7 +231,7 @@ do -- CARGO_CRATE
|
|||||||
-- @return Core.Point#COORDINATE The current Coordinate of the first Cargo of the CargoGroup.
|
-- @return Core.Point#COORDINATE The current Coordinate of the first Cargo of the CargoGroup.
|
||||||
-- @return #nil There is no valid Cargo in the CargoGroup.
|
-- @return #nil There is no valid Cargo in the CargoGroup.
|
||||||
function CARGO_CRATE:GetCoordinate()
|
function CARGO_CRATE:GetCoordinate()
|
||||||
--self:T()
|
--self:F()
|
||||||
|
|
||||||
return self.CargoObject:GetCoordinate()
|
return self.CargoObject:GetCoordinate()
|
||||||
end
|
end
|
||||||
@@ -264,7 +261,7 @@ do -- CARGO_CRATE
|
|||||||
-- @param #CARGO_CRATE self
|
-- @param #CARGO_CRATE self
|
||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
function CARGO_CRATE:RouteTo( Coordinate )
|
function CARGO_CRATE:RouteTo( Coordinate )
|
||||||
self:T( {Coordinate = Coordinate } )
|
self:F( {Coordinate = Coordinate } )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -277,7 +274,7 @@ do -- CARGO_CRATE
|
|||||||
-- @return #boolean The Cargo is near to the Carrier.
|
-- @return #boolean The Cargo is near to the Carrier.
|
||||||
-- @return #nil The Cargo is not near to the Carrier.
|
-- @return #nil The Cargo is not near to the Carrier.
|
||||||
function CARGO_CRATE:IsNear( CargoCarrier, NearRadius )
|
function CARGO_CRATE:IsNear( CargoCarrier, NearRadius )
|
||||||
self:T( {NearRadius = NearRadius } )
|
self:F( {NearRadius = NearRadius } )
|
||||||
|
|
||||||
return self:IsNear( CargoCarrier:GetCoordinate(), NearRadius )
|
return self:IsNear( CargoCarrier:GetCoordinate(), NearRadius )
|
||||||
end
|
end
|
||||||
@@ -286,7 +283,7 @@ do -- CARGO_CRATE
|
|||||||
-- @param #CARGO_CRATE self
|
-- @param #CARGO_CRATE self
|
||||||
function CARGO_CRATE:Respawn()
|
function CARGO_CRATE:Respawn()
|
||||||
|
|
||||||
self:T( { "Respawning crate " .. self:GetName() } )
|
self:F( { "Respawning crate " .. self:GetName() } )
|
||||||
|
|
||||||
|
|
||||||
-- Respawn the group...
|
-- Respawn the group...
|
||||||
@@ -303,7 +300,7 @@ do -- CARGO_CRATE
|
|||||||
-- @param #CARGO_CRATE self
|
-- @param #CARGO_CRATE self
|
||||||
function CARGO_CRATE:onafterReset()
|
function CARGO_CRATE:onafterReset()
|
||||||
|
|
||||||
self:T( { "Reset crate " .. self:GetName() } )
|
self:F( { "Reset crate " .. self:GetName() } )
|
||||||
|
|
||||||
|
|
||||||
-- Respawn the group...
|
-- Respawn the group...
|
||||||
|
|||||||
@@ -22,12 +22,9 @@ do -- CARGO_GROUP
|
|||||||
--- @type CARGO_GROUP
|
--- @type CARGO_GROUP
|
||||||
-- @field Core.Set#SET_CARGO CargoSet The collection of derived CARGO objects.
|
-- @field Core.Set#SET_CARGO CargoSet The collection of derived CARGO objects.
|
||||||
-- @field #string GroupName The name of the CargoGroup.
|
-- @field #string GroupName The name of the CargoGroup.
|
||||||
-- @field Wrapper.Group#GROUÜ CargoCarrier The carrier group.
|
|
||||||
-- @extends Cargo.Cargo#CARGO_REPORTABLE
|
-- @extends Cargo.Cargo#CARGO_REPORTABLE
|
||||||
|
|
||||||
--- Defines a cargo that is represented by a @{Wrapper.Group} object within the simulator.
|
--- Defines a cargo that is represented by a @{Wrapper.Group} object within the simulator.
|
||||||
--
|
|
||||||
-- 
|
|
||||||
-- The cargo can be Loaded, UnLoaded, Boarded, UnBoarded to and from Carriers.
|
-- The cargo can be Loaded, UnLoaded, Boarded, UnBoarded to and from Carriers.
|
||||||
--
|
--
|
||||||
-- The above cargo classes are used by the following AI_CARGO_ classes to allow AI groups to transport cargo:
|
-- The above cargo classes are used by the following AI_CARGO_ classes to allow AI groups to transport cargo:
|
||||||
@@ -67,7 +64,7 @@ do -- CARGO_GROUP
|
|||||||
|
|
||||||
-- Inherit CAROG_REPORTABLE
|
-- Inherit CAROG_REPORTABLE
|
||||||
local self = BASE:Inherit( self, CARGO_REPORTABLE:New( Type, Name, 0, LoadRadius, NearRadius ) ) -- #CARGO_GROUP
|
local self = BASE:Inherit( self, CARGO_REPORTABLE:New( Type, Name, 0, LoadRadius, NearRadius ) ) -- #CARGO_GROUP
|
||||||
self:T( { Type, Name, LoadRadius } )
|
self:F( { Type, Name, LoadRadius } )
|
||||||
|
|
||||||
self.CargoSet = SET_CARGO:New()
|
self.CargoSet = SET_CARGO:New()
|
||||||
self.CargoGroup = CargoGroup
|
self.CargoGroup = CargoGroup
|
||||||
@@ -149,7 +146,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param #CARGO_GROUP self
|
-- @param #CARGO_GROUP self
|
||||||
function CARGO_GROUP:Respawn()
|
function CARGO_GROUP:Respawn()
|
||||||
|
|
||||||
self:T( { "Respawning" } )
|
self:F( { "Respawning" } )
|
||||||
|
|
||||||
for CargoID, CargoData in pairs( self.CargoSet:GetSet() ) do
|
for CargoID, CargoData in pairs( self.CargoSet:GetSet() ) do
|
||||||
local Cargo = CargoData -- Cargo.Cargo#CARGO
|
local Cargo = CargoData -- Cargo.Cargo#CARGO
|
||||||
@@ -230,7 +227,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param #CARGO_GROUP self
|
-- @param #CARGO_GROUP self
|
||||||
function CARGO_GROUP:Regroup()
|
function CARGO_GROUP:Regroup()
|
||||||
|
|
||||||
self:T("Regroup")
|
self:F("Regroup")
|
||||||
|
|
||||||
if self.Grouped == false then
|
if self.Grouped == false then
|
||||||
|
|
||||||
@@ -244,7 +241,7 @@ do -- CARGO_GROUP
|
|||||||
for CargoUnitName, CargoUnit in pairs( self.CargoSet:GetSet() ) do
|
for CargoUnitName, CargoUnit in pairs( self.CargoSet:GetSet() ) do
|
||||||
local CargoUnit = CargoUnit -- Cargo.CargoUnit#CARGO_UNIT
|
local CargoUnit = CargoUnit -- Cargo.CargoUnit#CARGO_UNIT
|
||||||
|
|
||||||
self:T( { CargoUnit:GetName(), UnLoaded = CargoUnit:IsUnLoaded() } )
|
self:F( { CargoUnit:GetName(), UnLoaded = CargoUnit:IsUnLoaded() } )
|
||||||
|
|
||||||
if CargoUnit:IsUnLoaded() then
|
if CargoUnit:IsUnLoaded() then
|
||||||
|
|
||||||
@@ -261,7 +258,7 @@ do -- CARGO_GROUP
|
|||||||
-- Then we register the new group in the database
|
-- Then we register the new group in the database
|
||||||
self.CargoGroup = GROUP:NewTemplate( GroupTemplate, GroupTemplate.CoalitionID, GroupTemplate.CategoryID, GroupTemplate.CountryID )
|
self.CargoGroup = GROUP:NewTemplate( GroupTemplate, GroupTemplate.CoalitionID, GroupTemplate.CategoryID, GroupTemplate.CountryID )
|
||||||
|
|
||||||
self:T( { "Regroup", GroupTemplate } )
|
self:F( { "Regroup", GroupTemplate } )
|
||||||
|
|
||||||
-- Now we spawn the new group based on the template created.
|
-- Now we spawn the new group based on the template created.
|
||||||
self.CargoObject = _DATABASE:Spawn( GroupTemplate )
|
self.CargoObject = _DATABASE:Spawn( GroupTemplate )
|
||||||
@@ -274,7 +271,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function CARGO_GROUP:OnEventCargoDead( EventData )
|
function CARGO_GROUP:OnEventCargoDead( EventData )
|
||||||
|
|
||||||
self:T(EventData)
|
self:E(EventData)
|
||||||
|
|
||||||
local Destroyed = false
|
local Destroyed = false
|
||||||
|
|
||||||
@@ -299,7 +296,7 @@ do -- CARGO_GROUP
|
|||||||
|
|
||||||
if Destroyed then
|
if Destroyed then
|
||||||
self:Destroyed()
|
self:Destroyed()
|
||||||
self:T( { "Cargo group destroyed" } )
|
self:E( { "Cargo group destroyed" } )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -312,14 +309,14 @@ do -- CARGO_GROUP
|
|||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
||||||
function CARGO_GROUP:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ... )
|
function CARGO_GROUP:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||||
self:T( { CargoCarrier.UnitName, From, Event, To, NearRadius = NearRadius } )
|
self:F( { CargoCarrier.UnitName, From, Event, To, NearRadius = NearRadius } )
|
||||||
|
|
||||||
NearRadius = NearRadius or self.NearRadius
|
NearRadius = NearRadius or self.NearRadius
|
||||||
|
|
||||||
-- For each Cargo object within the CARGO_GROUPED, route each object to the CargoLoadPointVec2
|
-- For each Cargo object within the CARGO_GROUPED, route each object to the CargoLoadPointVec2
|
||||||
self.CargoSet:ForEach(
|
self.CargoSet:ForEach(
|
||||||
function( Cargo, ... )
|
function( Cargo, ... )
|
||||||
self:T( { "Board Unit", Cargo:GetName( ), Cargo:IsDestroyed(), Cargo.CargoObject:IsAlive() } )
|
self:F( { "Board Unit", Cargo:GetName( ), Cargo:IsDestroyed(), Cargo.CargoObject:IsAlive() } )
|
||||||
local CargoGroup = Cargo.CargoObject --Wrapper.Group#GROUP
|
local CargoGroup = Cargo.CargoObject --Wrapper.Group#GROUP
|
||||||
CargoGroup:OptionAlarmStateGreen()
|
CargoGroup:OptionAlarmStateGreen()
|
||||||
Cargo:__Board( 1, CargoCarrier, NearRadius, ... )
|
Cargo:__Board( 1, CargoCarrier, NearRadius, ... )
|
||||||
@@ -337,7 +334,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
function CARGO_GROUP:onafterLoad( From, Event, To, CargoCarrier, ... )
|
function CARGO_GROUP:onafterLoad( From, Event, To, CargoCarrier, ... )
|
||||||
--self:T( { From, Event, To, CargoCarrier, ...} )
|
--self:F( { From, Event, To, CargoCarrier, ...} )
|
||||||
|
|
||||||
if From == "UnLoaded" then
|
if From == "UnLoaded" then
|
||||||
-- For each Cargo object within the CARGO_GROUP, load each cargo to the CargoCarrier.
|
-- For each Cargo object within the CARGO_GROUP, load each cargo to the CargoCarrier.
|
||||||
@@ -362,7 +359,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
||||||
function CARGO_GROUP:onafterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
|
function CARGO_GROUP:onafterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||||
--self:T( { CargoCarrier.UnitName, From, Event, To } )
|
--self:F( { CargoCarrier.UnitName, From, Event, To } )
|
||||||
|
|
||||||
local Boarded = true
|
local Boarded = true
|
||||||
local Cancelled = false
|
local Cancelled = false
|
||||||
@@ -396,7 +393,7 @@ do -- CARGO_GROUP
|
|||||||
if not Boarded then
|
if not Boarded then
|
||||||
self:__Boarding( -5, CargoCarrier, NearRadius, ... )
|
self:__Boarding( -5, CargoCarrier, NearRadius, ... )
|
||||||
else
|
else
|
||||||
self:T("Group Cargo is loaded")
|
self:F("Group Cargo is loaded")
|
||||||
self:__Load( 1, CargoCarrier, ... )
|
self:__Load( 1, CargoCarrier, ... )
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -413,10 +410,10 @@ do -- CARGO_GROUP
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#COORDINATE ToPointVec2
|
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
||||||
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
||||||
function CARGO_GROUP:onafterUnBoard( From, Event, To, ToPointVec2, NearRadius, ... )
|
function CARGO_GROUP:onafterUnBoard( From, Event, To, ToPointVec2, NearRadius, ... )
|
||||||
self:T( {From, Event, To, ToPointVec2, NearRadius } )
|
self:F( {From, Event, To, ToPointVec2, NearRadius } )
|
||||||
|
|
||||||
NearRadius = NearRadius or 25
|
NearRadius = NearRadius or 25
|
||||||
|
|
||||||
@@ -456,10 +453,10 @@ do -- CARGO_GROUP
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#COORDINATE ToPointVec2
|
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
||||||
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
||||||
function CARGO_GROUP:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... )
|
function CARGO_GROUP:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... )
|
||||||
--self:T( { From, Event, To, ToPointVec2, NearRadius } )
|
--self:F( { From, Event, To, ToPointVec2, NearRadius } )
|
||||||
|
|
||||||
--local NearRadius = NearRadius or 25
|
--local NearRadius = NearRadius or 25
|
||||||
|
|
||||||
@@ -494,9 +491,9 @@ do -- CARGO_GROUP
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#COORDINATE ToPointVec2
|
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
||||||
function CARGO_GROUP:onafterUnLoad( From, Event, To, ToPointVec2, ... )
|
function CARGO_GROUP:onafterUnLoad( From, Event, To, ToPointVec2, ... )
|
||||||
--self:T( { From, Event, To, ToPointVec2 } )
|
--self:F( { From, Event, To, ToPointVec2 } )
|
||||||
|
|
||||||
if From == "Loaded" then
|
if From == "Loaded" then
|
||||||
|
|
||||||
@@ -614,7 +611,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param #CARGO_GROUP self
|
-- @param #CARGO_GROUP self
|
||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
function CARGO_GROUP:RouteTo( Coordinate )
|
function CARGO_GROUP:RouteTo( Coordinate )
|
||||||
--self:T( {Coordinate = Coordinate } )
|
--self:F( {Coordinate = Coordinate } )
|
||||||
|
|
||||||
-- For each Cargo within the CargoSet, route each object to the Coordinate
|
-- For each Cargo within the CargoSet, route each object to the Coordinate
|
||||||
self.CargoSet:ForEach(
|
self.CargoSet:ForEach(
|
||||||
@@ -632,13 +629,13 @@ do -- CARGO_GROUP
|
|||||||
-- @param #number NearRadius
|
-- @param #number NearRadius
|
||||||
-- @return #boolean The Cargo is near to the Carrier or #nil if the Cargo is not near to the Carrier.
|
-- @return #boolean The Cargo is near to the Carrier or #nil if the Cargo is not near to the Carrier.
|
||||||
function CARGO_GROUP:IsNear( CargoCarrier, NearRadius )
|
function CARGO_GROUP:IsNear( CargoCarrier, NearRadius )
|
||||||
self:T( {NearRadius = NearRadius } )
|
self:F( {NearRadius = NearRadius } )
|
||||||
|
|
||||||
for _, Cargo in pairs( self.CargoSet:GetSet() ) do
|
for _, Cargo in pairs( self.CargoSet:GetSet() ) do
|
||||||
local Cargo = Cargo -- Cargo.Cargo#CARGO
|
local Cargo = Cargo -- Cargo.Cargo#CARGO
|
||||||
if Cargo:IsAlive() then
|
if Cargo:IsAlive() then
|
||||||
if Cargo:IsNear( CargoCarrier:GetCoordinate(), NearRadius ) then
|
if Cargo:IsNear( CargoCarrier:GetCoordinate(), NearRadius ) then
|
||||||
self:T( "Near" )
|
self:F( "Near" )
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -652,7 +649,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
-- @return #boolean true if the Cargo Group is within the load radius.
|
-- @return #boolean true if the Cargo Group is within the load radius.
|
||||||
function CARGO_GROUP:IsInLoadRadius( Coordinate )
|
function CARGO_GROUP:IsInLoadRadius( Coordinate )
|
||||||
--self:T( { Coordinate } )
|
--self:F( { Coordinate } )
|
||||||
|
|
||||||
local Cargo = self:GetFirstAlive() -- Cargo.Cargo#CARGO
|
local Cargo = self:GetFirstAlive() -- Cargo.Cargo#CARGO
|
||||||
|
|
||||||
@@ -672,7 +669,7 @@ do -- CARGO_GROUP
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
self:T( { Distance = Distance, LoadRadius = self.LoadRadius } )
|
self:F( { Distance = Distance, LoadRadius = self.LoadRadius } )
|
||||||
if Distance <= self.LoadRadius then
|
if Distance <= self.LoadRadius then
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
@@ -690,12 +687,12 @@ do -- CARGO_GROUP
|
|||||||
-- @param Core.Point#Coordinate Coordinate
|
-- @param Core.Point#Coordinate Coordinate
|
||||||
-- @return #boolean true if the Cargo Group is within the report radius.
|
-- @return #boolean true if the Cargo Group is within the report radius.
|
||||||
function CARGO_GROUP:IsInReportRadius( Coordinate )
|
function CARGO_GROUP:IsInReportRadius( Coordinate )
|
||||||
--self:T( { Coordinate } )
|
--self:F( { Coordinate } )
|
||||||
|
|
||||||
local Cargo = self:GetFirstAlive() -- Cargo.Cargo#CARGO
|
local Cargo = self:GetFirstAlive() -- Cargo.Cargo#CARGO
|
||||||
|
|
||||||
if Cargo then
|
if Cargo then
|
||||||
self:T( { Cargo } )
|
self:F( { Cargo } )
|
||||||
local Distance = 0
|
local Distance = 0
|
||||||
if Cargo:IsUnLoaded() then
|
if Cargo:IsUnLoaded() then
|
||||||
Distance = Coordinate:Get2DDistance( Cargo.CargoObject:GetCoordinate() )
|
Distance = Coordinate:Get2DDistance( Cargo.CargoObject:GetCoordinate() )
|
||||||
@@ -741,7 +738,7 @@ do -- CARGO_GROUP
|
|||||||
-- @return #boolean **true** if the first element of the CargoGroup is in the Zone
|
-- @return #boolean **true** if the first element of the CargoGroup is in the Zone
|
||||||
-- @return #boolean **false** if there is no element of the CargoGroup in the Zone.
|
-- @return #boolean **false** if there is no element of the CargoGroup in the Zone.
|
||||||
function CARGO_GROUP:IsInZone( Zone )
|
function CARGO_GROUP:IsInZone( Zone )
|
||||||
--self:T( { Zone } )
|
--self:F( { Zone } )
|
||||||
|
|
||||||
local Cargo = self.CargoSet:GetFirst() -- Cargo.Cargo#CARGO
|
local Cargo = self.CargoSet:GetFirst() -- Cargo.Cargo#CARGO
|
||||||
|
|
||||||
@@ -774,4 +771,3 @@ do -- CARGO_GROUP
|
|||||||
|
|
||||||
|
|
||||||
end -- CARGO_GROUP
|
end -- CARGO_GROUP
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,6 @@ do -- CARGO_SLINGLOAD
|
|||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
||||||
-- Therefore, this class is considered to be deprecated
|
-- Therefore, this class is considered to be deprecated
|
||||||
--
|
--
|
||||||
@@ -54,7 +52,7 @@ do -- CARGO_SLINGLOAD
|
|||||||
-- @return #CARGO_SLINGLOAD
|
-- @return #CARGO_SLINGLOAD
|
||||||
function CARGO_SLINGLOAD:New( CargoStatic, Type, Name, LoadRadius, NearRadius )
|
function CARGO_SLINGLOAD:New( CargoStatic, Type, Name, LoadRadius, NearRadius )
|
||||||
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoStatic, Type, Name, nil, LoadRadius, NearRadius ) ) -- #CARGO_SLINGLOAD
|
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoStatic, Type, Name, nil, LoadRadius, NearRadius ) ) -- #CARGO_SLINGLOAD
|
||||||
self:T( { Type, Name, NearRadius } )
|
self:F( { Type, Name, NearRadius } )
|
||||||
|
|
||||||
self.CargoObject = CargoStatic
|
self.CargoObject = CargoStatic
|
||||||
|
|
||||||
@@ -132,7 +130,7 @@ do -- CARGO_SLINGLOAD
|
|||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
-- @return #boolean true if the Cargo Crate is within the report radius.
|
-- @return #boolean true if the Cargo Crate is within the report radius.
|
||||||
function CARGO_SLINGLOAD:IsInReportRadius( Coordinate )
|
function CARGO_SLINGLOAD:IsInReportRadius( Coordinate )
|
||||||
--self:T( { Coordinate, LoadRadius = self.LoadRadius } )
|
--self:F( { Coordinate, LoadRadius = self.LoadRadius } )
|
||||||
|
|
||||||
local Distance = 0
|
local Distance = 0
|
||||||
if self:IsUnLoaded() then
|
if self:IsUnLoaded() then
|
||||||
@@ -151,7 +149,7 @@ do -- CARGO_SLINGLOAD
|
|||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
-- @return #boolean true if the Cargo Slingload is within the loading radius.
|
-- @return #boolean true if the Cargo Slingload is within the loading radius.
|
||||||
function CARGO_SLINGLOAD:IsInLoadRadius( Coordinate )
|
function CARGO_SLINGLOAD:IsInLoadRadius( Coordinate )
|
||||||
--self:T( { Coordinate } )
|
--self:F( { Coordinate } )
|
||||||
|
|
||||||
local Distance = 0
|
local Distance = 0
|
||||||
if self:IsUnLoaded() then
|
if self:IsUnLoaded() then
|
||||||
@@ -171,7 +169,7 @@ do -- CARGO_SLINGLOAD
|
|||||||
-- @return Core.Point#COORDINATE The current Coordinate of the first Cargo of the CargoGroup.
|
-- @return Core.Point#COORDINATE The current Coordinate of the first Cargo of the CargoGroup.
|
||||||
-- @return #nil There is no valid Cargo in the CargoGroup.
|
-- @return #nil There is no valid Cargo in the CargoGroup.
|
||||||
function CARGO_SLINGLOAD:GetCoordinate()
|
function CARGO_SLINGLOAD:GetCoordinate()
|
||||||
--self:T()
|
--self:F()
|
||||||
|
|
||||||
return self.CargoObject:GetCoordinate()
|
return self.CargoObject:GetCoordinate()
|
||||||
end
|
end
|
||||||
@@ -201,7 +199,7 @@ do -- CARGO_SLINGLOAD
|
|||||||
-- @param #CARGO_SLINGLOAD self
|
-- @param #CARGO_SLINGLOAD self
|
||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
function CARGO_SLINGLOAD:RouteTo( Coordinate )
|
function CARGO_SLINGLOAD:RouteTo( Coordinate )
|
||||||
--self:T( {Coordinate = Coordinate } )
|
--self:F( {Coordinate = Coordinate } )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -214,7 +212,7 @@ do -- CARGO_SLINGLOAD
|
|||||||
-- @return #boolean The Cargo is near to the Carrier.
|
-- @return #boolean The Cargo is near to the Carrier.
|
||||||
-- @return #nil The Cargo is not near to the Carrier.
|
-- @return #nil The Cargo is not near to the Carrier.
|
||||||
function CARGO_SLINGLOAD:IsNear( CargoCarrier, NearRadius )
|
function CARGO_SLINGLOAD:IsNear( CargoCarrier, NearRadius )
|
||||||
--self:T( {NearRadius = NearRadius } )
|
--self:F( {NearRadius = NearRadius } )
|
||||||
|
|
||||||
return self:IsNear( CargoCarrier:GetCoordinate(), NearRadius )
|
return self:IsNear( CargoCarrier:GetCoordinate(), NearRadius )
|
||||||
end
|
end
|
||||||
@@ -224,7 +222,7 @@ do -- CARGO_SLINGLOAD
|
|||||||
-- @param #CARGO_SLINGLOAD self
|
-- @param #CARGO_SLINGLOAD self
|
||||||
function CARGO_SLINGLOAD:Respawn()
|
function CARGO_SLINGLOAD:Respawn()
|
||||||
|
|
||||||
--self:T( { "Respawning slingload " .. self:GetName() } )
|
--self:F( { "Respawning slingload " .. self:GetName() } )
|
||||||
|
|
||||||
|
|
||||||
-- Respawn the group...
|
-- Respawn the group...
|
||||||
@@ -241,7 +239,7 @@ do -- CARGO_SLINGLOAD
|
|||||||
-- @param #CARGO_SLINGLOAD self
|
-- @param #CARGO_SLINGLOAD self
|
||||||
function CARGO_SLINGLOAD:onafterReset()
|
function CARGO_SLINGLOAD:onafterReset()
|
||||||
|
|
||||||
--self:T( { "Reset slingload " .. self:GetName() } )
|
--self:F( { "Reset slingload " .. self:GetName() } )
|
||||||
|
|
||||||
|
|
||||||
-- Respawn the group...
|
-- Respawn the group...
|
||||||
|
|||||||
@@ -30,8 +30,6 @@ do -- CARGO_UNIT
|
|||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
||||||
-- Therefore, this class is considered to be deprecated
|
-- Therefore, this class is considered to be deprecated
|
||||||
--
|
--
|
||||||
@@ -74,10 +72,10 @@ do -- CARGO_UNIT
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#COORDINATE ToPointVec2
|
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
||||||
-- @param #number NearRadius (optional) Defaut 25 m.
|
-- @param #number NearRadius (optional) Defaut 25 m.
|
||||||
function CARGO_UNIT:onenterUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
function CARGO_UNIT:onenterUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
||||||
self:T( { From, Event, To, ToPointVec2, NearRadius } )
|
self:F( { From, Event, To, ToPointVec2, NearRadius } )
|
||||||
|
|
||||||
local Angle = 180
|
local Angle = 180
|
||||||
local Speed = 60
|
local Speed = 60
|
||||||
@@ -116,7 +114,7 @@ do -- CARGO_UNIT
|
|||||||
else
|
else
|
||||||
self.CargoObject:ReSpawnAt( FromPointVec2, CargoDeployHeading )
|
self.CargoObject:ReSpawnAt( FromPointVec2, CargoDeployHeading )
|
||||||
end
|
end
|
||||||
self:T( { "CargoUnits:", self.CargoObject:GetGroup():GetName() } )
|
self:F( { "CargoUnits:", self.CargoObject:GetGroup():GetName() } )
|
||||||
self.CargoCarrier = nil
|
self.CargoCarrier = nil
|
||||||
|
|
||||||
local Points = {}
|
local Points = {}
|
||||||
@@ -147,10 +145,10 @@ do -- CARGO_UNIT
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#COORDINATE ToPointVec2
|
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
||||||
-- @param #number NearRadius (optional) Defaut 100 m.
|
-- @param #number NearRadius (optional) Defaut 100 m.
|
||||||
function CARGO_UNIT:onleaveUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
function CARGO_UNIT:onleaveUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
||||||
self:T( { From, Event, To, ToPointVec2, NearRadius } )
|
self:F( { From, Event, To, ToPointVec2, NearRadius } )
|
||||||
|
|
||||||
local Angle = 180
|
local Angle = 180
|
||||||
local Speed = 10
|
local Speed = 10
|
||||||
@@ -173,10 +171,10 @@ do -- CARGO_UNIT
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#COORDINATE ToPointVec2
|
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
||||||
-- @param #number NearRadius (optional) Defaut 100 m.
|
-- @param #number NearRadius (optional) Defaut 100 m.
|
||||||
function CARGO_UNIT:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
function CARGO_UNIT:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
||||||
self:T( { From, Event, To, ToPointVec2, NearRadius } )
|
self:F( { From, Event, To, ToPointVec2, NearRadius } )
|
||||||
|
|
||||||
self.CargoInAir = self.CargoObject:InAir()
|
self.CargoInAir = self.CargoObject:InAir()
|
||||||
|
|
||||||
@@ -199,9 +197,9 @@ do -- CARGO_UNIT
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#COORDINATE
|
-- @param Core.Point#POINT_VEC2
|
||||||
function CARGO_UNIT:onenterUnLoaded( From, Event, To, ToPointVec2 )
|
function CARGO_UNIT:onenterUnLoaded( From, Event, To, ToPointVec2 )
|
||||||
self:T( { ToPointVec2, From, Event, To } )
|
self:F( { ToPointVec2, From, Event, To } )
|
||||||
|
|
||||||
local Angle = 180
|
local Angle = 180
|
||||||
local Speed = 10
|
local Speed = 10
|
||||||
@@ -238,7 +236,7 @@ do -- CARGO_UNIT
|
|||||||
-- @param Wrapper.Group#GROUP CargoCarrier
|
-- @param Wrapper.Group#GROUP CargoCarrier
|
||||||
-- @param #number NearRadius
|
-- @param #number NearRadius
|
||||||
function CARGO_UNIT:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ... )
|
function CARGO_UNIT:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||||
self:T( { From, Event, To, CargoCarrier, NearRadius = NearRadius } )
|
self:F( { From, Event, To, CargoCarrier, NearRadius = NearRadius } )
|
||||||
|
|
||||||
self.CargoInAir = self.CargoObject:InAir()
|
self.CargoInAir = self.CargoObject:InAir()
|
||||||
|
|
||||||
@@ -246,7 +244,7 @@ do -- CARGO_UNIT
|
|||||||
local MaxSpeed = Desc.speedMaxOffRoad
|
local MaxSpeed = Desc.speedMaxOffRoad
|
||||||
local TypeName = Desc.typeName
|
local TypeName = Desc.typeName
|
||||||
|
|
||||||
--self:T({Unit=self.CargoObject:GetName()})
|
--self:F({Unit=self.CargoObject:GetName()})
|
||||||
|
|
||||||
-- A cargo unit can only be boarded if it is not dead
|
-- A cargo unit can only be boarded if it is not dead
|
||||||
|
|
||||||
@@ -300,9 +298,9 @@ do -- CARGO_UNIT
|
|||||||
-- @param Wrapper.Client#CLIENT CargoCarrier
|
-- @param Wrapper.Client#CLIENT CargoCarrier
|
||||||
-- @param #number NearRadius Default 25 m.
|
-- @param #number NearRadius Default 25 m.
|
||||||
function CARGO_UNIT:onafterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
|
function CARGO_UNIT:onafterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||||
self:T( { From, Event, To, CargoCarrier:GetName(), NearRadius = NearRadius } )
|
self:F( { From, Event, To, CargoCarrier:GetName(), NearRadius = NearRadius } )
|
||||||
|
|
||||||
self:T( { IsAlive=self.CargoObject:IsAlive() } )
|
self:F( { IsAlive=self.CargoObject:IsAlive() } )
|
||||||
|
|
||||||
if CargoCarrier and CargoCarrier:IsAlive() then -- and self.CargoObject and self.CargoObject:IsAlive() then
|
if CargoCarrier and CargoCarrier:IsAlive() then -- and self.CargoObject and self.CargoObject:IsAlive() then
|
||||||
if (CargoCarrier:IsAir() and not CargoCarrier:InAir()) or true then
|
if (CargoCarrier:IsAir() and not CargoCarrier:InAir()) or true then
|
||||||
@@ -323,7 +321,7 @@ do -- CARGO_UNIT
|
|||||||
local Angle = 180
|
local Angle = 180
|
||||||
local Distance = 0
|
local Distance = 0
|
||||||
|
|
||||||
--self:T({Unit=self.CargoObject:GetName()})
|
--self:F({Unit=self.CargoObject:GetName()})
|
||||||
|
|
||||||
local CargoCarrierPointVec2 = CargoCarrier:GetPointVec2()
|
local CargoCarrierPointVec2 = CargoCarrier:GetPointVec2()
|
||||||
local CargoCarrierHeading = CargoCarrier:GetHeading() -- Get Heading of object in degrees.
|
local CargoCarrierHeading = CargoCarrier:GetHeading() -- Get Heading of object in degrees.
|
||||||
@@ -350,7 +348,7 @@ do -- CARGO_UNIT
|
|||||||
self.CargoObject:SetCommand( self.CargoObject:CommandStopRoute( true ) )
|
self.CargoObject:SetCommand( self.CargoObject:CommandStopRoute( true ) )
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
self:T("Something is wrong")
|
self:E("Something is wrong")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -363,11 +361,11 @@ do -- CARGO_UNIT
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
function CARGO_UNIT:onenterLoaded( From, Event, To, CargoCarrier )
|
function CARGO_UNIT:onenterLoaded( From, Event, To, CargoCarrier )
|
||||||
self:T( { From, Event, To, CargoCarrier } )
|
self:F( { From, Event, To, CargoCarrier } )
|
||||||
|
|
||||||
self.CargoCarrier = CargoCarrier
|
self.CargoCarrier = CargoCarrier
|
||||||
|
|
||||||
--self:T({Unit=self.CargoObject:GetName()})
|
--self:F({Unit=self.CargoObject:GetName()})
|
||||||
|
|
||||||
-- Only destroy the CargoObject if there is a CargoObject (packages don't have CargoObjects).
|
-- Only destroy the CargoObject if there is a CargoObject (packages don't have CargoObjects).
|
||||||
if self.CargoObject then
|
if self.CargoObject then
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
-- @module Core.Base
|
-- @module Core.Base
|
||||||
-- @image Core_Base.JPG
|
-- @image Core_Base.JPG
|
||||||
|
|
||||||
local _TraceOnOff = false -- default to no tracing
|
local _TraceOnOff = true
|
||||||
local _TraceLevel = 1
|
local _TraceLevel = 1
|
||||||
local _TraceAll = false
|
local _TraceAll = false
|
||||||
local _TraceClass = {}
|
local _TraceClass = {}
|
||||||
@@ -34,12 +34,11 @@ local _TraceClassMethod = {}
|
|||||||
|
|
||||||
local _ClassID = 0
|
local _ClassID = 0
|
||||||
|
|
||||||
--- Base class of everything
|
---
|
||||||
-- @type BASE
|
-- @type BASE
|
||||||
-- @field #string ClassName The name of the class.
|
-- @field ClassName The name of the class.
|
||||||
-- @field #number ClassID The ID number of the class.
|
-- @field ClassID The ID number of the class.
|
||||||
-- @field #string ClassNameAndID The name of the class concatenated with the ID number of the class.
|
-- @field ClassNameAndID The name of the class concatenated with the ID number of the class.
|
||||||
-- @field Core.Scheduler#SCHEDULER Scheduler The scheduler object.
|
|
||||||
|
|
||||||
--- BASE class
|
--- BASE class
|
||||||
--
|
--
|
||||||
@@ -201,7 +200,6 @@ BASE = {
|
|||||||
States = {},
|
States = {},
|
||||||
Debug = debug,
|
Debug = debug,
|
||||||
Scheduler = nil,
|
Scheduler = nil,
|
||||||
Properties = {},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-- @field #BASE.__
|
-- @field #BASE.__
|
||||||
@@ -212,6 +210,14 @@ BASE._ = {
|
|||||||
Schedules = {}, --- Contains the Schedulers Active
|
Schedules = {}, --- Contains the Schedulers Active
|
||||||
}
|
}
|
||||||
|
|
||||||
|
--- The Formation Class
|
||||||
|
-- @type FORMATION
|
||||||
|
-- @field Cone A cone formation.
|
||||||
|
FORMATION = {
|
||||||
|
Cone = "Cone",
|
||||||
|
Vee = "Vee",
|
||||||
|
}
|
||||||
|
|
||||||
--- BASE constructor.
|
--- BASE constructor.
|
||||||
--
|
--
|
||||||
-- This is an example how to use the BASE:New() constructor in a new class definition when inheriting from BASE.
|
-- This is an example how to use the BASE:New() constructor in a new class definition when inheriting from BASE.
|
||||||
@@ -735,31 +741,7 @@ do -- Event Handling
|
|||||||
-- @function [parent=#BASE] OnEventPlayerEnterAircraft
|
-- @function [parent=#BASE] OnEventPlayerEnterAircraft
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
||||||
|
|
||||||
--- Occurs when a player creates a dynamic cargo object from the F8 ground crew menu.
|
|
||||||
-- *** NOTE *** this is a workarounf for DCS not creating these events as of Aug 2024.
|
|
||||||
-- @function [parent=#BASE] OnEventNewDynamicCargo
|
|
||||||
-- @param #BASE self
|
|
||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
|
||||||
|
|
||||||
--- Occurs when a player loads a dynamic cargo object with the F8 ground crew menu into a helo.
|
|
||||||
-- *** NOTE *** this is a workarounf for DCS not creating these events as of Aug 2024.
|
|
||||||
-- @function [parent=#BASE] OnEventDynamicCargoLoaded
|
|
||||||
-- @param #BASE self
|
|
||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
|
||||||
|
|
||||||
--- Occurs when a player unloads a dynamic cargo object with the F8 ground crew menu from a helo.
|
|
||||||
-- *** NOTE *** this is a workarounf for DCS not creating these events as of Aug 2024.
|
|
||||||
-- @function [parent=#BASE] OnEventDynamicCargoUnloaded
|
|
||||||
-- @param #BASE self
|
|
||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
|
||||||
|
|
||||||
--- Occurs when a dynamic cargo crate is removed.
|
|
||||||
-- *** NOTE *** this is a workarounf for DCS not creating these events as of Aug 2024.
|
|
||||||
-- @function [parent=#BASE] OnEventDynamicCargoRemoved
|
|
||||||
-- @param #BASE self
|
|
||||||
-- @param Core.Event#EVENTDATA EventData The EventData structure.
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Creation of a Birth Event.
|
--- Creation of a Birth Event.
|
||||||
@@ -880,62 +862,6 @@ end
|
|||||||
|
|
||||||
world.onEvent(Event)
|
world.onEvent(Event)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Creation of a S_EVENT_NEW_DYNAMIC_CARGO event.
|
|
||||||
-- @param #BASE self
|
|
||||||
-- @param Wrapper.DynamicCargo#DYNAMICCARGO DynamicCargo the dynamic cargo object
|
|
||||||
function BASE:CreateEventNewDynamicCargo(DynamicCargo)
|
|
||||||
self:F({DynamicCargo})
|
|
||||||
local Event = {
|
|
||||||
id = EVENTS.NewDynamicCargo,
|
|
||||||
time = timer.getTime(),
|
|
||||||
dynamiccargo = DynamicCargo,
|
|
||||||
initiator = DynamicCargo:GetDCSObject(),
|
|
||||||
}
|
|
||||||
world.onEvent( Event )
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Creation of a S_EVENT_DYNAMIC_CARGO_LOADED event.
|
|
||||||
-- @param #BASE self
|
|
||||||
-- @param Wrapper.DynamicCargo#DYNAMICCARGO DynamicCargo the dynamic cargo object
|
|
||||||
function BASE:CreateEventDynamicCargoLoaded(DynamicCargo)
|
|
||||||
self:F({DynamicCargo})
|
|
||||||
local Event = {
|
|
||||||
id = EVENTS.DynamicCargoLoaded,
|
|
||||||
time = timer.getTime(),
|
|
||||||
dynamiccargo = DynamicCargo,
|
|
||||||
initiator = DynamicCargo:GetDCSObject(),
|
|
||||||
}
|
|
||||||
world.onEvent( Event )
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Creation of a S_EVENT_DYNAMIC_CARGO_UNLOADED event.
|
|
||||||
-- @param #BASE self
|
|
||||||
-- @param Wrapper.DynamicCargo#DYNAMICCARGO DynamicCargo the dynamic cargo object
|
|
||||||
function BASE:CreateEventDynamicCargoUnloaded(DynamicCargo)
|
|
||||||
self:F({DynamicCargo})
|
|
||||||
local Event = {
|
|
||||||
id = EVENTS.DynamicCargoUnloaded,
|
|
||||||
time = timer.getTime(),
|
|
||||||
dynamiccargo = DynamicCargo,
|
|
||||||
initiator = DynamicCargo:GetDCSObject(),
|
|
||||||
}
|
|
||||||
world.onEvent( Event )
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Creation of a S_EVENT_DYNAMIC_CARGO_REMOVED event.
|
|
||||||
-- @param #BASE self
|
|
||||||
-- @param Wrapper.DynamicCargo#DYNAMICCARGO DynamicCargo the dynamic cargo object
|
|
||||||
function BASE:CreateEventDynamicCargoRemoved(DynamicCargo)
|
|
||||||
self:F({DynamicCargo})
|
|
||||||
local Event = {
|
|
||||||
id = EVENTS.DynamicCargoRemoved,
|
|
||||||
time = timer.getTime(),
|
|
||||||
dynamiccargo = DynamicCargo,
|
|
||||||
initiator = DynamicCargo:GetDCSObject(),
|
|
||||||
}
|
|
||||||
world.onEvent( Event )
|
|
||||||
end
|
|
||||||
|
|
||||||
--- The main event handling function... This function captures all events generated for the class.
|
--- The main event handling function... This function captures all events generated for the class.
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
@@ -974,7 +900,7 @@ do -- Scheduling
|
|||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param #number Start Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.
|
-- @param #number Start Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.
|
||||||
-- @param #function SchedulerFunction The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.
|
-- @param #function SchedulerFunction The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.
|
||||||
-- @param ... Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.
|
-- @param #table ... Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.
|
||||||
-- @return #string The Schedule ID of the planned schedule.
|
-- @return #string The Schedule ID of the planned schedule.
|
||||||
function BASE:ScheduleOnce( Start, SchedulerFunction, ... )
|
function BASE:ScheduleOnce( Start, SchedulerFunction, ... )
|
||||||
|
|
||||||
@@ -1110,31 +1036,6 @@ function BASE:ClearState( Object, StateName )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set one property of an object.
|
|
||||||
-- @param #BASE self
|
|
||||||
-- @param Key The key that is used as a reference of the value. Note that the key can be a #string, but it can also be any other type!
|
|
||||||
-- @param Value The value that is stored. Note that the value can be a #string, but it can also be any other type!
|
|
||||||
function BASE:SetProperty(Key,Value)
|
|
||||||
self.Properties = self.Properties or {}
|
|
||||||
self.Properties[Key] = Value
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Get one property of an object by the key.
|
|
||||||
-- @param #BASE self
|
|
||||||
-- @param Key The key that is used as a reference of the value. Note that the key can be a #string, but it can also be any other type!
|
|
||||||
-- @return Value The value that is stored. Note that the value can be a #string, but it can also be any other type! Nil if not found.
|
|
||||||
function BASE:GetProperty(Key)
|
|
||||||
self.Properties = self.Properties or {}
|
|
||||||
return self.Properties[Key]
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Get all of the properties of an object in a table.
|
|
||||||
-- @param #BASE self
|
|
||||||
-- @return #table of values, indexed by keys.
|
|
||||||
function BASE:GetProperties()
|
|
||||||
return self.Properties
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Trace section
|
-- Trace section
|
||||||
|
|
||||||
-- Log a trace (only shown when trace is on)
|
-- Log a trace (only shown when trace is on)
|
||||||
@@ -1243,28 +1144,6 @@ function BASE:TraceClassMethod( Class, Method )
|
|||||||
self:I( "Tracing method " .. Method .. " of class " .. Class )
|
self:I( "Tracing method " .. Method .. " of class " .. Class )
|
||||||
end
|
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.
|
--- Trace a function call. This function is private.
|
||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param Arguments A #table or any field.
|
-- @param Arguments A #table or any field.
|
||||||
@@ -1289,7 +1168,7 @@ function BASE:_F( Arguments, DebugInfoCurrentParam, DebugInfoFromParam )
|
|||||||
if DebugInfoFrom then
|
if DebugInfoFrom then
|
||||||
LineFrom = DebugInfoFrom.currentline
|
LineFrom = DebugInfoFrom.currentline
|
||||||
end
|
end
|
||||||
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "F", self.ClassName, self.ClassID, Function, BASE:_Serialize(Arguments) ) )
|
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "F", self.ClassName, self.ClassID, Function, UTILS.BasicSerialize( Arguments ) ) )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1299,7 +1178,7 @@ end
|
|||||||
-- @param Arguments A #table or any field.
|
-- @param Arguments A #table or any field.
|
||||||
function BASE:F( Arguments )
|
function BASE:F( Arguments )
|
||||||
|
|
||||||
if BASE.Debug and _TraceOnOff == true then
|
if BASE.Debug and _TraceOnOff then
|
||||||
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
|
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
|
||||||
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
|
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
|
||||||
|
|
||||||
@@ -1314,7 +1193,7 @@ end
|
|||||||
-- @param Arguments A #table or any field.
|
-- @param Arguments A #table or any field.
|
||||||
function BASE:F2( Arguments )
|
function BASE:F2( Arguments )
|
||||||
|
|
||||||
if BASE.Debug and _TraceOnOff == true and _TraceLevel >= 2 then
|
if BASE.Debug and _TraceOnOff then
|
||||||
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
|
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
|
||||||
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
|
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
|
||||||
|
|
||||||
@@ -1329,7 +1208,7 @@ end
|
|||||||
-- @param Arguments A #table or any field.
|
-- @param Arguments A #table or any field.
|
||||||
function BASE:F3( Arguments )
|
function BASE:F3( Arguments )
|
||||||
|
|
||||||
if BASE.Debug and _TraceOnOff == true and _TraceLevel >= 3 then
|
if BASE.Debug and _TraceOnOff then
|
||||||
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
|
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
|
||||||
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
|
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
|
||||||
|
|
||||||
@@ -1363,7 +1242,7 @@ function BASE:_T( Arguments, DebugInfoCurrentParam, DebugInfoFromParam )
|
|||||||
if DebugInfoFrom then
|
if DebugInfoFrom then
|
||||||
LineFrom = DebugInfoFrom.currentline
|
LineFrom = DebugInfoFrom.currentline
|
||||||
end
|
end
|
||||||
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s", LineCurrent, LineFrom, "T", self.ClassName, self.ClassID, BASE:_Serialize(Arguments) ) )
|
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s", LineCurrent, LineFrom, "T", self.ClassName, self.ClassID, UTILS.BasicSerialize( Arguments ) ) )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1373,7 +1252,7 @@ end
|
|||||||
-- @param Arguments A #table or any field.
|
-- @param Arguments A #table or any field.
|
||||||
function BASE:T( Arguments )
|
function BASE:T( Arguments )
|
||||||
|
|
||||||
if BASE.Debug and _TraceOnOff == true then
|
if BASE.Debug and _TraceOnOff then
|
||||||
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
|
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
|
||||||
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
|
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
|
||||||
|
|
||||||
@@ -1388,7 +1267,7 @@ end
|
|||||||
-- @param Arguments A #table or any field.
|
-- @param Arguments A #table or any field.
|
||||||
function BASE:T2( Arguments )
|
function BASE:T2( Arguments )
|
||||||
|
|
||||||
if BASE.Debug and _TraceOnOff == true and _TraceLevel >= 2 then
|
if BASE.Debug and _TraceOnOff then
|
||||||
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
|
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
|
||||||
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
|
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
|
||||||
|
|
||||||
@@ -1403,7 +1282,7 @@ end
|
|||||||
-- @param Arguments A #table or any field.
|
-- @param Arguments A #table or any field.
|
||||||
function BASE:T3( Arguments )
|
function BASE:T3( Arguments )
|
||||||
|
|
||||||
if BASE.Debug and _TraceOnOff == true and _TraceLevel >= 3 then
|
if BASE.Debug and _TraceOnOff then
|
||||||
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
|
local DebugInfoCurrent = BASE.Debug.getinfo( 2, "nl" )
|
||||||
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
|
local DebugInfoFrom = BASE.Debug.getinfo( 3, "l" )
|
||||||
|
|
||||||
@@ -1435,7 +1314,7 @@ function BASE:E( Arguments )
|
|||||||
|
|
||||||
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "E", self.ClassName, self.ClassID, Function, UTILS.BasicSerialize( Arguments ) ) )
|
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "E", self.ClassName, self.ClassID, Function, UTILS.BasicSerialize( Arguments ) ) )
|
||||||
else
|
else
|
||||||
env.info( string.format( "%1s:%30s%05d(%s)", "E", self.ClassName, self.ClassID, UTILS.BasicSerialize(Arguments) ) )
|
env.info( string.format( "%1s:%30s%05d(%s)", "E", self.ClassName, self.ClassID, UTILS.BasicSerialize( Arguments ) ) )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -1462,7 +1341,39 @@ function BASE:I( Arguments )
|
|||||||
|
|
||||||
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "I", self.ClassName, self.ClassID, Function, UTILS.BasicSerialize( Arguments ) ) )
|
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "I", self.ClassName, self.ClassID, Function, UTILS.BasicSerialize( Arguments ) ) )
|
||||||
else
|
else
|
||||||
env.info( string.format( "%1s:%30s%05d(%s)", "I", self.ClassName, self.ClassID, UTILS.BasicSerialize(Arguments)) )
|
env.info( string.format( "%1s:%30s%05d(%s)", "I", self.ClassName, self.ClassID, UTILS.BasicSerialize( Arguments ) ) )
|
||||||
end
|
end
|
||||||
|
|
||||||
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,10 +8,6 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_Demos/tree/master/Core/Beacon)
|
|
||||||
--
|
|
||||||
-- ===
|
|
||||||
--
|
|
||||||
-- ### Authors: Hugues "Grey_Echo" Bousquet, funkyfranky
|
-- ### Authors: Hugues "Grey_Echo" Bousquet, funkyfranky
|
||||||
--
|
--
|
||||||
-- @module Core.Beacon
|
-- @module Core.Beacon
|
||||||
@@ -38,13 +34,11 @@
|
|||||||
-- @type BEACON
|
-- @type BEACON
|
||||||
-- @field #string ClassName Name of the class "BEACON".
|
-- @field #string ClassName Name of the class "BEACON".
|
||||||
-- @field Wrapper.Controllable#CONTROLLABLE Positionable The @{Wrapper.Controllable#CONTROLLABLE} that will receive radio capabilities.
|
-- @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
|
-- @extends Core.Base#BASE
|
||||||
BEACON = {
|
BEACON = {
|
||||||
ClassName = "BEACON",
|
ClassName = "BEACON",
|
||||||
Positionable = nil,
|
Positionable = nil,
|
||||||
name = nil,
|
name = nil,
|
||||||
UniqueName = 0,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Beacon types supported by DCS.
|
--- Beacon types supported by DCS.
|
||||||
@@ -292,7 +286,6 @@ end
|
|||||||
-- myBeacon:AATACAN(20, "TEXACO", true) -- Activate the beacon
|
-- myBeacon:AATACAN(20, "TEXACO", true) -- Activate the beacon
|
||||||
function BEACON:AATACAN(TACANChannel, Message, Bearing, BeaconDuration)
|
function BEACON:AATACAN(TACANChannel, Message, Bearing, BeaconDuration)
|
||||||
self:F({TACANChannel, Message, Bearing, BeaconDuration})
|
self:F({TACANChannel, Message, Bearing, BeaconDuration})
|
||||||
self:E("This method is DEPRECATED! Please use ActivateTACAN() instead.")
|
|
||||||
|
|
||||||
local IsValid = true
|
local IsValid = true
|
||||||
|
|
||||||
@@ -386,9 +379,7 @@ end
|
|||||||
function BEACON:RadioBeacon(FileName, Frequency, Modulation, Power, BeaconDuration)
|
function BEACON:RadioBeacon(FileName, Frequency, Modulation, Power, BeaconDuration)
|
||||||
self:F({FileName, Frequency, Modulation, Power, BeaconDuration})
|
self:F({FileName, Frequency, Modulation, Power, BeaconDuration})
|
||||||
local IsValid = false
|
local IsValid = false
|
||||||
|
|
||||||
Modulation = Modulation or radio.modulation.AM
|
|
||||||
|
|
||||||
-- Check the filename
|
-- Check the filename
|
||||||
if type(FileName) == "string" then
|
if type(FileName) == "string" then
|
||||||
if FileName:find(".ogg") or FileName:find(".wav") then
|
if FileName:find(".ogg") or FileName:find(".wav") then
|
||||||
@@ -399,7 +390,7 @@ function BEACON:RadioBeacon(FileName, Frequency, Modulation, Power, BeaconDurati
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not IsValid then
|
if not IsValid then
|
||||||
self:E({"File name invalid. Maybe something wrong with the extension? ", FileName})
|
self:E({"File name invalid. Maybe something wrong with the extension ? ", FileName})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check the Frequency
|
-- Check the Frequency
|
||||||
@@ -425,9 +416,7 @@ function BEACON:RadioBeacon(FileName, Frequency, Modulation, Power, BeaconDurati
|
|||||||
if IsValid then
|
if IsValid then
|
||||||
self:T2({"Activating Beacon on ", Frequency, Modulation})
|
self:T2({"Activating Beacon on ", Frequency, Modulation})
|
||||||
-- Note that this is looped. I have to give this transmission a unique name, I use the class ID
|
-- Note that this is looped. I have to give this transmission a unique name, I use the class ID
|
||||||
BEACON.UniqueName = BEACON.UniqueName + 1
|
trigger.action.radioTransmission(FileName, self.Positionable:GetPositionVec3(), Modulation, true, Frequency, Power, tostring(self.ID))
|
||||||
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
|
if BeaconDuration then -- Schedule the stop of the BEACON if asked by the MD
|
||||||
SCHEDULER:New( nil,
|
SCHEDULER:New( nil,
|
||||||
@@ -435,8 +424,7 @@ function BEACON:RadioBeacon(FileName, Frequency, Modulation, Power, BeaconDurati
|
|||||||
self:StopRadioBeacon()
|
self:StopRadioBeacon()
|
||||||
end, {}, BeaconDuration)
|
end, {}, BeaconDuration)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return self
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Stops the Radio Beacon
|
--- Stops the Radio Beacon
|
||||||
@@ -445,7 +433,7 @@ end
|
|||||||
function BEACON:StopRadioBeacon()
|
function BEACON:StopRadioBeacon()
|
||||||
self:F()
|
self:F()
|
||||||
-- The unique name of the transmission is the class ID
|
-- The unique name of the transmission is the class ID
|
||||||
trigger.action.stopRadioTransmission(self.BeaconName)
|
trigger.action.stopRadioTransmission(tostring(self.ID))
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
882
Moose Development/Moose/Core/ClientMenu.lua
Normal file
882
Moose Development/Moose/Core/ClientMenu.lua
Normal file
@@ -0,0 +1,882 @@
|
|||||||
|
--- **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: Oct 2023
|
||||||
|
|
||||||
|
-- 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
|
||||||
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
|
---
|
||||||
|
-- @field #CLIENTMENU
|
||||||
|
CLIENTMENU = {
|
||||||
|
ClassName = "CLIENTMENUE",
|
||||||
|
lid = "",
|
||||||
|
version = "0.1.1",
|
||||||
|
name = nil,
|
||||||
|
path = nil,
|
||||||
|
group = nil,
|
||||||
|
client = nil,
|
||||||
|
GroupID = nil,
|
||||||
|
Children = {},
|
||||||
|
Once = false,
|
||||||
|
Generic = false,
|
||||||
|
debug = false,
|
||||||
|
Controller = nil,
|
||||||
|
groupname = nil,
|
||||||
|
}
|
||||||
|
|
||||||
|
---
|
||||||
|
-- @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.
|
||||||
|
-- @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 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)
|
||||||
|
else
|
||||||
|
self.path = missionCommands.addSubMenuForGroup(self.GroupID,Text,self.parentpath)
|
||||||
|
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
|
||||||
|
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.
|
||||||
|
--
|
||||||
|
-- ## 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.3",
|
||||||
|
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.IniPlayerName )
|
||||||
|
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.IniPlayerName ))) 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.IniPlayerName )
|
||||||
|
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 to newly joined players. Useful if you have **one** menu structure only.
|
||||||
|
-- @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 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 playername = client:GetPlayerName()
|
||||||
|
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 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
|
||||||
|
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()
|
||||||
|
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
|
||||||
|
--
|
||||||
|
----------------------------------------------------------------------------------------------------------------
|
||||||
@@ -20,7 +20,6 @@
|
|||||||
-- * Manage database of hits to units and statics.
|
-- * Manage database of hits to units and statics.
|
||||||
-- * Manage database of destroys of units and statics.
|
-- * Manage database of destroys of units and statics.
|
||||||
-- * Manage database of @{Core.Zone#ZONE_BASE} objects.
|
-- * Manage database of @{Core.Zone#ZONE_BASE} objects.
|
||||||
-- * Manage database of @{Wrapper.DynamicCargo#DYNAMICCARGO} objects alive in the mission.
|
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -38,9 +37,6 @@
|
|||||||
-- @field #table Templates Templates: Units, Groups, Statics, ClientsByName, ClientsByID.
|
-- @field #table Templates Templates: Units, Groups, Statics, ClientsByName, ClientsByID.
|
||||||
-- @field #table CLIENTS Clients.
|
-- @field #table CLIENTS Clients.
|
||||||
-- @field #table STORAGES DCS warehouse storages.
|
-- @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.
|
|
||||||
-- @field #table DYNAMICCARGO Dynamic Cargo objects.
|
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
--- Contains collections of wrapper objects defined within MOOSE that reflect objects within the simulator.
|
--- Contains collections of wrapper objects defined within MOOSE that reflect objects within the simulator.
|
||||||
@@ -56,7 +52,6 @@
|
|||||||
-- * PLAYERS
|
-- * PLAYERS
|
||||||
-- * CARGOS
|
-- * CARGOS
|
||||||
-- * STORAGES (DCS warehouses)
|
-- * STORAGES (DCS warehouses)
|
||||||
-- * DYNAMICCARGO
|
|
||||||
--
|
--
|
||||||
-- On top, for internal MOOSE administration purposes, the DATABASE administers the Unit and Group TEMPLATES as defined within the Mission Editor.
|
-- On top, for internal MOOSE administration purposes, the DATABASE administers the Unit and Group TEMPLATES as defined within the Mission Editor.
|
||||||
--
|
--
|
||||||
@@ -98,9 +93,6 @@ DATABASE = {
|
|||||||
OPSZONES = {},
|
OPSZONES = {},
|
||||||
PATHLINES = {},
|
PATHLINES = {},
|
||||||
STORAGES = {},
|
STORAGES = {},
|
||||||
STNS={},
|
|
||||||
SADL={},
|
|
||||||
DYNAMICCARGO={},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local _DATABASECoalition =
|
local _DATABASECoalition =
|
||||||
@@ -139,7 +131,7 @@ function DATABASE:New()
|
|||||||
self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
|
self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
|
||||||
self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash )
|
self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash )
|
||||||
self:HandleEvent( EVENTS.RemoveUnit, self._EventOnDeadOrCrash )
|
self:HandleEvent( EVENTS.RemoveUnit, self._EventOnDeadOrCrash )
|
||||||
self:HandleEvent( EVENTS.UnitLost, self._EventOnDeadOrCrash ) -- DCS 2.7.1 for Aerial units no dead event ATM
|
--self:HandleEvent( EVENTS.UnitLost, self._EventOnDeadOrCrash ) -- DCS 2.7.1 for Aerial units no dead event ATM
|
||||||
self:HandleEvent( EVENTS.Hit, self.AccountHits )
|
self:HandleEvent( EVENTS.Hit, self.AccountHits )
|
||||||
self:HandleEvent( EVENTS.NewCargo )
|
self:HandleEvent( EVENTS.NewCargo )
|
||||||
self:HandleEvent( EVENTS.DeleteCargo )
|
self:HandleEvent( EVENTS.DeleteCargo )
|
||||||
@@ -147,8 +139,6 @@ function DATABASE:New()
|
|||||||
self:HandleEvent( EVENTS.DeleteZone )
|
self:HandleEvent( EVENTS.DeleteZone )
|
||||||
--self:HandleEvent( EVENTS.PlayerEnterUnit, self._EventOnPlayerEnterUnit ) -- This is not working anymore!, handling this through the birth event.
|
--self:HandleEvent( EVENTS.PlayerEnterUnit, self._EventOnPlayerEnterUnit ) -- This is not working anymore!, handling this through the birth event.
|
||||||
self:HandleEvent( EVENTS.PlayerLeaveUnit, self._EventOnPlayerLeaveUnit )
|
self:HandleEvent( EVENTS.PlayerLeaveUnit, self._EventOnPlayerLeaveUnit )
|
||||||
-- DCS 2.9.7 Moose own dynamic cargo events
|
|
||||||
self:HandleEvent( EVENTS.DynamicCargoRemoved, self._EventOnDynamicCargoRemoved)
|
|
||||||
|
|
||||||
self:_RegisterTemplates()
|
self:_RegisterTemplates()
|
||||||
self:_RegisterGroupsAndUnits()
|
self:_RegisterGroupsAndUnits()
|
||||||
@@ -176,30 +166,24 @@ end
|
|||||||
--- Adds a Unit based on the Unit Name in the DATABASE.
|
--- Adds a Unit based on the Unit Name in the DATABASE.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #string DCSUnitName Unit name.
|
-- @param #string DCSUnitName Unit name.
|
||||||
-- @param #boolean force
|
|
||||||
-- @return Wrapper.Unit#UNIT The added unit.
|
-- @return Wrapper.Unit#UNIT The added unit.
|
||||||
function DATABASE:AddUnit( DCSUnitName, force )
|
function DATABASE:AddUnit( DCSUnitName )
|
||||||
|
|
||||||
local DCSunitName = DCSUnitName
|
if not self.UNITS[DCSUnitName] then
|
||||||
|
|
||||||
if type(DCSunitName) == "number" then DCSunitName = string.format("%d",DCSUnitName) end
|
|
||||||
|
|
||||||
if not self.UNITS[DCSunitName] or force == true then
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:T( { "Add UNIT:", DCSunitName } )
|
self:T( { "Add UNIT:", DCSUnitName } )
|
||||||
|
|
||||||
-- Register unit
|
-- Register unit
|
||||||
self.UNITS[DCSunitName]=UNIT:Register(DCSunitName)
|
self.UNITS[DCSUnitName]=UNIT:Register(DCSUnitName)
|
||||||
end
|
end
|
||||||
|
|
||||||
return self.UNITS[DCSunitName]
|
return self.UNITS[DCSUnitName]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Deletes a Unit from the DATABASE based on the Unit Name.
|
--- Deletes a Unit from the DATABASE based on the Unit Name.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
function DATABASE:DeleteUnit( DCSUnitName )
|
function DATABASE:DeleteUnit( DCSUnitName )
|
||||||
self:T("DeleteUnit "..tostring(DCSUnitName))
|
|
||||||
self.UNITS[DCSUnitName] = nil
|
self.UNITS[DCSUnitName] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -211,9 +195,10 @@ function DATABASE:AddStatic( DCSStaticName )
|
|||||||
|
|
||||||
if not self.STATICS[DCSStaticName] then
|
if not self.STATICS[DCSStaticName] then
|
||||||
self.STATICS[DCSStaticName] = STATIC:Register( DCSStaticName )
|
self.STATICS[DCSStaticName] = STATIC:Register( DCSStaticName )
|
||||||
|
return self.STATICS[DCSStaticName]
|
||||||
end
|
end
|
||||||
|
|
||||||
return self.STATICS[DCSStaticName]
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -223,42 +208,16 @@ function DATABASE:DeleteStatic( DCSStaticName )
|
|||||||
self.STATICS[DCSStaticName] = nil
|
self.STATICS[DCSStaticName] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Finds a STATIC based on the Static Name.
|
--- Finds a STATIC based on the StaticName.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #string StaticName Name of the static object.
|
-- @param #string StaticName
|
||||||
-- @return Wrapper.Static#STATIC The found STATIC.
|
-- @return Wrapper.Static#STATIC The found STATIC.
|
||||||
function DATABASE:FindStatic( StaticName )
|
function DATABASE:FindStatic( StaticName )
|
||||||
|
|
||||||
local StaticFound = self.STATICS[StaticName]
|
local StaticFound = self.STATICS[StaticName]
|
||||||
return StaticFound
|
return StaticFound
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Add a DynamicCargo to the database.
|
|
||||||
-- @param #DATABASE self
|
|
||||||
-- @param #string Name Name of the dynamic cargo.
|
|
||||||
-- @return Wrapper.DynamicCargo#DYNAMICCARGO The dynamic cargo object.
|
|
||||||
function DATABASE:AddDynamicCargo( Name )
|
|
||||||
if not self.DYNAMICCARGO[Name] then
|
|
||||||
self.DYNAMICCARGO[Name] = DYNAMICCARGO:Register(Name)
|
|
||||||
end
|
|
||||||
return self.DYNAMICCARGO[Name]
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Finds a DYNAMICCARGO based on the Dynamic Cargo Name.
|
|
||||||
-- @param #DATABASE self
|
|
||||||
-- @param #string DynamicCargoName
|
|
||||||
-- @return Wrapper.DynamicCargo#DYNAMICCARGO The found DYNAMICCARGO.
|
|
||||||
function DATABASE:FindDynamicCargo( DynamicCargoName )
|
|
||||||
local StaticFound = self.DYNAMICCARGO[DynamicCargoName]
|
|
||||||
return StaticFound
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Deletes a DYNAMICCARGO from the DATABASE based on the Dynamic Cargo Name.
|
|
||||||
-- @param #DATABASE self
|
|
||||||
function DATABASE:DeleteDynamicCargo( DynamicCargoName )
|
|
||||||
self.DYNAMICCARGO[DynamicCargoName] = nil
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Adds a Airbase based on the Airbase Name in the DATABASE.
|
--- Adds a Airbase based on the Airbase Name in the DATABASE.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #string AirbaseName The name of the airbase.
|
-- @param #string AirbaseName The name of the airbase.
|
||||||
@@ -490,10 +449,10 @@ do -- Zones and Pathlines
|
|||||||
|
|
||||||
-- Loop over layers.
|
-- Loop over layers.
|
||||||
for layerID, layerData in pairs(env.mission.drawings.layers or {}) do
|
for layerID, layerData in pairs(env.mission.drawings.layers or {}) do
|
||||||
|
|
||||||
-- Loop over objects in layers.
|
-- Loop over objects in layers.
|
||||||
for objectID, objectData in pairs(layerData.objects or {}) do
|
for objectID, objectData in pairs(layerData.objects or {}) do
|
||||||
|
|
||||||
-- Check for polygon which has at least 4 points (we would need 3 but the origin seems to be there twice)
|
-- Check for polygon which has at least 4 points (we would need 3 but the origin seems to be there twice)
|
||||||
if objectData.polygonMode and (objectData.polygonMode=="free") and objectData.points and #objectData.points>=4 then
|
if objectData.polygonMode and (objectData.polygonMode=="free") and objectData.points and #objectData.points>=4 then
|
||||||
|
|
||||||
@@ -529,32 +488,10 @@ do -- Zones and Pathlines
|
|||||||
|
|
||||||
-- Create new polygon zone.
|
-- Create new polygon zone.
|
||||||
local Zone=ZONE_POLYGON:NewFromPointsArray(ZoneName, points)
|
local Zone=ZONE_POLYGON:NewFromPointsArray(ZoneName, points)
|
||||||
|
|
||||||
--Zone.DrawID = objectID
|
|
||||||
|
|
||||||
-- Set color.
|
-- Set color.
|
||||||
Zone:SetColor({1, 0, 0}, 0.15)
|
Zone:SetColor({1, 0, 0}, 0.15)
|
||||||
Zone:SetFillColor({1, 0, 0}, 0.15)
|
|
||||||
|
|
||||||
if objectData.colorString then
|
|
||||||
-- eg colorString = 0xff0000ff
|
|
||||||
local color = string.gsub(objectData.colorString,"^0x","")
|
|
||||||
local r = tonumber(string.sub(color,1,2),16)/255
|
|
||||||
local g = tonumber(string.sub(color,3,4),16)/255
|
|
||||||
local b = tonumber(string.sub(color,5,6),16)/255
|
|
||||||
local a = tonumber(string.sub(color,7,8),16)/255
|
|
||||||
Zone:SetColor({r, g, b}, a)
|
|
||||||
end
|
|
||||||
if objectData.fillColorString then
|
|
||||||
-- eg fillColorString = 0xff00004b
|
|
||||||
local color = string.gsub(objectData.colorString,"^0x","")
|
|
||||||
local r = tonumber(string.sub(color,1,2),16)/255
|
|
||||||
local g = tonumber(string.sub(color,3,4),16)/255
|
|
||||||
local b = tonumber(string.sub(color,5,6),16)/255
|
|
||||||
local a = tonumber(string.sub(color,7,8),16)/255
|
|
||||||
Zone:SetFillColor({r, g, b}, a)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Store in DB.
|
-- Store in DB.
|
||||||
self.ZONENAMES[ZoneName] = ZoneName
|
self.ZONENAMES[ZoneName] = ZoneName
|
||||||
|
|
||||||
@@ -595,26 +532,7 @@ do -- Zones and Pathlines
|
|||||||
|
|
||||||
-- Set color.
|
-- Set color.
|
||||||
Zone:SetColor({1, 0, 0}, 0.15)
|
Zone:SetColor({1, 0, 0}, 0.15)
|
||||||
|
|
||||||
if objectData.colorString then
|
|
||||||
-- eg colorString = 0xff0000ff
|
|
||||||
local color = string.gsub(objectData.colorString,"^0x","")
|
|
||||||
local r = tonumber(string.sub(color,1,2),16)/255
|
|
||||||
local g = tonumber(string.sub(color,3,4),16)/255
|
|
||||||
local b = tonumber(string.sub(color,5,6),16)/255
|
|
||||||
local a = tonumber(string.sub(color,7,8),16)/255
|
|
||||||
Zone:SetColor({r, g, b}, a)
|
|
||||||
end
|
|
||||||
if objectData.fillColorString then
|
|
||||||
-- eg fillColorString = 0xff00004b
|
|
||||||
local color = string.gsub(objectData.colorString,"^0x","")
|
|
||||||
local r = tonumber(string.sub(color,1,2),16)/255
|
|
||||||
local g = tonumber(string.sub(color,3,4),16)/255
|
|
||||||
local b = tonumber(string.sub(color,5,6),16)/255
|
|
||||||
local a = tonumber(string.sub(color,7,8),16)/255
|
|
||||||
Zone:SetFillColor({r, g, b}, a)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Store in DB.
|
-- Store in DB.
|
||||||
self.ZONENAMES[ZoneName] = ZoneName
|
self.ZONENAMES[ZoneName] = ZoneName
|
||||||
|
|
||||||
@@ -838,7 +756,7 @@ end -- cargo
|
|||||||
|
|
||||||
--- Finds a CLIENT based on the ClientName.
|
--- Finds a CLIENT based on the ClientName.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #string ClientName - Note this is the UNIT name of the client!
|
-- @param #string ClientName
|
||||||
-- @return Wrapper.Client#CLIENT The found CLIENT.
|
-- @return Wrapper.Client#CLIENT The found CLIENT.
|
||||||
function DATABASE:FindClient( ClientName )
|
function DATABASE:FindClient( ClientName )
|
||||||
|
|
||||||
@@ -850,19 +768,14 @@ end
|
|||||||
--- Adds a CLIENT based on the ClientName in the DATABASE.
|
--- Adds a CLIENT based on the ClientName in the DATABASE.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #string ClientName Name of the Client unit.
|
-- @param #string ClientName Name of the Client unit.
|
||||||
-- @param #boolean Force (optional) Force registration of client.
|
|
||||||
-- @return Wrapper.Client#CLIENT The client object.
|
-- @return Wrapper.Client#CLIENT The client object.
|
||||||
function DATABASE:AddClient( ClientName, Force )
|
function DATABASE:AddClient( ClientName )
|
||||||
|
|
||||||
local DCSUnitName = ClientName
|
if not self.CLIENTS[ClientName] then
|
||||||
|
self.CLIENTS[ClientName] = CLIENT:Register( ClientName )
|
||||||
if type(DCSUnitName) == "number" then DCSUnitName = string.format("%d",ClientName) end
|
|
||||||
|
|
||||||
if not self.CLIENTS[DCSUnitName] or Force == true then
|
|
||||||
self.CLIENTS[DCSUnitName] = CLIENT:Register( DCSUnitName )
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return self.CLIENTS[DCSUnitName]
|
return self.CLIENTS[ClientName]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -872,28 +785,16 @@ end
|
|||||||
-- @return Wrapper.Group#GROUP The found GROUP.
|
-- @return Wrapper.Group#GROUP The found GROUP.
|
||||||
function DATABASE:FindGroup( GroupName )
|
function DATABASE:FindGroup( GroupName )
|
||||||
|
|
||||||
if type(GroupName) ~= "string" or GroupName == "" then return end
|
|
||||||
|
|
||||||
local GroupFound = self.GROUPS[GroupName]
|
local GroupFound = self.GROUPS[GroupName]
|
||||||
|
|
||||||
if GroupFound == nil and GroupName ~= nil and self.Templates.Groups[GroupName] == nil then
|
|
||||||
-- see if the group exists in the API, maybe a dynamic slot
|
|
||||||
self:_RegisterDynamicGroup(GroupName)
|
|
||||||
return self.GROUPS[GroupName]
|
|
||||||
end
|
|
||||||
|
|
||||||
return GroupFound
|
return GroupFound
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Adds a GROUP based on the GroupName in the DATABASE.
|
--- Adds a GROUP based on the GroupName in the DATABASE.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #string GroupName
|
function DATABASE:AddGroup( GroupName )
|
||||||
-- @param #boolean force
|
|
||||||
-- @return Wrapper.Group#GROUP The Group
|
|
||||||
function DATABASE:AddGroup( GroupName, force )
|
|
||||||
|
|
||||||
if not self.GROUPS[GroupName] or force == true then
|
if not self.GROUPS[GroupName] then
|
||||||
self:T( { "Add GROUP:", GroupName } )
|
self:T( { "Add GROUP:", GroupName } )
|
||||||
self.GROUPS[GroupName] = GROUP:Register( GroupName )
|
self.GROUPS[GroupName] = GROUP:Register( GroupName )
|
||||||
end
|
end
|
||||||
@@ -904,11 +805,9 @@ end
|
|||||||
--- Adds a player based on the Player Name in the DATABASE.
|
--- Adds a player based on the Player Name in the DATABASE.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
function DATABASE:AddPlayer( UnitName, PlayerName )
|
function DATABASE:AddPlayer( UnitName, PlayerName )
|
||||||
|
|
||||||
if type(UnitName) == "number" then UnitName = string.format("%d",UnitName) end
|
|
||||||
|
|
||||||
if PlayerName then
|
if PlayerName then
|
||||||
self:I( { "Add player for unit:", UnitName, PlayerName } )
|
self:T( { "Add player for unit:", UnitName, PlayerName } )
|
||||||
self.PLAYERS[PlayerName] = UnitName
|
self.PLAYERS[PlayerName] = UnitName
|
||||||
self.PLAYERUNITS[PlayerName] = self:FindUnit( UnitName )
|
self.PLAYERUNITS[PlayerName] = self:FindUnit( UnitName )
|
||||||
self.PLAYERSJOINED[PlayerName] = PlayerName
|
self.PLAYERSJOINED[PlayerName] = PlayerName
|
||||||
@@ -916,21 +815,6 @@ function DATABASE:AddPlayer( UnitName, PlayerName )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get a PlayerName by UnitName from PLAYERS in DATABASE.
|
|
||||||
-- @param #DATABASE self
|
|
||||||
-- @return #string PlayerName
|
|
||||||
-- @return Wrapper.Unit#UNIT PlayerUnit
|
|
||||||
function DATABASE:_FindPlayerNameByUnitName(UnitName)
|
|
||||||
if UnitName then
|
|
||||||
for playername,unitname in pairs(self.PLAYERS) do
|
|
||||||
if unitname == UnitName and self.PLAYERUNITS[playername] and self.PLAYERUNITS[playername]:IsAlive() then
|
|
||||||
return playername, self.PLAYERUNITS[playername]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Deletes a player from the DATABASE based on the Player Name.
|
--- Deletes a player from the DATABASE based on the Player Name.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
function DATABASE:DeletePlayer( UnitName, PlayerName )
|
function DATABASE:DeletePlayer( UnitName, PlayerName )
|
||||||
@@ -1003,7 +887,7 @@ function DATABASE:Spawn( SpawnTemplate )
|
|||||||
SpawnTemplate.CountryID = nil
|
SpawnTemplate.CountryID = nil
|
||||||
SpawnTemplate.CategoryID = nil
|
SpawnTemplate.CategoryID = nil
|
||||||
|
|
||||||
self:_RegisterGroupTemplate( SpawnTemplate, SpawnCoalitionID, SpawnCategoryID, SpawnCountryID, SpawnTemplate.name )
|
self:_RegisterGroupTemplate( SpawnTemplate, SpawnCoalitionID, SpawnCategoryID, SpawnCountryID )
|
||||||
|
|
||||||
self:T3( SpawnTemplate )
|
self:T3( SpawnTemplate )
|
||||||
coalition.addGroup( SpawnCountryID, SpawnCategoryID, SpawnTemplate )
|
coalition.addGroup( SpawnCountryID, SpawnCategoryID, SpawnTemplate )
|
||||||
@@ -1080,7 +964,7 @@ function DATABASE:_RegisterGroupTemplate( GroupTemplate, CoalitionSide, Category
|
|||||||
self.Templates.Groups[GroupTemplateName].CategoryID = CategoryID
|
self.Templates.Groups[GroupTemplateName].CategoryID = CategoryID
|
||||||
self.Templates.Groups[GroupTemplateName].CoalitionID = CoalitionSide
|
self.Templates.Groups[GroupTemplateName].CoalitionID = CoalitionSide
|
||||||
self.Templates.Groups[GroupTemplateName].CountryID = CountryID
|
self.Templates.Groups[GroupTemplateName].CountryID = CountryID
|
||||||
|
|
||||||
local UnitNames = {}
|
local UnitNames = {}
|
||||||
|
|
||||||
for unit_num, UnitTemplate in pairs( GroupTemplate.units ) do
|
for unit_num, UnitTemplate in pairs( GroupTemplate.units ) do
|
||||||
@@ -1104,31 +988,10 @@ function DATABASE:_RegisterGroupTemplate( GroupTemplate, CoalitionSide, Category
|
|||||||
self.Templates.ClientsByName[UnitTemplate.name].CountryID = CountryID
|
self.Templates.ClientsByName[UnitTemplate.name].CountryID = CountryID
|
||||||
self.Templates.ClientsByID[UnitTemplate.unitId] = UnitTemplate
|
self.Templates.ClientsByID[UnitTemplate.unitId] = UnitTemplate
|
||||||
end
|
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:T("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:T("Register SADL "..tostring(UnitTemplate.AddPropAircraft.SADL_TN).." for ".. UnitTemplate.name)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
UnitNames[#UnitNames+1] = self.Templates.Units[UnitTemplate.name].UnitName
|
UnitNames[#UnitNames+1] = self.Templates.Units[UnitTemplate.name].UnitName
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:T( { Group = self.Templates.Groups[GroupTemplateName].GroupName,
|
self:T( { Group = self.Templates.Groups[GroupTemplateName].GroupName,
|
||||||
Coalition = self.Templates.Groups[GroupTemplateName].CoalitionID,
|
Coalition = self.Templates.Groups[GroupTemplateName].CoalitionID,
|
||||||
@@ -1139,92 +1002,15 @@ function DATABASE:_RegisterGroupTemplate( GroupTemplate, CoalitionSide, Category
|
|||||||
)
|
)
|
||||||
end
|
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.
|
--- Get group template.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #string GroupName Group name.
|
-- @param #string GroupName Group name.
|
||||||
-- @return #table Group template table.
|
-- @return #table Group template table.
|
||||||
function DATABASE:GetGroupTemplate( GroupName )
|
function DATABASE:GetGroupTemplate( GroupName )
|
||||||
local GroupTemplate=nil
|
local GroupTemplate = self.Templates.Groups[GroupName].Template
|
||||||
if self.Templates.Groups[GroupName] then
|
GroupTemplate.SpawnCoalitionID = self.Templates.Groups[GroupName].CoalitionID
|
||||||
GroupTemplate = self.Templates.Groups[GroupName].Template
|
GroupTemplate.SpawnCategoryID = self.Templates.Groups[GroupName].CategoryID
|
||||||
GroupTemplate.SpawnCoalitionID = self.Templates.Groups[GroupName].CoalitionID
|
GroupTemplate.SpawnCountryID = self.Templates.Groups[GroupName].CountryID
|
||||||
GroupTemplate.SpawnCategoryID = self.Templates.Groups[GroupName].CategoryID
|
|
||||||
GroupTemplate.SpawnCountryID = self.Templates.Groups[GroupName].CountryID
|
|
||||||
end
|
|
||||||
return GroupTemplate
|
return GroupTemplate
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1269,43 +1055,6 @@ function DATABASE:_RegisterStaticTemplate( StaticTemplate, CoalitionID, Category
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get a generic static cargo group template from scratch for dynamic cargo spawns register. Does not register the template!
|
|
||||||
-- @param #DATABASE self
|
|
||||||
-- @param #string Name Name of the static.
|
|
||||||
-- @param #string Typename Typename of the static. Defaults to "container_cargo".
|
|
||||||
-- @param #number Mass Mass of the static. Defaults to 0.
|
|
||||||
-- @param #number Coalition Coalition of the static. Defaults to coalition.side.BLUE.
|
|
||||||
-- @param #number Country Country of the static. Defaults to country.id.GERMANY.
|
|
||||||
-- @return #table Static template table.
|
|
||||||
function DATABASE:_GetGenericStaticCargoGroupTemplate(Name,Typename,Mass,Coalition,Country)
|
|
||||||
local StaticTemplate = {}
|
|
||||||
StaticTemplate.name = Name or "None"
|
|
||||||
StaticTemplate.units = { [1] = {
|
|
||||||
name = Name,
|
|
||||||
resourcePayload = {
|
|
||||||
["weapons"] = {},
|
|
||||||
["aircrafts"] = {},
|
|
||||||
["gasoline"] = 0,
|
|
||||||
["diesel"] = 0,
|
|
||||||
["methanol_mixture"] = 0,
|
|
||||||
["jet_fuel"] = 0,
|
|
||||||
},
|
|
||||||
["mass"] = Mass or 0,
|
|
||||||
["category"] = "Cargos",
|
|
||||||
["canCargo"] = true,
|
|
||||||
["type"] = Typename or "container_cargo",
|
|
||||||
["rate"] = 100,
|
|
||||||
["y"] = 0,
|
|
||||||
["x"] = 0,
|
|
||||||
["heading"] = 0,
|
|
||||||
}}
|
|
||||||
StaticTemplate.CategoryID = "static"
|
|
||||||
StaticTemplate.CoalitionID = Coalition or coalition.side.BLUE
|
|
||||||
StaticTemplate.CountryID = Country or country.id.GERMANY
|
|
||||||
--UTILS.PrintTableToLog(StaticTemplate)
|
|
||||||
return StaticTemplate
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Get static group template.
|
--- Get static group template.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #string StaticName Name of the static.
|
-- @param #string StaticName Name of the static.
|
||||||
@@ -1379,11 +1128,7 @@ end
|
|||||||
-- @param #string ClientName Name of the Client.
|
-- @param #string ClientName Name of the Client.
|
||||||
-- @return #number Coalition ID.
|
-- @return #number Coalition ID.
|
||||||
function DATABASE:GetCoalitionFromClientTemplate( ClientName )
|
function DATABASE:GetCoalitionFromClientTemplate( ClientName )
|
||||||
if self.Templates.ClientsByName[ClientName] then
|
return self.Templates.ClientsByName[ClientName].CoalitionID
|
||||||
return self.Templates.ClientsByName[ClientName].CoalitionID
|
|
||||||
end
|
|
||||||
self:T("WARNING: Template does not exist for client "..tostring(ClientName))
|
|
||||||
return nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get category ID from client name.
|
--- Get category ID from client name.
|
||||||
@@ -1391,11 +1136,7 @@ end
|
|||||||
-- @param #string ClientName Name of the Client.
|
-- @param #string ClientName Name of the Client.
|
||||||
-- @return #number Category ID.
|
-- @return #number Category ID.
|
||||||
function DATABASE:GetCategoryFromClientTemplate( ClientName )
|
function DATABASE:GetCategoryFromClientTemplate( ClientName )
|
||||||
if self.Templates.ClientsByName[ClientName] then
|
return self.Templates.ClientsByName[ClientName].CategoryID
|
||||||
return self.Templates.ClientsByName[ClientName].CategoryID
|
|
||||||
end
|
|
||||||
self:T("WARNING: Template does not exist for client "..tostring(ClientName))
|
|
||||||
return nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get country ID from client name.
|
--- Get country ID from client name.
|
||||||
@@ -1403,11 +1144,7 @@ end
|
|||||||
-- @param #string ClientName Name of the Client.
|
-- @param #string ClientName Name of the Client.
|
||||||
-- @return #number Country ID.
|
-- @return #number Country ID.
|
||||||
function DATABASE:GetCountryFromClientTemplate( ClientName )
|
function DATABASE:GetCountryFromClientTemplate( ClientName )
|
||||||
if self.Templates.ClientsByName[ClientName] then
|
return self.Templates.ClientsByName[ClientName].CountryID
|
||||||
return self.Templates.ClientsByName[ClientName].CountryID
|
|
||||||
end
|
|
||||||
self:T("WARNING: Template does not exist for client "..tostring(ClientName))
|
|
||||||
return nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Airbase
|
--- Airbase
|
||||||
@@ -1453,36 +1190,6 @@ function DATABASE:_RegisterPlayers()
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Private method that registers a single dynamic slot Group and Units within in the mission.
|
|
||||||
-- @param #DATABASE self
|
|
||||||
-- @return #DATABASE self
|
|
||||||
function DATABASE:_RegisterDynamicGroup(Groupname)
|
|
||||||
local DCSGroup = Group.getByName(Groupname)
|
|
||||||
if DCSGroup and DCSGroup:isExist() then
|
|
||||||
|
|
||||||
-- Group name.
|
|
||||||
local DCSGroupName = DCSGroup:getName()
|
|
||||||
|
|
||||||
-- Add group.
|
|
||||||
self:I(string.format("Register Group: %s", tostring(DCSGroupName)))
|
|
||||||
self:AddGroup( DCSGroupName, true )
|
|
||||||
|
|
||||||
-- Loop over units in group.
|
|
||||||
for DCSUnitId, DCSUnit in pairs( DCSGroup:getUnits() ) do
|
|
||||||
|
|
||||||
-- Get unit name.
|
|
||||||
local DCSUnitName = DCSUnit:getName()
|
|
||||||
|
|
||||||
-- Add unit.
|
|
||||||
self:I(string.format("Register Unit: %s", tostring(DCSUnitName)))
|
|
||||||
self:AddUnit( tostring(DCSUnitName), true )
|
|
||||||
|
|
||||||
end
|
|
||||||
else
|
|
||||||
self:E({"Group does not exist: ", DCSGroup})
|
|
||||||
end
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Private method that registers all Groups and Units within in the mission.
|
--- Private method that registers all Groups and Units within in the mission.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
@@ -1581,29 +1288,12 @@ end
|
|||||||
-- @param DCS#Airbase airbase Airbase.
|
-- @param DCS#Airbase airbase Airbase.
|
||||||
-- @return #DATABASE self
|
-- @return #DATABASE self
|
||||||
function DATABASE:_RegisterAirbase(airbase)
|
function DATABASE:_RegisterAirbase(airbase)
|
||||||
|
|
||||||
local IsSyria = UTILS.GetDCSMap() == "Syria" and true or false
|
|
||||||
local countHSyria = 0
|
|
||||||
|
|
||||||
if airbase then
|
if airbase then
|
||||||
|
|
||||||
-- Get the airbase name.
|
-- Get the airbase name.
|
||||||
local DCSAirbaseName = airbase:getName()
|
local DCSAirbaseName = airbase:getName()
|
||||||
|
|
||||||
-- DCS 2.9.8.1107 added 143 helipads all named H with the same object ID ..
|
|
||||||
if IsSyria and DCSAirbaseName == "H" and countHSyria > 0 then
|
|
||||||
--[[
|
|
||||||
local p = airbase:getPosition().p
|
|
||||||
local mgrs = COORDINATE:New(p.x,p.z,p.y):ToStringMGRS()
|
|
||||||
self:I("Airbase on Syria map named H @ "..mgrs)
|
|
||||||
countHSyria = countHSyria + 1
|
|
||||||
if countHSyria > 1 then return self end
|
|
||||||
--]]
|
|
||||||
return self
|
|
||||||
elseif IsSyria and DCSAirbaseName == "H" and countHSyria == 0 then
|
|
||||||
countHSyria = countHSyria + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
-- This gave the incorrect value to be inserted into the airdromeID for DCS 2.5.6. Is fixed now.
|
-- This gave the incorrect value to be inserted into the airdromeID for DCS 2.5.6. Is fixed now.
|
||||||
local airbaseID=airbase:getID()
|
local airbaseID=airbase:getID()
|
||||||
|
|
||||||
@@ -1612,17 +1302,9 @@ function DATABASE:_RegisterAirbase(airbase)
|
|||||||
|
|
||||||
-- Unique ID.
|
-- Unique ID.
|
||||||
local airbaseUID=airbase:GetID(true)
|
local airbaseUID=airbase:GetID(true)
|
||||||
|
|
||||||
local typename = airbase:GetTypeName()
|
|
||||||
|
|
||||||
local category = airbase.category
|
|
||||||
|
|
||||||
if category == Airbase.Category.SHIP and typename == "FARP_SINGLE_01" then
|
|
||||||
category = Airbase.Category.HELIPAD
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Debug output.
|
-- Debug output.
|
||||||
local text=string.format("Register %s: %s (UID=%d), Runways=%d, Parking=%d [", AIRBASE.CategoryName[category], tostring(DCSAirbaseName), airbaseUID, #airbase.runways, airbase.NparkingTotal)
|
local text=string.format("Register %s: %s (UID=%d), Runways=%d, Parking=%d [", AIRBASE.CategoryName[airbase.category], tostring(DCSAirbaseName), airbaseUID, #airbase.runways, airbase.NparkingTotal)
|
||||||
for _,terminalType in pairs(AIRBASE.TerminalType) do
|
for _,terminalType in pairs(AIRBASE.TerminalType) do
|
||||||
if airbase.NparkingTerminal and airbase.NparkingTerminal[terminalType] then
|
if airbase.NparkingTerminal and airbase.NparkingTerminal[terminalType] then
|
||||||
text=text..string.format("%d=%d ", terminalType, airbase.NparkingTerminal[terminalType])
|
text=text..string.format("%d=%d ", terminalType, airbase.NparkingTerminal[terminalType])
|
||||||
@@ -1643,7 +1325,7 @@ end
|
|||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param Core.Event#EVENTDATA Event
|
-- @param Core.Event#EVENTDATA Event
|
||||||
function DATABASE:_EventOnBirth( Event )
|
function DATABASE:_EventOnBirth( Event )
|
||||||
self:T( { Event } )
|
self:F( { Event } )
|
||||||
|
|
||||||
if Event.IniDCSUnit then
|
if Event.IniDCSUnit then
|
||||||
|
|
||||||
@@ -1651,17 +1333,7 @@ function DATABASE:_EventOnBirth( Event )
|
|||||||
|
|
||||||
-- Add static object to DB.
|
-- Add static object to DB.
|
||||||
self:AddStatic( Event.IniDCSUnitName )
|
self:AddStatic( Event.IniDCSUnitName )
|
||||||
|
|
||||||
elseif Event.IniObjectCategory == Object.Category.CARGO and string.match(Event.IniUnitName,".+|%d%d:%d%d|PKG%d+") then
|
|
||||||
|
|
||||||
-- Add dynamic cargo object to DB
|
|
||||||
|
|
||||||
local cargo = self:AddDynamicCargo(Event.IniDCSUnitName)
|
|
||||||
|
|
||||||
self:I(string.format("Adding dynamic cargo %s", tostring(Event.IniDCSUnitName)))
|
|
||||||
|
|
||||||
self:CreateEventNewDynamicCargo( cargo )
|
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
if Event.IniObjectCategory == Object.Category.UNIT then
|
if Event.IniObjectCategory == Object.Category.UNIT then
|
||||||
@@ -1682,9 +1354,9 @@ function DATABASE:_EventOnBirth( Event )
|
|||||||
end
|
end
|
||||||
|
|
||||||
if Event.IniObjectCategory == Object.Category.UNIT then
|
if Event.IniObjectCategory == Object.Category.UNIT then
|
||||||
|
|
||||||
Event.IniGroup = self:FindGroup( Event.IniDCSGroupName )
|
|
||||||
Event.IniUnit = self:FindUnit( Event.IniDCSUnitName )
|
Event.IniUnit = self:FindUnit( Event.IniDCSUnitName )
|
||||||
|
Event.IniGroup = self:FindGroup( Event.IniDCSGroupName )
|
||||||
|
|
||||||
-- Client
|
-- Client
|
||||||
local client=self.CLIENTS[Event.IniDCSUnitName] --Wrapper.Client#CLIENT
|
local client=self.CLIENTS[Event.IniDCSUnitName] --Wrapper.Client#CLIENT
|
||||||
@@ -1699,11 +1371,11 @@ function DATABASE:_EventOnBirth( Event )
|
|||||||
if PlayerName then
|
if PlayerName then
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:I(string.format("Player '%s' joined unit '%s' (%s) of group '%s'", tostring(PlayerName), tostring(Event.IniDCSUnitName), tostring(Event.IniTypeName), tostring(Event.IniDCSGroupName)))
|
self:I(string.format("Player '%s' joined unit '%s' of group '%s'", tostring(PlayerName), tostring(Event.IniDCSUnitName), tostring(Event.IniDCSGroupName)))
|
||||||
|
|
||||||
-- Add client in case it does not exist already.
|
-- Add client in case it does not exist already.
|
||||||
if client == nil or (client and client:CountPlayers() == 0) then
|
if not client then
|
||||||
client=self:AddClient(Event.IniDCSUnitName, true)
|
client=self:AddClient(Event.IniDCSUnitName)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Add player.
|
-- Add player.
|
||||||
@@ -1713,19 +1385,14 @@ function DATABASE:_EventOnBirth( Event )
|
|||||||
if not self.PLAYERS[PlayerName] then
|
if not self.PLAYERS[PlayerName] then
|
||||||
self:AddPlayer( Event.IniUnitName, PlayerName )
|
self:AddPlayer( Event.IniUnitName, PlayerName )
|
||||||
end
|
end
|
||||||
|
|
||||||
local function SetPlayerSettings(self,PlayerName,IniUnit)
|
-- Player settings.
|
||||||
-- Player settings.
|
local Settings = SETTINGS:Set( PlayerName )
|
||||||
local Settings = SETTINGS:Set( PlayerName )
|
Settings:SetPlayerMenu(Event.IniUnit)
|
||||||
--Settings:SetPlayerMenu(Event.IniUnit)
|
|
||||||
Settings:SetPlayerMenu(IniUnit)
|
-- Create an event.
|
||||||
-- Create an event.
|
self:CreateEventPlayerEnterAircraft(Event.IniUnit)
|
||||||
self:CreateEventPlayerEnterAircraft(IniUnit)
|
|
||||||
--self:CreateEventPlayerEnterAircraft(Event.IniUnit)
|
|
||||||
end
|
|
||||||
|
|
||||||
self:ScheduleOnce(1,SetPlayerSettings,self,PlayerName,Event.IniUnit)
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -1739,6 +1406,7 @@ end
|
|||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param Core.Event#EVENTDATA Event
|
-- @param Core.Event#EVENTDATA Event
|
||||||
function DATABASE:_EventOnDeadOrCrash( Event )
|
function DATABASE:_EventOnDeadOrCrash( Event )
|
||||||
|
|
||||||
if Event.IniDCSUnit then
|
if Event.IniDCSUnit then
|
||||||
|
|
||||||
local name=Event.IniDCSUnitName
|
local name=Event.IniDCSUnitName
|
||||||
@@ -1746,7 +1414,7 @@ function DATABASE:_EventOnDeadOrCrash( Event )
|
|||||||
if Event.IniObjectCategory == 3 then
|
if Event.IniObjectCategory == 3 then
|
||||||
|
|
||||||
---
|
---
|
||||||
-- STATICS
|
-- STATICS
|
||||||
---
|
---
|
||||||
|
|
||||||
if self.STATICS[Event.IniDCSUnitName] then
|
if self.STATICS[Event.IniDCSUnitName] then
|
||||||
@@ -1756,7 +1424,7 @@ function DATABASE:_EventOnDeadOrCrash( Event )
|
|||||||
---
|
---
|
||||||
-- Maybe a UNIT?
|
-- Maybe a UNIT?
|
||||||
---
|
---
|
||||||
|
|
||||||
-- Delete unit.
|
-- Delete unit.
|
||||||
if self.UNITS[Event.IniDCSUnitName] then
|
if self.UNITS[Event.IniDCSUnitName] then
|
||||||
self:T("STATIC Event for UNIT "..tostring(Event.IniDCSUnitName))
|
self:T("STATIC Event for UNIT "..tostring(Event.IniDCSUnitName))
|
||||||
@@ -1779,8 +1447,7 @@ function DATABASE:_EventOnDeadOrCrash( Event )
|
|||||||
|
|
||||||
-- Delete unit.
|
-- Delete unit.
|
||||||
if self.UNITS[Event.IniDCSUnitName] then
|
if self.UNITS[Event.IniDCSUnitName] then
|
||||||
self:ScheduleOnce(1,self.DeleteUnit,self,Event.IniDCSUnitName)
|
self:DeleteUnit(Event.IniDCSUnitName)
|
||||||
--self:DeleteUnit(Event.IniDCSUnitName)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Remove client players.
|
-- Remove client players.
|
||||||
@@ -1847,15 +1514,6 @@ function DATABASE:_EventOnPlayerEnterUnit( Event )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Handles the OnDynamicCargoRemoved event to clean the active dynamic cargo table.
|
|
||||||
-- @param #DATABASE self
|
|
||||||
-- @param Core.Event#EVENTDATA Event
|
|
||||||
function DATABASE:_EventOnDynamicCargoRemoved( Event )
|
|
||||||
self:T( { Event } )
|
|
||||||
if Event.IniDynamicCargoName then
|
|
||||||
self:DeleteDynamicCargo(Event.IniDynamicCargoName)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Handles the OnPlayerLeaveUnit event to clean the active players table.
|
--- Handles the OnPlayerLeaveUnit event to clean the active players table.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
@@ -1879,7 +1537,7 @@ function DATABASE:_EventOnPlayerLeaveUnit( Event )
|
|||||||
if Event.IniObjectCategory == 1 then
|
if Event.IniObjectCategory == 1 then
|
||||||
|
|
||||||
-- Try to get the player name. This can be buggy for multicrew aircraft!
|
-- Try to get the player name. This can be buggy for multicrew aircraft!
|
||||||
local PlayerName = Event.IniPlayerName or Event.IniUnit:GetPlayerName() or FindPlayerName(Event.IniUnitName)
|
local PlayerName = Event.IniUnit:GetPlayerName() or FindPlayerName(Event.IniUnitName)
|
||||||
|
|
||||||
if PlayerName then
|
if PlayerName then
|
||||||
|
|
||||||
@@ -1897,7 +1555,6 @@ function DATABASE:_EventOnPlayerLeaveUnit( Event )
|
|||||||
local client=self.CLIENTS[Event.IniDCSUnitName] --Wrapper.Client#CLIENT
|
local client=self.CLIENTS[Event.IniDCSUnitName] --Wrapper.Client#CLIENT
|
||||||
if client then
|
if client then
|
||||||
client:RemovePlayer(PlayerName)
|
client:RemovePlayer(PlayerName)
|
||||||
--self.PLAYERSETTINGS[PlayerName] = nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -2195,7 +1852,7 @@ end
|
|||||||
|
|
||||||
--- Add a flight control to the data base.
|
--- Add a flight control to the data base.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param OPS.FlightControl#FLIGHTCONTROL flightcontrol
|
-- @param Ops.FlightControl#FLIGHTCONTROL flightcontrol
|
||||||
function DATABASE:AddFlightControl(flightcontrol)
|
function DATABASE:AddFlightControl(flightcontrol)
|
||||||
self:F2( { flightcontrol } )
|
self:F2( { flightcontrol } )
|
||||||
self.FLIGHTCONTROLS[flightcontrol.airbasename]=flightcontrol
|
self.FLIGHTCONTROLS[flightcontrol.airbasename]=flightcontrol
|
||||||
@@ -2204,7 +1861,7 @@ end
|
|||||||
--- Get a flight control object from the data base.
|
--- Get a flight control object from the data base.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #string airbasename Name of the associated airbase.
|
-- @param #string airbasename Name of the associated airbase.
|
||||||
-- @return OPS.FlightControl#FLIGHTCONTROL The FLIGHTCONTROL object.s
|
-- @return Ops.FlightControl#FLIGHTCONTROL The FLIGHTCONTROL object.s
|
||||||
function DATABASE:GetFlightControl(airbasename)
|
function DATABASE:GetFlightControl(airbasename)
|
||||||
return self.FLIGHTCONTROLS[airbasename]
|
return self.FLIGHTCONTROLS[airbasename]
|
||||||
end
|
end
|
||||||
@@ -2276,7 +1933,7 @@ function DATABASE:_RegisterTemplates()
|
|||||||
for group_num, Template in pairs(obj_type_data.group) do
|
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
|
if obj_type_name ~= "static" and Template and Template.units and type(Template.units) == 'table' then --making sure again- this is a valid group
|
||||||
|
|
||||||
self:_RegisterGroupTemplate(Template, CoalitionSide, _DATABASECategory[string.lower(CategoryName)], CountryID)
|
self:_RegisterGroupTemplate(Template, CoalitionSide, _DATABASECategory[string.lower(CategoryName)], CountryID)
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -194,11 +194,6 @@ world.event.S_EVENT_NEW_ZONE_GOAL = world.event.S_EVENT_MAX + 1004
|
|||||||
world.event.S_EVENT_DELETE_ZONE_GOAL = world.event.S_EVENT_MAX + 1005
|
world.event.S_EVENT_DELETE_ZONE_GOAL = world.event.S_EVENT_MAX + 1005
|
||||||
world.event.S_EVENT_REMOVE_UNIT = world.event.S_EVENT_MAX + 1006
|
world.event.S_EVENT_REMOVE_UNIT = world.event.S_EVENT_MAX + 1006
|
||||||
world.event.S_EVENT_PLAYER_ENTER_AIRCRAFT = world.event.S_EVENT_MAX + 1007
|
world.event.S_EVENT_PLAYER_ENTER_AIRCRAFT = world.event.S_EVENT_MAX + 1007
|
||||||
-- dynamic cargo
|
|
||||||
world.event.S_EVENT_NEW_DYNAMIC_CARGO = world.event.S_EVENT_MAX + 1008
|
|
||||||
world.event.S_EVENT_DYNAMIC_CARGO_LOADED = world.event.S_EVENT_MAX + 1009
|
|
||||||
world.event.S_EVENT_DYNAMIC_CARGO_UNLOADED = world.event.S_EVENT_MAX + 1010
|
|
||||||
world.event.S_EVENT_DYNAMIC_CARGO_REMOVED = world.event.S_EVENT_MAX + 1011
|
|
||||||
|
|
||||||
|
|
||||||
--- The different types of events supported by MOOSE.
|
--- The different types of events supported by MOOSE.
|
||||||
@@ -266,29 +261,8 @@ EVENTS = {
|
|||||||
SimulationStart = world.event.S_EVENT_SIMULATION_START or -1,
|
SimulationStart = world.event.S_EVENT_SIMULATION_START or -1,
|
||||||
WeaponRearm = world.event.S_EVENT_WEAPON_REARM or -1,
|
WeaponRearm = world.event.S_EVENT_WEAPON_REARM or -1,
|
||||||
WeaponDrop = world.event.S_EVENT_WEAPON_DROP or -1,
|
WeaponDrop = world.event.S_EVENT_WEAPON_DROP or -1,
|
||||||
-- Added with DCS 2.9.x
|
|
||||||
--UnitTaskTimeout = world.event.S_EVENT_UNIT_TASK_TIMEOUT or -1,
|
|
||||||
UnitTaskComplete = world.event.S_EVENT_UNIT_TASK_COMPLETE or -1,
|
|
||||||
UnitTaskStage = world.event.S_EVENT_UNIT_TASK_STAGE or -1,
|
|
||||||
--MacSubtaskScore = world.event.S_EVENT_MAC_SUBTASK_SCORE or -1,
|
|
||||||
MacExtraScore = world.event.S_EVENT_MAC_EXTRA_SCORE or -1,
|
|
||||||
MissionRestart = world.event.S_EVENT_MISSION_RESTART or -1,
|
|
||||||
MissionWinner = world.event.S_EVENT_MISSION_WINNER or -1,
|
|
||||||
RunwayTakeoff = world.event.S_EVENT_RUNWAY_TAKEOFF or -1,
|
|
||||||
RunwayTouch = world.event.S_EVENT_RUNWAY_TOUCH or -1,
|
|
||||||
MacLMSRestart = world.event.S_EVENT_MAC_LMS_RESTART or -1,
|
|
||||||
SimulationFreeze = world.event.S_EVENT_SIMULATION_FREEZE or -1,
|
|
||||||
SimulationUnfreeze = world.event.S_EVENT_SIMULATION_UNFREEZE or -1,
|
|
||||||
HumanAircraftRepairStart = world.event.S_EVENT_HUMAN_AIRCRAFT_REPAIR_START or -1,
|
|
||||||
HumanAircraftRepairFinish = world.event.S_EVENT_HUMAN_AIRCRAFT_REPAIR_FINISH or -1,
|
|
||||||
-- dynamic cargo
|
|
||||||
NewDynamicCargo = world.event.S_EVENT_NEW_DYNAMIC_CARGO or -1,
|
|
||||||
DynamicCargoLoaded = world.event.S_EVENT_DYNAMIC_CARGO_LOADED or -1,
|
|
||||||
DynamicCargoUnloaded = world.event.S_EVENT_DYNAMIC_CARGO_UNLOADED or -1,
|
|
||||||
DynamicCargoRemoved = world.event.S_EVENT_DYNAMIC_CARGO_REMOVED or -1,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
--- The Event structure
|
--- The Event structure
|
||||||
-- Note that at the beginning of each field description, there is an indication which field will be populated depending on the object type involved in the Event:
|
-- Note that at the beginning of each field description, there is an indication which field will be populated depending on the object type involved in the Event:
|
||||||
--
|
--
|
||||||
@@ -344,9 +318,6 @@ EVENTS = {
|
|||||||
--
|
--
|
||||||
-- @field Core.Zone#ZONE Zone The zone object.
|
-- @field Core.Zone#ZONE Zone The zone object.
|
||||||
-- @field #string ZoneName The name of the zone.
|
-- @field #string ZoneName The name of the zone.
|
||||||
--
|
|
||||||
-- @field Wrapper.DynamicCargo#DYNAMICCARGO IniDynamicCargo The dynamic cargo object.
|
|
||||||
-- @field #string IniDynamicCargoName The dynamic cargo unit name.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -665,113 +636,8 @@ local _EVENTMETA = {
|
|||||||
Event = "OnEventWeaponDrop",
|
Event = "OnEventWeaponDrop",
|
||||||
Text = "S_EVENT_WEAPON_DROP"
|
Text = "S_EVENT_WEAPON_DROP"
|
||||||
},
|
},
|
||||||
-- DCS 2.9
|
|
||||||
--[EVENTS.UnitTaskTimeout] = {
|
|
||||||
-- Order = 1,
|
|
||||||
-- Side = "I",
|
|
||||||
-- Event = "OnEventUnitTaskTimeout",
|
|
||||||
-- Text = "S_EVENT_UNIT_TASK_TIMEOUT "
|
|
||||||
--},
|
|
||||||
[EVENTS.UnitTaskStage] = {
|
|
||||||
Order = 1,
|
|
||||||
Side = "I",
|
|
||||||
Event = "OnEventUnitTaskStage",
|
|
||||||
Text = "S_EVENT_UNIT_TASK_STAGE "
|
|
||||||
},
|
|
||||||
--[EVENTS.MacSubtaskScore] = {
|
|
||||||
-- Order = 1,
|
|
||||||
--Side = "I",
|
|
||||||
--Event = "OnEventMacSubtaskScore",
|
|
||||||
--Text = "S_EVENT_MAC_SUBTASK_SCORE"
|
|
||||||
--},
|
|
||||||
[EVENTS.MacExtraScore] = {
|
|
||||||
Order = 1,
|
|
||||||
Side = "I",
|
|
||||||
Event = "OnEventMacExtraScore",
|
|
||||||
Text = "S_EVENT_MAC_EXTRA_SCOREP"
|
|
||||||
},
|
|
||||||
[EVENTS.MissionRestart] = {
|
|
||||||
Order = 1,
|
|
||||||
Side = "I",
|
|
||||||
Event = "OnEventMissionRestart",
|
|
||||||
Text = "S_EVENT_MISSION_RESTART"
|
|
||||||
},
|
|
||||||
[EVENTS.MissionWinner] = {
|
|
||||||
Order = 1,
|
|
||||||
Side = "I",
|
|
||||||
Event = "OnEventMissionWinner",
|
|
||||||
Text = "S_EVENT_MISSION_WINNER"
|
|
||||||
},
|
|
||||||
[EVENTS.RunwayTakeoff] = {
|
|
||||||
Order = 1,
|
|
||||||
Side = "I",
|
|
||||||
Event = "OnEventRunwayTakeoff",
|
|
||||||
Text = "S_EVENT_RUNWAY_TAKEOFF"
|
|
||||||
},
|
|
||||||
[EVENTS.RunwayTouch] = {
|
|
||||||
Order = 1,
|
|
||||||
Side = "I",
|
|
||||||
Event = "OnEventRunwayTouch",
|
|
||||||
Text = "S_EVENT_RUNWAY_TOUCH"
|
|
||||||
},
|
|
||||||
[EVENTS.MacLMSRestart] = {
|
|
||||||
Order = 1,
|
|
||||||
Side = "I",
|
|
||||||
Event = "OnEventMacLMSRestart",
|
|
||||||
Text = "S_EVENT_MAC_LMS_RESTART"
|
|
||||||
},
|
|
||||||
[EVENTS.SimulationFreeze] = {
|
|
||||||
Order = 1,
|
|
||||||
Side = "I",
|
|
||||||
Event = "OnEventSimulationFreeze",
|
|
||||||
Text = "S_EVENT_SIMULATION_FREEZE"
|
|
||||||
},
|
|
||||||
[EVENTS.SimulationUnfreeze] = {
|
|
||||||
Order = 1,
|
|
||||||
Side = "I",
|
|
||||||
Event = "OnEventSimulationUnfreeze",
|
|
||||||
Text = "S_EVENT_SIMULATION_UNFREEZE"
|
|
||||||
},
|
|
||||||
[EVENTS.HumanAircraftRepairStart] = {
|
|
||||||
Order = 1,
|
|
||||||
Side = "I",
|
|
||||||
Event = "OnEventHumanAircraftRepairStart",
|
|
||||||
Text = "S_EVENT_HUMAN_AIRCRAFT_REPAIR_START"
|
|
||||||
},
|
|
||||||
[EVENTS.HumanAircraftRepairFinish] = {
|
|
||||||
Order = 1,
|
|
||||||
Side = "I",
|
|
||||||
Event = "OnEventHumanAircraftRepairFinish",
|
|
||||||
Text = "S_EVENT_HUMAN_AIRCRAFT_REPAIR_FINISH"
|
|
||||||
},
|
|
||||||
-- dynamic cargo
|
|
||||||
[EVENTS.NewDynamicCargo] = {
|
|
||||||
Order = 1,
|
|
||||||
Side = "I",
|
|
||||||
Event = "OnEventNewDynamicCargo",
|
|
||||||
Text = "S_EVENT_NEW_DYNAMIC_CARGO"
|
|
||||||
},
|
|
||||||
[EVENTS.DynamicCargoLoaded] = {
|
|
||||||
Order = 1,
|
|
||||||
Side = "I",
|
|
||||||
Event = "OnEventDynamicCargoLoaded",
|
|
||||||
Text = "S_EVENT_DYNAMIC_CARGO_LOADED"
|
|
||||||
},
|
|
||||||
[EVENTS.DynamicCargoUnloaded] = {
|
|
||||||
Order = 1,
|
|
||||||
Side = "I",
|
|
||||||
Event = "OnEventDynamicCargoUnloaded",
|
|
||||||
Text = "S_EVENT_DYNAMIC_CARGO_UNLOADED"
|
|
||||||
},
|
|
||||||
[EVENTS.DynamicCargoRemoved] = {
|
|
||||||
Order = 1,
|
|
||||||
Side = "I",
|
|
||||||
Event = "OnEventDynamicCargoRemoved",
|
|
||||||
Text = "S_EVENT_DYNAMIC_CARGO_REMOVED"
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
--- The Events structure
|
--- The Events structure
|
||||||
-- @type EVENT.Events
|
-- @type EVENT.Events
|
||||||
-- @field #number IniUnit
|
-- @field #number IniUnit
|
||||||
@@ -1184,63 +1050,7 @@ do -- Event Creation
|
|||||||
|
|
||||||
world.onEvent( Event )
|
world.onEvent( Event )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Creation of a S_EVENT_NEW_DYNAMIC_CARGO event.
|
|
||||||
-- @param #EVENT self
|
|
||||||
-- @param Wrapper.DynamicCargo#DYNAMICCARGO DynamicCargo the dynamic cargo object
|
|
||||||
function EVENT:CreateEventNewDynamicCargo(DynamicCargo)
|
|
||||||
self:F({DynamicCargo})
|
|
||||||
local Event = {
|
|
||||||
id = EVENTS.NewDynamicCargo,
|
|
||||||
time = timer.getTime(),
|
|
||||||
dynamiccargo = DynamicCargo,
|
|
||||||
initiator = DynamicCargo:GetDCSObject(),
|
|
||||||
}
|
|
||||||
world.onEvent( Event )
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Creation of a S_EVENT_DYNAMIC_CARGO_LOADED event.
|
|
||||||
-- @param #EVENT self
|
|
||||||
-- @param Wrapper.DynamicCargo#DYNAMICCARGO DynamicCargo the dynamic cargo object
|
|
||||||
function EVENT:CreateEventDynamicCargoLoaded(DynamicCargo)
|
|
||||||
self:F({DynamicCargo})
|
|
||||||
local Event = {
|
|
||||||
id = EVENTS.DynamicCargoLoaded,
|
|
||||||
time = timer.getTime(),
|
|
||||||
dynamiccargo = DynamicCargo,
|
|
||||||
initiator = DynamicCargo:GetDCSObject(),
|
|
||||||
}
|
|
||||||
world.onEvent( Event )
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Creation of a S_EVENT_DYNAMIC_CARGO_UNLOADED event.
|
|
||||||
-- @param #EVENT self
|
|
||||||
-- @param Wrapper.DynamicCargo#DYNAMICCARGO DynamicCargo the dynamic cargo object
|
|
||||||
function EVENT:CreateEventDynamicCargoUnloaded(DynamicCargo)
|
|
||||||
self:F({DynamicCargo})
|
|
||||||
local Event = {
|
|
||||||
id = EVENTS.DynamicCargoUnloaded,
|
|
||||||
time = timer.getTime(),
|
|
||||||
dynamiccargo = DynamicCargo,
|
|
||||||
initiator = DynamicCargo:GetDCSObject(),
|
|
||||||
}
|
|
||||||
world.onEvent( Event )
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Creation of a S_EVENT_DYNAMIC_CARGO_REMOVED event.
|
|
||||||
-- @param #EVENT self
|
|
||||||
-- @param Wrapper.DynamicCargo#DYNAMICCARGO DynamicCargo the dynamic cargo object
|
|
||||||
function EVENT:CreateEventDynamicCargoRemoved(DynamicCargo)
|
|
||||||
self:F({DynamicCargo})
|
|
||||||
local Event = {
|
|
||||||
id = EVENTS.DynamicCargoRemoved,
|
|
||||||
time = timer.getTime(),
|
|
||||||
dynamiccargo = DynamicCargo,
|
|
||||||
initiator = DynamicCargo:GetDCSObject(),
|
|
||||||
}
|
|
||||||
world.onEvent( Event )
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Main event function.
|
--- Main event function.
|
||||||
@@ -1329,7 +1139,6 @@ function EVENT:onEvent( Event )
|
|||||||
end
|
end
|
||||||
|
|
||||||
Event.IniDCSGroupName = Event.IniUnit and Event.IniUnit.GroupName or ""
|
Event.IniDCSGroupName = Event.IniUnit and Event.IniUnit.GroupName or ""
|
||||||
Event.IniGroupName=Event.IniDCSGroupName --At least set the group name because group might not exist any more
|
|
||||||
if Event.IniDCSGroup and Event.IniDCSGroup:isExist() then
|
if Event.IniDCSGroup and Event.IniDCSGroup:isExist() then
|
||||||
Event.IniDCSGroupName = Event.IniDCSGroup:getName()
|
Event.IniDCSGroupName = Event.IniDCSGroup:getName()
|
||||||
Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
|
Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
|
||||||
@@ -1356,13 +1165,7 @@ function EVENT:onEvent( Event )
|
|||||||
Event.IniDCSUnit = Event.initiator
|
Event.IniDCSUnit = Event.initiator
|
||||||
Event.IniDCSUnitName = Event.IniDCSUnit:getName()
|
Event.IniDCSUnitName = Event.IniDCSUnit:getName()
|
||||||
Event.IniUnitName = Event.IniDCSUnitName
|
Event.IniUnitName = Event.IniDCSUnitName
|
||||||
if string.match(Event.IniUnitName,".+|%d%d:%d%d|PKG%d+") then
|
Event.IniUnit = CARGO:FindByName( Event.IniDCSUnitName )
|
||||||
Event.IniDynamicCargo = DYNAMICCARGO:FindByName(Event.IniUnitName)
|
|
||||||
Event.IniDynamicCargoName = Event.IniUnitName
|
|
||||||
Event.IniPlayerName = string.match(Event.IniUnitName,"^(.+)|%d%d:%d%d|PKG%d+")
|
|
||||||
else
|
|
||||||
Event.IniUnit = CARGO:FindByName( Event.IniDCSUnitName )
|
|
||||||
end
|
|
||||||
Event.IniCoalition = Event.IniDCSUnit:getCoalition()
|
Event.IniCoalition = Event.IniDCSUnit:getCoalition()
|
||||||
Event.IniCategory = Event.IniDCSUnit:getDesc().category
|
Event.IniCategory = Event.IniDCSUnit:getDesc().category
|
||||||
Event.IniTypeName = Event.IniDCSUnit:getTypeName()
|
Event.IniTypeName = Event.IniDCSUnit:getTypeName()
|
||||||
@@ -1372,12 +1175,11 @@ function EVENT:onEvent( Event )
|
|||||||
-- Scenery
|
-- Scenery
|
||||||
---
|
---
|
||||||
Event.IniDCSUnit = Event.initiator
|
Event.IniDCSUnit = Event.initiator
|
||||||
Event.IniDCSUnitName = ( Event.IniDCSUnit and Event.IniDCSUnit.getName ) and Event.IniDCSUnit:getName() or "Scenery no name "..math.random(1,20000)
|
Event.IniDCSUnitName = Event.IniDCSUnit:getName()
|
||||||
Event.IniUnitName = Event.IniDCSUnitName
|
Event.IniUnitName = Event.IniDCSUnitName
|
||||||
Event.IniUnit = SCENERY:Register( Event.IniDCSUnitName, Event.initiator )
|
Event.IniUnit = SCENERY:Register( Event.IniDCSUnitName, Event.initiator )
|
||||||
Event.IniCategory = (Event.IniDCSUnit and Event.IniDCSUnit.getDesc ) and Event.IniDCSUnit:getDesc().category
|
Event.IniCategory = Event.IniDCSUnit:getDesc().category
|
||||||
Event.IniTypeName = (Event.initiator and Event.initiator.isExist
|
Event.IniTypeName = Event.initiator:isExist() and Event.IniDCSUnit:getTypeName() or "SCENERY"
|
||||||
and Event.initiator:isExist() and Event.IniDCSUnit and Event.IniDCSUnit.getTypeName) and Event.IniDCSUnit:getTypeName() or "SCENERY"
|
|
||||||
|
|
||||||
elseif Event.IniObjectCategory == Object.Category.BASE then
|
elseif Event.IniObjectCategory == Object.Category.BASE then
|
||||||
---
|
---
|
||||||
@@ -1441,16 +1243,13 @@ function EVENT:onEvent( Event )
|
|||||||
-- STATIC
|
-- STATIC
|
||||||
---
|
---
|
||||||
Event.TgtDCSUnit = Event.target
|
Event.TgtDCSUnit = Event.target
|
||||||
if Event.target.isExist and Event.target:isExist() and Event.id ~= 33 then -- leave out ejected seat object, check that isExist exists (Kiowa Hellfire issue, Special K)
|
if Event.target:isExist() and Event.id ~= 33 then -- leave out ejected seat object
|
||||||
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
|
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
|
||||||
-- Workaround for borked target info on cruise missiles
|
Event.TgtUnitName = Event.TgtDCSUnitName
|
||||||
if Event.TgtDCSUnitName and Event.TgtDCSUnitName ~= "" then
|
Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName, false )
|
||||||
Event.TgtUnitName = Event.TgtDCSUnitName
|
Event.TgtCoalition = Event.TgtDCSUnit:getCoalition()
|
||||||
Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName, false )
|
Event.TgtCategory = Event.TgtDCSUnit:getDesc().category
|
||||||
Event.TgtCoalition = Event.TgtDCSUnit:getCoalition()
|
Event.TgtTypeName = Event.TgtDCSUnit:getTypeName()
|
||||||
Event.TgtCategory = Event.TgtDCSUnit:getDesc().category
|
|
||||||
Event.TgtTypeName = Event.TgtDCSUnit:getTypeName()
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
Event.TgtDCSUnitName = string.format("No target object for Event ID %s", tostring(Event.id))
|
Event.TgtDCSUnitName = string.format("No target object for Event ID %s", tostring(Event.id))
|
||||||
Event.TgtUnitName = Event.TgtDCSUnitName
|
Event.TgtUnitName = Event.TgtDCSUnitName
|
||||||
@@ -1475,26 +1274,23 @@ function EVENT:onEvent( Event )
|
|||||||
-- SCENERY
|
-- SCENERY
|
||||||
---
|
---
|
||||||
Event.TgtDCSUnit = Event.target
|
Event.TgtDCSUnit = Event.target
|
||||||
Event.TgtDCSUnitName = Event.TgtDCSUnit.getName and Event.TgtDCSUnit.getName() or nil
|
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
|
||||||
if Event.TgtDCSUnitName~=nil then
|
Event.TgtUnitName = Event.TgtDCSUnitName
|
||||||
Event.TgtUnitName = Event.TgtDCSUnitName
|
Event.TgtUnit = SCENERY:Register( Event.TgtDCSUnitName, Event.target )
|
||||||
Event.TgtUnit = SCENERY:Register( Event.TgtDCSUnitName, Event.target )
|
Event.TgtCategory = Event.TgtDCSUnit:getDesc().category
|
||||||
Event.TgtCategory = Event.TgtDCSUnit:getDesc().category
|
Event.TgtTypeName = Event.TgtDCSUnit:getTypeName()
|
||||||
Event.TgtTypeName = Event.TgtDCSUnit:getTypeName()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Weapon.
|
-- Weapon.
|
||||||
if Event.weapon and type(Event.weapon) == "table" and Event.weapon.isExist and Event.weapon:isExist() then
|
if Event.weapon then
|
||||||
Event.Weapon = Event.weapon
|
Event.Weapon = Event.weapon
|
||||||
Event.WeaponName = Event.weapon:isExist() and Event.weapon:getTypeName() or "Unknown Weapon"
|
Event.WeaponName = Event.Weapon:getTypeName()
|
||||||
Event.WeaponUNIT = CLIENT:Find( Event.Weapon, '', true ) -- Sometimes, the weapon is a player unit!
|
Event.WeaponUNIT = CLIENT:Find( Event.Weapon, '', true ) -- Sometimes, the weapon is a player unit!
|
||||||
Event.WeaponPlayerName = Event.WeaponUNIT and Event.Weapon.getPlayerName and Event.Weapon:getPlayerName()
|
Event.WeaponPlayerName = Event.WeaponUNIT and Event.Weapon:getPlayerName()
|
||||||
--Event.WeaponPlayerName = Event.WeaponUNIT and Event.Weapon:getPlayerName()
|
Event.WeaponCoalition = Event.WeaponUNIT and Event.Weapon:getCoalition()
|
||||||
Event.WeaponCoalition = Event.WeaponUNIT and Event.Weapon.getCoalition and Event.Weapon:getCoalition()
|
Event.WeaponCategory = Event.WeaponUNIT and Event.Weapon:getDesc().category
|
||||||
Event.WeaponCategory = Event.WeaponUNIT and Event.Weapon.getDesc and Event.Weapon:getDesc().category
|
Event.WeaponTypeName = Event.WeaponUNIT and Event.Weapon:getTypeName()
|
||||||
Event.WeaponTypeName = Event.WeaponUNIT and Event.Weapon.getTypeName and Event.Weapon:getTypeName()
|
|
||||||
--Event.WeaponTgtDCSUnit = Event.Weapon:getTarget()
|
--Event.WeaponTgtDCSUnit = Event.Weapon:getTarget()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1520,7 +1316,6 @@ function EVENT:onEvent( Event )
|
|||||||
Event.MarkCoordinate=COORDINATE:NewFromVec3(Event.pos)
|
Event.MarkCoordinate=COORDINATE:NewFromVec3(Event.pos)
|
||||||
Event.MarkText=Event.text
|
Event.MarkText=Event.text
|
||||||
Event.MarkCoalition=Event.coalition
|
Event.MarkCoalition=Event.coalition
|
||||||
Event.IniCoalition=Event.coalition
|
|
||||||
Event.MarkGroupID = Event.groupID
|
Event.MarkGroupID = Event.groupID
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1529,15 +1324,6 @@ function EVENT:onEvent( Event )
|
|||||||
Event.Cargo = Event.cargo
|
Event.Cargo = Event.cargo
|
||||||
Event.CargoName = Event.cargo.Name
|
Event.CargoName = Event.cargo.Name
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Dynamic cargo Object
|
|
||||||
if Event.dynamiccargo then
|
|
||||||
Event.IniDynamicCargo = Event.dynamiccargo
|
|
||||||
Event.IniDynamicCargoName = Event.IniDynamicCargo.StaticName
|
|
||||||
if Event.IniDynamicCargo.Owner or Event.IniUnitName then
|
|
||||||
Event.IniPlayerName = Event.IniDynamicCargo.Owner or string.match(Event.IniUnitName or "None|00:00|PKG00","^(.+)|%d%d:%d%d|PKG%d+")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Zone object.
|
-- Zone object.
|
||||||
if Event.zone then
|
if Event.zone then
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ do -- FSM
|
|||||||
--
|
--
|
||||||
-- ### Linear Transition Example
|
-- ### Linear Transition Example
|
||||||
--
|
--
|
||||||
-- This example is fully implemented in the MOOSE test mission on GitHub: [FSM-100 - Transition Explanation](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Core/FSM/FSM-100%20-%20Transition%20Explanation)
|
-- This example is fully implemented in the MOOSE test mission on GITHUB: [FSM-100 - Transition Explanation](https://github.com/FlightControl-Master/MOOSE_MISSIONS/blob/master/FSM%20-%20Finite%20State%20Machine/FSM-100%20-%20Transition%20Explanation/FSM-100%20-%20Transition%20Explanation.lua)
|
||||||
--
|
--
|
||||||
-- It models a unit standing still near Batumi, and flaring every 5 seconds while switching between a Green flare and a Red flare.
|
-- It models a unit standing still near Batumi, and flaring every 5 seconds while switching between a Green flare and a Red flare.
|
||||||
-- The purpose of this example is not to show how exciting flaring is, but it demonstrates how a Linear Transition FSM can be build.
|
-- The purpose of this example is not to show how exciting flaring is, but it demonstrates how a Linear Transition FSM can be build.
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
-- ### Author: **Applevangelist**
|
-- ### Author: **Applevangelist**
|
||||||
--
|
--
|
||||||
-- Date: 5 May 2021
|
-- Date: 5 May 2021
|
||||||
-- Last Update: Mar 2023
|
-- Last Update: Feb 2023
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
---
|
---
|
||||||
@@ -50,7 +50,7 @@ MARKEROPS_BASE = {
|
|||||||
ClassName = "MARKEROPS",
|
ClassName = "MARKEROPS",
|
||||||
Tag = "mytag",
|
Tag = "mytag",
|
||||||
Keywords = {},
|
Keywords = {},
|
||||||
version = "0.1.4",
|
version = "0.1.1",
|
||||||
debug = false,
|
debug = false,
|
||||||
Casesensitive = true,
|
Casesensitive = true,
|
||||||
}
|
}
|
||||||
@@ -108,30 +108,23 @@ function MARKEROPS_BASE:New(Tagname,Keywords,Casesensitive)
|
|||||||
--- On after "MarkAdded" event. Triggered when a Marker is added to the F10 map.
|
--- On after "MarkAdded" event. Triggered when a Marker is added to the F10 map.
|
||||||
-- @function [parent=#MARKEROPS_BASE] OnAfterMarkAdded
|
-- @function [parent=#MARKEROPS_BASE] OnAfterMarkAdded
|
||||||
-- @param #MARKEROPS_BASE self
|
-- @param #MARKEROPS_BASE self
|
||||||
-- @param #string From The From state.
|
-- @param #string From The From state
|
||||||
-- @param #string Event The Event called.
|
-- @param #string Event The Event called
|
||||||
-- @param #string To The To state.
|
-- @param #string To The To state
|
||||||
-- @param #string Text The text on the marker.
|
-- @param #string Text The text on the marker
|
||||||
-- @param #table Keywords Table of matching keywords found in the Event text.
|
-- @param #table Keywords Table of matching keywords found in the Event text
|
||||||
-- @param Core.Point#COORDINATE Coord Coordinate of the marker.
|
-- @param Core.Point#COORDINATE Coord Coordinate of the marker.
|
||||||
-- @param #number MarkerID Id of this marker.
|
|
||||||
-- @param #number CoalitionNumber Coalition of the marker creator.
|
|
||||||
-- @param #string PlayerName Name of the player creating/changing the mark. nil if it cannot be obtained.
|
|
||||||
-- @param Core.Event#EVENTDATA EventData the event data table.
|
|
||||||
|
|
||||||
--- On after "MarkChanged" event. Triggered when a Marker is changed on the F10 map.
|
--- On after "MarkChanged" event. Triggered when a Marker is changed on the F10 map.
|
||||||
-- @function [parent=#MARKEROPS_BASE] OnAfterMarkChanged
|
-- @function [parent=#MARKEROPS_BASE] OnAfterMarkChanged
|
||||||
-- @param #MARKEROPS_BASE self
|
-- @param #MARKEROPS_BASE self
|
||||||
-- @param #string From The From state.
|
-- @param #string From The From state
|
||||||
-- @param #string Event The Event called.
|
-- @param #string Event The Event called
|
||||||
-- @param #string To The To state.
|
-- @param #string To The To state
|
||||||
-- @param #string Text The text on the marker.
|
-- @param #string Text The text on the marker
|
||||||
-- @param #table Keywords Table of matching keywords found in the Event text.
|
-- @param #table Keywords Table of matching keywords found in the Event text
|
||||||
-- @param Core.Point#COORDINATE Coord Coordinate of the marker.
|
-- @param Core.Point#COORDINATE Coord Coordinate of the marker.
|
||||||
-- @param #number MarkerID Id of this marker.
|
-- @param #number idx DCS Marker ID
|
||||||
-- @param #number CoalitionNumber Coalition of the marker creator.
|
|
||||||
-- @param #string PlayerName Name of the player creating/changing the mark. nil if it cannot be obtained.
|
|
||||||
-- @param Core.Event#EVENTDATA EventData the event data table
|
|
||||||
|
|
||||||
--- On after "MarkDeleted" event. Triggered when a Marker is deleted from the F10 map.
|
--- On after "MarkDeleted" event. Triggered when a Marker is deleted from the F10 map.
|
||||||
-- @function [parent=#MARKEROPS_BASE] OnAfterMarkDeleted
|
-- @function [parent=#MARKEROPS_BASE] OnAfterMarkDeleted
|
||||||
@@ -140,7 +133,7 @@ function MARKEROPS_BASE:New(Tagname,Keywords,Casesensitive)
|
|||||||
-- @param #string Event The Event called
|
-- @param #string Event The Event called
|
||||||
-- @param #string To The To state
|
-- @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
|
-- @function [parent=#MARKEROPS_BASE] Stop
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -154,43 +147,37 @@ function MARKEROPS_BASE:OnEventMark(Event)
|
|||||||
self:E("Skipping onEvent. Event or Event.idx unknown.")
|
self:E("Skipping onEvent. Event or Event.idx unknown.")
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
--position
|
||||||
local coalition = Event.MarkCoalition
|
local vec3={y=Event.pos.y, x=Event.pos.x, z=Event.pos.z}
|
||||||
|
local coord=COORDINATE:NewFromVec3(vec3)
|
||||||
|
if self.debug then
|
||||||
|
local coordtext = coord:ToStringLLDDM()
|
||||||
|
local text = tostring(Event.text)
|
||||||
|
local m = MESSAGE:New(string.format("Mark added at %s with text: %s",coordtext,text),10,"Info",false):ToAll()
|
||||||
|
end
|
||||||
-- decision
|
-- decision
|
||||||
if Event.id==world.event.S_EVENT_MARK_ADDED then
|
if Event.id==world.event.S_EVENT_MARK_ADDED then
|
||||||
self:T({event="S_EVENT_MARK_ADDED", carrier=Event.IniGroupName, vec3=Event.pos})
|
self:T({event="S_EVENT_MARK_ADDED", carrier=self.groupname, vec3=Event.pos})
|
||||||
-- Handle event
|
-- Handle event
|
||||||
local Eventtext = tostring(Event.text)
|
local Eventtext = tostring(Event.text)
|
||||||
if Eventtext~=nil then
|
if Eventtext~=nil then
|
||||||
if self:_MatchTag(Eventtext) then
|
if self:_MatchTag(Eventtext) then
|
||||||
local coord=COORDINATE:NewFromVec3({y=Event.pos.y, x=Event.pos.x, z=Event.pos.z})
|
local matchtable = self:_MatchKeywords(Eventtext)
|
||||||
if self.debug then
|
self:MarkAdded(Eventtext,matchtable,coord)
|
||||||
local coordtext = coord:ToStringLLDDM()
|
|
||||||
local text = tostring(Event.text)
|
|
||||||
local m = MESSAGE:New(string.format("Mark added at %s with text: %s",coordtext,text),10,"Info",false):ToAll()
|
|
||||||
end
|
|
||||||
local matchtable = self:_MatchKeywords(Eventtext)
|
|
||||||
self:MarkAdded(Eventtext,matchtable,coord,Event.idx,coalition,Event.PlayerName,Event)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif Event.id==world.event.S_EVENT_MARK_CHANGE then
|
elseif Event.id==world.event.S_EVENT_MARK_CHANGE then
|
||||||
self:T({event="S_EVENT_MARK_CHANGE", carrier=Event.IniGroupName, vec3=Event.pos})
|
self:T({event="S_EVENT_MARK_CHANGE", carrier=self.groupname, vec3=Event.pos})
|
||||||
-- Handle event.
|
-- Handle event.
|
||||||
local Eventtext = tostring(Event.text)
|
local Eventtext = tostring(Event.text)
|
||||||
if Eventtext~=nil then
|
if Eventtext~=nil then
|
||||||
if self:_MatchTag(Eventtext) then
|
if self:_MatchTag(Eventtext) then
|
||||||
local coord=COORDINATE:NewFromVec3({y=Event.pos.y, x=Event.pos.x, z=Event.pos.z})
|
local matchtable = self:_MatchKeywords(Eventtext)
|
||||||
if self.debug then
|
self:MarkChanged(Eventtext,matchtable,coord,Event.idx)
|
||||||
local coordtext = coord:ToStringLLDDM()
|
|
||||||
local text = tostring(Event.text)
|
|
||||||
local m = MESSAGE:New(string.format("Mark changed at %s with text: %s",coordtext,text),10,"Info",false):ToAll()
|
|
||||||
end
|
|
||||||
local matchtable = self:_MatchKeywords(Eventtext)
|
|
||||||
self:MarkChanged(Eventtext,matchtable,coord,Event.idx,coalition,Event.PlayerName,Event)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif Event.id==world.event.S_EVENT_MARK_REMOVED then
|
elseif Event.id==world.event.S_EVENT_MARK_REMOVED then
|
||||||
self:T({event="S_EVENT_MARK_REMOVED", carrier=Event.IniGroupName, vec3=Event.pos})
|
self:T({event="S_EVENT_MARK_REMOVED", carrier=self.groupname, vec3=Event.pos})
|
||||||
-- Hande event.
|
-- Hande event.
|
||||||
local Eventtext = tostring(Event.text)
|
local Eventtext = tostring(Event.text)
|
||||||
if Eventtext~=nil then
|
if Eventtext~=nil then
|
||||||
@@ -243,10 +230,8 @@ end
|
|||||||
-- @param #string To The To state
|
-- @param #string To The To state
|
||||||
-- @param #string Text The text on the marker
|
-- @param #string Text The text on the marker
|
||||||
-- @param #table Keywords Table of matching keywords found in the Event text
|
-- @param #table Keywords Table of matching keywords found in the Event text
|
||||||
-- @param #number MarkerID Id of this marker
|
|
||||||
-- @param #number CoalitionNumber Coalition of the marker creator
|
|
||||||
-- @param Core.Point#COORDINATE Coord Coordinate of the marker.
|
-- @param Core.Point#COORDINATE Coord Coordinate of the marker.
|
||||||
function MARKEROPS_BASE:onbeforeMarkAdded(From,Event,To,Text,Keywords,Coord,MarkerID,CoalitionNumber)
|
function MARKEROPS_BASE:onbeforeMarkAdded(From,Event,To,Text,Keywords,Coord)
|
||||||
self:T({self.lid,From,Event,To,Text,Keywords,Coord:ToStringLLDDM()})
|
self:T({self.lid,From,Event,To,Text,Keywords,Coord:ToStringLLDDM()})
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -257,10 +242,8 @@ end
|
|||||||
-- @param #string To The To state
|
-- @param #string To The To state
|
||||||
-- @param #string Text The text on the marker
|
-- @param #string Text The text on the marker
|
||||||
-- @param #table Keywords Table of matching keywords found in the Event text
|
-- @param #table Keywords Table of matching keywords found in the Event text
|
||||||
-- @param #number MarkerID Id of this marker
|
|
||||||
-- @param #number CoalitionNumber Coalition of the marker creator
|
|
||||||
-- @param Core.Point#COORDINATE Coord Coordinate of the marker.
|
-- @param Core.Point#COORDINATE Coord Coordinate of the marker.
|
||||||
function MARKEROPS_BASE:onbeforeMarkChanged(From,Event,To,Text,Keywords,Coord,MarkerID,CoalitionNumber)
|
function MARKEROPS_BASE:onbeforeMarkChanged(From,Event,To,Text,Keywords,Coord)
|
||||||
self:T({self.lid,From,Event,To,Text,Keywords,Coord:ToStringLLDDM()})
|
self:T({self.lid,From,Event,To,Text,Keywords,Coord:ToStringLLDDM()})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -75,37 +75,35 @@ MESSAGE.Type = {
|
|||||||
|
|
||||||
--- Creates a new MESSAGE object. Note that these MESSAGE objects are not yet displayed on the display panel. You must use the functions @{#MESSAGE.ToClient} or @{#MESSAGE.ToCoalition} or @{#MESSAGE.ToAll} to send these Messages to the respective recipients.
|
--- Creates a new MESSAGE object. Note that these MESSAGE objects are not yet displayed on the display panel. You must use the functions @{#MESSAGE.ToClient} or @{#MESSAGE.ToCoalition} or @{#MESSAGE.ToAll} to send these Messages to the respective recipients.
|
||||||
-- @param self
|
-- @param self
|
||||||
-- @param #string Text is the text of the Message.
|
-- @param #string MessageText is the text of the Message.
|
||||||
-- @param #number Duration Duration in seconds how long the message text is shown.
|
-- @param #number MessageDuration is a number in seconds of how long the MESSAGE should be shown on the display panel.
|
||||||
-- @param #string Category (Optional) String expressing the "category" of the Message. The category will be shown as the first text in the message followed by a ": ".
|
-- @param #string MessageCategory (optional) is a string expressing the "category" of the Message. The category will be shown as the first text in the message followed by a ": ".
|
||||||
-- @param #boolean ClearScreen (optional) Clear all previous messages if true.
|
-- @param #boolean ClearScreen (optional) Clear all previous messages if true.
|
||||||
-- @return #MESSAGE self
|
-- @return #MESSAGE
|
||||||
-- @usage
|
-- @usage
|
||||||
--
|
--
|
||||||
-- -- Create a series of new Messages.
|
-- -- Create a series of new Messages.
|
||||||
-- -- MessageAll is meant to be sent to all players, for 25 seconds, and is classified as "Score".
|
-- -- MessageAll is meant to be sent to all players, for 25 seconds, and is classified as "Score".
|
||||||
-- -- MessageRED is meant to be sent to the RED players only, for 10 seconds, and is classified as "End of Mission", with ID "Win".
|
-- -- MessageRED is meant to be sent to the RED players only, for 10 seconds, and is classified as "End of Mission", with ID "Win".
|
||||||
-- -- MessageClient1 is meant to be sent to a Client, for 25 seconds, and is classified as "Score", with ID "Score".
|
-- -- MessageClient1 is meant to be sent to a Client, for 25 seconds, and is classified as "Score", with ID "Score".
|
||||||
-- -- MessageClient1 is meant to be sent to a Client, for 25 seconds, and is classified as "Score", with ID "Score".
|
-- -- MessageClient1 is meant to be sent to a Client, for 25 seconds, and is classified as "Score", with ID "Score".
|
||||||
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", 25, "End of Mission" )
|
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", 25, "End of Mission" )
|
||||||
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", 25, "Penalty" )
|
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", 25, "Penalty" )
|
||||||
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", 25, "Score" )
|
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", 25, "Score" )
|
||||||
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", 25, "Score")
|
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", 25, "Score")
|
||||||
--
|
--
|
||||||
function MESSAGE:New( Text, Duration, Category, ClearScreen )
|
function MESSAGE:New( MessageText, MessageDuration, MessageCategory, ClearScreen )
|
||||||
|
|
||||||
local self = BASE:Inherit( self, BASE:New() )
|
local self = BASE:Inherit( self, BASE:New() )
|
||||||
|
self:F( { MessageText, MessageDuration, MessageCategory } )
|
||||||
self:F( { Text, Duration, Category } )
|
|
||||||
|
|
||||||
self.MessageType = nil
|
self.MessageType = nil
|
||||||
|
|
||||||
-- When no MessageCategory is given, we don't show it as a title...
|
-- When no MessageCategory is given, we don't show it as a title...
|
||||||
if Category and Category ~= "" then
|
if MessageCategory and MessageCategory ~= "" then
|
||||||
if Category:sub( -1 ) ~= "\n" then
|
if MessageCategory:sub( -1 ) ~= "\n" then
|
||||||
self.MessageCategory = Category .. ": "
|
self.MessageCategory = MessageCategory .. ": "
|
||||||
else
|
else
|
||||||
self.MessageCategory = Category:sub( 1, -2 ) .. ":\n"
|
self.MessageCategory = MessageCategory:sub( 1, -2 ) .. ":\n"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
self.MessageCategory = ""
|
self.MessageCategory = ""
|
||||||
@@ -116,9 +114,9 @@ function MESSAGE:New( Text, Duration, Category, ClearScreen )
|
|||||||
self.ClearScreen = ClearScreen
|
self.ClearScreen = ClearScreen
|
||||||
end
|
end
|
||||||
|
|
||||||
self.MessageDuration = Duration or 5
|
self.MessageDuration = MessageDuration or 5
|
||||||
self.MessageTime = timer.getTime()
|
self.MessageTime = timer.getTime()
|
||||||
self.MessageText = Text:gsub( "^\n", "", 1 ):gsub( "\n$", "", 1 )
|
self.MessageText = MessageText:gsub( "^\n", "", 1 ):gsub( "\n$", "", 1 )
|
||||||
|
|
||||||
self.MessageSent = false
|
self.MessageSent = false
|
||||||
self.MessageGroup = false
|
self.MessageGroup = false
|
||||||
@@ -179,22 +177,40 @@ end
|
|||||||
--
|
--
|
||||||
-- -- Send the 2 messages created with the @{New} method to the Client Group.
|
-- -- Send the 2 messages created with the @{New} method to the Client Group.
|
||||||
-- -- Note that the Message of MessageClient2 is overwriting the Message of MessageClient1.
|
-- -- Note that the Message of MessageClient2 is overwriting the Message of MessageClient1.
|
||||||
-- Client = CLIENT:FindByName("NameOfClientUnit")
|
-- ClientGroup = Group.getByName( "ClientGroup" )
|
||||||
--
|
--
|
||||||
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", 25, "Score" ):ToClient( Client )
|
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25, "Score" ):ToClient( ClientGroup )
|
||||||
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", 25, "Score" ):ToClient( Client )
|
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25, "Score" ):ToClient( ClientGroup )
|
||||||
-- or
|
-- or
|
||||||
-- MESSAGE:New( "Congratulations, you've just hit a target", 25, "Score"):ToClient( Client )
|
-- MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25 ):ToClient( ClientGroup )
|
||||||
-- MESSAGE:New( "Congratulations, you've just killed a target", 25, "Score"):ToClient( Client )
|
-- MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25 ):ToClient( ClientGroup )
|
||||||
-- or
|
-- or
|
||||||
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", 25, "Score")
|
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25 )
|
||||||
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", 25, "Score")
|
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25 )
|
||||||
-- MessageClient1:ToClient( Client )
|
-- MessageClient1:ToClient( ClientGroup )
|
||||||
-- MessageClient2:ToClient( Client )
|
-- MessageClient2:ToClient( ClientGroup )
|
||||||
--
|
--
|
||||||
function MESSAGE:ToClient( Client, Settings )
|
function MESSAGE:ToClient( Client, Settings )
|
||||||
self:F( Client )
|
self:F( Client )
|
||||||
self:ToUnit(Client,Settings)
|
|
||||||
|
if Client and Client:GetClientGroupID() then
|
||||||
|
|
||||||
|
if self.MessageType then
|
||||||
|
local Settings = Settings or ( Client and _DATABASE:GetPlayerSettings( Client:GetPlayerName() ) ) or _SETTINGS -- Core.Settings#SETTINGS
|
||||||
|
self.MessageDuration = Settings:GetMessageTime( self.MessageType )
|
||||||
|
self.MessageCategory = "" -- self.MessageType .. ": "
|
||||||
|
end
|
||||||
|
|
||||||
|
local Unit = Client:GetClient()
|
||||||
|
|
||||||
|
if self.MessageDuration ~= 0 then
|
||||||
|
local ClientGroupID = Client:GetClientGroupID()
|
||||||
|
self:T( self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration )
|
||||||
|
--trigger.action.outTextForGroup( ClientGroupID, self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration , self.ClearScreen)
|
||||||
|
trigger.action.outTextForUnit( Unit:GetID(), self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration , self.ClearScreen)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -206,7 +222,7 @@ end
|
|||||||
function MESSAGE:ToGroup( Group, Settings )
|
function MESSAGE:ToGroup( Group, Settings )
|
||||||
self:F( Group.GroupName )
|
self:F( Group.GroupName )
|
||||||
|
|
||||||
if Group and Group:IsAlive() then
|
if Group then
|
||||||
|
|
||||||
if self.MessageType then
|
if self.MessageType then
|
||||||
local Settings = Settings or (Group and _DATABASE:GetPlayerSettings( Group:GetPlayerName() )) or _SETTINGS -- Core.Settings#SETTINGS
|
local Settings = Settings or (Group and _DATABASE:GetPlayerSettings( Group:GetPlayerName() )) or _SETTINGS -- Core.Settings#SETTINGS
|
||||||
@@ -231,7 +247,7 @@ end
|
|||||||
function MESSAGE:ToUnit( Unit, Settings )
|
function MESSAGE:ToUnit( Unit, Settings )
|
||||||
self:F( Unit.IdentifiableName )
|
self:F( Unit.IdentifiableName )
|
||||||
|
|
||||||
if Unit and Unit:IsAlive() then
|
if Unit then
|
||||||
|
|
||||||
if self.MessageType then
|
if self.MessageType then
|
||||||
local Settings = Settings or ( Unit and _DATABASE:GetPlayerSettings( Unit:GetPlayerName() ) ) or _SETTINGS -- Core.Settings#SETTINGS
|
local Settings = Settings or ( Unit and _DATABASE:GetPlayerSettings( Unit:GetPlayerName() ) ) or _SETTINGS -- Core.Settings#SETTINGS
|
||||||
@@ -241,7 +257,6 @@ function MESSAGE:ToUnit( Unit, Settings )
|
|||||||
|
|
||||||
if self.MessageDuration ~= 0 then
|
if self.MessageDuration ~= 0 then
|
||||||
self:T( self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration )
|
self:T( self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration )
|
||||||
local ID = Unit:GetID()
|
|
||||||
trigger.action.outTextForUnit( Unit:GetID(), self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration, self.ClearScreen )
|
trigger.action.outTextForUnit( Unit:GetID(), self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration, self.ClearScreen )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -290,11 +305,11 @@ end
|
|||||||
-- @usage
|
-- @usage
|
||||||
--
|
--
|
||||||
-- -- Send a message created with the @{New} method to the BLUE coalition.
|
-- -- Send a message created with the @{New} method to the BLUE coalition.
|
||||||
-- MessageBLUE = MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", 25, "Penalty"):ToBlue()
|
-- MessageBLUE = MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", "Penalty", 25):ToBlue()
|
||||||
-- or
|
-- or
|
||||||
-- MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", 25, "Penalty"):ToBlue()
|
-- MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 ):ToBlue()
|
||||||
-- or
|
-- or
|
||||||
-- MessageBLUE = MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", 25, "Penalty")
|
-- MessageBLUE = MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 )
|
||||||
-- MessageBLUE:ToBlue()
|
-- MessageBLUE:ToBlue()
|
||||||
--
|
--
|
||||||
function MESSAGE:ToBlue()
|
function MESSAGE:ToBlue()
|
||||||
@@ -311,11 +326,11 @@ end
|
|||||||
-- @usage
|
-- @usage
|
||||||
--
|
--
|
||||||
-- -- Send a message created with the @{New} method to the RED coalition.
|
-- -- Send a message created with the @{New} method to the RED coalition.
|
||||||
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", 25, "Penalty"):ToRed()
|
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 ):ToRed()
|
||||||
-- or
|
-- or
|
||||||
-- MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", 25, "Penalty"):ToRed()
|
-- MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 ):ToRed()
|
||||||
-- or
|
-- or
|
||||||
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", 25, "Penalty")
|
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 )
|
||||||
-- MessageRED:ToRed()
|
-- MessageRED:ToRed()
|
||||||
--
|
--
|
||||||
function MESSAGE:ToRed()
|
function MESSAGE:ToRed()
|
||||||
@@ -334,11 +349,11 @@ end
|
|||||||
-- @usage
|
-- @usage
|
||||||
--
|
--
|
||||||
-- -- Send a message created with the @{New} method to the RED coalition.
|
-- -- Send a message created with the @{New} method to the RED coalition.
|
||||||
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", 25, "Penalty"):ToCoalition( coalition.side.RED )
|
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 ):ToCoalition( coalition.side.RED )
|
||||||
-- or
|
-- or
|
||||||
-- MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", 25, "Penalty"):ToCoalition( coalition.side.RED )
|
-- MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 ):ToCoalition( coalition.side.RED )
|
||||||
-- or
|
-- or
|
||||||
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", 25, "Penalty")
|
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 )
|
||||||
-- MessageRED:ToCoalition( coalition.side.RED )
|
-- MessageRED:ToCoalition( coalition.side.RED )
|
||||||
--
|
--
|
||||||
function MESSAGE:ToCoalition( CoalitionSide, Settings )
|
function MESSAGE:ToCoalition( CoalitionSide, Settings )
|
||||||
@@ -353,7 +368,7 @@ function MESSAGE:ToCoalition( CoalitionSide, Settings )
|
|||||||
if CoalitionSide then
|
if CoalitionSide then
|
||||||
if self.MessageDuration ~= 0 then
|
if self.MessageDuration ~= 0 then
|
||||||
self:T( self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ) .. " / " .. self.MessageDuration )
|
self:T( self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ) .. " / " .. self.MessageDuration )
|
||||||
trigger.action.outTextForCoalition( CoalitionSide, self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ), self.MessageDuration, self.ClearScreen )
|
trigger.action.outTextForCoalition( CoalitionSide, self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ), self.MessageDuration, self.ClearScreen )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -380,36 +395,29 @@ end
|
|||||||
--- Sends a MESSAGE to all players.
|
--- Sends a MESSAGE to all players.
|
||||||
-- @param #MESSAGE self
|
-- @param #MESSAGE self
|
||||||
-- @param Core.Settings#Settings Settings (Optional) Settings for message display.
|
-- @param Core.Settings#Settings Settings (Optional) Settings for message display.
|
||||||
-- @param #number Delay (Optional) Delay in seconds before the message is send. Default instantly (`nil`).
|
-- @return #MESSAGE
|
||||||
-- @return #MESSAGE self
|
|
||||||
-- @usage
|
-- @usage
|
||||||
--
|
--
|
||||||
-- -- Send a message created to all players.
|
-- -- Send a message created to all players.
|
||||||
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", 25, "End of Mission"):ToAll()
|
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25 ):ToAll()
|
||||||
-- or
|
-- or
|
||||||
-- MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", 25, "End of Mission"):ToAll()
|
-- MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25 ):ToAll()
|
||||||
-- or
|
-- or
|
||||||
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", 25, "End of Mission")
|
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25 )
|
||||||
-- MessageAll:ToAll()
|
-- MessageAll:ToAll()
|
||||||
--
|
--
|
||||||
function MESSAGE:ToAll( Settings, Delay )
|
function MESSAGE:ToAll( Settings )
|
||||||
self:F()
|
self:F()
|
||||||
|
|
||||||
if Delay and Delay>0 then
|
if self.MessageType then
|
||||||
self:ScheduleOnce(Delay, MESSAGE.ToAll, self, Settings, 0)
|
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
||||||
else
|
self.MessageDuration = Settings:GetMessageTime( self.MessageType )
|
||||||
|
self.MessageCategory = "" -- self.MessageType .. ": "
|
||||||
|
end
|
||||||
|
|
||||||
if self.MessageType then
|
if self.MessageDuration ~= 0 then
|
||||||
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
self:T( self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ) .. " / " .. self.MessageDuration )
|
||||||
self.MessageDuration = Settings:GetMessageTime( self.MessageType )
|
trigger.action.outText( self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ), self.MessageDuration, self.ClearScreen )
|
||||||
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
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -451,77 +459,66 @@ end
|
|||||||
|
|
||||||
_MESSAGESRS = {}
|
_MESSAGESRS = {}
|
||||||
|
|
||||||
--- Set up MESSAGE generally to allow Text-To-Speech via SRS and TTS functions. `SetMSRS()` will try to use as many attributes configured with @{Sound.SRS#MSRS.LoadConfigFile}() as possible.
|
--- Set up MESSAGE generally to allow Text-To-Speech via SRS and TTS functions.
|
||||||
-- @param #string PathToSRS (optional) Path to SRS TTS Folder, defaults to "C:\\\\Program Files\\\\DCS-SimpleRadio-Standalone\\ExternalAudio" or your configuration file setting.
|
-- @param #string PathToSRS Path to SRS Folder, defaults to "C:\\\\Program Files\\\\DCS-SimpleRadio-Standalone".
|
||||||
-- @param #number Port Port (optional) number of SRS, defaults to 5002 or your configuration file setting.
|
-- @param #number Port Port number of SRS, defaults to 5002.
|
||||||
-- @param #string PathToCredentials (optional) Path to credentials file for Google.
|
-- @param #string PathToCredentials (optional) Path to credentials file for e.g. Google.
|
||||||
-- @param #number Frequency Frequency in MHz. Can also be given as a #table of frequencies.
|
-- @param #number Frequency Frequency in MHz. Can also be given as a #table of frequencies.
|
||||||
-- @param #number Modulation Modulation, i.e. radio.modulation.AM or radio.modulation.FM. Can also be given as a #table of modulations.
|
-- @param #number Modulation Modulation, i.e. radio.modulation.AM or radio.modulation.FM. Can also be given as a #table of modulations.
|
||||||
-- @param #string Gender (optional) Gender, i.e. "male" or "female", defaults to "female" or your configuration file setting.
|
-- @param #string Gender (optional) Gender, i.e. "male" or "female", defaults to "female".
|
||||||
-- @param #string Culture (optional) Culture, e.g. "en-US", defaults to "en-GB" or your configuration file setting.
|
-- @param #string Culture (optional) Culture, e.g. "en-US", defaults to "en-GB"
|
||||||
-- @param #string Voice (optional) Voice. Will override gender and culture settings, e.g. MSRS.Voices.Microsoft.Hazel or MSRS.Voices.Google.Standard.de_DE_Standard_D. Hint on Microsoft voices - working voices are limited to Hedda, Hazel, David, Zira and Hortense. **Must** be installed on your Desktop or Server!
|
-- @param #string Voice (optional) Voice. Will override gender and culture settings, e.g. MSRS.Voices.Microsoft.Hazel or MSRS.Voices.Google.Standard.de_DE_Standard_D. Hint on Microsoft voices - working voices are limited to Hedda, Hazel, David, Zira and Hortense. **Must** be installed on your Desktop or Server!
|
||||||
-- @param #number Coalition (optional) Coalition, can be coalition.side.RED, coalition.side.BLUE or coalition.side.NEUTRAL. Defaults to coalition.side.NEUTRAL.
|
-- @param #number Coalition (optional) Coalition, can be coalition.side.RED, coalition.side.BLUE or coalition.side.NEUTRAL. Defaults to coalition.side.NEUTRAL.
|
||||||
-- @param #number Volume (optional) Volume, can be between 0.0 and 1.0 (loudest).
|
-- @param #number Volume (optional) Volume, can be between 0.0 and 1.0 (loudest).
|
||||||
-- @param #string Label (optional) Label, defaults to "MESSAGE" or the Message Category set.
|
-- @param #string Label (optional) Label, defaults to "MESSAGE" or the Message Category set.
|
||||||
-- @param Core.Point#COORDINATE Coordinate (optional) Coordinate this messages originates from.
|
-- @param Core.Point#COORDINATE Coordinate (optional) Coordinate this messages originates from.
|
||||||
-- @param #string Backend (optional) Backend to be used, can be MSRS.Backend.SRSEXE or MSRS.Backend.GRPC
|
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Mind the dot here, not using the colon this time around!
|
-- -- Mind the dot here, not using the colon this time around!
|
||||||
-- -- Needed once only
|
-- -- Needed once only
|
||||||
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.BLUE)
|
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.BLUE)
|
||||||
-- -- later on in your code
|
-- -- later on in your code
|
||||||
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRS()
|
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRS()
|
||||||
--
|
--
|
||||||
function MESSAGE.SetMSRS(PathToSRS,Port,PathToCredentials,Frequency,Modulation,Gender,Culture,Voice,Coalition,Volume,Label,Coordinate,Backend)
|
function MESSAGE.SetMSRS(PathToSRS,Port,PathToCredentials,Frequency,Modulation,Gender,Culture,Voice,Coalition,Volume,Label,Coordinate)
|
||||||
|
_MESSAGESRS.MSRS = MSRS:New(PathToSRS,Frequency or 243,Modulation or radio.modulation.AM,Volume)
|
||||||
|
|
||||||
_MESSAGESRS.PathToSRS = PathToSRS or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio"
|
_MESSAGESRS.frequency = Frequency
|
||||||
|
_MESSAGESRS.modulation = Modulation or radio.modulation.AM
|
||||||
|
|
||||||
_MESSAGESRS.frequency = Frequency or MSRS.frequencies or 243
|
_MESSAGESRS.MSRS:SetCoalition(Coalition or coalition.side.NEUTRAL)
|
||||||
_MESSAGESRS.modulation = Modulation or MSRS.modulations or radio.modulation.AM
|
_MESSAGESRS.coalition = Coalition or coalition.side.NEUTRAL
|
||||||
|
|
||||||
_MESSAGESRS.MSRS = MSRS:New(_MESSAGESRS.PathToSRS,_MESSAGESRS.frequency, _MESSAGESRS.modulation)
|
|
||||||
|
|
||||||
_MESSAGESRS.coalition = Coalition or MSRS.coalition or coalition.side.NEUTRAL
|
|
||||||
_MESSAGESRS.MSRS:SetCoalition(_MESSAGESRS.coalition)
|
|
||||||
|
|
||||||
_MESSAGESRS.coordinate = Coordinate
|
_MESSAGESRS.coordinate = Coordinate
|
||||||
|
_MESSAGESRS.MSRS:SetCoordinate(Coordinate)
|
||||||
|
|
||||||
if Coordinate then
|
|
||||||
_MESSAGESRS.MSRS:SetCoordinate(Coordinate)
|
|
||||||
end
|
|
||||||
|
|
||||||
if Backend then
|
|
||||||
_MESSAGESRS.MSRS:SetBackend(Backend)
|
|
||||||
end
|
|
||||||
|
|
||||||
_MESSAGESRS.Culture = Culture or MSRS.culture or "en-GB"
|
|
||||||
_MESSAGESRS.MSRS:SetCulture(Culture)
|
_MESSAGESRS.MSRS:SetCulture(Culture)
|
||||||
|
_MESSAGESRS.Culture = Culture or "en-GB"
|
||||||
|
|
||||||
_MESSAGESRS.Gender = Gender or MSRS.gender or "female"
|
|
||||||
_MESSAGESRS.MSRS:SetGender(Gender)
|
_MESSAGESRS.MSRS:SetGender(Gender)
|
||||||
|
_MESSAGESRS.Gender = Gender or "female"
|
||||||
|
|
||||||
if PathToCredentials then
|
_MESSAGESRS.MSRS:SetGoogle(PathToCredentials)
|
||||||
_MESSAGESRS.MSRS:SetProviderOptionsGoogle(PathToCredentials)
|
_MESSAGESRS.google = PathToCredentials
|
||||||
_MESSAGESRS.MSRS:SetProvider(MSRS.Provider.GOOGLE)
|
|
||||||
end
|
_MESSAGESRS.MSRS:SetLabel(Label or "MESSAGE")
|
||||||
|
_MESSAGESRS.label = Label or "MESSAGE"
|
||||||
|
|
||||||
|
_MESSAGESRS.MSRS:SetPort(Port or 5002)
|
||||||
|
_MESSAGESRS.port = Port or 5002
|
||||||
|
|
||||||
_MESSAGESRS.label = Label or MSRS.Label or "MESSAGE"
|
_MESSAGESRS.volume = Volume or 1
|
||||||
_MESSAGESRS.MSRS:SetLabel(_MESSAGESRS.label)
|
|
||||||
|
|
||||||
_MESSAGESRS.port = Port or MSRS.port or 5002
|
|
||||||
_MESSAGESRS.MSRS:SetPort(_MESSAGESRS.port)
|
|
||||||
|
|
||||||
_MESSAGESRS.volume = Volume or MSRS.volume or 1
|
|
||||||
_MESSAGESRS.MSRS:SetVolume(_MESSAGESRS.volume)
|
_MESSAGESRS.MSRS:SetVolume(_MESSAGESRS.volume)
|
||||||
|
|
||||||
if Voice then _MESSAGESRS.MSRS:SetVoice(Voice) end
|
if Voice then _MESSAGESRS.MSRS:SetVoice(Voice) end
|
||||||
|
|
||||||
_MESSAGESRS.voice = Voice or MSRS.voice --or MSRS.Voices.Microsoft.Hedda
|
_MESSAGESRS.voice = Voice --or MSRS.Voices.Microsoft.Hedda
|
||||||
|
--if _MESSAGESRS.google and not Voice then _MESSAGESRS.Voice = MSRS.Voices.Google.Standard.en_GB_Standard_A end
|
||||||
|
--_MESSAGESRS.MSRS:SetVoice(Voice or _MESSAGESRS.voice)
|
||||||
|
|
||||||
_MESSAGESRS.SRSQ = MSRSQUEUE:New(_MESSAGESRS.label)
|
_MESSAGESRS.SRSQ = MSRSQUEUE:New(Label or "MESSAGE")
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Sends a message via SRS. `ToSRS()` will try to use as many attributes configured with @{Core.Message#MESSAGE.SetMSRS}() and @{Sound.SRS#MSRS.LoadConfigFile}() as possible.
|
--- Sends a message via SRS.
|
||||||
-- @param #MESSAGE self
|
-- @param #MESSAGE self
|
||||||
-- @param #number frequency (optional) Frequency in MHz. Can also be given as a #table of frequencies. Only needed if you want to override defaults set with `MESSAGE.SetMSRS()` for this one setting.
|
-- @param #number frequency (optional) Frequency in MHz. Can also be given as a #table of frequencies. Only needed if you want to override defaults set with `MESSAGE.SetMSRS()` for this one setting.
|
||||||
-- @param #number modulation (optional) Modulation, i.e. radio.modulation.AM or radio.modulation.FM. Can also be given as a #table of modulations. Only needed if you want to override defaults set with `MESSAGE.SetMSRS()` for this one setting.
|
-- @param #number modulation (optional) Modulation, i.e. radio.modulation.AM or radio.modulation.FM. Can also be given as a #table of modulations. Only needed if you want to override defaults set with `MESSAGE.SetMSRS()` for this one setting.
|
||||||
@@ -535,7 +532,7 @@ end
|
|||||||
-- @usage
|
-- @usage
|
||||||
-- -- Mind the dot here, not using the colon this time around!
|
-- -- Mind the dot here, not using the colon this time around!
|
||||||
-- -- Needed once only
|
-- -- Needed once only
|
||||||
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.BLUE)
|
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.BLUE)
|
||||||
-- -- later on in your code
|
-- -- later on in your code
|
||||||
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRS()
|
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRS()
|
||||||
--
|
--
|
||||||
@@ -549,7 +546,7 @@ function MESSAGE:ToSRS(frequency,modulation,gender,culture,voice,coalition,volum
|
|||||||
_MESSAGESRS.MSRS:SetCoordinate(coordinate)
|
_MESSAGESRS.MSRS:SetCoordinate(coordinate)
|
||||||
end
|
end
|
||||||
local category = string.gsub(self.MessageCategory,":","")
|
local category = string.gsub(self.MessageCategory,":","")
|
||||||
_MESSAGESRS.SRSQ:NewTransmission(self.MessageText,nil,_MESSAGESRS.MSRS,0.5,1,nil,nil,nil,frequency or _MESSAGESRS.frequency,modulation or _MESSAGESRS.modulation, gender or _MESSAGESRS.Gender,culture or _MESSAGESRS.Culture,nil,volume or _MESSAGESRS.volume,category,coordinate or _MESSAGESRS.coordinate)
|
_MESSAGESRS.SRSQ:NewTransmission(self.MessageText,nil,_MESSAGESRS.MSRS,nil,nil,nil,nil,nil,frequency or _MESSAGESRS.frequency,modulation or _MESSAGESRS.modulation, gender or _MESSAGESRS.Gender,culture or _MESSAGESRS.Culture,nil,volume or _MESSAGESRS.volume,category,coordinate or _MESSAGESRS.coordinate)
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -567,7 +564,7 @@ end
|
|||||||
-- @usage
|
-- @usage
|
||||||
-- -- Mind the dot here, not using the colon this time around!
|
-- -- Mind the dot here, not using the colon this time around!
|
||||||
-- -- Needed once only
|
-- -- Needed once only
|
||||||
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.BLUE)
|
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.BLUE)
|
||||||
-- -- later on in your code
|
-- -- later on in your code
|
||||||
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRSBlue()
|
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRSBlue()
|
||||||
--
|
--
|
||||||
@@ -589,7 +586,7 @@ end
|
|||||||
-- @usage
|
-- @usage
|
||||||
-- -- Mind the dot here, not using the colon this time around!
|
-- -- Mind the dot here, not using the colon this time around!
|
||||||
-- -- Needed once only
|
-- -- Needed once only
|
||||||
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.RED)
|
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.RED)
|
||||||
-- -- later on in your code
|
-- -- later on in your code
|
||||||
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRSRed()
|
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRSRed()
|
||||||
--
|
--
|
||||||
@@ -611,7 +608,7 @@ end
|
|||||||
-- @usage
|
-- @usage
|
||||||
-- -- Mind the dot here, not using the colon this time around!
|
-- -- Mind the dot here, not using the colon this time around!
|
||||||
-- -- Needed once only
|
-- -- Needed once only
|
||||||
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.NEUTRAL)
|
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.NEUTRAL)
|
||||||
-- -- later on in your code
|
-- -- later on in your code
|
||||||
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRSAll()
|
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRSAll()
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ PATHLINE = {
|
|||||||
|
|
||||||
--- PATHLINE class version.
|
--- PATHLINE class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
PATHLINE.version="0.1.1"
|
PATHLINE.version="0.1.0"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
@@ -237,14 +237,13 @@ 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.
|
--- 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
|
-- @param #PATHLINE self
|
||||||
-- @return <Core.Point#COORDINATE> List of COORDINATES points.
|
-- @return <Core.Point#COORDINATE> List of COORDINATES points.
|
||||||
function PATHLINE:GetCoordinates()
|
function PATHLINE:GetCoordinats()
|
||||||
|
|
||||||
local vecs={}
|
local vecs={}
|
||||||
|
|
||||||
for _,_point in pairs(self.points) do
|
for _,_point in pairs(self.points) do
|
||||||
local point=_point --#PATHLINE.Point
|
local point=_point --#PATHLINE.Point
|
||||||
local coord=COORDINATE:NewFromVec3(point.vec3)
|
local coord=COORDINATE:NewFromVec3(point.vec3)
|
||||||
table.insert(vecs,coord)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return vecs
|
return vecs
|
||||||
@@ -263,7 +262,7 @@ function PATHLINE:GetPointFromIndex(n)
|
|||||||
local point=nil --#PATHLINE.Point
|
local point=nil --#PATHLINE.Point
|
||||||
|
|
||||||
if n>=1 and n<=N then
|
if n>=1 and n<=N then
|
||||||
point=self.points[n]
|
point=self.point[n]
|
||||||
else
|
else
|
||||||
self:E(self.lid..string.format("ERROR: No point in pathline for N=%s", tostring(n)))
|
self:E(self.lid..string.format("ERROR: No point in pathline for N=%s", tostring(n)))
|
||||||
end
|
end
|
||||||
@@ -368,4 +367,4 @@ end
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -175,7 +175,7 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr
|
|||||||
local Name = Info.name or "?"
|
local Name = Info.name or "?"
|
||||||
|
|
||||||
local ErrorHandler = function( errmsg )
|
local ErrorHandler = function( errmsg )
|
||||||
env.info( "Error in timer function: " .. errmsg or "" )
|
env.info( "Error in timer function: " .. errmsg )
|
||||||
if BASE.Debug ~= nil then
|
if BASE.Debug ~= nil then
|
||||||
env.info( BASE.Debug.traceback() )
|
env.info( BASE.Debug.traceback() )
|
||||||
end
|
end
|
||||||
@@ -326,7 +326,7 @@ function SCHEDULEDISPATCHER:Stop( Scheduler, CallID )
|
|||||||
local Schedule = self.Schedule[Scheduler][CallID] -- #SCHEDULEDISPATCHER.ScheduleData
|
local Schedule = self.Schedule[Scheduler][CallID] -- #SCHEDULEDISPATCHER.ScheduleData
|
||||||
|
|
||||||
-- Only stop when there is a ScheduleID defined for the CallID. So, when the scheduler was stopped before, do nothing.
|
-- Only stop when there is a ScheduleID defined for the CallID. So, when the scheduler was stopped before, do nothing.
|
||||||
if Schedule and Schedule.ScheduleID then
|
if Schedule.ScheduleID then
|
||||||
|
|
||||||
self:T( string.format( "SCHEDULEDISPATCHER stopping scheduler CallID=%s, ScheduleID=%s", tostring( CallID ), tostring( Schedule.ScheduleID ) ) )
|
self:T( string.format( "SCHEDULEDISPATCHER stopping scheduler CallID=%s, ScheduleID=%s", tostring( CallID ), tostring( Schedule.ScheduleID ) ) )
|
||||||
|
|
||||||
|
|||||||
@@ -14,13 +14,17 @@
|
|||||||
--
|
--
|
||||||
-- # Demo Missions
|
-- # Demo Missions
|
||||||
--
|
--
|
||||||
-- ### [SCHEDULER Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Core/Scheduler)
|
-- ### [SCHEDULER Demo Missions source code](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SCH%20-%20Scheduler)
|
||||||
|
--
|
||||||
|
-- ### [SCHEDULER Demo Missions, only for beta testers](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SCH%20-%20Scheduler)
|
||||||
|
--
|
||||||
|
-- ### [ALL Demo Missions pack of the last release](https://github.com/FlightControl-Master/MOOSE_MISSIONS/releases)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # YouTube Channel
|
-- # YouTube Channel
|
||||||
--
|
--
|
||||||
-- ### None
|
-- ### [SCHEDULER YouTube Channel (none)]()
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -29,9 +29,7 @@
|
|||||||
-- @module Core.Settings
|
-- @module Core.Settings
|
||||||
-- @image Core_Settings.JPG
|
-- @image Core_Settings.JPG
|
||||||
|
|
||||||
|
--- @type SETTINGS
|
||||||
---
|
|
||||||
-- @type SETTINGS
|
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
--- Takes care of various settings that influence the behavior of certain functionalities and classes within the MOOSE framework.
|
--- Takes care of various settings that influence the behavior of certain functionalities and classes within the MOOSE framework.
|
||||||
@@ -220,8 +218,7 @@ SETTINGS = {
|
|||||||
|
|
||||||
SETTINGS.__Enum = {}
|
SETTINGS.__Enum = {}
|
||||||
|
|
||||||
---
|
--- @type SETTINGS.__Enum.Era
|
||||||
-- @type SETTINGS.__Enum.Era
|
|
||||||
-- @field #number WWII
|
-- @field #number WWII
|
||||||
-- @field #number Korea
|
-- @field #number Korea
|
||||||
-- @field #number Cold
|
-- @field #number Cold
|
||||||
@@ -740,8 +737,8 @@ do -- SETTINGS
|
|||||||
if _SETTINGS.ShowPlayerMenu == true then
|
if _SETTINGS.ShowPlayerMenu == true then
|
||||||
|
|
||||||
local PlayerGroup = PlayerUnit:GetGroup()
|
local PlayerGroup = PlayerUnit:GetGroup()
|
||||||
local PlayerName = PlayerUnit:GetPlayerName() or "None"
|
local PlayerName = PlayerUnit:GetPlayerName()
|
||||||
--local PlayerNames = PlayerGroup:GetPlayerNames()
|
local PlayerNames = PlayerGroup:GetPlayerNames()
|
||||||
|
|
||||||
local PlayerMenu = MENU_GROUP:New( PlayerGroup, 'Settings "' .. PlayerName .. '"' )
|
local PlayerMenu = MENU_GROUP:New( PlayerGroup, 'Settings "' .. PlayerName .. '"' )
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,36 +1,36 @@
|
|||||||
--- **Core** - Spawn statics.
|
--- **Core** - Spawn statics.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ## Features:
|
-- ## Features:
|
||||||
--
|
--
|
||||||
-- * Spawn new statics from a static already defined in the mission editor.
|
-- * 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 template.
|
||||||
-- * Spawn new statics from a given type.
|
-- * Spawn new statics from a given type.
|
||||||
-- * Spawn with a custom heading and location.
|
-- * Spawn with a custom heading and location.
|
||||||
-- * Spawn within a zone.
|
-- * Spawn within a zone.
|
||||||
-- * Spawn statics linked to units, .e.g on aircraft carriers.
|
-- * Spawn statics linked to units, .e.g on aircraft carriers.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # Demo Missions
|
-- # Demo Missions
|
||||||
|
--
|
||||||
|
-- ## [SPAWNSTATIC Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SPS%20-%20Spawning%20Statics)
|
||||||
--
|
--
|
||||||
-- ## [SPAWNSTATIC Demo Missions](https://github.com/FlightControl-Master/MOOSE_Demos/tree/master/Core/SpawnStatic)
|
--
|
||||||
--
|
|
||||||
--
|
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # YouTube Channel
|
-- # YouTube Channel
|
||||||
--
|
--
|
||||||
-- ## No videos yet!
|
-- ## [SPAWNSTATIC YouTube Channel]() [No videos yet!]
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
-- ### Contributions: **funkyfranky**
|
-- ### Contributions: **funkyfranky**
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @module Core.SpawnStatic
|
-- @module Core.SpawnStatic
|
||||||
-- @image Core_Spawnstatic.JPG
|
-- @image Core_Spawnstatic.JPG
|
||||||
|
|
||||||
@@ -58,37 +58,37 @@
|
|||||||
|
|
||||||
|
|
||||||
--- Allows to spawn dynamically new @{Wrapper.Static}s into your mission.
|
--- Allows to spawn dynamically new @{Wrapper.Static}s into your mission.
|
||||||
--
|
--
|
||||||
-- Through creating a copy of an existing static object template as defined in the Mission Editor (ME), SPAWNSTATIC can retireve the properties of the defined static object template (like type, category etc),
|
-- Through creating a copy of an existing static object template as defined in the Mission Editor (ME), SPAWNSTATIC can retireve the properties of the defined static object template (like type, category etc),
|
||||||
-- and "copy" these properties to create a new static object and place it at the desired coordinate.
|
-- and "copy" these properties to create a new static object and place it at the desired coordinate.
|
||||||
--
|
--
|
||||||
-- New spawned @{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:
|
-- 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**.
|
-- * Spawned @{Wrapper.Static}s will have the name _StaticName_#_nnn_, where _StaticName_ is the name of the **Template Static**, and _nnn_ is a **counter from 0 to 99999**.
|
||||||
--
|
--
|
||||||
-- # SPAWNSTATIC Constructors
|
-- # SPAWNSTATIC Constructors
|
||||||
--
|
--
|
||||||
-- 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.
|
-- 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
|
-- ## 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
|
-- 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 the static.
|
||||||
--
|
--
|
||||||
-- ## From a Template
|
-- ## 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.
|
-- 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
|
-- ## 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
|
-- 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.
|
-- are used. For example, if no spawn coordinate is given, the static will be created at the origin of the map.
|
||||||
--
|
--
|
||||||
-- # Setting Parameters
|
-- # 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!
|
-- 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.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.InitHeading}(Heading) sets the orientation of the static.
|
||||||
-- * @{#SPAWNSTATIC.InitLivery}(LiveryName) sets the livery of the static. Not all statics support this.
|
-- * @{#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.
|
-- * @{#SPAWNSTATIC.InitLinkToUnit}(Unit, OffsetX, OffsetY, OffsetAngle) links the static to a unit, e.g. to an aircraft carrier.
|
||||||
--
|
--
|
||||||
-- # Spawning the Statics
|
-- # 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
|
-- 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.
|
-- 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.Spawn}(Heading, NewName) spawns the static with the set parameters. Optionally, heading and name can be given. The name **must be unique**!
|
||||||
-- * @{#SPAWNSTATIC.SpawnFromCoordinate}(Coordinate, Heading, NewName) spawn the static at the given coordinate. Optionally, heading and name can be given. The name **must be unique**!
|
-- * @{#SPAWNSTATIC.SpawnFromCoordinate}(Coordinate, Heading, NewName) spawn the static at the given coordinate. Optionally, heading and name can be given. The name **must be unique**!
|
||||||
-- * @{#SPAWNSTATIC.SpawnFromPointVec2}(PointVec2, Heading, NewName) spawns the static at a COORDINATE 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**!
|
-- * @{#SPAWNSTATIC.SpawnFromZone}(Zone, Heading, NewName) spawns the static at the center of a @{Core.Zone}. Optionally, heading and name can be given. The name **must be unique**!
|
||||||
--
|
--
|
||||||
-- @field #SPAWNSTATIC SPAWNSTATIC
|
-- @field #SPAWNSTATIC SPAWNSTATIC
|
||||||
--
|
--
|
||||||
SPAWNSTATIC = {
|
SPAWNSTATIC = {
|
||||||
ClassName = "SPAWNSTATIC",
|
ClassName = "SPAWNSTATIC",
|
||||||
SpawnIndex = 0,
|
SpawnIndex = 0,
|
||||||
@@ -139,9 +139,9 @@ SPAWNSTATIC = {
|
|||||||
function SPAWNSTATIC:NewFromStatic(SpawnTemplateName, SpawnCountryID)
|
function SPAWNSTATIC:NewFromStatic(SpawnTemplateName, SpawnCountryID)
|
||||||
|
|
||||||
local self = BASE:Inherit( self, BASE:New() ) -- #SPAWNSTATIC
|
local self = BASE:Inherit( self, BASE:New() ) -- #SPAWNSTATIC
|
||||||
|
|
||||||
local TemplateStatic, CoalitionID, CategoryID, CountryID = _DATABASE:GetStaticGroupTemplate(SpawnTemplateName)
|
local TemplateStatic, CoalitionID, CategoryID, CountryID = _DATABASE:GetStaticGroupTemplate(SpawnTemplateName)
|
||||||
|
|
||||||
if TemplateStatic then
|
if TemplateStatic then
|
||||||
self.SpawnTemplatePrefix = SpawnTemplateName
|
self.SpawnTemplatePrefix = SpawnTemplateName
|
||||||
self.TemplateStaticUnit = UTILS.DeepCopy(TemplateStatic.units[1])
|
self.TemplateStaticUnit = UTILS.DeepCopy(TemplateStatic.units[1])
|
||||||
@@ -149,7 +149,6 @@ function SPAWNSTATIC:NewFromStatic(SpawnTemplateName, SpawnCountryID)
|
|||||||
self.CategoryID = CategoryID
|
self.CategoryID = CategoryID
|
||||||
self.CoalitionID = CoalitionID
|
self.CoalitionID = CoalitionID
|
||||||
self.SpawnIndex = 0
|
self.SpawnIndex = 0
|
||||||
self.StaticCopyFrom = SpawnTemplateName
|
|
||||||
else
|
else
|
||||||
error( "SPAWNSTATIC:New: There is no static declared in the mission editor with SpawnTemplatePrefix = '" .. tostring(SpawnTemplateName) .. "'" )
|
error( "SPAWNSTATIC:New: There is no static declared in the mission editor with SpawnTemplatePrefix = '" .. tostring(SpawnTemplateName) .. "'" )
|
||||||
end
|
end
|
||||||
@@ -167,11 +166,11 @@ end
|
|||||||
function SPAWNSTATIC:NewFromTemplate(SpawnTemplate, CountryID)
|
function SPAWNSTATIC:NewFromTemplate(SpawnTemplate, CountryID)
|
||||||
|
|
||||||
local self = BASE:Inherit( self, BASE:New() ) -- #SPAWNSTATIC
|
local self = BASE:Inherit( self, BASE:New() ) -- #SPAWNSTATIC
|
||||||
|
|
||||||
self.TemplateStaticUnit = UTILS.DeepCopy(SpawnTemplate)
|
self.TemplateStaticUnit = UTILS.DeepCopy(SpawnTemplate)
|
||||||
self.SpawnTemplatePrefix = SpawnTemplate.name
|
self.SpawnTemplatePrefix = SpawnTemplate.name
|
||||||
self.CountryID = CountryID or country.id.USA
|
self.CountryID = CountryID or country.id.USA
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -190,69 +189,13 @@ function SPAWNSTATIC:NewFromType(StaticType, StaticCategory, CountryID)
|
|||||||
self.InitStaticCategory=StaticCategory
|
self.InitStaticCategory=StaticCategory
|
||||||
self.CountryID=CountryID or country.id.USA
|
self.CountryID=CountryID or country.id.USA
|
||||||
self.SpawnTemplatePrefix=self.InitStaticType
|
self.SpawnTemplatePrefix=self.InitStaticType
|
||||||
self.TemplateStaticUnit = {}
|
|
||||||
|
|
||||||
self.InitStaticCoordinate=COORDINATE:New(0, 0, 0)
|
self.InitStaticCoordinate=COORDINATE:New(0, 0, 0)
|
||||||
self.InitStaticHeading=0
|
self.InitStaticHeading=0
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- (Internal/Cargo) Init the resource table for STATIC object that should be spawned containing storage objects.
|
|
||||||
-- NOTE that you have to init many other parameters as the resources.
|
|
||||||
-- @param #SPAWNSTATIC self
|
|
||||||
-- @param #number CombinedWeight The weight this cargo object should have (some have fixed weights!), defaults to 1kg.
|
|
||||||
-- @return #SPAWNSTATIC self
|
|
||||||
function SPAWNSTATIC:_InitResourceTable(CombinedWeight)
|
|
||||||
if not self.TemplateStaticUnit.resourcePayload then
|
|
||||||
self.TemplateStaticUnit.resourcePayload = {
|
|
||||||
["weapons"] = {},
|
|
||||||
["aircrafts"] = {},
|
|
||||||
["gasoline"] = 0,
|
|
||||||
["diesel"] = 0,
|
|
||||||
["methanol_mixture"] = 0,
|
|
||||||
["jet_fuel"] = 0,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
self:InitCargo(true)
|
|
||||||
self:InitCargoMass(CombinedWeight or 1)
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
|
|
||||||
--- (User/Cargo) Add to resource table for STATIC object that should be spawned containing storage objects. Inits the object table if necessary and sets it to be cargo for helicopters.
|
|
||||||
-- @param #SPAWNSTATIC self
|
|
||||||
-- @param #string Type Type of cargo. Known types are: STORAGE.Type.WEAPONS, STORAGE.Type.LIQUIDS, STORAGE.Type.AIRCRAFT. Liquids are fuel.
|
|
||||||
-- @param #string Name Name of the cargo type. Liquids can be STORAGE.LiquidName.JETFUEL, STORAGE.LiquidName.GASOLINE, STORAGE.LiquidName.MW50 and STORAGE.LiquidName.DIESEL. The currently available weapon items are available in the `ENUMS.Storage.weapons`, e.g. `ENUMS.Storage.weapons.bombs.Mk_82Y`. Aircraft go by their typename.
|
|
||||||
-- @param #number Amount of tons (liquids) or number (everything else) to add.
|
|
||||||
-- @param #number CombinedWeight Combined weight to be set to this static cargo object. NOTE - some static cargo objects have fixed weights!
|
|
||||||
-- @return #SPAWNSTATIC self
|
|
||||||
function SPAWNSTATIC:AddCargoResource(Type,Name,Amount,CombinedWeight)
|
|
||||||
if not self.TemplateStaticUnit.resourcePayload then
|
|
||||||
self:_InitResourceTable(CombinedWeight)
|
|
||||||
end
|
|
||||||
if Type == STORAGE.Type.LIQUIDS and type(Name) == "string" then
|
|
||||||
self.TemplateStaticUnit.resourcePayload[Name] = Amount
|
|
||||||
else
|
|
||||||
self.TemplateStaticUnit.resourcePayload[Type] = {
|
|
||||||
[Name] = {
|
|
||||||
["amount"] = Amount,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
UTILS.PrintTableToLog(self.TemplateStaticUnit)
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
|
|
||||||
--- (User/Cargo) Resets resource table to zero for STATIC object that should be spawned containing storage objects. Inits the object table if necessary and sets it to be cargo for helicopters.
|
|
||||||
-- Handy if you spawn from cargo statics which have resources already set.
|
|
||||||
-- @param #SPAWNSTATIC self
|
|
||||||
-- @return #SPAWNSTATIC self
|
|
||||||
function SPAWNSTATIC:ResetCargoResources()
|
|
||||||
self.TemplateStaticUnit.resourcePayload = nil
|
|
||||||
self:_InitResourceTable()
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Initialize heading of the spawned static.
|
--- Initialize heading of the spawned static.
|
||||||
-- @param #SPAWNSTATIC self
|
-- @param #SPAWNSTATIC self
|
||||||
-- @param Core.Point#COORDINATE Coordinate Position where the static is spawned.
|
-- @param Core.Point#COORDINATE Coordinate Position where the static is spawned.
|
||||||
@@ -303,16 +246,12 @@ end
|
|||||||
-- @param #number CallsignID Callsign ID. Default 1 (="London").
|
-- @param #number CallsignID Callsign ID. Default 1 (="London").
|
||||||
-- @param #number Frequency Frequency in MHz. Default 127.5 MHz.
|
-- @param #number Frequency Frequency in MHz. Default 127.5 MHz.
|
||||||
-- @param #number Modulation Modulation 0=AM, 1=FM.
|
-- @param #number Modulation Modulation 0=AM, 1=FM.
|
||||||
-- @param #boolean DynamicSpawns If true, allow Dynamic Spawns
|
|
||||||
-- @param #boolean DynamicHotStarts If true, and DynamicSpawns is true, then allow Dynamic Spawns with hot starts.
|
|
||||||
-- @return #SPAWNSTATIC self
|
-- @return #SPAWNSTATIC self
|
||||||
function SPAWNSTATIC:InitFARP(CallsignID, Frequency, Modulation, DynamicSpawns,DynamicHotStarts)
|
function SPAWNSTATIC:InitFARP(CallsignID, Frequency, Modulation)
|
||||||
self.InitFarp=true
|
self.InitFarp=true
|
||||||
self.InitFarpCallsignID=CallsignID or 1
|
self.InitFarpCallsignID=CallsignID or 1
|
||||||
self.InitFarpFreq=Frequency or 127.5
|
self.InitFarpFreq=Frequency or 127.5
|
||||||
self.InitFarpModu=Modulation or 0
|
self.InitFarpModu=Modulation or 0
|
||||||
self.InitFarpDynamicSpawns = DynamicSpawns
|
|
||||||
self.InitFarpDynamicHotStarts = (DynamicSpawns == true and DynamicHotStarts == true) and true or nil
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -352,7 +291,7 @@ function SPAWNSTATIC:InitCountry(CountryID)
|
|||||||
return self
|
return self
|
||||||
end
|
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 #SPAWNSTATIC self
|
||||||
-- @param #string NamePrefix Name prefix of statics spawned. Will append #0001, etc to the name.
|
-- @param #string NamePrefix Name prefix of statics spawned. Will append #0001, etc to the name.
|
||||||
-- @return #SPAWNSTATIC self
|
-- @return #SPAWNSTATIC self
|
||||||
@@ -378,25 +317,6 @@ function SPAWNSTATIC:InitLinkToUnit(Unit, OffsetX, OffsetY, OffsetAngle)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Allows to place a CallFunction hook when a new static spawns.
|
|
||||||
-- The provided method will be called when a new group is spawned, including its given parameters.
|
|
||||||
-- The first parameter of the SpawnFunction is the @{Wrapper.Static#STATIC} that was spawned.
|
|
||||||
-- @param #SPAWNSTATIC self
|
|
||||||
-- @param #function SpawnCallBackFunction The function to be called when a group spawns.
|
|
||||||
-- @param SpawnFunctionArguments A random amount of arguments to be provided to the function when the group spawns.
|
|
||||||
-- @return #SPAWNSTATIC self
|
|
||||||
function SPAWNSTATIC:OnSpawnStatic( SpawnCallBackFunction, ... )
|
|
||||||
self:F( "OnSpawnStatic" )
|
|
||||||
|
|
||||||
self.SpawnFunctionHook = SpawnCallBackFunction
|
|
||||||
self.SpawnFunctionArguments = {}
|
|
||||||
if arg then
|
|
||||||
self.SpawnFunctionArguments = arg
|
|
||||||
end
|
|
||||||
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Spawn a new STATIC object.
|
--- Spawn a new STATIC object.
|
||||||
-- @param #SPAWNSTATIC self
|
-- @param #SPAWNSTATIC self
|
||||||
-- @param #number Heading (Optional) The heading of the static, which is a number in degrees from 0 to 360. Default is the heading of the template.
|
-- @param #number Heading (Optional) The heading of the static, which is a number in degrees from 0 to 360. Default is the heading of the template.
|
||||||
@@ -407,18 +327,18 @@ function SPAWNSTATIC:Spawn(Heading, NewName)
|
|||||||
if Heading then
|
if Heading then
|
||||||
self.InitStaticHeading=Heading
|
self.InitStaticHeading=Heading
|
||||||
end
|
end
|
||||||
|
|
||||||
if NewName then
|
if NewName then
|
||||||
self.InitStaticName=NewName
|
self.InitStaticName=NewName
|
||||||
end
|
end
|
||||||
|
|
||||||
return self:_SpawnStatic(self.TemplateStaticUnit, self.CountryID)
|
return self:_SpawnStatic(self.TemplateStaticUnit, self.CountryID)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Creates a new @{Wrapper.Static} from a COORDINATE.
|
--- Creates a new @{Wrapper.Static} from a POINT_VEC2.
|
||||||
-- @param #SPAWNSTATIC self
|
-- @param #SPAWNSTATIC self
|
||||||
-- @param Core.Point#COORDINATE PointVec2 The 2D coordinate where to spawn the static.
|
-- @param Core.Point#POINT_VEC2 PointVec2 The 2D coordinate where to spawn the static.
|
||||||
-- @param #number Heading The heading of the static, which is a number in degrees from 0 to 360.
|
-- @param #number Heading The heading of the static, which is a number in degrees from 0 to 360.
|
||||||
-- @param #string NewName (Optional) The name of the new static.
|
-- @param #string NewName (Optional) The name of the new static.
|
||||||
-- @return Wrapper.Static#STATIC The static spawned.
|
-- @return Wrapper.Static#STATIC The static spawned.
|
||||||
@@ -427,7 +347,7 @@ function SPAWNSTATIC:SpawnFromPointVec2(PointVec2, Heading, NewName)
|
|||||||
local vec2={x=PointVec2:GetX(), y=PointVec2:GetY()}
|
local vec2={x=PointVec2:GetX(), y=PointVec2:GetY()}
|
||||||
|
|
||||||
local Coordinate=COORDINATE:NewFromVec2(vec2)
|
local Coordinate=COORDINATE:NewFromVec2(vec2)
|
||||||
|
|
||||||
return self:SpawnFromCoordinate(Coordinate, Heading, NewName)
|
return self:SpawnFromCoordinate(Coordinate, Heading, NewName)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -442,11 +362,11 @@ function SPAWNSTATIC:SpawnFromCoordinate(Coordinate, Heading, NewName)
|
|||||||
|
|
||||||
-- Set up coordinate.
|
-- Set up coordinate.
|
||||||
self.InitStaticCoordinate=Coordinate
|
self.InitStaticCoordinate=Coordinate
|
||||||
|
|
||||||
if Heading then
|
if Heading then
|
||||||
self.InitStaticHeading=Heading
|
self.InitStaticHeading=Heading
|
||||||
end
|
end
|
||||||
|
|
||||||
if NewName then
|
if NewName then
|
||||||
self.InitStaticName=NewName
|
self.InitStaticName=NewName
|
||||||
end
|
end
|
||||||
@@ -464,9 +384,8 @@ end
|
|||||||
function SPAWNSTATIC:SpawnFromZone(Zone, Heading, NewName)
|
function SPAWNSTATIC:SpawnFromZone(Zone, Heading, NewName)
|
||||||
|
|
||||||
-- Spawn the new static at the center of the zone.
|
-- Spawn the new static at the center of the zone.
|
||||||
--local Static = self:SpawnFromPointVec2( Zone:GetPointVec2(), Heading, NewName )
|
local Static = self:SpawnFromPointVec2( Zone:GetPointVec2(), Heading, NewName )
|
||||||
local Static = self:SpawnFromCoordinate(Zone:GetCoordinate(), Heading, NewName)
|
|
||||||
|
|
||||||
return Static
|
return Static
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -480,45 +399,45 @@ function SPAWNSTATIC:_SpawnStatic(Template, CountryID)
|
|||||||
Template=Template or {}
|
Template=Template or {}
|
||||||
|
|
||||||
local CountryID=CountryID or self.CountryID
|
local CountryID=CountryID or self.CountryID
|
||||||
|
|
||||||
if self.InitStaticType then
|
if self.InitStaticType then
|
||||||
Template.type=self.InitStaticType
|
Template.type=self.InitStaticType
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.InitStaticCategory then
|
if self.InitStaticCategory then
|
||||||
Template.category=self.InitStaticCategory
|
Template.category=self.InitStaticCategory
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.InitStaticCoordinate then
|
if self.InitStaticCoordinate then
|
||||||
Template.x = self.InitStaticCoordinate.x
|
Template.x = self.InitStaticCoordinate.x
|
||||||
Template.y = self.InitStaticCoordinate.z
|
Template.y = self.InitStaticCoordinate.z
|
||||||
Template.alt = self.InitStaticCoordinate.y
|
Template.alt = self.InitStaticCoordinate.y
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.InitStaticHeading then
|
if self.InitStaticHeading then
|
||||||
Template.heading = math.rad(self.InitStaticHeading)
|
Template.heading = math.rad(self.InitStaticHeading)
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.InitStaticShape then
|
if self.InitStaticShape then
|
||||||
Template.shape_name=self.InitStaticShape
|
Template.shape_name=self.InitStaticShape
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.InitStaticLivery then
|
if self.InitStaticLivery then
|
||||||
Template.livery_id=self.InitStaticLivery
|
Template.livery_id=self.InitStaticLivery
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.InitStaticDead~=nil then
|
if self.InitStaticDead~=nil then
|
||||||
Template.dead=self.InitStaticDead
|
Template.dead=self.InitStaticDead
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.InitStaticCargo~=nil then
|
if self.InitStaticCargo~=nil then
|
||||||
Template.canCargo=self.InitStaticCargo
|
Template.canCargo=self.InitStaticCargo
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.InitStaticCargoMass~=nil then
|
if self.InitStaticCargoMass~=nil then
|
||||||
Template.mass=self.InitStaticCargoMass
|
Template.mass=self.InitStaticCargoMass
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.InitLinkUnit then
|
if self.InitLinkUnit then
|
||||||
Template.linkUnit=self.InitLinkUnit:GetID()
|
Template.linkUnit=self.InitLinkUnit:GetID()
|
||||||
Template.linkOffset=true
|
Template.linkOffset=true
|
||||||
@@ -527,51 +446,49 @@ function SPAWNSTATIC:_SpawnStatic(Template, CountryID)
|
|||||||
Template.offsets.x=self.InitOffsetX
|
Template.offsets.x=self.InitOffsetX
|
||||||
Template.offsets.angle=self.InitOffsetAngle and math.rad(self.InitOffsetAngle) or 0
|
Template.offsets.angle=self.InitOffsetAngle and math.rad(self.InitOffsetAngle) or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.InitFarp then
|
if self.InitFarp then
|
||||||
Template.heliport_callsign_id = self.InitFarpCallsignID
|
Template.heliport_callsign_id = self.InitFarpCallsignID
|
||||||
Template.heliport_frequency = self.InitFarpFreq
|
Template.heliport_frequency = self.InitFarpFreq
|
||||||
Template.heliport_modulation = self.InitFarpModu
|
Template.heliport_modulation = self.InitFarpModu
|
||||||
Template.unitId=nil
|
Template.unitId=nil
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Increase spawn index counter.
|
-- Increase spawn index counter.
|
||||||
self.SpawnIndex = self.SpawnIndex + 1
|
self.SpawnIndex = self.SpawnIndex + 1
|
||||||
|
|
||||||
-- Name of the spawned static.
|
-- Name of the spawned static.
|
||||||
Template.name = self.InitStaticName or string.format("%s#%05d", self.SpawnTemplatePrefix, self.SpawnIndex)
|
Template.name = self.InitStaticName or string.format("%s#%05d", self.SpawnTemplatePrefix, self.SpawnIndex)
|
||||||
|
|
||||||
|
-- Add and register the new static.
|
||||||
|
local mystatic=_DATABASE:AddStatic(Template.name)
|
||||||
|
|
||||||
|
-- Debug output.
|
||||||
|
self:T(Template)
|
||||||
|
|
||||||
-- Add static to the game.
|
-- Add static to the game.
|
||||||
local Static=nil --DCS#StaticObject
|
local Static=nil --DCS#StaticObject
|
||||||
|
|
||||||
if self.InitFarp then
|
if self.InitFarp then
|
||||||
|
|
||||||
local TemplateGroup={}
|
local TemplateGroup={}
|
||||||
TemplateGroup.units={}
|
TemplateGroup.units={}
|
||||||
TemplateGroup.units[1]=Template
|
TemplateGroup.units[1]=Template
|
||||||
|
|
||||||
TemplateGroup.visible=true
|
TemplateGroup.visible=true
|
||||||
TemplateGroup.hidden=false
|
TemplateGroup.hidden=false
|
||||||
TemplateGroup.x=Template.x
|
TemplateGroup.x=Template.x
|
||||||
TemplateGroup.y=Template.y
|
TemplateGroup.y=Template.y
|
||||||
TemplateGroup.name=Template.name
|
TemplateGroup.name=Template.name
|
||||||
|
|
||||||
if self.InitFarpDynamicSpawns == true then
|
|
||||||
TemplateGroup.units[1].dynamicSpawn = true
|
|
||||||
if self.InitFarpDynamicHotStarts == true then
|
|
||||||
TemplateGroup.units[1].allowHotStart = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
self:T("Spawning FARP")
|
self:T("Spawning FARP")
|
||||||
self:T({Template=Template})
|
self:T({Template=Template})
|
||||||
self:T({TemplateGroup=TemplateGroup})
|
self:T({TemplateGroup=TemplateGroup})
|
||||||
|
|
||||||
-- ED's dirty way to spawn FARPS.
|
-- ED's dirty way to spawn FARPS.
|
||||||
Static=coalition.addGroup(CountryID, -1, TemplateGroup)
|
Static=coalition.addGroup(CountryID, -1, TemplateGroup)
|
||||||
--Static=coalition.addStaticObject(CountryID, Template)
|
|
||||||
|
-- Currently DCS 2.8 does not trigger birth events if FAPRS are spawned!
|
||||||
-- Currently DCS 2.8 does not trigger birth events if FARPS are spawned!
|
|
||||||
-- We create such an event. The airbase is registered in Core.Event
|
-- We create such an event. The airbase is registered in Core.Event
|
||||||
local Event = {
|
local Event = {
|
||||||
id = EVENTS.Birth,
|
id = EVENTS.Birth,
|
||||||
@@ -582,45 +499,10 @@ function SPAWNSTATIC:_SpawnStatic(Template, CountryID)
|
|||||||
world.onEvent(Event)
|
world.onEvent(Event)
|
||||||
|
|
||||||
else
|
else
|
||||||
self:T("Spawning Static")
|
self:T("Spawning Static")
|
||||||
self:T2({Template=Template})
|
self:T2({Template=Template})
|
||||||
Static=coalition.addStaticObject(CountryID, Template)
|
Static=coalition.addStaticObject(CountryID, Template)
|
||||||
|
end
|
||||||
|
|
||||||
if Static then
|
|
||||||
self:T(string.format("Succesfully spawned static object \"%s\" ID=%d", Static:getName(), Static:getID()))
|
|
||||||
--[[
|
|
||||||
local static=StaticObject.getByName(Static:getName())
|
|
||||||
if static then
|
|
||||||
env.info(string.format("FF got static from StaticObject.getByName"))
|
|
||||||
else
|
|
||||||
env.error(string.format("FF error did NOT get static from StaticObject.getByName"))
|
|
||||||
end ]]
|
|
||||||
else
|
|
||||||
self:E(string.format("ERROR: DCS static object \"%s\" is nil!", tostring(Template.name)))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Add and register the new static.
|
|
||||||
local mystatic=_DATABASE:AddStatic(Template.name)
|
|
||||||
|
|
||||||
-- If there is a SpawnFunction hook defined, call it.
|
|
||||||
if self.SpawnFunctionHook then
|
|
||||||
-- delay calling this for .3 seconds so that it hopefully comes after the BIRTH event of the group.
|
|
||||||
self:ScheduleOnce(0.3, self.SpawnFunctionHook, mystatic, unpack(self.SpawnFunctionArguments))
|
|
||||||
end
|
|
||||||
|
|
||||||
if self.StaticCopyFrom ~= nil then
|
|
||||||
mystatic.StaticCopyFrom = self.StaticCopyFrom
|
|
||||||
if not _DATABASE.Templates.Statics[Template.name] then
|
|
||||||
local TemplateGroup={}
|
|
||||||
TemplateGroup.units={}
|
|
||||||
TemplateGroup.units[1]=Template
|
|
||||||
TemplateGroup.x=Template.x
|
|
||||||
TemplateGroup.y=Template.y
|
|
||||||
TemplateGroup.name=Template.name
|
|
||||||
_DATABASE:_RegisterStaticTemplate( TemplateGroup, self.CoalitionID, self.CategoryID, CountryID )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return mystatic
|
return mystatic
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -329,14 +329,14 @@ do
|
|||||||
if self.Lasing then
|
if self.Lasing then
|
||||||
if self.Target and self.Target:IsAlive() then
|
if self.Target and self.Target:IsAlive() then
|
||||||
|
|
||||||
self.SpotIR:setPoint( self.Target:GetPointVec3():AddY(1):AddY(math.random(-100,100)/200):AddX(math.random(-100,100)/200):GetVec3() )
|
self.SpotIR:setPoint( self.Target:GetPointVec3():AddY(1):AddY(math.random(-100,100)/100):AddX(math.random(-100,100)/100):GetVec3() )
|
||||||
self.SpotLaser:setPoint( self.Target:GetPointVec3():AddY(1):GetVec3() )
|
self.SpotLaser:setPoint( self.Target:GetPointVec3():AddY(1):GetVec3() )
|
||||||
|
|
||||||
self:__Lasing(0.2)
|
self:__Lasing(0.2)
|
||||||
elseif self.TargetCoord then
|
elseif self.TargetCoord then
|
||||||
|
|
||||||
-- Wiggle the IR spot a bit.
|
-- Wiggle the IR spot a bit.
|
||||||
local irvec3={x=self.TargetCoord.x+math.random(-100,100)/200, y=self.TargetCoord.y+math.random(-100,100)/200, z=self.TargetCoord.z} --#DCS.Vec3
|
local irvec3={x=self.TargetCoord.x+math.random(-100,100)/100, y=self.TargetCoord.y+math.random(-100,100)/100, z=self.TargetCoord.z} --#DCS.Vec3
|
||||||
local lsvec3={x=self.TargetCoord.x, y=self.TargetCoord.y, z=self.TargetCoord.z} --#DCS.Vec3
|
local lsvec3={x=self.TargetCoord.x, y=self.TargetCoord.y, z=self.TargetCoord.z} --#DCS.Vec3
|
||||||
|
|
||||||
self.SpotIR:setPoint(irvec3)
|
self.SpotIR:setPoint(irvec3)
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ do -- UserFlag
|
|||||||
|
|
||||||
--- Set the userflag to a given Number.
|
--- Set the userflag to a given Number.
|
||||||
-- @param #USERFLAG self
|
-- @param #USERFLAG self
|
||||||
-- @param #number Number The number value to set the flag to.
|
-- @param #number Number The number value to be checked if it is the same as the userflag.
|
||||||
-- @param #number Delay Delay in seconds, before the flag is set.
|
-- @param #number Delay Delay in seconds, before the flag is set.
|
||||||
-- @return #USERFLAG The userflag instance.
|
-- @return #USERFLAG The userflag instance.
|
||||||
-- @usage
|
-- @usage
|
||||||
@@ -104,4 +104,4 @@ do -- UserFlag
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -2,8 +2,7 @@
|
|||||||
-- @module Core.Zone_Detection
|
-- @module Core.Zone_Detection
|
||||||
-- @image MOOSE.JPG
|
-- @image MOOSE.JPG
|
||||||
|
|
||||||
---
|
--- @type ZONE_DETECTION
|
||||||
-- @type ZONE_DETECTION
|
|
||||||
-- @field DCS#Vec2 Vec2 The current location of the zone.
|
-- @field DCS#Vec2 Vec2 The current location of the zone.
|
||||||
-- @field DCS#Distance Radius The radius of the zone.
|
-- @field DCS#Distance Radius The radius of the zone.
|
||||||
-- @extends #ZONE_BASE
|
-- @extends #ZONE_BASE
|
||||||
@@ -107,7 +106,7 @@ function ZONE_DETECTION:SmokeZone( SmokeColor, Points, AddHeight, AngleOffset )
|
|||||||
local Radial = ( Angle + AngleOffset ) * RadialBase / 360
|
local Radial = ( Angle + AngleOffset ) * RadialBase / 360
|
||||||
Point.x = Vec2.x + math.cos( Radial ) * self:GetRadius()
|
Point.x = Vec2.x + math.cos( Radial ) * self:GetRadius()
|
||||||
Point.y = Vec2.y + math.sin( Radial ) * self:GetRadius()
|
Point.y = Vec2.y + math.sin( Radial ) * self:GetRadius()
|
||||||
COORDINATE:New( Point.x, AddHeight, Point.y):Smoke( SmokeColor )
|
POINT_VEC2:New( Point.x, Point.y, AddHeight ):Smoke( SmokeColor )
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -138,7 +137,7 @@ function ZONE_DETECTION:FlareZone( FlareColor, Points, Azimuth, AddHeight )
|
|||||||
local Radial = Angle * RadialBase / 360
|
local Radial = Angle * RadialBase / 360
|
||||||
Point.x = Vec2.x + math.cos( Radial ) * self:GetRadius()
|
Point.x = Vec2.x + math.cos( Radial ) * self:GetRadius()
|
||||||
Point.y = Vec2.y + math.sin( Radial ) * self:GetRadius()
|
Point.y = Vec2.y + math.sin( Radial ) * self:GetRadius()
|
||||||
COORDINATE:New( Point.x, AddHeight, Point.y ):Flare( FlareColor, Azimuth )
|
POINT_VEC2:New( Point.x, Point.y, AddHeight ):Flare( FlareColor, Azimuth )
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -202,3 +201,4 @@ function ZONE_DETECTION:IsVec3InZone( Vec3 )
|
|||||||
|
|
||||||
return InZone
|
return InZone
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ do -- world
|
|||||||
-- @field #world.event event [https://wiki.hoggitworld.com/view/DCS_enum_world](https://wiki.hoggitworld.com/view/DCS_enum_world)
|
-- @field #world.event event [https://wiki.hoggitworld.com/view/DCS_enum_world](https://wiki.hoggitworld.com/view/DCS_enum_world)
|
||||||
-- @field #world.BirthPlace BirthPlace The birthplace enumerator is used to define where an aircraft or helicopter has spawned in association with birth events.
|
-- @field #world.BirthPlace BirthPlace The birthplace enumerator is used to define where an aircraft or helicopter has spawned in association with birth events.
|
||||||
-- @field #world.VolumeType VolumeType The volumeType enumerator defines the types of 3d geometery used within the [world.searchObjects](https://wiki.hoggitworld.com/view/DCS_func_searchObjects) function.
|
-- @field #world.VolumeType VolumeType The volumeType enumerator defines the types of 3d geometery used within the [world.searchObjects](https://wiki.hoggitworld.com/view/DCS_func_searchObjects) function.
|
||||||
-- @field #world.weather weather Weather functions for fog etc.
|
|
||||||
|
|
||||||
--- The world singleton contains functions centered around two different but extremely useful functions.
|
--- The world singleton contains functions centered around two different but extremely useful functions.
|
||||||
-- * Events and event handlers are all governed within world.
|
-- * Events and event handlers are all governed within world.
|
||||||
@@ -26,68 +25,38 @@ do -- world
|
|||||||
|
|
||||||
--- [https://wiki.hoggitworld.com/view/DCS_enum_world](https://wiki.hoggitworld.com/view/DCS_enum_world)
|
--- [https://wiki.hoggitworld.com/view/DCS_enum_world](https://wiki.hoggitworld.com/view/DCS_enum_world)
|
||||||
-- @type world.event
|
-- @type world.event
|
||||||
-- @field S_EVENT_INVALID = 0
|
-- @field S_EVENT_INVALID
|
||||||
-- @field S_EVENT_SHOT = 1
|
-- @field S_EVENT_SHOT [https://wiki.hoggitworld.com/view/DCS_event_shot](https://wiki.hoggitworld.com/view/DCS_event_shot)
|
||||||
-- @field S_EVENT_HIT = 2
|
-- @field S_EVENT_HIT [https://wiki.hoggitworld.com/view/DCS_event_hit](https://wiki.hoggitworld.com/view/DCS_event_hit)
|
||||||
-- @field S_EVENT_TAKEOFF = 3
|
-- @field S_EVENT_TAKEOFF [https://wiki.hoggitworld.com/view/DCS_event_takeoff](https://wiki.hoggitworld.com/view/DCS_event_takeoff)
|
||||||
-- @field S_EVENT_LAND = 4
|
-- @field S_EVENT_LAND [https://wiki.hoggitworld.com/view/DCS_event_land](https://wiki.hoggitworld.com/view/DCS_event_land)
|
||||||
-- @field S_EVENT_CRASH = 5
|
-- @field S_EVENT_CRASH [https://wiki.hoggitworld.com/view/DCS_event_crash](https://wiki.hoggitworld.com/view/DCS_event_crash)
|
||||||
-- @field S_EVENT_EJECTION = 6
|
-- @field S_EVENT_EJECTION [https://wiki.hoggitworld.com/view/DCS_event_ejection](https://wiki.hoggitworld.com/view/DCS_event_ejection)
|
||||||
-- @field S_EVENT_REFUELING = 7
|
-- @field S_EVENT_REFUELING [https://wiki.hoggitworld.com/view/DCS_event_refueling](https://wiki.hoggitworld.com/view/DCS_event_refueling)
|
||||||
-- @field S_EVENT_DEAD = 8
|
-- @field S_EVENT_DEAD [https://wiki.hoggitworld.com/view/DCS_event_dead](https://wiki.hoggitworld.com/view/DCS_event_dead)
|
||||||
-- @field S_EVENT_PILOT_DEAD = 9
|
-- @field S_EVENT_PILOT_DEAD [https://wiki.hoggitworld.com/view/DCS_event_pilot_dead](https://wiki.hoggitworld.com/view/DCS_event_pilot_dead)
|
||||||
-- @field S_EVENT_BASE_CAPTURED = 10
|
-- @field S_EVENT_BASE_CAPTURED [https://wiki.hoggitworld.com/view/DCS_event_base_captured](https://wiki.hoggitworld.com/view/DCS_event_base_captured)
|
||||||
-- @field S_EVENT_MISSION_START = 11
|
-- @field S_EVENT_MISSION_START [https://wiki.hoggitworld.com/view/DCS_event_mission_start](https://wiki.hoggitworld.com/view/DCS_event_mission_start)
|
||||||
-- @field S_EVENT_MISSION_END = 12
|
-- @field S_EVENT_MISSION_END [https://wiki.hoggitworld.com/view/DCS_event_mission_end](https://wiki.hoggitworld.com/view/DCS_event_mission_end)
|
||||||
-- @field S_EVENT_TOOK_CONTROL = 13
|
-- @field S_EVENT_TOOK_CONTROL
|
||||||
-- @field S_EVENT_REFUELING_STOP = 14
|
-- @field S_EVENT_REFUELING_STOP [https://wiki.hoggitworld.com/view/DCS_event_refueling_stop](https://wiki.hoggitworld.com/view/DCS_event_refueling_stop)
|
||||||
-- @field S_EVENT_BIRTH = 15
|
-- @field S_EVENT_BIRTH [https://wiki.hoggitworld.com/view/DCS_event_birth](https://wiki.hoggitworld.com/view/DCS_event_birth)
|
||||||
-- @field S_EVENT_HUMAN_FAILURE = 16
|
-- @field S_EVENT_HUMAN_FAILURE [https://wiki.hoggitworld.com/view/DCS_event_human_failure](https://wiki.hoggitworld.com/view/DCS_event_human_failure)
|
||||||
-- @field S_EVENT_DETAILED_FAILURE = 17
|
-- @field S_EVENT_ENGINE_STARTUP [https://wiki.hoggitworld.com/view/DCS_event_engine_startup](https://wiki.hoggitworld.com/view/DCS_event_engine_startup)
|
||||||
-- @field S_EVENT_ENGINE_STARTUP = 18
|
-- @field S_EVENT_ENGINE_SHUTDOWN [https://wiki.hoggitworld.com/view/DCS_event_engine_shutdown](https://wiki.hoggitworld.com/view/DCS_event_engine_shutdown)
|
||||||
-- @field S_EVENT_ENGINE_SHUTDOWN = 19
|
-- @field S_EVENT_PLAYER_ENTER_UNIT [https://wiki.hoggitworld.com/view/DCS_event_player_enter_unit](https://wiki.hoggitworld.com/view/DCS_event_player_enter_unit)
|
||||||
-- @field S_EVENT_PLAYER_ENTER_UNIT = 20
|
-- @field S_EVENT_PLAYER_LEAVE_UNIT [https://wiki.hoggitworld.com/view/DCS_event_player_leave_unit](https://wiki.hoggitworld.com/view/DCS_event_player_leave_unit)
|
||||||
-- @field S_EVENT_PLAYER_LEAVE_UNIT = 21
|
-- @field S_EVENT_PLAYER_COMMENT
|
||||||
-- @field S_EVENT_PLAYER_COMMENT = 22
|
-- @field S_EVENT_SHOOTING_START [https://wiki.hoggitworld.com/view/DCS_event_shooting_start](https://wiki.hoggitworld.com/view/DCS_event_shooting_start)
|
||||||
-- @field S_EVENT_SHOOTING_START = 23
|
-- @field S_EVENT_SHOOTING_END [https://wiki.hoggitworld.com/view/DCS_event_shooting_end](https://wiki.hoggitworld.com/view/DCS_event_shooting_end)
|
||||||
-- @field S_EVENT_SHOOTING_END = 24
|
-- @field S_EVENT_MARK ADDED [https://wiki.hoggitworld.com/view/DCS_event_mark_added](https://wiki.hoggitworld.com/view/DCS_event_mark_added) DCS>=2.5.1
|
||||||
-- @field S_EVENT_MARK_ADDED = 25
|
-- @field S_EVENT_MARK CHANGE [https://wiki.hoggitworld.com/view/DCS_event_mark_change](https://wiki.hoggitworld.com/view/DCS_event_mark_change) DCS>=2.5.1
|
||||||
-- @field S_EVENT_MARK_CHANGE = 26
|
-- @field S_EVENT_MARK REMOVE [https://wiki.hoggitworld.com/view/DCS_event_mark_remove](https://wiki.hoggitworld.com/view/DCS_event_mark_remove) DCS>=2.5.1
|
||||||
-- @field S_EVENT_MARK_REMOVED = 27
|
-- @field S_EVENT_KILL [https://wiki.hoggitworld.com/view/DCS_event_kill](https://wiki.hoggitworld.com/view/DCS_event_kill) DCS>=2.5.6
|
||||||
-- @field S_EVENT_KILL = 28
|
-- @field S_EVENT_SCORE [https://wiki.hoggitworld.com/view/DCS_event_score](https://wiki.hoggitworld.com/view/DCS_event_score) DCS>=2.5.6
|
||||||
-- @field S_EVENT_SCORE = 29
|
-- @field S_EVENT_UNIT_LOST [https://wiki.hoggitworld.com/view/DCS_event_unit_lost](https://wiki.hoggitworld.com/view/DCS_event_unit_lost) DCS>=2.5.6
|
||||||
-- @field S_EVENT_UNIT_LOST = 30
|
-- @field S_EVENT_LANDING_AFTER_EJECTION [https://wiki.hoggitworld.com/view/DCS_event_landing_after_ejection](https://wiki.hoggitworld.com/view/DCS_event_landing_after_ejection) DCS>=2.5.6
|
||||||
-- @field S_EVENT_LANDING_AFTER_EJECTION = 31
|
-- @field S_EVENT_MAX
|
||||||
-- @field S_EVENT_PARATROOPER_LENDING = 32 -- who's lending whom what? ;)
|
|
||||||
-- @field S_EVENT_DISCARD_CHAIR_AFTER_EJECTION = 33
|
|
||||||
-- @field S_EVENT_WEAPON_ADD = 34
|
|
||||||
-- @field S_EVENT_TRIGGER_ZONE = 35
|
|
||||||
-- @field S_EVENT_LANDING_QUALITY_MARK = 36
|
|
||||||
-- @field S_EVENT_BDA = 37 -- battle damage assessment
|
|
||||||
-- @field S_EVENT_AI_ABORT_MISSION = 38
|
|
||||||
-- @field S_EVENT_DAYNIGHT = 39
|
|
||||||
-- @field S_EVENT_FLIGHT_TIME = 40
|
|
||||||
-- @field S_EVENT_PLAYER_SELF_KILL_PILOT = 41
|
|
||||||
-- @field S_EVENT_PLAYER_CAPTURE_AIRFIELD = 42
|
|
||||||
-- @field S_EVENT_EMERGENCY_LANDING = 43
|
|
||||||
-- @field S_EVENT_UNIT_CREATE_TASK = 44
|
|
||||||
-- @field S_EVENT_UNIT_DELETE_TASK = 45
|
|
||||||
-- @field S_EVENT_SIMULATION_START = 46
|
|
||||||
-- @field S_EVENT_WEAPON_REARM = 47
|
|
||||||
-- @field S_EVENT_WEAPON_DROP = 48
|
|
||||||
-- @field S_EVENT_UNIT_TASK_COMPLETE = 49
|
|
||||||
-- @field S_EVENT_UNIT_TASK_STAGE = 50
|
|
||||||
-- @field S_EVENT_MAC_EXTRA_SCORE= 51 -- not sure what this is
|
|
||||||
-- @field S_EVENT_MISSION_RESTART= 52
|
|
||||||
-- @field S_EVENT_MISSION_WINNER = 53
|
|
||||||
-- @field S_EVENT_RUNWAY_TAKEOFF= 54
|
|
||||||
-- @field S_EVENT_RUNWAY_TOUCH= 55
|
|
||||||
-- @field S_EVENT_MAC_LMS_RESTART= 56 -- not sure what this is
|
|
||||||
-- @field S_EVENT_SIMULATION_FREEZE = 57
|
|
||||||
-- @field S_EVENT_SIMULATION_UNFREEZE = 58
|
|
||||||
-- @field S_EVENT_HUMAN_AIRCRAFT_REPAIR_START = 59
|
|
||||||
-- @field S_EVENT_HUMAN_AIRCRAFT_REPAIR_FINISH = 60
|
|
||||||
-- @field S_EVENT_MAX = 61
|
|
||||||
|
|
||||||
--- The birthplace enumerator is used to define where an aircraft or helicopter has spawned in association with birth events.
|
--- The birthplace enumerator is used to define where an aircraft or helicopter has spawned in association with birth events.
|
||||||
-- @type world.BirthPlace
|
-- @type world.BirthPlace
|
||||||
@@ -133,36 +102,6 @@ do -- world
|
|||||||
-- @function [parent=#world] getAirbases
|
-- @function [parent=#world] getAirbases
|
||||||
-- @param #number coalitionId The coalition side number ID. Default is all airbases are returned.
|
-- @param #number coalitionId The coalition side number ID. Default is all airbases are returned.
|
||||||
-- @return #table Table of DCS airbase objects.
|
-- @return #table Table of DCS airbase objects.
|
||||||
|
|
||||||
|
|
||||||
--- Weather functions.
|
|
||||||
-- @type world.weather
|
|
||||||
|
|
||||||
--- Fog animation data structure.
|
|
||||||
-- @type world.FogAnimation
|
|
||||||
-- @field #number time
|
|
||||||
-- @field #number visibility
|
|
||||||
-- @field #number thickness
|
|
||||||
|
|
||||||
--- Returns the current fog thickness.
|
|
||||||
-- @function [parent=#world.weather] getFogThickness Returns the fog thickness.
|
|
||||||
-- @return #number Fog thickness in meters. If there is no fog, zero is returned.
|
|
||||||
|
|
||||||
--- Sets the fog thickness instantly. Any current fog animation is discarded.
|
|
||||||
-- @function [parent=#world.weather] setFogThickness
|
|
||||||
-- @param #number thickness Fog thickness in meters. Set to zero to disable fog.
|
|
||||||
|
|
||||||
--- Returns the current fog visibility distance.
|
|
||||||
-- @function [parent=#world.weather] getFogVisibilityDistance Returns the current maximum visibility distance in meters. Returns zero if fog is not present.
|
|
||||||
|
|
||||||
--- Instantly sets the maximum visibility distance of fog at sea level when looking at the horizon. Any current fog animation is discarded. Set zero to disable the fog.
|
|
||||||
-- @function [parent=#world.weather] setFogVisibilityDistance
|
|
||||||
-- @param #number visibility Max fog visibility in meters. Set to zero to disable fog.
|
|
||||||
|
|
||||||
--- Sets fog animation keys. Time is set in seconds and relative to the current simulation time, where time=0 is the current moment.
|
|
||||||
-- Time must be increasing. Previous animation is always discarded despite the data being correct.
|
|
||||||
-- @function [parent=#world.weather] setFogAnimation
|
|
||||||
-- @param #world.FogAnimation animation List of fog animations
|
|
||||||
|
|
||||||
end -- world
|
end -- world
|
||||||
|
|
||||||
@@ -198,7 +137,7 @@ end -- env
|
|||||||
|
|
||||||
do -- radio
|
do -- radio
|
||||||
|
|
||||||
--@type radio
|
---@type radio
|
||||||
-- @field #radio.modulation modulation
|
-- @field #radio.modulation modulation
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -438,7 +377,7 @@ do -- coalition
|
|||||||
-- @param #table groupData Group data table.
|
-- @param #table groupData Group data table.
|
||||||
-- @return DCS#Group The spawned Group object.
|
-- @return DCS#Group The spawned Group object.
|
||||||
|
|
||||||
--- Dynamically spawns a static object. See [hoggit](https://wiki.hoggitworld.com/view/DCS_func_addStaticObject)
|
--- Dynamically spawns a static object. See [hoggit](https://wiki.hoggitworld.com/view/DCS_func_addGroup)
|
||||||
-- @function [parent=#coalition] addStaticObject
|
-- @function [parent=#coalition] addStaticObject
|
||||||
-- @param #number countryId Id of the country.
|
-- @param #number countryId Id of the country.
|
||||||
-- @param #table groupData Group data table.
|
-- @param #table groupData Group data table.
|
||||||
@@ -451,7 +390,6 @@ end -- coalition
|
|||||||
|
|
||||||
do -- Types
|
do -- Types
|
||||||
|
|
||||||
--- Descriptors.
|
|
||||||
-- @type Desc
|
-- @type Desc
|
||||||
-- @field #number speedMax0 Max speed in meters/second at zero altitude.
|
-- @field #number speedMax0 Max speed in meters/second at zero altitude.
|
||||||
-- @field #number massEmpty Empty mass in kg.
|
-- @field #number massEmpty Empty mass in kg.
|
||||||
@@ -630,13 +568,9 @@ do -- Object
|
|||||||
--- @function [parent=#Object] destroy
|
--- @function [parent=#Object] destroy
|
||||||
-- @param #Object self
|
-- @param #Object self
|
||||||
|
|
||||||
--- Returns an enumerator of the category for the specific object.
|
--- @function [parent=#Object] getCategory
|
||||||
-- The enumerator returned is dependent on the category of the object and how the function is called.
|
|
||||||
-- As of DCS 2.9.2 when this function is called on an Object, Unit, Weapon, or Airbase a 2nd value will be returned which details the object sub-category value.
|
|
||||||
-- @function [parent=#Object] getCategory
|
|
||||||
-- @param #Object self
|
-- @param #Object self
|
||||||
-- @return #Object.Category The object category (1=UNIT, 2=WEAPON, 3=STATIC, 4=BASE, 5=SCENERY, 6=Cargo)
|
-- @return #Object.Category
|
||||||
-- @return #number The subcategory of the passed object, e.g. Unit.Category if a unit object was passed.
|
|
||||||
|
|
||||||
--- Returns type name of the Object.
|
--- Returns type name of the Object.
|
||||||
-- @function [parent=#Object] getTypeName
|
-- @function [parent=#Object] getTypeName
|
||||||
@@ -1049,16 +983,14 @@ do -- Spot
|
|||||||
end -- Spot
|
end -- Spot
|
||||||
|
|
||||||
do -- Controller
|
do -- Controller
|
||||||
|
|
||||||
--- Controller is an object that performs A.I.-tasks. Other words controller is an instance of A.I.. Controller stores current main task, active enroute tasks and behavior options. Controller performs commands. Please, read DCS A-10C GUI Manual EN.pdf chapter "Task Planning for Unit Groups", page 91 to understand A.I. system of DCS:A-10C.
|
--- Controller is an object that performs A.I.-tasks. Other words controller is an instance of A.I.. Controller stores current main task, active enroute tasks and behavior options. Controller performs commands. Please, read DCS A-10C GUI Manual EN.pdf chapter "Task Planning for Unit Groups", page 91 to understand A.I. system of DCS:A-10C.
|
||||||
--
|
--
|
||||||
-- This class has 2 types of functions:
|
-- This class has 2 types of functions:
|
||||||
--
|
--
|
||||||
-- * Tasks
|
-- * Tasks
|
||||||
-- * Commands: Commands are instant actions those required zero time to perform. Commands may be used both for control unit/group behavior and control game mechanics.
|
-- * Commands: Commands are instant actions those required zero time to perform. Commands may be used both for control unit/group behavior and control game mechanics.
|
||||||
--
|
|
||||||
-- @type Controller
|
-- @type Controller
|
||||||
-- @field #Controller.Detection Detection Enum contains identifiers of surface types.
|
-- @field #Controller.Detection Detection Enum contains identifiers of surface types.
|
||||||
|
|
||||||
--- Enables and disables the controller.
|
--- Enables and disables the controller.
|
||||||
-- Note: Now it works only for ground / naval groups!
|
-- Note: Now it works only for ground / naval groups!
|
||||||
@@ -1117,18 +1049,18 @@ do -- Controller
|
|||||||
|
|
||||||
-- Detection
|
-- Detection
|
||||||
|
|
||||||
--- Enum containing detection types.
|
--- Enum contains identifiers of surface types.
|
||||||
-- @type Controller.Detection
|
-- @type Controller.Detection
|
||||||
-- @field #number VISUAL Visual detection. Numeric value 1.
|
-- @field VISUAL
|
||||||
-- @field #number OPTIC Optical detection. Numeric value 2.
|
-- @field OPTIC
|
||||||
-- @field #number RADAR Radar detection. Numeric value 4.
|
-- @field RADAR
|
||||||
-- @field #number IRST Infra-red search and track detection. Numeric value 8.
|
-- @field IRST
|
||||||
-- @field #number RWR Radar Warning Receiver detection. Numeric value 16.
|
-- @field RWR
|
||||||
-- @field #number DLINK Data link detection. Numeric value 32.
|
-- @field DLINK
|
||||||
|
|
||||||
--- Detected target.
|
--- Detected target.
|
||||||
-- @type Controller.DetectedTarget
|
-- @type DetectedTarget
|
||||||
-- @field DCS#Object object The target
|
-- @field Wrapper.Object#Object object The target
|
||||||
-- @field #boolean visible The target is visible
|
-- @field #boolean visible The target is visible
|
||||||
-- @field #boolean type The target type is known
|
-- @field #boolean type The target type is known
|
||||||
-- @field #boolean distance Distance to the target is known
|
-- @field #boolean distance Distance to the target is known
|
||||||
@@ -1141,9 +1073,9 @@ do -- Controller
|
|||||||
-- @param #Controller.Detection detection Controller.Detection detection1, Controller.Detection detection2, ... Controller.Detection detectionN
|
-- @param #Controller.Detection detection Controller.Detection detection1, Controller.Detection detection2, ... Controller.Detection detectionN
|
||||||
-- @return #boolean detected True if the target is detected.
|
-- @return #boolean detected True if the target is detected.
|
||||||
-- @return #boolean visible Has effect only if detected is true. True if the target is visible now.
|
-- @return #boolean visible Has effect only if detected is true. True if the target is visible now.
|
||||||
-- @return #boolean type Has effect only if detected is true. True if the target type is known.
|
|
||||||
-- @return #boolean distance Has effect only if detected is true. True if the distance to the target is known.
|
|
||||||
-- @return #ModelTime lastTime Has effect only if visible is false. Last time when target was seen.
|
-- @return #ModelTime lastTime Has effect only if visible is false. Last time when target was seen.
|
||||||
|
-- @return #boolean type Has effect only if detected is true. True if the target type is known.
|
||||||
|
-- @return #boolean distance Has effect only if detected is true. True if the distance to the target is known.
|
||||||
-- @return #Vec3 lastPos Has effect only if visible is false. Last position of the target when it was seen.
|
-- @return #Vec3 lastPos Has effect only if visible is false. Last position of the target when it was seen.
|
||||||
-- @return #Vec3 lastVel Has effect only if visible is false. Last velocity of the target when it was seen.
|
-- @return #Vec3 lastVel Has effect only if visible is false. Last velocity of the target when it was seen.
|
||||||
|
|
||||||
@@ -1169,7 +1101,6 @@ end -- Controller
|
|||||||
|
|
||||||
do -- Unit
|
do -- Unit
|
||||||
|
|
||||||
--- Unit.
|
|
||||||
-- @type Unit
|
-- @type Unit
|
||||||
-- @extends #CoalitionObject
|
-- @extends #CoalitionObject
|
||||||
-- @field ID Identifier of an unit. It assigned to an unit by the Mission Editor automatically.
|
-- @field ID Identifier of an unit. It assigned to an unit by the Mission Editor automatically.
|
||||||
@@ -1734,7 +1665,6 @@ do -- AI
|
|||||||
-- @field ALARM_STATE @{#AI.Option.Ground.val.ALARM_STATE}
|
-- @field ALARM_STATE @{#AI.Option.Ground.val.ALARM_STATE}
|
||||||
-- @field ENGAGE_AIR_WEAPONS
|
-- @field ENGAGE_AIR_WEAPONS
|
||||||
-- @field AC_ENGAGEMENT_RANGE_RESTRICTION
|
-- @field AC_ENGAGEMENT_RANGE_RESTRICTION
|
||||||
-- @field EVASION_OF_ARM
|
|
||||||
|
|
||||||
---
|
---
|
||||||
-- @type AI.Option.Ground.mid -- Moose added
|
-- @type AI.Option.Ground.mid -- Moose added
|
||||||
|
|||||||
1338
Moose Development/Moose/Functional/AICSAR.lua
Normal file
1338
Moose Development/Moose/Functional/AICSAR.lua
Normal file
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,9 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ## Missions: None
|
-- ## Missions:
|
||||||
|
--
|
||||||
|
-- [ABP - Airbase Police](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/ABP%20-%20Airbase%20Police)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -18,15 +20,13 @@
|
|||||||
-- ### Author: FlightControl - Framework Design & Programming
|
-- ### Author: FlightControl - Framework Design & Programming
|
||||||
-- ### Refactoring to use the Runway auto-detection: Applevangelist
|
-- ### Refactoring to use the Runway auto-detection: Applevangelist
|
||||||
-- @date August 2022
|
-- @date August 2022
|
||||||
-- Last Update Feb 2025
|
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @module Functional.ATC_Ground
|
-- @module Functional.ATC_Ground
|
||||||
-- @image Air_Traffic_Control_Ground_Operations.JPG
|
-- @image Air_Traffic_Control_Ground_Operations.JPG
|
||||||
|
|
||||||
---
|
--- @type ATC_GROUND
|
||||||
-- @type ATC_GROUND
|
|
||||||
-- @field Core.Set#SET_CLIENT SetClient
|
-- @field Core.Set#SET_CLIENT SetClient
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
@@ -39,8 +39,7 @@ ATC_GROUND = {
|
|||||||
AirbaseNames = nil,
|
AirbaseNames = nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
---
|
--- @type ATC_GROUND.AirbaseNames
|
||||||
-- @type ATC_GROUND.AirbaseNames
|
|
||||||
-- @list <#string>
|
-- @list <#string>
|
||||||
|
|
||||||
|
|
||||||
@@ -52,7 +51,7 @@ function ATC_GROUND:New( Airbases, AirbaseList )
|
|||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, BASE:New() ) -- #ATC_GROUND
|
local self = BASE:Inherit( self, BASE:New() ) -- #ATC_GROUND
|
||||||
self:T( { self.ClassName, Airbases } )
|
self:E( { self.ClassName, Airbases } )
|
||||||
|
|
||||||
self.Airbases = Airbases
|
self.Airbases = Airbases
|
||||||
self.AirbaseList = AirbaseList
|
self.AirbaseList = AirbaseList
|
||||||
@@ -83,7 +82,7 @@ function ATC_GROUND:New( Airbases, AirbaseList )
|
|||||||
end
|
end
|
||||||
|
|
||||||
self.SetClient:ForEachClient(
|
self.SetClient:ForEachClient(
|
||||||
-- @param Wrapper.Client#CLIENT Client
|
--- @param Wrapper.Client#CLIENT Client
|
||||||
function( Client )
|
function( Client )
|
||||||
Client:SetState( self, "Speeding", false )
|
Client:SetState( self, "Speeding", false )
|
||||||
Client:SetState( self, "Warnings", 0)
|
Client:SetState( self, "Warnings", 0)
|
||||||
@@ -247,11 +246,11 @@ function ATC_GROUND:SetMaximumKickSpeedMiph( MaximumKickSpeedMiph, Airbase )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #ATC_GROUND self
|
--- @param #ATC_GROUND self
|
||||||
function ATC_GROUND:_AirbaseMonitor()
|
function ATC_GROUND:_AirbaseMonitor()
|
||||||
|
|
||||||
self.SetClient:ForEachClient(
|
self.SetClient:ForEachClient(
|
||||||
-- @param Wrapper.Client#CLIENT Client
|
--- @param Wrapper.Client#CLIENT Client
|
||||||
function( Client )
|
function( Client )
|
||||||
|
|
||||||
if Client:IsAlive() then
|
if Client:IsAlive() then
|
||||||
@@ -259,7 +258,7 @@ function ATC_GROUND:_AirbaseMonitor()
|
|||||||
local IsOnGround = Client:InAir() == false
|
local IsOnGround = Client:InAir() == false
|
||||||
|
|
||||||
for AirbaseID, AirbaseMeta in pairs( self.Airbases ) do
|
for AirbaseID, AirbaseMeta in pairs( self.Airbases ) do
|
||||||
self:T( AirbaseID, AirbaseMeta.KickSpeed )
|
self:E( AirbaseID, AirbaseMeta.KickSpeed )
|
||||||
|
|
||||||
if AirbaseMeta.Monitor == true and Client:IsInZone( AirbaseMeta.ZoneBoundary ) then
|
if AirbaseMeta.Monitor == true and Client:IsInZone( AirbaseMeta.ZoneBoundary ) then
|
||||||
|
|
||||||
@@ -272,7 +271,7 @@ function ATC_GROUND:_AirbaseMonitor()
|
|||||||
|
|
||||||
if IsOnGround then
|
if IsOnGround then
|
||||||
local Taxi = Client:GetState( self, "Taxi" )
|
local Taxi = Client:GetState( self, "Taxi" )
|
||||||
self:T( Taxi )
|
self:E( Taxi )
|
||||||
if Taxi == false then
|
if Taxi == false then
|
||||||
local Velocity = VELOCITY:New( AirbaseMeta.KickSpeed or self.KickSpeed )
|
local Velocity = VELOCITY:New( AirbaseMeta.KickSpeed or self.KickSpeed )
|
||||||
Client:Message( "Welcome to " .. AirbaseID .. ". The maximum taxiing speed is " ..
|
Client:Message( "Welcome to " .. AirbaseID .. ". The maximum taxiing speed is " ..
|
||||||
@@ -332,7 +331,7 @@ function ATC_GROUND:_AirbaseMonitor()
|
|||||||
Client:SetState( self, "Warnings", SpeedingWarnings + 1 )
|
Client:SetState( self, "Warnings", SpeedingWarnings + 1 )
|
||||||
else
|
else
|
||||||
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
||||||
-- @param Wrapper.Client#CLIENT Client
|
--- @param Wrapper.Client#CLIENT Client
|
||||||
Client:Destroy()
|
Client:Destroy()
|
||||||
Client:SetState( self, "Speeding", false )
|
Client:SetState( self, "Speeding", false )
|
||||||
Client:SetState( self, "Warnings", 0 )
|
Client:SetState( self, "Warnings", 0 )
|
||||||
@@ -364,7 +363,7 @@ function ATC_GROUND:_AirbaseMonitor()
|
|||||||
Client:SetState( self, "OffRunwayWarnings", OffRunwayWarnings + 1 )
|
Client:SetState( self, "OffRunwayWarnings", OffRunwayWarnings + 1 )
|
||||||
else
|
else
|
||||||
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
||||||
-- @param Wrapper.Client#CLIENT Client
|
--- @param Wrapper.Client#CLIENT Client
|
||||||
Client:Destroy()
|
Client:Destroy()
|
||||||
Client:SetState( self, "IsOffRunway", false )
|
Client:SetState( self, "IsOffRunway", false )
|
||||||
Client:SetState( self, "OffRunwayWarnings", 0 )
|
Client:SetState( self, "OffRunwayWarnings", 0 )
|
||||||
@@ -416,7 +415,7 @@ end
|
|||||||
-- @field #ATC_GROUND_UNIVERSAL
|
-- @field #ATC_GROUND_UNIVERSAL
|
||||||
ATC_GROUND_UNIVERSAL = {
|
ATC_GROUND_UNIVERSAL = {
|
||||||
ClassName = "ATC_GROUND_UNIVERSAL",
|
ClassName = "ATC_GROUND_UNIVERSAL",
|
||||||
Version = "0.0.2",
|
Version = "0.0.1",
|
||||||
SetClient = nil,
|
SetClient = nil,
|
||||||
Airbases = nil,
|
Airbases = nil,
|
||||||
AirbaseList = nil,
|
AirbaseList = nil,
|
||||||
@@ -425,44 +424,22 @@ ATC_GROUND_UNIVERSAL = {
|
|||||||
|
|
||||||
--- Creates a new ATC\_GROUND\_UNIVERSAL object. This works on any map.
|
--- Creates a new ATC\_GROUND\_UNIVERSAL object. This works on any map.
|
||||||
-- @param #ATC_GROUND_UNIVERSAL self
|
-- @param #ATC_GROUND_UNIVERSAL self
|
||||||
-- @param AirbaseList A table of Airbase Names. Leave empty to cover **all** airbases of the map.
|
-- @param AirbaseList (Optional) A table of Airbase Names.
|
||||||
-- @return #ATC_GROUND_UNIVERSAL self
|
-- @return #ATC_GROUND_UNIVERSAL self
|
||||||
-- @usage
|
|
||||||
-- -- define monitoring for one airbase
|
|
||||||
-- local atc=ATC_GROUND_UNIVERSAL:New({AIRBASE.Syria.Gecitkale})
|
|
||||||
-- -- set kick speed
|
|
||||||
-- atc:SetKickSpeed(UTILS.KnotsToMps(20))
|
|
||||||
-- -- start monitoring evey 10 secs
|
|
||||||
-- atc:Start(10)
|
|
||||||
function ATC_GROUND_UNIVERSAL:New(AirbaseList)
|
function ATC_GROUND_UNIVERSAL:New(AirbaseList)
|
||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, BASE:New() ) -- #ATC_GROUND
|
local self = BASE:Inherit( self, BASE:New() ) -- #ATC_GROUND
|
||||||
self:T( { self.ClassName } )
|
self:E( { self.ClassName } )
|
||||||
|
|
||||||
self.Airbases = {}
|
self.Airbases = {}
|
||||||
|
|
||||||
|
for _name,_ in pairs(_DATABASE.AIRBASES) do
|
||||||
|
self.Airbases[_name]={}
|
||||||
|
end
|
||||||
|
|
||||||
self.AirbaseList = AirbaseList
|
self.AirbaseList = AirbaseList
|
||||||
|
|
||||||
if not self.AirbaseList then
|
|
||||||
self.AirbaseList = {}
|
|
||||||
for _name,_base in pairs(_DATABASE.AIRBASES) do
|
|
||||||
-- DONE exclude FARPS and Ships
|
|
||||||
if _base and _base.isAirdrome == true then
|
|
||||||
self.AirbaseList[_name]=_name
|
|
||||||
self.Airbases[_name]={}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
for _,_name in pairs(AirbaseList) do
|
|
||||||
-- DONE exclude FARPS and Ships
|
|
||||||
local airbase = _DATABASE:FindAirbase(_name)
|
|
||||||
if airbase and (airbase.isAirdrome == true) then
|
|
||||||
self.Airbases[_name]={}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
self.SetClient = SET_CLIENT:New():FilterCategories( "plane" ):FilterStart()
|
self.SetClient = SET_CLIENT:New():FilterCategories( "plane" ):FilterStart()
|
||||||
|
|
||||||
|
|
||||||
@@ -483,9 +460,8 @@ function ATC_GROUND_UNIVERSAL:New(AirbaseList)
|
|||||||
self.Airbases[AirbaseName].Monitor = true
|
self.Airbases[AirbaseName].Monitor = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
self.SetClient:ForEachClient(
|
self.SetClient:ForEachClient(
|
||||||
-- @param Wrapper.Client#CLIENT Client
|
--- @param Wrapper.Client#CLIENT Client
|
||||||
function( Client )
|
function( Client )
|
||||||
Client:SetState( self, "Speeding", false )
|
Client:SetState( self, "Speeding", false )
|
||||||
Client:SetState( self, "Warnings", 0)
|
Client:SetState( self, "Warnings", 0)
|
||||||
@@ -703,10 +679,9 @@ end
|
|||||||
-- @param #ATC_GROUND_UNIVERSAL self
|
-- @param #ATC_GROUND_UNIVERSAL self
|
||||||
-- @return #ATC_GROUND_UNIVERSAL self
|
-- @return #ATC_GROUND_UNIVERSAL self
|
||||||
function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
|
function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
|
||||||
self:I("_AirbaseMonitor")
|
|
||||||
self.SetClient:ForEachClient(
|
self.SetClient:ForEachClient(
|
||||||
--- Nameless function
|
--- @param Wrapper.Client#CLIENT Client
|
||||||
-- @param Wrapper.Client#CLIENT Client
|
|
||||||
function( Client )
|
function( Client )
|
||||||
|
|
||||||
if Client:IsAlive() then
|
if Client:IsAlive() then
|
||||||
@@ -714,7 +689,7 @@ function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
|
|||||||
local IsOnGround = Client:InAir() == false
|
local IsOnGround = Client:InAir() == false
|
||||||
|
|
||||||
for AirbaseID, AirbaseMeta in pairs( self.Airbases ) do
|
for AirbaseID, AirbaseMeta in pairs( self.Airbases ) do
|
||||||
self:T( AirbaseID, AirbaseMeta.KickSpeed )
|
self:E( AirbaseID, AirbaseMeta.KickSpeed )
|
||||||
|
|
||||||
if AirbaseMeta.Monitor == true and Client:IsInZone( AirbaseMeta.ZoneBoundary ) then
|
if AirbaseMeta.Monitor == true and Client:IsInZone( AirbaseMeta.ZoneBoundary ) then
|
||||||
|
|
||||||
@@ -729,18 +704,14 @@ function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
|
|||||||
|
|
||||||
if NotInRunwayZone then
|
if NotInRunwayZone then
|
||||||
|
|
||||||
local Taxi = Client:GetState( self, "Taxi" )
|
|
||||||
|
|
||||||
if IsOnGround then
|
if IsOnGround then
|
||||||
|
local Taxi = Client:GetState( self, "Taxi" )
|
||||||
self:T( Taxi )
|
self:E( Taxi )
|
||||||
if Taxi == false then
|
if Taxi == false then
|
||||||
local Velocity = VELOCITY:New( AirbaseMeta.KickSpeed or self.KickSpeed )
|
local Velocity = VELOCITY:New( AirbaseMeta.KickSpeed or self.KickSpeed )
|
||||||
Client:Message( "Welcome to " .. AirbaseID .. ". The maximum taxiing speed is " ..
|
Client:Message( "Welcome to " .. AirbaseID .. ". The maximum taxiing speed is " ..
|
||||||
Velocity:ToString() , 20, "ATC" )
|
Velocity:ToString() , 20, "ATC" )
|
||||||
Client:SetState( self, "Taxi", true )
|
Client:SetState( self, "Taxi", true )
|
||||||
Client:SetState( self, "Speeding", false )
|
|
||||||
Client:SetState( self, "Warnings", 0 )
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TODO: GetVelocityKMH function usage
|
-- TODO: GetVelocityKMH function usage
|
||||||
@@ -749,7 +720,7 @@ function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
|
|||||||
local IsAboveRunway = Client:IsAboveRunway()
|
local IsAboveRunway = Client:IsAboveRunway()
|
||||||
self:T( {IsAboveRunway, IsOnGround, Velocity:Get() })
|
self:T( {IsAboveRunway, IsOnGround, Velocity:Get() })
|
||||||
|
|
||||||
if IsOnGround and not Taxi then
|
if IsOnGround then
|
||||||
local Speeding = false
|
local Speeding = false
|
||||||
if AirbaseMeta.MaximumKickSpeed then
|
if AirbaseMeta.MaximumKickSpeed then
|
||||||
if Velocity:Get() > AirbaseMeta.MaximumKickSpeed then
|
if Velocity:Get() > AirbaseMeta.MaximumKickSpeed then
|
||||||
@@ -761,17 +732,15 @@ function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if Speeding == true then
|
if Speeding == true then
|
||||||
--MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() ..
|
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() ..
|
||||||
-- " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
" has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
||||||
--Client:Destroy()
|
Client:Destroy()
|
||||||
Client:SetState( self, "Speeding", true )
|
Client:SetState( self, "Speeding", false )
|
||||||
local SpeedingWarnings = Client:GetState( self, "Warnings" )
|
Client:SetState( self, "Warnings", 0 )
|
||||||
Client:SetState( self, "Warnings", SpeedingWarnings + 1 )
|
|
||||||
Client:Message( "Warning " .. SpeedingWarnings .. "/3! Airbase traffic rule violation! Slow down now! Your speed is " ..
|
|
||||||
Velocity:ToString(), 5, "ATC" )
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if IsOnGround then
|
if IsOnGround then
|
||||||
|
|
||||||
local Speeding = false
|
local Speeding = false
|
||||||
@@ -797,7 +766,7 @@ function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
|
|||||||
Client:SetState( self, "Warnings", SpeedingWarnings + 1 )
|
Client:SetState( self, "Warnings", SpeedingWarnings + 1 )
|
||||||
else
|
else
|
||||||
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
||||||
-- @param Wrapper.Client#CLIENT Client
|
--- @param Wrapper.Client#CLIENT Client
|
||||||
Client:Destroy()
|
Client:Destroy()
|
||||||
Client:SetState( self, "Speeding", false )
|
Client:SetState( self, "Speeding", false )
|
||||||
Client:SetState( self, "Warnings", 0 )
|
Client:SetState( self, "Warnings", 0 )
|
||||||
@@ -829,7 +798,7 @@ function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
|
|||||||
Client:SetState( self, "OffRunwayWarnings", OffRunwayWarnings + 1 )
|
Client:SetState( self, "OffRunwayWarnings", OffRunwayWarnings + 1 )
|
||||||
else
|
else
|
||||||
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
||||||
-- @param Wrapper.Client#CLIENT Client
|
--- @param Wrapper.Client#CLIENT Client
|
||||||
Client:Destroy()
|
Client:Destroy()
|
||||||
Client:SetState( self, "IsOffRunway", false )
|
Client:SetState( self, "IsOffRunway", false )
|
||||||
Client:SetState( self, "OffRunwayWarnings", 0 )
|
Client:SetState( self, "OffRunwayWarnings", 0 )
|
||||||
@@ -869,16 +838,15 @@ end
|
|||||||
|
|
||||||
--- Start SCHEDULER for ATC_GROUND_UNIVERSAL object.
|
--- Start SCHEDULER for ATC_GROUND_UNIVERSAL object.
|
||||||
-- @param #ATC_GROUND_UNIVERSAL self
|
-- @param #ATC_GROUND_UNIVERSAL self
|
||||||
-- @param RepeatScanSeconds Time in second for defining schedule of alerts.
|
-- @param RepeatScanSeconds Time in second for defining occurency of alerts.
|
||||||
-- @return #ATC_GROUND_UNIVERSAL self
|
-- @return #ATC_GROUND_UNIVERSAL self
|
||||||
function ATC_GROUND_UNIVERSAL:Start( RepeatScanSeconds )
|
function ATC_GROUND_UNIVERSAL:Start( RepeatScanSeconds )
|
||||||
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
||||||
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, RepeatScanSeconds )
|
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds )
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
---
|
--- @type ATC_GROUND_CAUCASUS
|
||||||
-- @type ATC_GROUND_CAUCASUS
|
|
||||||
-- @extends #ATC_GROUND
|
-- @extends #ATC_GROUND
|
||||||
|
|
||||||
--- # ATC\_GROUND\_CAUCASUS, extends @{#ATC_GROUND_UNIVERSAL}
|
--- # ATC\_GROUND\_CAUCASUS, extends @{#ATC_GROUND_UNIVERSAL}
|
||||||
@@ -1013,12 +981,12 @@ end
|
|||||||
-- @return nothing
|
-- @return nothing
|
||||||
function ATC_GROUND_CAUCASUS:Start( RepeatScanSeconds )
|
function ATC_GROUND_CAUCASUS:Start( RepeatScanSeconds )
|
||||||
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
||||||
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, RepeatScanSeconds )
|
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
-- @type ATC_GROUND_NEVADA
|
--- @type ATC_GROUND_NEVADA
|
||||||
-- @extends #ATC_GROUND
|
-- @extends #ATC_GROUND
|
||||||
|
|
||||||
|
|
||||||
@@ -1049,23 +1017,23 @@ end
|
|||||||
-- The following airbases are monitored at the Nevada region.
|
-- The following airbases are monitored at the Nevada region.
|
||||||
-- Use the @{Wrapper.Airbase#AIRBASE.Nevada} enumeration to select the airbases to be monitored.
|
-- Use the @{Wrapper.Airbase#AIRBASE.Nevada} enumeration to select the airbases to be monitored.
|
||||||
--
|
--
|
||||||
-- * `AIRBASE.Nevada.Beatty`
|
-- * `AIRBASE.Nevada.Beatty_Airport`
|
||||||
-- * `AIRBASE.Nevada.Boulder_City`
|
-- * `AIRBASE.Nevada.Boulder_City_Airport`
|
||||||
-- * `AIRBASE.Nevada.Creech`
|
-- * `AIRBASE.Nevada.Creech_AFB`
|
||||||
-- * `AIRBASE.Nevada.Echo_Bay`
|
-- * `AIRBASE.Nevada.Echo_Bay`
|
||||||
-- * `AIRBASE.Nevada.Groom_Lake`
|
-- * `AIRBASE.Nevada.Groom_Lake_AFB`
|
||||||
-- * `AIRBASE.Nevada.Henderson_Executive`
|
-- * `AIRBASE.Nevada.Henderson_Executive_Airport`
|
||||||
-- * `AIRBASE.Nevada.Jean`
|
-- * `AIRBASE.Nevada.Jean_Airport`
|
||||||
-- * `AIRBASE.Nevada.Laughlin`
|
-- * `AIRBASE.Nevada.Laughlin_Airport`
|
||||||
-- * `AIRBASE.Nevada.Lincoln_County`
|
-- * `AIRBASE.Nevada.Lincoln_County`
|
||||||
-- * `AIRBASE.Nevada.McCarran_International`
|
-- * `AIRBASE.Nevada.McCarran_International_Airport`
|
||||||
-- * `AIRBASE.Nevada.Mesquite`
|
-- * `AIRBASE.Nevada.Mesquite`
|
||||||
-- * `AIRBASE.Nevada.Mina`
|
-- * `AIRBASE.Nevada.Mina_Airport`
|
||||||
-- * `AIRBASE.Nevada.Nellis`
|
-- * `AIRBASE.Nevada.Nellis_AFB`
|
||||||
-- * `AIRBASE.Nevada.North_Las_Vegas`
|
-- * `AIRBASE.Nevada.North_Las_Vegas`
|
||||||
-- * `AIRBASE.Nevada.Pahute_Mesa`
|
-- * `AIRBASE.Nevada.Pahute_Mesa_Airstrip`
|
||||||
-- * `AIRBASE.Nevada.Tonopah`
|
-- * `AIRBASE.Nevada.Tonopah_Airport`
|
||||||
-- * `AIRBASE.Nevada.Tonopah_Test_Range`
|
-- * `AIRBASE.Nevada.Tonopah_Test_Range_Airfield`
|
||||||
--
|
--
|
||||||
-- # Installation
|
-- # Installation
|
||||||
--
|
--
|
||||||
@@ -1102,10 +1070,10 @@ end
|
|||||||
--
|
--
|
||||||
-- -- Monitor specific airbases.
|
-- -- Monitor specific airbases.
|
||||||
-- ATC_Ground = ATC_GROUND_NEVADA:New(
|
-- ATC_Ground = ATC_GROUND_NEVADA:New(
|
||||||
-- { AIRBASE.Nevada.Laughlin,
|
-- { AIRBASE.Nevada.Laughlin_Airport,
|
||||||
-- AIRBASE.Nevada.Lincoln_County,
|
-- AIRBASE.Nevada.Lincoln_County,
|
||||||
-- AIRBASE.Nevada.North_Las_Vegas,
|
-- AIRBASE.Nevada.North_Las_Vegas,
|
||||||
-- AIRBASE.Nevada.McCarran_International
|
-- AIRBASE.Nevada.McCarran_International_Airport
|
||||||
-- }
|
-- }
|
||||||
-- )
|
-- )
|
||||||
--
|
--
|
||||||
@@ -1152,11 +1120,11 @@ end
|
|||||||
-- @return nothing
|
-- @return nothing
|
||||||
function ATC_GROUND_NEVADA:Start( RepeatScanSeconds )
|
function ATC_GROUND_NEVADA:Start( RepeatScanSeconds )
|
||||||
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
||||||
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, RepeatScanSeconds )
|
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds )
|
||||||
end
|
end
|
||||||
|
|
||||||
---
|
|
||||||
-- @type ATC_GROUND_NORMANDY
|
--- @type ATC_GROUND_NORMANDY
|
||||||
-- @extends #ATC_GROUND
|
-- @extends #ATC_GROUND
|
||||||
|
|
||||||
|
|
||||||
@@ -1309,11 +1277,10 @@ end
|
|||||||
-- @return nothing
|
-- @return nothing
|
||||||
function ATC_GROUND_NORMANDY:Start( RepeatScanSeconds )
|
function ATC_GROUND_NORMANDY:Start( RepeatScanSeconds )
|
||||||
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
||||||
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, RepeatScanSeconds )
|
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds )
|
||||||
end
|
end
|
||||||
|
|
||||||
---
|
--- @type ATC_GROUND_PERSIANGULF
|
||||||
-- @type ATC_GROUND_PERSIANGULF
|
|
||||||
-- @extends #ATC_GROUND
|
-- @extends #ATC_GROUND
|
||||||
|
|
||||||
|
|
||||||
@@ -1344,33 +1311,33 @@ end
|
|||||||
-- The following airbases are monitored at the PersianGulf region.
|
-- The following airbases are monitored at the PersianGulf region.
|
||||||
-- Use the @{Wrapper.Airbase#AIRBASE.PersianGulf} enumeration to select the airbases to be monitored.
|
-- Use the @{Wrapper.Airbase#AIRBASE.PersianGulf} enumeration to select the airbases to be monitored.
|
||||||
--
|
--
|
||||||
-- * `AIRBASE.PersianGulf.Abu_Musa_Island`
|
-- * `AIRBASE.PersianGulf.Abu_Musa_Island_Airport`
|
||||||
-- * `AIRBASE.PersianGulf.Al_Dhafra_AFB`
|
-- * `AIRBASE.PersianGulf.Al_Dhafra_AB`
|
||||||
-- * `AIRBASE.PersianGulf.Al_Maktoum_Intl`
|
-- * `AIRBASE.PersianGulf.Al_Maktoum_Intl`
|
||||||
-- * `AIRBASE.PersianGulf.Al_Minhad_AFB`
|
-- * `AIRBASE.PersianGulf.Al_Minhad_AB`
|
||||||
-- * `AIRBASE.PersianGulf.Bandar_Abbas_Intl`
|
-- * `AIRBASE.PersianGulf.Bandar_Abbas_Intl`
|
||||||
-- * `AIRBASE.PersianGulf.Bandar_Lengeh`
|
-- * `AIRBASE.PersianGulf.Bandar_Lengeh`
|
||||||
-- * `AIRBASE.PersianGulf.Dubai_Intl`
|
-- * `AIRBASE.PersianGulf.Dubai_Intl`
|
||||||
-- * `AIRBASE.PersianGulf.Fujairah_Intl`
|
-- * `AIRBASE.PersianGulf.Fujairah_Intl`
|
||||||
-- * `AIRBASE.PersianGulf.Havadarya`
|
-- * `AIRBASE.PersianGulf.Havadarya`
|
||||||
-- * `AIRBASE.PersianGulf.Kerman`
|
-- * `AIRBASE.PersianGulf.Kerman_Airport`
|
||||||
-- * `AIRBASE.PersianGulf.Khasab`
|
-- * `AIRBASE.PersianGulf.Khasab`
|
||||||
-- * `AIRBASE.PersianGulf.Lar`
|
-- * `AIRBASE.PersianGulf.Lar_Airbase`
|
||||||
-- * `AIRBASE.PersianGulf.Qeshm_Island`
|
-- * `AIRBASE.PersianGulf.Qeshm_Island`
|
||||||
-- * `AIRBASE.PersianGulf.Sharjah_Intl`
|
-- * `AIRBASE.PersianGulf.Sharjah_Intl`
|
||||||
-- * `AIRBASE.PersianGulf.Shiraz_Intl`
|
-- * `AIRBASE.PersianGulf.Shiraz_International_Airport`
|
||||||
-- * `AIRBASE.PersianGulf.Sir_Abu_Nuayr`
|
-- * `AIRBASE.PersianGulf.Sir_Abu_Nuayr`
|
||||||
-- * `AIRBASE.PersianGulf.Sirri_Island`
|
-- * `AIRBASE.PersianGulf.Sirri_Island`
|
||||||
-- * `AIRBASE.PersianGulf.Tunb_Island_AFB`
|
-- * `AIRBASE.PersianGulf.Tunb_Island_AFB`
|
||||||
-- * `AIRBASE.PersianGulf.Tunb_Kochak`
|
-- * `AIRBASE.PersianGulf.Tunb_Kochak`
|
||||||
-- * `AIRBASE.PersianGulf.Sas_Al_Nakheel`
|
-- * `AIRBASE.PersianGulf.Sas_Al_Nakheel_Airport`
|
||||||
-- * `AIRBASE.PersianGulf.Bandar_e_Jask`
|
-- * `AIRBASE.PersianGulf.Bandar_e_Jask_airfield`
|
||||||
-- * `AIRBASE.PersianGulf.Abu_Dhabi_Intl`
|
-- * `AIRBASE.PersianGulf.Abu_Dhabi_International_Airport`
|
||||||
-- * `AIRBASE.PersianGulf.Al_Bateen`
|
-- * `AIRBASE.PersianGulf.Al_Bateen_Airport`
|
||||||
-- * `AIRBASE.PersianGulf.Kish_Intl`
|
-- * `AIRBASE.PersianGulf.Kish_International_Airport`
|
||||||
-- * `AIRBASE.PersianGulf.Al_Ain_Intl`
|
-- * `AIRBASE.PersianGulf.Al_Ain_International_Airport`
|
||||||
-- * `AIRBASE.PersianGulf.Lavan_Island`
|
-- * `AIRBASE.PersianGulf.Lavan_Island_Airport`
|
||||||
-- * `AIRBASE.PersianGulf.Jiroft`
|
-- * `AIRBASE.PersianGulf.Jiroft_Airport`
|
||||||
--
|
--
|
||||||
-- # Installation
|
-- # Installation
|
||||||
--
|
--
|
||||||
@@ -1405,8 +1372,8 @@ end
|
|||||||
-- AirbasePoliceCaucasus = ATC_GROUND_PERSIANGULF:New()
|
-- AirbasePoliceCaucasus = ATC_GROUND_PERSIANGULF:New()
|
||||||
--
|
--
|
||||||
-- ATC_Ground = ATC_GROUND_PERSIANGULF:New(
|
-- ATC_Ground = ATC_GROUND_PERSIANGULF:New(
|
||||||
-- { AIRBASE.PersianGulf.Kerman,
|
-- { AIRBASE.PersianGulf.Kerman_Airport,
|
||||||
-- AIRBASE.PersianGulf.Al_Minhad_AFB
|
-- AIRBASE.PersianGulf.Al_Minhad_AB
|
||||||
-- }
|
-- }
|
||||||
-- )
|
-- )
|
||||||
--
|
--
|
||||||
@@ -1452,13 +1419,14 @@ end
|
|||||||
-- @return nothing
|
-- @return nothing
|
||||||
function ATC_GROUND_PERSIANGULF:Start( RepeatScanSeconds )
|
function ATC_GROUND_PERSIANGULF:Start( RepeatScanSeconds )
|
||||||
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
||||||
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, RepeatScanSeconds )
|
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds )
|
||||||
end
|
end
|
||||||
|
|
||||||
---
|
|
||||||
-- @type ATC_GROUND_MARIANAISLANDS
|
--- @type ATC_GROUND_MARIANAISLANDS
|
||||||
-- @extends #ATC_GROUND
|
-- @extends #ATC_GROUND
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- # ATC\_GROUND\_MARIANA, extends @{#ATC_GROUND}
|
--- # ATC\_GROUND\_MARIANA, extends @{#ATC_GROUND}
|
||||||
--
|
--
|
||||||
@@ -1549,7 +1517,7 @@ end
|
|||||||
-- * @{#ATC_GROUND.SetMaximumKickSpeedKmph}(): Set the maximum speed allowed at an airbase in kilometers per hour.
|
-- * @{#ATC_GROUND.SetMaximumKickSpeedKmph}(): Set the maximum speed allowed at an airbase in kilometers per hour.
|
||||||
-- * @{#ATC_GROUND.SetMaximumKickSpeedMiph}(): Set the maximum speed allowed at an airbase in miles per hour.
|
-- * @{#ATC_GROUND.SetMaximumKickSpeedMiph}(): Set the maximum speed allowed at an airbase in miles per hour.
|
||||||
--
|
--
|
||||||
-- @field #ATC_GROUND_MARIANAISLANDS
|
---- @field #ATC_GROUND_MARIANAISLANDS
|
||||||
ATC_GROUND_MARIANAISLANDS = {
|
ATC_GROUND_MARIANAISLANDS = {
|
||||||
ClassName = "ATC_GROUND_MARIANAISLANDS",
|
ClassName = "ATC_GROUND_MARIANAISLANDS",
|
||||||
}
|
}
|
||||||
@@ -1561,7 +1529,7 @@ ATC_GROUND_MARIANAISLANDS = {
|
|||||||
function ATC_GROUND_MARIANAISLANDS:New( AirbaseNames )
|
function ATC_GROUND_MARIANAISLANDS:New( AirbaseNames )
|
||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, ATC_GROUND_UNIVERSAL:New( AirbaseNames ) )
|
local self = BASE:Inherit( self, ATC_GROUND_UNIVERSAL:New( self.Airbases, AirbaseNames ) )
|
||||||
|
|
||||||
self:SetKickSpeedKmph( 50 )
|
self:SetKickSpeedKmph( 50 )
|
||||||
self:SetMaximumKickSpeedKmph( 150 )
|
self:SetMaximumKickSpeedKmph( 150 )
|
||||||
@@ -1575,5 +1543,5 @@ end
|
|||||||
-- @return nothing
|
-- @return nothing
|
||||||
function ATC_GROUND_MARIANAISLANDS:Start( RepeatScanSeconds )
|
function ATC_GROUND_MARIANAISLANDS:Start( RepeatScanSeconds )
|
||||||
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
||||||
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, RepeatScanSeconds )
|
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds )
|
||||||
end
|
end
|
||||||
|
|||||||
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:
|
||||||
|
--
|
||||||
|
-- ### [AmmoTruck](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/AMT%20-%20AmmoTruck/AmmoTruck%20100%20-%20NTTR%20-%20Basic)
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
|
--
|
||||||
|
-- ### 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
|
||||||
@@ -45,7 +45,6 @@
|
|||||||
-- @field #table currentMove Holds the current commanded move, if there is one assigned.
|
-- @field #table currentMove Holds the current commanded move, if there is one assigned.
|
||||||
-- @field #number Nammo0 Initial amount total ammunition (shells+rockets+missiles) of the whole group.
|
-- @field #number Nammo0 Initial amount total ammunition (shells+rockets+missiles) of the whole group.
|
||||||
-- @field #number Nshells0 Initial amount of shells of the whole group.
|
-- @field #number Nshells0 Initial amount of shells of the whole group.
|
||||||
-- @field #number Narty0 Initial amount of artillery shells of the whole group.
|
|
||||||
-- @field #number Nrockets0 Initial amount of rockets of the whole group.
|
-- @field #number Nrockets0 Initial amount of rockets of the whole group.
|
||||||
-- @field #number Nmissiles0 Initial amount of missiles of the whole group.
|
-- @field #number Nmissiles0 Initial amount of missiles of the whole group.
|
||||||
-- @field #number Nukes0 Initial amount of tactical nukes of the whole group. Default is 0.
|
-- @field #number Nukes0 Initial amount of tactical nukes of the whole group. Default is 0.
|
||||||
@@ -416,7 +415,7 @@
|
|||||||
-- arty set, battery "Paladin Alpha", rearming place
|
-- arty set, battery "Paladin Alpha", rearming place
|
||||||
--
|
--
|
||||||
-- Setting the rearming group is independent of the position of the mark. Just create one anywhere on the map and type
|
-- Setting the rearming group is independent of the position of the mark. Just create one anywhere on the map and type
|
||||||
-- arty set, battery "Mortar Bravo", rearming group "Ammo Truck M939"
|
-- arty set, battery "Mortar Bravo", rearming group "Ammo Truck M818"
|
||||||
-- Note that the name of the rearming group has to be given in quotation marks and spelt exactly as the group name defined in the mission editor.
|
-- Note that the name of the rearming group has to be given in quotation marks and spelt exactly as the group name defined in the mission editor.
|
||||||
--
|
--
|
||||||
-- ## Transporting
|
-- ## Transporting
|
||||||
@@ -454,7 +453,7 @@
|
|||||||
-- -- Creat a new ARTY object from a Paladin group.
|
-- -- Creat a new ARTY object from a Paladin group.
|
||||||
-- paladin=ARTY:New(GROUP:FindByName("Blue Paladin"))
|
-- paladin=ARTY:New(GROUP:FindByName("Blue Paladin"))
|
||||||
--
|
--
|
||||||
-- -- Define a rearming group. This is a Transport M939 truck.
|
-- -- Define a rearming group. This is a Transport M818 truck.
|
||||||
-- paladin:SetRearmingGroup(GROUP:FindByName("Blue Ammo Truck"))
|
-- paladin:SetRearmingGroup(GROUP:FindByName("Blue Ammo Truck"))
|
||||||
--
|
--
|
||||||
-- -- Set the max firing range. A Paladin unit has a range of 20 km.
|
-- -- Set the max firing range. A Paladin unit has a range of 20 km.
|
||||||
@@ -619,148 +618,63 @@ ARTY.WeaponType={
|
|||||||
}
|
}
|
||||||
|
|
||||||
--- Database of common artillery unit properties.
|
--- Database of common artillery unit properties.
|
||||||
-- @type ARTY.dbitem
|
|
||||||
-- @field #string displayname Name displayed in ME.
|
|
||||||
-- @field #number minrange Minimum firing range in meters.
|
|
||||||
-- @field #number maxrange Maximum firing range in meters.
|
|
||||||
-- @field #number reloadtime Reload time in seconds.
|
|
||||||
|
|
||||||
--- Database of common artillery unit properties.
|
|
||||||
-- Table key is the "type name" and table value is and `ARTY.dbitem`.
|
|
||||||
-- @type ARTY.db
|
-- @type ARTY.db
|
||||||
ARTY.db={
|
ARTY.db={
|
||||||
["LeFH_18-40-105"] = {
|
["2B11 mortar"] = { -- type "2B11 mortar"
|
||||||
displayname = "FH LeFH-18 105mm", -- name displayed in the ME
|
minrange = 500, -- correct?
|
||||||
minrange = 500, -- min range (green circle) in meters
|
maxrange = 7000, -- 7 km
|
||||||
maxrange = 10500, -- max range (red circle) in meters
|
reloadtime = 30, -- 30 sec
|
||||||
reloadtime = nil, -- reload time in seconds
|
|
||||||
},
|
},
|
||||||
["M2A1-105"] = {
|
["SPH 2S1 Gvozdika"] = { -- type "SAU Gvozdika"
|
||||||
displayname = "FH M2A1 105mm",
|
minrange = 300, -- correct?
|
||||||
minrange = 500,
|
maxrange = 15000, -- 15 km
|
||||||
maxrange = 11500,
|
reloadtime = nil, -- unknown
|
||||||
reloadtime = nil,
|
|
||||||
},
|
},
|
||||||
["Pak40"] = {
|
["SPH 2S19 Msta"] = { --type "SAU Msta", alias "2S19 Msta"
|
||||||
displayname = "FH Pak 40 75mm",
|
minrange = 300, -- correct?
|
||||||
minrange = 500,
|
maxrange = 23500, -- 23.5 km
|
||||||
maxrange = 3000,
|
reloadtime = nil, -- unknown
|
||||||
reloadtime = nil,
|
|
||||||
},
|
|
||||||
["L118_Unit"] = {
|
|
||||||
displayname = "L118 Light Artillery Gun",
|
|
||||||
minrange = 500,
|
|
||||||
maxrange = 17500,
|
|
||||||
reloadtime = nil,
|
|
||||||
},
|
},
|
||||||
["Smerch"] = {
|
["SPH 2S3 Akatsia"] = { -- type "SAU Akatsia", alias "2S3 Akatsia"
|
||||||
displayname = "MLRS 9A52 Smerch CM 300mm",
|
minrange = 300, -- correct?
|
||||||
minrange = 20000,
|
maxrange = 17000, -- 17 km
|
||||||
maxrange = 70000,
|
reloadtime = nil, -- unknown
|
||||||
reloadtime = 2160,
|
|
||||||
},
|
},
|
||||||
["Smerch_HE"] = {
|
["SPH 2S9 Nona"] = { --type "SAU 2-C9"
|
||||||
displayname = "MLRS 9A52 Smerch HE 300mm",
|
minrange = 500, -- correct?
|
||||||
minrange = 20000,
|
maxrange = 7000, -- 7 km
|
||||||
maxrange = 70000,
|
reloadtime = nil, -- unknown
|
||||||
reloadtime = 2160,
|
|
||||||
},
|
},
|
||||||
["Uragan_BM-27"] = {
|
["SPH M109 Paladin"] = { -- type "M-109", alias "M109"
|
||||||
displayname = "MLRS 9K57 Uragan BM-27 220mm",
|
minrange = 300, -- correct?
|
||||||
minrange = 11500,
|
maxrange = 22000, -- 22 km
|
||||||
maxrange = 35800,
|
reloadtime = nil, -- unknown
|
||||||
reloadtime = 840,
|
|
||||||
},
|
},
|
||||||
["Grad-URAL"] = {
|
["SpGH Dana"] = { -- type "SpGH_Dana"
|
||||||
displayname = "MLRS BM-21 Grad 122mm",
|
minrange = 300, -- correct?
|
||||||
minrange = 5000,
|
maxrange = 18700, -- 18.7 km
|
||||||
maxrange = 19000,
|
reloadtime = nil, -- unknown
|
||||||
reloadtime = 420,
|
|
||||||
},
|
},
|
||||||
["HL_B8M1"] = {
|
["MLRS BM-21 Grad"] = { --type "Grad-URAL", alias "MLRS BM-21 Grad"
|
||||||
displayname = "MLRS HL with B8M1 80mm",
|
minrange = 5000, -- 5 km
|
||||||
minrange = 500,
|
maxrange = 19000, -- 19 km
|
||||||
maxrange = 5000,
|
reloadtime = 420, -- 7 min
|
||||||
reloadtime = nil,
|
|
||||||
},
|
},
|
||||||
["tt_B8M1"] = {
|
["MLRS 9K57 Uragan BM-27"] = { -- type "Uragan_BM-27"
|
||||||
displayname = "MLRS LC with B8M1 80mm",
|
minrange = 11500, -- 11.5 km
|
||||||
minrange = 500,
|
maxrange = 35800, -- 35.8 km
|
||||||
maxrange = 5000,
|
reloadtime = 840, -- 14 min
|
||||||
reloadtime = nil,
|
|
||||||
},
|
},
|
||||||
["MLRS"] = {
|
["MLRS 9A52 Smerch"] = { -- type "Smerch"
|
||||||
displayname = "MLRS M270 227mm",
|
minrange = 20000, -- 20 km
|
||||||
minrange = 10000,
|
maxrange = 70000, -- 70 km
|
||||||
maxrange = 32000,
|
reloadtime = 2160, -- 36 min
|
||||||
reloadtime = 540,
|
|
||||||
},
|
},
|
||||||
["2B11 mortar"] = {
|
["MLRS M270"] = { --type "MRLS", alias "M270 MRLS"
|
||||||
displayname = "Mortar 2B11 120mm",
|
minrange = 10000, -- 10 km
|
||||||
minrange = 500,
|
maxrange = 32000, -- 32 km
|
||||||
maxrange = 7000,
|
reloadtime = 540, -- 9 min
|
||||||
reloadtime = 30,
|
|
||||||
},
|
},
|
||||||
["PLZ05"] = {
|
|
||||||
displayname = "PLZ-05",
|
|
||||||
minrange = 500,
|
|
||||||
maxrange = 23500,
|
|
||||||
reloadtime = nil,
|
|
||||||
},
|
|
||||||
["SAU Gvozdika"] = {
|
|
||||||
displayname = "SPH 2S1 Gvozdika 122mm",
|
|
||||||
minrange = 300,
|
|
||||||
maxrange = 15000,
|
|
||||||
reloadtime = nil,
|
|
||||||
},
|
|
||||||
["SAU Msta"] = {
|
|
||||||
displayname = "SPH 2S19 Msta 152mm",
|
|
||||||
minrange = 300,
|
|
||||||
maxrange = 23500,
|
|
||||||
reloadtime = nil,
|
|
||||||
},
|
|
||||||
["SAU Akatsia"] = {
|
|
||||||
displayname = "SPH 2S3 Akatsia 152mm",
|
|
||||||
minrange = 300,
|
|
||||||
maxrange = 17000,
|
|
||||||
reloadtime = nil,
|
|
||||||
},
|
|
||||||
["SpGH_Dana"] = {
|
|
||||||
displayname = "SPH Dana vz77 152mm",
|
|
||||||
minrange = 300,
|
|
||||||
maxrange = 18700,
|
|
||||||
reloadtime = nil,
|
|
||||||
},
|
|
||||||
["M-109"] = {
|
|
||||||
displayname = "SPH M109 Paladin 155mm",
|
|
||||||
minrange = 300,
|
|
||||||
maxrange = 22000,
|
|
||||||
reloadtime = nil,
|
|
||||||
},
|
|
||||||
["M12_GMC"] = {
|
|
||||||
displayname = "SPH M12 GMC 155mm",
|
|
||||||
minrange = 300,
|
|
||||||
maxrange = 18200,
|
|
||||||
reloadtime = nil,
|
|
||||||
},
|
|
||||||
["Wespe124"] = {
|
|
||||||
displayname = "SPH Sd.Kfz.124 Wespe 105mm",
|
|
||||||
minrange = 300,
|
|
||||||
maxrange = 7000,
|
|
||||||
reloadtime = nil,
|
|
||||||
},
|
|
||||||
["T155_Firtina"] = {
|
|
||||||
displayname = "SPH T155 Firtina 155mm",
|
|
||||||
minrange = 300,
|
|
||||||
maxrange = 41000,
|
|
||||||
reloadtime = nil,
|
|
||||||
},
|
|
||||||
["SAU 2-C9"] = {
|
|
||||||
displayname = "SPM 2S9 Nona 120mm M",
|
|
||||||
minrange = 500,
|
|
||||||
maxrange = 7000,
|
|
||||||
reloadtime = nil,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Target.
|
--- Target.
|
||||||
@@ -780,7 +694,7 @@ ARTY.db={
|
|||||||
|
|
||||||
--- Arty script version.
|
--- Arty script version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
ARTY.version="1.3.3"
|
ARTY.version="1.3.0"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -793,7 +707,7 @@ ARTY.version="1.3.3"
|
|||||||
-- DONE: Add user defined rearm weapon types.
|
-- DONE: Add user defined rearm weapon types.
|
||||||
-- DONE: Check if target is in range. Maybe this requires a data base with the ranges of all arty units. <solved by user function>
|
-- DONE: Check if target is in range. Maybe this requires a data base with the ranges of all arty units. <solved by user function>
|
||||||
-- DONE: Make ARTY move to rearming position.
|
-- DONE: Make ARTY move to rearming position.
|
||||||
-- DONE: Check that right rearming vehicle is specified. Blue M939, Red Ural-375. Are there more? <user needs to know!>
|
-- DONE: Check that right rearming vehicle is specified. Blue M818, Red Ural-375. Are there more? <user needs to know!>
|
||||||
-- DONE: Check if ARTY group is still alive.
|
-- DONE: Check if ARTY group is still alive.
|
||||||
-- DONE: Handle dead events.
|
-- DONE: Handle dead events.
|
||||||
-- DONE: Abort firing task if no shooting event occured with 5(?) minutes. Something went wrong then. Min/max range for example.
|
-- DONE: Abort firing task if no shooting event occured with 5(?) minutes. Something went wrong then. Min/max range for example.
|
||||||
@@ -882,8 +796,8 @@ function ARTY:New(group, alias)
|
|||||||
-- Maximum speed in km/h.
|
-- Maximum speed in km/h.
|
||||||
self.SpeedMax=group:GetSpeedMax()
|
self.SpeedMax=group:GetSpeedMax()
|
||||||
|
|
||||||
-- Group is mobile or not (e.g. mortars). Some immobile units have a speed of 1 m/s = 3.6 km/h. So we check this number.
|
-- Group is mobile or not (e.g. mortars).
|
||||||
if self.SpeedMax>3.6 then
|
if self.SpeedMax>1 then
|
||||||
self.ismobile=true
|
self.ismobile=true
|
||||||
else
|
else
|
||||||
self.ismobile=false
|
self.ismobile=false
|
||||||
@@ -1618,7 +1532,7 @@ end
|
|||||||
|
|
||||||
--- Assign a group, which is responsible for rearming the ARTY group. If the group is too far away from the ARTY group it will be guided towards the ARTY group.
|
--- Assign a group, which is responsible for rearming the ARTY group. If the group is too far away from the ARTY group it will be guided towards the ARTY group.
|
||||||
-- @param #ARTY self
|
-- @param #ARTY self
|
||||||
-- @param Wrapper.Group#GROUP group Group that is supposed to rearm the ARTY group. For the blue coalition, this is often a unarmed M939 transport whilst for red an unarmed Ural-375 transport can be used.
|
-- @param Wrapper.Group#GROUP group Group that is supposed to rearm the ARTY group. For the blue coalition, this is often a unarmed M818 transport whilst for red an unarmed Ural-375 transport can be used.
|
||||||
-- @return self
|
-- @return self
|
||||||
function ARTY:SetRearmingGroup(group)
|
function ARTY:SetRearmingGroup(group)
|
||||||
self:F({group=group})
|
self:F({group=group})
|
||||||
@@ -1973,7 +1887,7 @@ function ARTY:onafterStart(Controllable, From, Event, To)
|
|||||||
MESSAGE:New(text, 5):ToAllIf(self.Debug)
|
MESSAGE:New(text, 5):ToAllIf(self.Debug)
|
||||||
|
|
||||||
-- Get Ammo.
|
-- Get Ammo.
|
||||||
self.Nammo0, self.Nshells0, self.Nrockets0, self.Nmissiles0, self.Narty0=self:GetAmmo(self.Debug)
|
self.Nammo0, self.Nshells0, self.Nrockets0, self.Nmissiles0=self:GetAmmo(self.Debug)
|
||||||
|
|
||||||
-- Init nuclear explosion parameters if they were not set by user.
|
-- Init nuclear explosion parameters if they were not set by user.
|
||||||
if self.nukerange==nil then
|
if self.nukerange==nil then
|
||||||
@@ -2008,7 +1922,7 @@ function ARTY:onafterStart(Controllable, From, Event, To)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Check if we have and arty type that is in the DB.
|
-- Check if we have and arty type that is in the DB.
|
||||||
local _dbproperties=self:_CheckDB(self.Type)
|
local _dbproperties=self:_CheckDB(self.DisplayName)
|
||||||
self:T({dbproperties=_dbproperties})
|
self:T({dbproperties=_dbproperties})
|
||||||
if _dbproperties~=nil then
|
if _dbproperties~=nil then
|
||||||
for property,value in pairs(_dbproperties) do
|
for property,value in pairs(_dbproperties) do
|
||||||
@@ -2054,8 +1968,8 @@ function ARTY:onafterStart(Controllable, From, Event, To)
|
|||||||
text=text..string.format("Type = %s\n", self.Type)
|
text=text..string.format("Type = %s\n", self.Type)
|
||||||
text=text..string.format("Display Name = %s\n", self.DisplayName)
|
text=text..string.format("Display Name = %s\n", self.DisplayName)
|
||||||
text=text..string.format("Number of units = %d\n", self.IniGroupStrength)
|
text=text..string.format("Number of units = %d\n", self.IniGroupStrength)
|
||||||
text=text..string.format("Speed max = %.1f km/h\n", self.SpeedMax)
|
text=text..string.format("Speed max = %d km/h\n", self.SpeedMax)
|
||||||
text=text..string.format("Speed default = %.1f km/h\n", self.Speed)
|
text=text..string.format("Speed default = %d km/h\n", self.Speed)
|
||||||
text=text..string.format("Is mobile = %s\n", tostring(self.ismobile))
|
text=text..string.format("Is mobile = %s\n", tostring(self.ismobile))
|
||||||
text=text..string.format("Is cargo = %s\n", tostring(self.iscargo))
|
text=text..string.format("Is cargo = %s\n", tostring(self.iscargo))
|
||||||
text=text..string.format("Min range = %.1f km\n", self.minrange/1000)
|
text=text..string.format("Min range = %.1f km\n", self.minrange/1000)
|
||||||
@@ -2179,7 +2093,7 @@ function ARTY:_StatusReport(display)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Get Ammo.
|
-- Get Ammo.
|
||||||
local Nammo, Nshells, Nrockets, Nmissiles, Narty=self:GetAmmo()
|
local Nammo, Nshells, Nrockets, Nmissiles=self:GetAmmo()
|
||||||
local Nnukes=self.Nukes
|
local Nnukes=self.Nukes
|
||||||
local Nillu=self.Nillu
|
local Nillu=self.Nillu
|
||||||
local Nsmoke=self.Nsmoke
|
local Nsmoke=self.Nsmoke
|
||||||
@@ -2192,7 +2106,7 @@ function ARTY:_StatusReport(display)
|
|||||||
text=text..string.format("Clock = %s\n", Clock)
|
text=text..string.format("Clock = %s\n", Clock)
|
||||||
text=text..string.format("FSM state = %s\n", self:GetState())
|
text=text..string.format("FSM state = %s\n", self:GetState())
|
||||||
text=text..string.format("Total ammo count = %d\n", Nammo)
|
text=text..string.format("Total ammo count = %d\n", Nammo)
|
||||||
text=text..string.format("Number of shells = %d\n", Narty)
|
text=text..string.format("Number of shells = %d\n", Nshells)
|
||||||
text=text..string.format("Number of rockets = %d\n", Nrockets)
|
text=text..string.format("Number of rockets = %d\n", Nrockets)
|
||||||
text=text..string.format("Number of missiles = %d\n", Nmissiles)
|
text=text..string.format("Number of missiles = %d\n", Nmissiles)
|
||||||
text=text..string.format("Number of nukes = %d\n", Nnukes)
|
text=text..string.format("Number of nukes = %d\n", Nnukes)
|
||||||
@@ -2379,7 +2293,7 @@ function ARTY:OnEventShot(EventData)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Get current ammo.
|
-- Get current ammo.
|
||||||
local _nammo,_nshells,_nrockets,_nmissiles,_narty=self:GetAmmo()
|
local _nammo,_nshells,_nrockets,_nmissiles=self:GetAmmo()
|
||||||
|
|
||||||
-- Decrease available nukes because we just fired one.
|
-- Decrease available nukes because we just fired one.
|
||||||
if self.currentTarget.weapontype==ARTY.WeaponType.TacticalNukes then
|
if self.currentTarget.weapontype==ARTY.WeaponType.TacticalNukes then
|
||||||
@@ -2409,7 +2323,7 @@ function ARTY:OnEventShot(EventData)
|
|||||||
|
|
||||||
-- Weapon type name for current target.
|
-- Weapon type name for current target.
|
||||||
local _weapontype=self:_WeaponTypeName(self.currentTarget.weapontype)
|
local _weapontype=self:_WeaponTypeName(self.currentTarget.weapontype)
|
||||||
self:T(self.lid..string.format("Group %s ammo: total=%d, shells=%d, rockets=%d, missiles=%d", self.groupname, _nammo, _narty, _nrockets, _nmissiles))
|
self:T(self.lid..string.format("Group %s ammo: total=%d, shells=%d, rockets=%d, missiles=%d", self.groupname, _nammo, _nshells, _nrockets, _nmissiles))
|
||||||
self:T(self.lid..string.format("Group %s uses weapontype %s for current target.", self.groupname, _weapontype))
|
self:T(self.lid..string.format("Group %s uses weapontype %s for current target.", self.groupname, _weapontype))
|
||||||
|
|
||||||
-- Default switches for cease fire and relocation.
|
-- Default switches for cease fire and relocation.
|
||||||
@@ -2857,7 +2771,7 @@ function ARTY:onafterStatus(Controllable, From, Event, To)
|
|||||||
self:_EventFromTo("onafterStatus", Event, From, To)
|
self:_EventFromTo("onafterStatus", Event, From, To)
|
||||||
|
|
||||||
-- Get ammo.
|
-- Get ammo.
|
||||||
local nammo, nshells, nrockets, nmissiles, narty=self:GetAmmo()
|
local nammo, nshells, nrockets, nmissiles=self:GetAmmo()
|
||||||
|
|
||||||
-- We have a cargo group ==> check if group was loaded into a carrier.
|
-- We have a cargo group ==> check if group was loaded into a carrier.
|
||||||
if self.iscargo and self.cargogroup then
|
if self.iscargo and self.cargogroup then
|
||||||
@@ -2874,7 +2788,7 @@ function ARTY:onafterStatus(Controllable, From, Event, To)
|
|||||||
|
|
||||||
-- FSM state.
|
-- FSM state.
|
||||||
local fsmstate=self:GetState()
|
local fsmstate=self:GetState()
|
||||||
self:T(self.lid..string.format("Status %s, Ammo total=%d: shells=%d [smoke=%d, illu=%d, nukes=%d*%.3f kT], rockets=%d, missiles=%d", fsmstate, nammo, narty, self.Nsmoke, self.Nillu, self.Nukes, self.nukewarhead/1000000, nrockets, nmissiles))
|
self:T(self.lid..string.format("Status %s, Ammo total=%d: shells=%d [smoke=%d, illu=%d, nukes=%d*%.3f kT], rockets=%d, missiles=%d", fsmstate, nammo, nshells, self.Nsmoke, self.Nillu, self.Nukes, self.nukewarhead/1000000, nrockets, nmissiles))
|
||||||
|
|
||||||
if self.Controllable and self.Controllable:IsAlive() then
|
if self.Controllable and self.Controllable:IsAlive() then
|
||||||
|
|
||||||
@@ -2957,19 +2871,20 @@ function ARTY:onafterStatus(Controllable, From, Event, To)
|
|||||||
if self.currentTarget then
|
if self.currentTarget then
|
||||||
self:CeaseFire(self.currentTarget)
|
self:CeaseFire(self.currentTarget)
|
||||||
end
|
end
|
||||||
|
|
||||||
if self:is("CombatReady") then
|
-- Open fire on timed target.
|
||||||
-- Open fire on timed target.
|
self:OpenFire(_timedTarget)
|
||||||
self:OpenFire(_timedTarget)
|
|
||||||
end
|
|
||||||
elseif _normalTarget then
|
elseif _normalTarget then
|
||||||
|
|
||||||
if self:is("CombatReady") then
|
-- Open fire on normal target.
|
||||||
-- Open fire on normal target.
|
self:OpenFire(_normalTarget)
|
||||||
self:OpenFire(_normalTarget)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Get ammo.
|
||||||
|
--local nammo, nshells, nrockets, nmissiles=self:GetAmmo()
|
||||||
|
|
||||||
-- Check if we have a target in the queue for which weapons are still available.
|
-- Check if we have a target in the queue for which weapons are still available.
|
||||||
local gotsome=false
|
local gotsome=false
|
||||||
if #self.targets>0 then
|
if #self.targets>0 then
|
||||||
@@ -3130,14 +3045,14 @@ function ARTY:onafterOpenFire(Controllable, From, Event, To, target)
|
|||||||
local range=Controllable:GetCoordinate():Get2DDistance(target.coord)
|
local range=Controllable:GetCoordinate():Get2DDistance(target.coord)
|
||||||
|
|
||||||
-- Get ammo.
|
-- Get ammo.
|
||||||
local Nammo, Nshells, Nrockets, Nmissiles, Narty=self:GetAmmo()
|
local Nammo, Nshells, Nrockets, Nmissiles=self:GetAmmo()
|
||||||
local nfire=Narty
|
local nfire=Nammo
|
||||||
local _type="shots"
|
local _type="shots"
|
||||||
if target.weapontype==ARTY.WeaponType.Auto then
|
if target.weapontype==ARTY.WeaponType.Auto then
|
||||||
nfire=Nammo -- We take everything that is available
|
nfire=Nammo
|
||||||
_type="shots"
|
_type="shots"
|
||||||
elseif target.weapontype==ARTY.WeaponType.Cannon then
|
elseif target.weapontype==ARTY.WeaponType.Cannon then
|
||||||
nfire=Narty
|
nfire=Nshells
|
||||||
_type="shells"
|
_type="shells"
|
||||||
elseif target.weapontype==ARTY.WeaponType.TacticalNukes then
|
elseif target.weapontype==ARTY.WeaponType.TacticalNukes then
|
||||||
nfire=self.Nukes
|
nfire=self.Nukes
|
||||||
@@ -3155,8 +3070,6 @@ function ARTY:onafterOpenFire(Controllable, From, Event, To, target)
|
|||||||
nfire=Nmissiles
|
nfire=Nmissiles
|
||||||
_type="cruise missiles"
|
_type="cruise missiles"
|
||||||
end
|
end
|
||||||
|
|
||||||
--env.info(string.format("FF type=%s, Nrockets=%d, Nfire=%d target.nshells=%d", _type, Nrockets, nfire, target.nshells))
|
|
||||||
|
|
||||||
-- Adjust if less than requested ammo is left.
|
-- Adjust if less than requested ammo is left.
|
||||||
target.nshells=math.min(target.nshells, nfire)
|
target.nshells=math.min(target.nshells, nfire)
|
||||||
@@ -3424,7 +3337,7 @@ function ARTY:_CheckRearmed()
|
|||||||
self:F2()
|
self:F2()
|
||||||
|
|
||||||
-- Get current ammo.
|
-- Get current ammo.
|
||||||
local nammo,nshells,nrockets,nmissiles,narty=self:GetAmmo()
|
local nammo,nshells,nrockets,nmissiles=self:GetAmmo()
|
||||||
|
|
||||||
-- Number of units still alive.
|
-- Number of units still alive.
|
||||||
local units=self.Controllable:GetUnits()
|
local units=self.Controllable:GetUnits()
|
||||||
@@ -3633,7 +3546,7 @@ end
|
|||||||
-- @param #string To To state.
|
-- @param #string To To state.
|
||||||
function ARTY:onafterRespawn(Controllable, From, Event, To)
|
function ARTY:onafterRespawn(Controllable, From, Event, To)
|
||||||
self:_EventFromTo("onafterRespawn", Event, From, To)
|
self:_EventFromTo("onafterRespawn", Event, From, To)
|
||||||
self:I("Respawning arty group")
|
|
||||||
local group=self.Controllable --Wrapper.Group#GROUP
|
local group=self.Controllable --Wrapper.Group#GROUP
|
||||||
|
|
||||||
-- Respawn group.
|
-- Respawn group.
|
||||||
@@ -3690,11 +3603,7 @@ function ARTY:_FireAtCoord(coord, radius, nshells, weapontype)
|
|||||||
if weapontype==ARTY.WeaponType.TacticalNukes or weapontype==ARTY.WeaponType.IlluminationShells or weapontype==ARTY.WeaponType.SmokeShells then
|
if weapontype==ARTY.WeaponType.TacticalNukes or weapontype==ARTY.WeaponType.IlluminationShells or weapontype==ARTY.WeaponType.SmokeShells then
|
||||||
weapontype=ARTY.WeaponType.Cannon
|
weapontype=ARTY.WeaponType.Cannon
|
||||||
end
|
end
|
||||||
|
|
||||||
if group:HasTask() then
|
|
||||||
group:ClearTasks()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Set ROE to weapon free.
|
-- Set ROE to weapon free.
|
||||||
group:OptionROEOpenFire()
|
group:OptionROEOpenFire()
|
||||||
|
|
||||||
@@ -3705,7 +3614,7 @@ function ARTY:_FireAtCoord(coord, radius, nshells, weapontype)
|
|||||||
local fire=group:TaskFireAtPoint(vec2, radius, nshells, weapontype)
|
local fire=group:TaskFireAtPoint(vec2, radius, nshells, weapontype)
|
||||||
|
|
||||||
-- Execute task.
|
-- Execute task.
|
||||||
group:SetTask(fire,1)
|
group:SetTask(fire)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set task for attacking a group.
|
--- Set task for attacking a group.
|
||||||
@@ -3722,11 +3631,7 @@ function ARTY:_AttackGroup(target)
|
|||||||
if weapontype==ARTY.WeaponType.TacticalNukes or weapontype==ARTY.WeaponType.IlluminationShells or weapontype==ARTY.WeaponType.SmokeShells then
|
if weapontype==ARTY.WeaponType.TacticalNukes or weapontype==ARTY.WeaponType.IlluminationShells or weapontype==ARTY.WeaponType.SmokeShells then
|
||||||
weapontype=ARTY.WeaponType.Cannon
|
weapontype=ARTY.WeaponType.Cannon
|
||||||
end
|
end
|
||||||
|
|
||||||
if group:HasTask() then
|
|
||||||
group:ClearTasks()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Set ROE to weapon free.
|
-- Set ROE to weapon free.
|
||||||
group:OptionROEOpenFire()
|
group:OptionROEOpenFire()
|
||||||
|
|
||||||
@@ -3737,7 +3642,7 @@ function ARTY:_AttackGroup(target)
|
|||||||
local fire=group:TaskAttackGroup(targetgroup, weapontype, AI.Task.WeaponExpend.ONE, 1)
|
local fire=group:TaskAttackGroup(targetgroup, weapontype, AI.Task.WeaponExpend.ONE, 1)
|
||||||
|
|
||||||
-- Execute task.
|
-- Execute task.
|
||||||
group:SetTask(fire,1)
|
group:SetTask(fire)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -4010,7 +3915,6 @@ end
|
|||||||
-- @return #number Number of shells the group has left.
|
-- @return #number Number of shells the group has left.
|
||||||
-- @return #number Number of rockets the group has left.
|
-- @return #number Number of rockets the group has left.
|
||||||
-- @return #number Number of missiles the group has left.
|
-- @return #number Number of missiles the group has left.
|
||||||
-- @return #number Number of artillery shells the group has left.
|
|
||||||
function ARTY:GetAmmo(display)
|
function ARTY:GetAmmo(display)
|
||||||
self:F3({display=display})
|
self:F3({display=display})
|
||||||
|
|
||||||
@@ -4024,7 +3928,6 @@ function ARTY:GetAmmo(display)
|
|||||||
local nshells=0
|
local nshells=0
|
||||||
local nrockets=0
|
local nrockets=0
|
||||||
local nmissiles=0
|
local nmissiles=0
|
||||||
local nartyshells=0
|
|
||||||
|
|
||||||
-- Get all units.
|
-- Get all units.
|
||||||
local units=self.Controllable:GetUnits()
|
local units=self.Controllable:GetUnits()
|
||||||
@@ -4127,8 +4030,7 @@ function ARTY:GetAmmo(display)
|
|||||||
|
|
||||||
-- Add up all shells.
|
-- Add up all shells.
|
||||||
nshells=nshells+Nammo
|
nshells=nshells+Nammo
|
||||||
local _,_,_,_,_,shells = unit:GetAmmunition()
|
|
||||||
nartyshells=nartyshells+shells
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
text=text..string.format("- %d shells of type %s\n", Nammo, _weaponName)
|
text=text..string.format("- %d shells of type %s\n", Nammo, _weaponName)
|
||||||
|
|
||||||
@@ -4174,7 +4076,7 @@ function ARTY:GetAmmo(display)
|
|||||||
-- Total amount of ammunition.
|
-- Total amount of ammunition.
|
||||||
nammo=nshells+nrockets+nmissiles
|
nammo=nshells+nrockets+nmissiles
|
||||||
|
|
||||||
return nammo, nshells, nrockets, nmissiles, nartyshells
|
return nammo, nshells, nrockets, nmissiles
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Returns a name of a missile category.
|
--- Returns a name of a missile category.
|
||||||
@@ -4925,10 +4827,7 @@ function ARTY:_CheckShootingStarted()
|
|||||||
|
|
||||||
-- Check if we waited long enough and no shot was fired.
|
-- Check if we waited long enough and no shot was fired.
|
||||||
--if dt > self.WaitForShotTime and self.Nshots==0 then
|
--if dt > self.WaitForShotTime and self.Nshots==0 then
|
||||||
|
if dt > self.WaitForShotTime and (self.Nshots==0 or self.currentTarget.nshells >= self.Nshots) then --https://github.com/FlightControl-Master/MOOSE/issues/1356
|
||||||
self:T(string.format("dt = %d WaitTime = %d | shots = %d TargetShells = %d",dt,self.WaitForShotTime,self.Nshots,self.currentTarget.nshells))
|
|
||||||
|
|
||||||
if (dt > self.WaitForShotTime and self.Nshots==0) or (self.currentTarget.nshells <= self.Nshots) then --https://github.com/FlightControl-Master/MOOSE/issues/1356
|
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:T(self.lid..string.format("%s, no shot event after %d seconds. Removing current target %s from list.", self.groupname, self.WaitForShotTime, name))
|
self:T(self.lid..string.format("%s, no shot event after %d seconds. Removing current target %s from list.", self.groupname, self.WaitForShotTime, name))
|
||||||
@@ -4990,7 +4889,7 @@ end
|
|||||||
function ARTY:_CheckOutOfAmmo(targets)
|
function ARTY:_CheckOutOfAmmo(targets)
|
||||||
|
|
||||||
-- Get current ammo.
|
-- Get current ammo.
|
||||||
local _nammo,_nshells,_nrockets,_nmissiles,_narty=self:GetAmmo()
|
local _nammo,_nshells,_nrockets,_nmissiles=self:GetAmmo()
|
||||||
|
|
||||||
-- Special weapon type requested ==> Check if corresponding ammo is empty.
|
-- Special weapon type requested ==> Check if corresponding ammo is empty.
|
||||||
local _partlyoutofammo=false
|
local _partlyoutofammo=false
|
||||||
@@ -5002,7 +4901,7 @@ function ARTY:_CheckOutOfAmmo(targets)
|
|||||||
self:T(self.lid..string.format("Group %s, auto weapon requested for target %s but all ammo is empty.", self.groupname, Target.name))
|
self:T(self.lid..string.format("Group %s, auto weapon requested for target %s but all ammo is empty.", self.groupname, Target.name))
|
||||||
_partlyoutofammo=true
|
_partlyoutofammo=true
|
||||||
|
|
||||||
elseif Target.weapontype==ARTY.WeaponType.Cannon and _narty==0 then
|
elseif Target.weapontype==ARTY.WeaponType.Cannon and _nshells==0 then
|
||||||
|
|
||||||
self:T(self.lid..string.format("Group %s, cannons requested for target %s but shells empty.", self.groupname, Target.name))
|
self:T(self.lid..string.format("Group %s, cannons requested for target %s but shells empty.", self.groupname, Target.name))
|
||||||
_partlyoutofammo=true
|
_partlyoutofammo=true
|
||||||
@@ -5046,14 +4945,14 @@ end
|
|||||||
function ARTY:_CheckWeaponTypeAvailable(target)
|
function ARTY:_CheckWeaponTypeAvailable(target)
|
||||||
|
|
||||||
-- Get current ammo of group.
|
-- Get current ammo of group.
|
||||||
local Nammo, Nshells, Nrockets, Nmissiles, Narty=self:GetAmmo()
|
local Nammo, Nshells, Nrockets, Nmissiles=self:GetAmmo()
|
||||||
|
|
||||||
-- Check if enough ammo is there for the selected weapon type.
|
-- Check if enough ammo is there for the selected weapon type.
|
||||||
local nfire=Nammo
|
local nfire=Nammo
|
||||||
if target.weapontype==ARTY.WeaponType.Auto then
|
if target.weapontype==ARTY.WeaponType.Auto then
|
||||||
nfire=Nammo
|
nfire=Nammo
|
||||||
elseif target.weapontype==ARTY.WeaponType.Cannon then
|
elseif target.weapontype==ARTY.WeaponType.Cannon then
|
||||||
nfire=Narty
|
nfire=Nshells
|
||||||
elseif target.weapontype==ARTY.WeaponType.TacticalNukes then
|
elseif target.weapontype==ARTY.WeaponType.TacticalNukes then
|
||||||
nfire=self.Nukes
|
nfire=self.Nukes
|
||||||
elseif target.weapontype==ARTY.WeaponType.IlluminationShells then
|
elseif target.weapontype==ARTY.WeaponType.IlluminationShells then
|
||||||
|
|||||||
1150
Moose Development/Moose/Functional/Autolase.lua
Normal file
1150
Moose Development/Moose/Functional/Autolase.lua
Normal file
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [CLA - CleanUp Airbase](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/CleanUp)
|
-- [CLA - CleanUp Airbase](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CLA%20-%20CleanUp%20Airbase)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -354,7 +354,7 @@ function CLEANUP_AIRBASE.__:EventAddForCleanUp( Event )
|
|||||||
self:F({Event})
|
self:F({Event})
|
||||||
|
|
||||||
|
|
||||||
if Event.IniDCSUnit and Event.IniUnit and Event.IniCategory == Object.Category.UNIT then
|
if Event.IniDCSUnit and Event.IniCategory == Object.Category.UNIT then
|
||||||
if self.CleanUpList[Event.IniDCSUnitName] == nil then
|
if self.CleanUpList[Event.IniDCSUnitName] == nil then
|
||||||
if self:IsInAirbase( Event.IniUnit:GetVec2() ) then
|
if self:IsInAirbase( Event.IniUnit:GetVec2() ) then
|
||||||
self:AddForCleanUp( Event.IniUnit, Event.IniDCSUnitName )
|
self:AddForCleanUp( Event.IniUnit, Event.IniDCSUnitName )
|
||||||
@@ -362,7 +362,7 @@ function CLEANUP_AIRBASE.__:EventAddForCleanUp( Event )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if Event.TgtDCSUnit and Event.TgtUnit and Event.TgtCategory == Object.Category.UNIT then
|
if Event.TgtDCSUnit and Event.TgtCategory == Object.Category.UNIT then
|
||||||
if self.CleanUpList[Event.TgtDCSUnitName] == nil then
|
if self.CleanUpList[Event.TgtDCSUnitName] == nil then
|
||||||
if self:IsInAirbase( Event.TgtUnit:GetVec2() ) then
|
if self:IsInAirbase( Event.TgtUnit:GetVec2() ) then
|
||||||
self:AddForCleanUp( Event.TgtUnit, Event.TgtDCSUnitName )
|
self:AddForCleanUp( Event.TgtUnit, Event.TgtDCSUnitName )
|
||||||
@@ -384,7 +384,7 @@ function CLEANUP_AIRBASE.__:CleanUpSchedule()
|
|||||||
local CleanUpUnit = CleanUpListData.CleanUpUnit -- Wrapper.Unit#UNIT
|
local CleanUpUnit = CleanUpListData.CleanUpUnit -- Wrapper.Unit#UNIT
|
||||||
local CleanUpGroupName = CleanUpListData.CleanUpGroupName
|
local CleanUpGroupName = CleanUpListData.CleanUpGroupName
|
||||||
|
|
||||||
if CleanUpUnit and CleanUpUnit:IsAlive() ~= nil then
|
if CleanUpUnit:IsAlive() ~= nil then
|
||||||
|
|
||||||
if self:IsInAirbase( CleanUpUnit:GetVec2() ) then
|
if self:IsInAirbase( CleanUpUnit:GetVec2() ) then
|
||||||
|
|
||||||
@@ -411,7 +411,7 @@ function CLEANUP_AIRBASE.__:CleanUpSchedule()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- Clean Units which are waiting for a very long time in the CleanUpZone.
|
-- Clean Units which are waiting for a very long time in the CleanUpZone.
|
||||||
if CleanUpUnit and (CleanUpUnit.GetPlayerName == nil or not CleanUpUnit:GetPlayerName()) then
|
if CleanUpUnit and not CleanUpUnit:GetPlayerName() then
|
||||||
local CleanUpUnitVelocity = CleanUpUnit:GetVelocityKMH()
|
local CleanUpUnitVelocity = CleanUpUnit:GetVelocityKMH()
|
||||||
if CleanUpUnitVelocity < 1 then
|
if CleanUpUnitVelocity < 1 then
|
||||||
if CleanUpListData.CleanUpMoved then
|
if CleanUpListData.CleanUpMoved then
|
||||||
|
|||||||
@@ -1,687 +0,0 @@
|
|||||||
--- **Functional** - Manage and track client slots easily to add your own client-based menus and modules to.
|
|
||||||
--
|
|
||||||
-- The @{#CLIENTWATCH} class adds a simplified way to create scripts and menus for individual clients. Instead of creating large algorithms and juggling multiple event handlers, you can simply provide one or more prefixes to the class and use the callback functions on spawn, despawn, and any aircraft related events to script to your hearts content.
|
|
||||||
--
|
|
||||||
-- ===
|
|
||||||
--
|
|
||||||
-- ## Features:
|
|
||||||
--
|
|
||||||
-- * Find clients by prefixes or by providing a Wrapper.CLIENT object
|
|
||||||
-- * Trigger functions when the client spawns and despawns
|
|
||||||
-- * Create multiple client instances without overwriting event handlers between instances
|
|
||||||
-- * More reliable aircraft lost events for when DCS thinks the aircraft id dead but a dead event fails to trigger
|
|
||||||
-- * Easily manage clients spawned in dynamic slots
|
|
||||||
--
|
|
||||||
-- ====
|
|
||||||
--
|
|
||||||
-- ### Author: **Statua**
|
|
||||||
--
|
|
||||||
-- ### Contributions: **FlightControl**: Wrapper.CLIENT
|
|
||||||
--
|
|
||||||
-- ====
|
|
||||||
-- @module Functional.ClientWatch
|
|
||||||
-- @image clientwatch.jpg
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
||||||
--- CLIENTWATCH class
|
|
||||||
-- @type CLIENTWATCH
|
|
||||||
-- @field #string ClassName Name of the class.
|
|
||||||
-- @field #boolean Debug Write Debug messages to DCS log file and send Debug messages to all players.
|
|
||||||
-- @field #string lid String for DCS log file.
|
|
||||||
-- @field #number FilterCoalition If not nil, will only activate for aircraft of the given coalition value.
|
|
||||||
-- @field #number FilterCategory If not nil, will only activate for aircraft of the given category value.
|
|
||||||
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
|
||||||
|
|
||||||
--- Manage and track client slots easily to add your own client-based menus and modules to.
|
|
||||||
--
|
|
||||||
-- ## Creating a new instance
|
|
||||||
--
|
|
||||||
-- To start, you must first create a new instance of the client manager and provide it with either a Wrapper.Client#CLIENT object, a string prefix of the unit name, or a table of string prefixes for unit names. These are used to capture the client unit when it spawns and apply your scripted functions to it. Only fixed wing and rotary wing aircraft controlled by players can be used by this class.
|
|
||||||
-- **This will not work if the client aircraft is alive!**
|
|
||||||
--
|
|
||||||
-- ### Examples
|
|
||||||
--
|
|
||||||
-- -- Create an instance with a Wrapper.Client#CLIENT object
|
|
||||||
-- local heliClient = CLIENT:FindByName('Rotary1-1')
|
|
||||||
-- local clientInstance = CLIENTWATCH:New(heliClient)
|
|
||||||
--
|
|
||||||
-- -- Create an instance with part of the unit name in the Mission Editor
|
|
||||||
-- local clientInstance = CLIENTWATCH:New("Rotary")
|
|
||||||
--
|
|
||||||
-- -- Create an instance using prefixes for a few units as well as a FARP name for any dynamic spawns coming out of it
|
|
||||||
-- local clientInstance = CLIENTWATCH:New({"Rescue","UH-1H","FARP ALPHA"})
|
|
||||||
--
|
|
||||||
-- ## Applying functions and methods to client aircraft when they spawn
|
|
||||||
--
|
|
||||||
-- Once the instance is created, it will watch for birth events. If the unit name of the client aircraft matches the one provided in the instance, the callback method @{#CLIENTWATCH:OnAfterSpawn}() can be used to apply functions and methods to the client object.
|
|
||||||
--
|
|
||||||
-- In the OnAfterSpawn() callback method are four values. From, Event, To, and ClientObject. From,Event,To are standard FSM strings for the state changes. ClientObject is where the magic happens. This is a special object which you can use to access all the data of the client aircraft. The following entries in ClientObject are available for you to use:
|
|
||||||
--
|
|
||||||
-- * **ClientObject.Unit**: The Moose @{Wrapper.Unit#UNIT} of the client aircraft
|
|
||||||
-- * **ClientObject.Group**: The Moose @{Wrapper.Group#GRUP} of the client aircraft
|
|
||||||
-- * **ClientObject.Client**: The Moose @{Wrapper.Client#CLIENT} of the client aircraft
|
|
||||||
-- * **ClientObject.PlayerName**: A #string of the player controlling the aircraft
|
|
||||||
-- * **ClientObject.UnitName**: A #string of the client aircraft unit.
|
|
||||||
-- * **ClientObject.GroupName**: A #string of the client aircraft group.
|
|
||||||
--
|
|
||||||
-- ### Examples
|
|
||||||
--
|
|
||||||
-- -- Create an instance with a client unit prefix and send them a message when they spawn
|
|
||||||
-- local clientInstance = CLIENTWATCH:New("Rotary")
|
|
||||||
-- function clientInstance:OnAfterSpawn(From,Event,To,ClientObject,EventData)
|
|
||||||
-- MESSAGE:New("Welcome to your aircraft!",10):ToUnit(ClientObject.Unit)
|
|
||||||
-- end
|
|
||||||
--
|
|
||||||
-- ## Using event callbacks
|
|
||||||
--
|
|
||||||
-- In a normal setting, you can only use a callback function for a specific option in one location. If you have multiple scripts that rely on the same callback from the same object, this can get quite messy. With the ClientWatch module, these callbacks are isolated t the instances and therefore open the possibility to use many instances with the same callback doing different things. ClientWatch instances subscribe to all events that are applicable to player controlled aircraft and provides callbacks for each, forwarding the EventData in the callback function.
|
|
||||||
--
|
|
||||||
-- The following event callbacks can be used inside the OnAfterSpawn() callback:
|
|
||||||
--
|
|
||||||
-- * **:OnAfterDespawn(From,Event,To)**: Triggers whenever DCS no longer sees the aircraft as 'alive'. No event data is given in this callback as it is derived from other events
|
|
||||||
-- * **:OnAfterHit(From,Event,To,EventData)**: Triggers every time the aircraft takes damage or is struck by a weapon/explosion
|
|
||||||
-- * **:OnAfterKill(From,Event,To,EventData)**: Triggers after the aircraft kills something with its weapons
|
|
||||||
-- * **:OnAfterScore(From,Event,To,EventData)**: Triggers after accumulating score
|
|
||||||
-- * **:OnAfterShot(From,Event,To,EventData)**: Triggers after a single-shot weapon is released
|
|
||||||
-- * **:OnAfterShootingStart(From,Event,To,EventData)**: Triggers when an automatic weapon begins firing
|
|
||||||
-- * **:OnAfterShootingEnd(From,Event,To,EventData)**: Triggers when an automatic weapon stops firing
|
|
||||||
-- * **:OnAfterLand(From,Event,To,EventData)**: Triggers when an aircraft transitions from being airborne to on the ground
|
|
||||||
-- * **:OnAfterTakeoff(From,Event,To,EventData)**: Triggers when an aircraft transitions from being on the ground to airborne
|
|
||||||
-- * **:OnAfterRunwayTakeoff(From,Event,To,EventData)**: Triggers after lifting off from a runway
|
|
||||||
-- * **:OnAfterRunwayTouch(From,Event,To,EventData)**: Triggers when an aircraft's gear makes contact with a runway
|
|
||||||
-- * **:OnAfterRefueling(From,Event,To,EventData)**: Triggers when an aircraft begins taking on fuel
|
|
||||||
-- * **:OnAfterRefuelingStop(From,Event,To,EventData)**: Triggers when an aircraft stops taking on fuel
|
|
||||||
-- * **:OnAfterPlayerLeaveUnit(From,Event,To,EventData)**: Triggers when a player leaves an operational aircraft
|
|
||||||
-- * **:OnAfterCrash(From,Event,To,EventData)**: Triggers when an aircraft is destroyed (may fail to trigger if the aircraft is only partially destroyed)
|
|
||||||
-- * **:OnAfterDead(From,Event,To,EventData)**: Triggers when an aircraft is considered dead (may fail to trigger if the aircraft was partially destroyed first)
|
|
||||||
-- * **:OnAfterPilotDead(From,Event,To,EventData)**: Triggers when the pilot is killed (may fail to trigger if the aircraft was partially destroyed first)
|
|
||||||
-- * **:OnAfterUnitLost(From,Event,To,EventData)**: Triggers when an aircraft is lost for any reason (may fail to trigger if the aircraft was partially destroyed first)
|
|
||||||
-- * **:OnAfterEjection(From,Event,To,EventData)**: Triggers when a pilot ejects from an aircraft
|
|
||||||
-- * **:OnAfterHumanFailure(From,Event,To,EventData)**: Triggers when an aircraft or system is damaged from any source or action by the player
|
|
||||||
-- * **:OnAfterHumanAircraftRepairStart(From,Event,To,EventData)**: Triggers when an aircraft repair is started
|
|
||||||
-- * **:OnAfterHumanAircraftRepairFinish(From,Event,To,EventData)**: Triggers when an aircraft repair is completed
|
|
||||||
-- * **:OnAfterEngineStartup(From,Event,To,EventData)**: Triggers when the engine enters what DCS considers to be a started state. Parameters vary by aircraft
|
|
||||||
-- * **:OnAfterEngineShutdown(From,Event,To,EventData)**: Triggers when the engine enters what DCS considers to be a stopped state. Parameters vary by aircraft
|
|
||||||
-- * **:OnAfterWeaponAdd(From,Event,To,EventData)**: Triggers when an item is added to an aircraft's payload
|
|
||||||
-- * **:OnAfterWeaponDrop(From,Event,To,EventData)**: Triggers when an item is jettisoned or dropped from an aircraft (unconfirmed)
|
|
||||||
-- * **:OnAfterWeaponRearm(From,Event,To,EventData)**: Triggers when an item with internal supply is restored (unconfirmed)
|
|
||||||
--
|
|
||||||
-- ### Examples
|
|
||||||
--
|
|
||||||
-- -- Show a message to player when they take damage from a weapon
|
|
||||||
-- local clientInstance = CLIENTWATCH:New("Rotary")
|
|
||||||
-- function clientInstance:OnAfterSpawn(From,Event,To,ClientObject,EventData)
|
|
||||||
-- function ClientObject:OnAfterHit(From,Event,To,EventData)
|
|
||||||
-- local typeShooter = EventData.IniTypeName
|
|
||||||
-- local nameWeapon = EventData.weapon_name
|
|
||||||
-- MESSAGE:New("A "..typeShooter.." hit you with a "..nameWeapon,20):ToUnit(ClientObject.Unit)
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
--
|
|
||||||
-- @field #CLIENTWATCH
|
|
||||||
CLIENTWATCH = {}
|
|
||||||
CLIENTWATCH.ClassName = "CLIENTWATCH"
|
|
||||||
CLIENTWATCH.Debug = false
|
|
||||||
CLIENTWATCH.DebugEventData = false
|
|
||||||
CLIENTWATCH.lid = nil
|
|
||||||
|
|
||||||
-- @type CLIENTWATCHTools
|
|
||||||
-- @field #table Unit Wrapper.UNIT of the cient object
|
|
||||||
-- @field #table Group Wrapper.GROUP of the cient object
|
|
||||||
-- @field #table Client Wrapper.CLIENT of the cient object
|
|
||||||
-- @field #string PlayerName Name of the player controlling the client object
|
|
||||||
-- @field #string UnitName Name of the unit that is the client object
|
|
||||||
-- @field #string GroupName Name of the group the client object belongs to
|
|
||||||
CLIENTWATCHTools = {}
|
|
||||||
|
|
||||||
--- CLIENTWATCH version
|
|
||||||
-- @field #string version
|
|
||||||
CLIENTWATCH.version="1.0.1"
|
|
||||||
|
|
||||||
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
--- Creates a new instance of CLIENTWATCH to add scripts to. Can be used multiple times with the same client/prefixes if you need it for multiple scripts.
|
|
||||||
-- @param #CLIENTWATCH self
|
|
||||||
-- @param #string Will watch for clients whos UNIT NAME or GROUP NAME matches part of the #string as a prefix.
|
|
||||||
-- @param #table Put strings in a table to use multiple prefixes for the above method.
|
|
||||||
-- @param Wrapper.Client#CLIENT Provide a Moose CLIENT object to apply to that specific aircraft slot (static slots only!)
|
|
||||||
-- @param #nil Leave blank to activate for ALL CLIENTS
|
|
||||||
-- @return #CLIENTWATCH self
|
|
||||||
function CLIENTWATCH:New(client)
|
|
||||||
--Init FSM
|
|
||||||
local self=BASE:Inherit(self, FSM:New())
|
|
||||||
self:SetStartState( "Idle" )
|
|
||||||
self:AddTransition( "*", "Spawn", "*" )
|
|
||||||
|
|
||||||
self.FilterCoalition = nil
|
|
||||||
self.FilterCategory = nil
|
|
||||||
|
|
||||||
--- User function for OnAfter "Spawn" event.
|
|
||||||
-- @function [parent=#CLIENTWATCH] OnAfterSpawn
|
|
||||||
-- @param #CLIENTWATCH self
|
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE Controllable Controllable of the group.
|
|
||||||
-- @param #string From From state.
|
|
||||||
-- @param #string Event Event.
|
|
||||||
-- @param #string To To state.
|
|
||||||
-- @param #table clientObject Custom object that handles events and stores Moose object data. See top documentation for more details.
|
|
||||||
-- @param #table eventdata Data from EVENTS.Birth.
|
|
||||||
|
|
||||||
--Set up spawn tracking
|
|
||||||
if not client then
|
|
||||||
if self.Debug then self:I({"New client instance created. ClientType = All clients"}) end
|
|
||||||
self:HandleEvent(EVENTS.Birth)
|
|
||||||
function self:OnEventBirth(eventdata)
|
|
||||||
if (eventdata.IniCategory == 0 or eventdata.IniCategory == 1) and eventdata.IniPlayerName
|
|
||||||
and (not self.FilterCoalition or self.FilterCoalition == eventdata.IniCoalition)
|
|
||||||
and (not self.FilterCategory or self.FilterCategory == eventdata.IniCategory) then
|
|
||||||
if self.Debug then
|
|
||||||
self:I({"Client spawned in.",IniCategory = eventdata.IniCategory})
|
|
||||||
end
|
|
||||||
local clientWatchDebug = self.Debug
|
|
||||||
local clientObject = CLIENTWATCHTools:_newClient(clientWatchDebug,eventdata)
|
|
||||||
self:Spawn(clientObject,eventdata)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
elseif type(client) == "table" or type(client) == "string" then
|
|
||||||
if type(client) == "table" then
|
|
||||||
|
|
||||||
--CLIENT TABLE
|
|
||||||
if client.ClassName == "CLIENT" then
|
|
||||||
if self.Debug then self:I({"New client instance created. ClientType = Wrapper.CLIENT",client}) end
|
|
||||||
self.ClientName = client:GetName()
|
|
||||||
self:HandleEvent(EVENTS.Birth)
|
|
||||||
function self:OnEventBirth(eventdata)
|
|
||||||
if (eventdata.IniCategory == 0 or eventdata.IniCategory == 1) and eventdata.IniPlayerName
|
|
||||||
and (not self.FilterCoalition or self.FilterCoalition == eventdata.IniCoalition)
|
|
||||||
and (not self.FilterCategory or self.FilterCategory == eventdata.IniCategory) then
|
|
||||||
if self.ClientName == eventdata.IniUnitName then
|
|
||||||
if self.Debug then
|
|
||||||
self:I({"Client spawned in.",IniCategory = eventdata.IniCategory})
|
|
||||||
end
|
|
||||||
local clientWatchDebug = self.Debug
|
|
||||||
local clientObject = CLIENTWATCHTools:_newClient(clientWatchDebug,eventdata)
|
|
||||||
self:Spawn(clientObject,eventdata)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--STRING TABLE
|
|
||||||
else
|
|
||||||
if self.Debug then self:I({"New client instance created. ClientType = Multiple Prefixes",client}) end
|
|
||||||
local tableValid = true
|
|
||||||
for _,entry in pairs(client) do
|
|
||||||
if type(entry) ~= "string" then
|
|
||||||
tableValid = false
|
|
||||||
self:E({"The base handler failed to start because at least one entry in param1's table is not a string!",InvalidEntry = entry})
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if tableValid then
|
|
||||||
self:HandleEvent(EVENTS.Birth)
|
|
||||||
function self:OnEventBirth(eventdata)
|
|
||||||
for _,entry in pairs(client) do
|
|
||||||
if (eventdata.IniCategory == 0 or eventdata.IniCategory == 1) and eventdata.IniPlayerName
|
|
||||||
and (not self.FilterCoalition or self.FilterCoalition == eventdata.IniCoalition)
|
|
||||||
and (not self.FilterCategory or self.FilterCategory == eventdata.IniCategory) then
|
|
||||||
if string.match(eventdata.IniUnitName,entry) or string.match(eventdata.IniGroupName,entry) then
|
|
||||||
if self.Debug then
|
|
||||||
self:I({"Client spawned in.",IniCategory = eventdata.IniCategory})
|
|
||||||
end
|
|
||||||
local clientWatchDebug = self.Debug
|
|
||||||
local clientObject = CLIENTWATCHTools:_newClient(clientWatchDebug,eventdata)
|
|
||||||
self:Spawn(clientObject,eventdata)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if self.Debug then self:I({"New client instance created. ClientType = Single Prefix",client}) end
|
|
||||||
|
|
||||||
--SOLO STRING
|
|
||||||
self:HandleEvent(EVENTS.Birth)
|
|
||||||
function self:OnEventBirth(eventdata)
|
|
||||||
if (eventdata.IniCategory == 0 or eventdata.IniCategory == 1) and eventdata.IniPlayerName
|
|
||||||
and (not self.FilterCoalition or self.FilterCoalition == eventdata.IniCoalition)
|
|
||||||
and (not self.FilterCategory or self.FilterCategory == eventdata.IniCategory) then
|
|
||||||
if string.match(eventdata.IniUnitName,client) or string.match(eventdata.IniGroupName,client) then
|
|
||||||
if self.Debug then
|
|
||||||
self:I({"Client spawned in.",IniCategory = eventdata.IniCategory})
|
|
||||||
end
|
|
||||||
local clientWatchDebug = self.Debug
|
|
||||||
local clientObject = CLIENTWATCHTools:_newClient(clientWatchDebug,eventdata)
|
|
||||||
self:Spawn(clientObject,eventdata)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
self:E({"The base handler failed to start because param1 is not a CLIENT object or a prefix string!",param1 = client})
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--- Filter out all clients not belonging to the provided coalition
|
|
||||||
-- @param #CLIENTWATCH self
|
|
||||||
-- @param #number Coalition number (1 = red, 2 = blue)
|
|
||||||
-- @param #string Coalition string ('red' or 'blue')
|
|
||||||
function CLIENTWATCH:FilterByCoalition(value)
|
|
||||||
if value == 1 or value == "red" then
|
|
||||||
self.FilterCoalition = 1
|
|
||||||
else
|
|
||||||
self.FilterCoalition = 2
|
|
||||||
end
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--- Filter out all clients that are not of the given category
|
|
||||||
-- @param #CLIENTWATCH self
|
|
||||||
-- @param #number Category number (0 = airplane, 1 = helicopter)
|
|
||||||
-- @param #string Category string ('airplane' or 'helicopter')
|
|
||||||
function CLIENTWATCH:FilterByCategory(value)
|
|
||||||
if value == 1 or value == "helicopter" then
|
|
||||||
self.FilterCategory = 1
|
|
||||||
else
|
|
||||||
self.FilterCategory = 0
|
|
||||||
end
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
--- Internal function for creating a new client on birth. Do not use!!!.
|
|
||||||
-- @param #CLIENTWATCHTools self
|
|
||||||
-- @param #EVENTS.Birth EventData
|
|
||||||
-- @return #CLIENTWATCHTools self
|
|
||||||
function CLIENTWATCHTools:_newClient(clientWatchDebug,eventdata)
|
|
||||||
--Init FSM
|
|
||||||
local self=BASE:Inherit(self, FSM:New())
|
|
||||||
self:SetStartState( "Alive" )
|
|
||||||
self:AddTransition( "Alive", "Despawn", "Dead" )
|
|
||||||
|
|
||||||
self.Unit = eventdata.IniUnit
|
|
||||||
self.Group = self.Unit:GetGroup()
|
|
||||||
self.Client = self.Unit:GetClient()
|
|
||||||
self.PlayerName = self.Unit:GetPlayerName()
|
|
||||||
self.UnitName = self.Unit:GetName()
|
|
||||||
self.GroupName = self.Group:GetName()
|
|
||||||
|
|
||||||
--Event events
|
|
||||||
self:AddTransition( "*", "Hit", "*" )
|
|
||||||
self:AddTransition( "*", "Kill", "*" )
|
|
||||||
self:AddTransition( "*", "Score", "*" )
|
|
||||||
self:AddTransition( "*", "Shot", "*" )
|
|
||||||
self:AddTransition( "*", "ShootingStart", "*" )
|
|
||||||
self:AddTransition( "*", "ShootingEnd", "*" )
|
|
||||||
self:AddTransition( "*", "Land", "*" )
|
|
||||||
self:AddTransition( "*", "Takeoff", "*" )
|
|
||||||
self:AddTransition( "*", "RunwayTakeoff", "*" )
|
|
||||||
self:AddTransition( "*", "RunwayTouch", "*" )
|
|
||||||
self:AddTransition( "*", "Refueling", "*" )
|
|
||||||
self:AddTransition( "*", "RefuelingStop", "*" )
|
|
||||||
self:AddTransition( "*", "PlayerLeaveUnit", "*" )
|
|
||||||
self:AddTransition( "*", "Crash", "*" )
|
|
||||||
self:AddTransition( "*", "Dead", "*" )
|
|
||||||
self:AddTransition( "*", "PilotDead", "*" )
|
|
||||||
self:AddTransition( "*", "UnitLost", "*" )
|
|
||||||
self:AddTransition( "*", "Ejection", "*" )
|
|
||||||
self:AddTransition( "*", "HumanFailure", "*" )
|
|
||||||
self:AddTransition( "*", "HumanAircraftRepairFinish", "*" )
|
|
||||||
self:AddTransition( "*", "HumanAircraftRepairStart", "*" )
|
|
||||||
self:AddTransition( "*", "EngineShutdown", "*" )
|
|
||||||
self:AddTransition( "*", "EngineStartup", "*" )
|
|
||||||
self:AddTransition( "*", "WeaponAdd", "*" )
|
|
||||||
self:AddTransition( "*", "WeaponDrop", "*" )
|
|
||||||
self:AddTransition( "*", "WeaponRearm", "*" )
|
|
||||||
|
|
||||||
--Event Handlers
|
|
||||||
self:HandleEvent( EVENTS.Hit )
|
|
||||||
self:HandleEvent( EVENTS.Kill )
|
|
||||||
self:HandleEvent( EVENTS.Score )
|
|
||||||
self:HandleEvent( EVENTS.Shot )
|
|
||||||
self:HandleEvent( EVENTS.ShootingStart )
|
|
||||||
self:HandleEvent( EVENTS.ShootingEnd )
|
|
||||||
self:HandleEvent( EVENTS.Land )
|
|
||||||
self:HandleEvent( EVENTS.Takeoff )
|
|
||||||
self:HandleEvent( EVENTS.RunwayTakeoff )
|
|
||||||
self:HandleEvent( EVENTS.RunwayTouch )
|
|
||||||
self:HandleEvent( EVENTS.Refueling )
|
|
||||||
self:HandleEvent( EVENTS.RefuelingStop )
|
|
||||||
self:HandleEvent( EVENTS.PlayerLeaveUnit )
|
|
||||||
self:HandleEvent( EVENTS.Crash )
|
|
||||||
self:HandleEvent( EVENTS.Dead )
|
|
||||||
self:HandleEvent( EVENTS.PilotDead )
|
|
||||||
self:HandleEvent( EVENTS.UnitLost )
|
|
||||||
self:HandleEvent( EVENTS.Ejection )
|
|
||||||
self:HandleEvent( EVENTS.HumanFailure )
|
|
||||||
self:HandleEvent( EVENTS.HumanAircraftRepairFinish )
|
|
||||||
self:HandleEvent( EVENTS.HumanAircraftRepairStart )
|
|
||||||
self:HandleEvent( EVENTS.EngineShutdown )
|
|
||||||
self:HandleEvent( EVENTS.EngineStartup )
|
|
||||||
self:HandleEvent( EVENTS.WeaponAdd )
|
|
||||||
self:HandleEvent( EVENTS.WeaponDrop )
|
|
||||||
self:HandleEvent( EVENTS.WeaponRearm )
|
|
||||||
|
|
||||||
function self:OnEventHit(EventData)
|
|
||||||
if EventData.TgtUnitName == self.UnitName then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client triggered hit event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
|
|
||||||
end
|
|
||||||
self:Hit(EventData)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function self:OnEventKill(EventData)
|
|
||||||
if EventData.IniUnitName == self.UnitName then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client triggered kill event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
|
|
||||||
end
|
|
||||||
self:Kill(EventData)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function self:OnEventScore(EventData)
|
|
||||||
if EventData.IniUnitName == self.UnitName then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client triggered score event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
|
|
||||||
end
|
|
||||||
self:Score(EventData)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function self:OnEventShot(EventData)
|
|
||||||
if EventData.IniUnitName == self.UnitName then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client triggered shot event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
|
|
||||||
end
|
|
||||||
self:Shot(EventData)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function self:OnEventShootingStart(EventData)
|
|
||||||
if EventData.IniUnitName == self.UnitName then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client triggered shooting start event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
|
|
||||||
end
|
|
||||||
self:ShootingStart(EventData)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function self:OnEventShootingEnd(EventData)
|
|
||||||
if EventData.IniUnitName == self.UnitName then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client triggered shooting end event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
|
|
||||||
end
|
|
||||||
self:ShootingEnd(EventData)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function self:OnEventLand(EventData)
|
|
||||||
if EventData.IniUnitName == self.UnitName then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client triggered land event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
|
|
||||||
end
|
|
||||||
self:Land(EventData)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function self:OnEventTakeoff(EventData)
|
|
||||||
if EventData.IniUnitName == self.UnitName then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client triggered takeoff event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
|
|
||||||
end
|
|
||||||
self:Takeoff(EventData)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function self:OnEventRunwayTakeoff(EventData)
|
|
||||||
if EventData.IniUnitName == self.UnitName then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client triggered runway takeoff event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
|
|
||||||
end
|
|
||||||
self:RunwayTakeoff(EventData)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function self:OnEventRunwayTouch(EventData)
|
|
||||||
if EventData.IniUnitName == self.UnitName then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client triggered runway touch event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
|
|
||||||
end
|
|
||||||
self:RunwayTouch(EventData)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function self:OnEventRefueling(EventData)
|
|
||||||
if EventData.IniUnitName == self.UnitName then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client triggered refueling event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
|
|
||||||
end
|
|
||||||
self:Refueling(EventData)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function self:OnEventRefuelingStop(EventData)
|
|
||||||
if EventData.IniUnitName == self.UnitName then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client triggered refueling event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
|
|
||||||
end
|
|
||||||
self:RefuelingStop(EventData)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function self:OnEventPlayerLeaveUnit(EventData)
|
|
||||||
if EventData.IniUnitName == self.UnitName then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client triggered leave unit event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
|
|
||||||
end
|
|
||||||
self:PlayerLeaveUnit(EventData)
|
|
||||||
self._deadRoutine()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function self:OnEventCrash(EventData)
|
|
||||||
if EventData.IniUnitName == self.UnitName then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client triggered crash event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
|
|
||||||
end
|
|
||||||
self:Crash(EventData)
|
|
||||||
self._deadRoutine()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function self:OnEventDead(EventData)
|
|
||||||
if EventData.IniUnitName == self.UnitName then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client triggered dead event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
|
|
||||||
end
|
|
||||||
self:Dead(EventData)
|
|
||||||
self._deadRoutine()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function self:OnEventPilotDead(EventData)
|
|
||||||
if EventData.IniUnitName == self.UnitName then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client triggered pilot dead event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
|
|
||||||
end
|
|
||||||
self:PilotDead(EventData)
|
|
||||||
self._deadRoutine()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function self:OnEventUnitLost(EventData)
|
|
||||||
if EventData.IniUnitName == self.UnitName then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client triggered unit lost event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
|
|
||||||
end
|
|
||||||
self:UnitLost(EventData)
|
|
||||||
self._deadRoutine()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function self:OnEventEjection(EventData)
|
|
||||||
if EventData.IniUnitName == self.UnitName then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client triggered ejection event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
|
|
||||||
end
|
|
||||||
self:Ejection(EventData)
|
|
||||||
self._deadRoutine()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function self:OnEventHumanFailure(EventData)
|
|
||||||
if EventData.IniUnitName == self.UnitName then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client triggered human failure event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
|
|
||||||
end
|
|
||||||
self:HumanFailure(EventData)
|
|
||||||
if not self.Unit:IsAlive() then
|
|
||||||
self._deadRoutine()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function self:OnEventHumanAircraftRepairFinish(EventData)
|
|
||||||
if EventData.IniUnitName == self.UnitName then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client triggered repair finished event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
|
|
||||||
end
|
|
||||||
self:HumanAircraftRepairFinish(EventData)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function self:OnEventHumanAircraftRepairStart(EventData)
|
|
||||||
if EventData.IniUnitName == self.UnitName then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client triggered repair start event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
|
|
||||||
end
|
|
||||||
self:HumanAircraftRepairStart(EventData)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function self:OnEventEngineShutdown(EventData)
|
|
||||||
if EventData.IniUnitName == self.UnitName then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client triggered engine shutdown event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
|
|
||||||
end
|
|
||||||
self:EngineShutdown(EventData)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function self:OnEventEngineStartup(EventData)
|
|
||||||
if EventData.IniUnitName == self.UnitName then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client triggered engine startup event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
|
|
||||||
end
|
|
||||||
self:EngineStartup(EventData)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function self:OnEventWeaponAdd(EventData)
|
|
||||||
if EventData.IniUnitName == self.UnitName then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client triggered weapon add event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
|
|
||||||
end
|
|
||||||
self:WeaponAdd(EventData)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function self:OnEventWeaponDrop(EventData)
|
|
||||||
if EventData.IniUnitName == self.UnitName then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client triggered weapon drop event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
|
|
||||||
end
|
|
||||||
self:WeaponDrop(EventData)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function self:OnEventWeaponRearm(EventData)
|
|
||||||
if EventData.IniUnitName == self.UnitName then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client triggered weapon rearm event.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
|
|
||||||
end
|
|
||||||
self:WeaponRearm(EventData)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--Fallback timer
|
|
||||||
self.FallbackTimer = TIMER:New(function()
|
|
||||||
if not self.Unit:IsAlive() then
|
|
||||||
if clientWatchDebug then
|
|
||||||
self:I({"Client is registered as dead without an event trigger. Running fallback dead routine.",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName})
|
|
||||||
end
|
|
||||||
self._deadRoutine()
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
self.FallbackTimer:Start(5,5)
|
|
||||||
|
|
||||||
--Stop event handlers and trigger Despawn
|
|
||||||
function self._deadRoutine()
|
|
||||||
if clientWatchDebug then self:I({"Client dead routine triggered. Shutting down tracking...",Player = self.PlayerName,Group = self.GroupName,Unit = self.UnitName}) end
|
|
||||||
self:UnHandleEvent( EVENTS.Hit )
|
|
||||||
self:UnHandleEvent( EVENTS.Kill )
|
|
||||||
self:UnHandleEvent( EVENTS.Score )
|
|
||||||
self:UnHandleEvent( EVENTS.Shot )
|
|
||||||
self:UnHandleEvent( EVENTS.ShootingStart )
|
|
||||||
self:UnHandleEvent( EVENTS.ShootingEnd )
|
|
||||||
self:UnHandleEvent( EVENTS.Land )
|
|
||||||
self:UnHandleEvent( EVENTS.Takeoff )
|
|
||||||
self:UnHandleEvent( EVENTS.RunwayTakeoff )
|
|
||||||
self:UnHandleEvent( EVENTS.RunwayTouch )
|
|
||||||
self:UnHandleEvent( EVENTS.Refueling )
|
|
||||||
self:UnHandleEvent( EVENTS.RefuelingStop )
|
|
||||||
self:UnHandleEvent( EVENTS.PlayerLeaveUnit )
|
|
||||||
self:UnHandleEvent( EVENTS.Crash )
|
|
||||||
self:UnHandleEvent( EVENTS.Dead )
|
|
||||||
self:UnHandleEvent( EVENTS.PilotDead )
|
|
||||||
self:UnHandleEvent( EVENTS.UnitLost )
|
|
||||||
self:UnHandleEvent( EVENTS.Ejection )
|
|
||||||
self:UnHandleEvent( EVENTS.HumanFailure )
|
|
||||||
self:UnHandleEvent( EVENTS.HumanAircraftRepairFinish )
|
|
||||||
self:UnHandleEvent( EVENTS.HumanAircraftRepairStart )
|
|
||||||
self:UnHandleEvent( EVENTS.EngineShutdown )
|
|
||||||
self:UnHandleEvent( EVENTS.EngineStartup )
|
|
||||||
self:UnHandleEvent( EVENTS.WeaponAdd )
|
|
||||||
self:UnHandleEvent( EVENTS.WeaponDrop )
|
|
||||||
self:UnHandleEvent( EVENTS.WeaponRearm )
|
|
||||||
self.FallbackTimer:Stop()
|
|
||||||
self:Despawn()
|
|
||||||
end
|
|
||||||
|
|
||||||
self:I({"Detected client spawn and applied internal functions and events.", PlayerName = self.PlayerName, UnitName = self.UnitName, GroupName = self.GroupName})
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
@@ -15,12 +15,10 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ## Additional Material:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- * **Demo Missions:** [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Designate)
|
-- [DES - Designation](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/DES%20-%20Designation)
|
||||||
-- * **YouTube videos:** None
|
--
|
||||||
-- * **Guides:** None
|
|
||||||
--
|
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- Targets detected by recce will be communicated to a group of attacking players.
|
-- Targets detected by recce will be communicated to a group of attacking players.
|
||||||
@@ -184,7 +182,7 @@
|
|||||||
|
|
||||||
do -- DESIGNATE
|
do -- DESIGNATE
|
||||||
|
|
||||||
-- @type DESIGNATE
|
--- @type DESIGNATE
|
||||||
-- @extends Core.Fsm#FSM_PROCESS
|
-- @extends Core.Fsm#FSM_PROCESS
|
||||||
|
|
||||||
--- Manage the designation of detected targets.
|
--- Manage the designation of detected targets.
|
||||||
@@ -525,7 +523,7 @@ do -- DESIGNATE
|
|||||||
|
|
||||||
self.AttackSet:ForEachGroupAlive(
|
self.AttackSet:ForEachGroupAlive(
|
||||||
|
|
||||||
-- @param Wrapper.Group#GROUP AttackGroup
|
--- @param Wrapper.Group#GROUP AttackGroup
|
||||||
function( AttackGroup )
|
function( AttackGroup )
|
||||||
self.FlashStatusMenu[AttackGroup] = FlashMenu
|
self.FlashStatusMenu[AttackGroup] = FlashMenu
|
||||||
end
|
end
|
||||||
@@ -554,7 +552,7 @@ do -- DESIGNATE
|
|||||||
|
|
||||||
self.AttackSet:ForEachGroupAlive(
|
self.AttackSet:ForEachGroupAlive(
|
||||||
|
|
||||||
-- @param Wrapper.Group#GROUP AttackGroup
|
--- @param Wrapper.Group#GROUP AttackGroup
|
||||||
function( AttackGroup )
|
function( AttackGroup )
|
||||||
self.FlashDetectionMessage[AttackGroup] = FlashDetectionMessage
|
self.FlashDetectionMessage[AttackGroup] = FlashDetectionMessage
|
||||||
end
|
end
|
||||||
@@ -826,7 +824,7 @@ do -- DESIGNATE
|
|||||||
-- This Detection is obsolete, remove from the designate scope
|
-- This Detection is obsolete, remove from the designate scope
|
||||||
self.Designating[DesignateIndex] = nil
|
self.Designating[DesignateIndex] = nil
|
||||||
self.AttackSet:ForEachGroupAlive(
|
self.AttackSet:ForEachGroupAlive(
|
||||||
-- @param Wrapper.Group#GROUP AttackGroup
|
--- @param Wrapper.Group#GROUP AttackGroup
|
||||||
function( AttackGroup )
|
function( AttackGroup )
|
||||||
if AttackGroup:IsAlive() == true then
|
if AttackGroup:IsAlive() == true then
|
||||||
local DetectionText = self.Detection:DetectedItemReportSummary( DetectedItem, AttackGroup ):Text( ", " )
|
local DetectionText = self.Detection:DetectedItemReportSummary( DetectedItem, AttackGroup ):Text( ", " )
|
||||||
@@ -903,7 +901,7 @@ do -- DESIGNATE
|
|||||||
|
|
||||||
self.AttackSet:ForEachGroupAlive(
|
self.AttackSet:ForEachGroupAlive(
|
||||||
|
|
||||||
-- @param Wrapper.Group#GROUP GroupReport
|
--- @param Wrapper.Group#GROUP GroupReport
|
||||||
function( AttackGroup )
|
function( AttackGroup )
|
||||||
|
|
||||||
if self.FlashStatusMenu[AttackGroup] or ( MenuAttackGroup and ( AttackGroup:GetName() == MenuAttackGroup:GetName() ) ) then
|
if self.FlashStatusMenu[AttackGroup] or ( MenuAttackGroup and ( AttackGroup:GetName() == MenuAttackGroup:GetName() ) ) then
|
||||||
@@ -1060,7 +1058,7 @@ do -- DESIGNATE
|
|||||||
|
|
||||||
self.AttackSet:ForEachGroupAlive(
|
self.AttackSet:ForEachGroupAlive(
|
||||||
|
|
||||||
-- @param Wrapper.Group#GROUP GroupReport
|
--- @param Wrapper.Group#GROUP GroupReport
|
||||||
function( AttackGroup )
|
function( AttackGroup )
|
||||||
|
|
||||||
self:ScheduleOnce( Delay, self.SetMenu, self, AttackGroup )
|
self:ScheduleOnce( Delay, self.SetMenu, self, AttackGroup )
|
||||||
@@ -1198,7 +1196,7 @@ do -- DESIGNATE
|
|||||||
--local ReportTypes = REPORT:New()
|
--local ReportTypes = REPORT:New()
|
||||||
--local ReportLaserCodes = REPORT:New()
|
--local ReportLaserCodes = REPORT:New()
|
||||||
|
|
||||||
--TargetSetUnit:Flush( self )
|
TargetSetUnit:Flush( self )
|
||||||
|
|
||||||
--self:F( { Recces = self.Recces } )
|
--self:F( { Recces = self.Recces } )
|
||||||
for TargetUnit, RecceData in pairs( self.Recces ) do
|
for TargetUnit, RecceData in pairs( self.Recces ) do
|
||||||
@@ -1229,12 +1227,10 @@ do -- DESIGNATE
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if TargetSetUnit == nil then return end
|
|
||||||
|
|
||||||
if self.AutoLase or ( not self.AutoLase and ( self.LaseStart + Duration >= timer.getTime() ) ) then
|
if self.AutoLase or ( not self.AutoLase and ( self.LaseStart + Duration >= timer.getTime() ) ) then
|
||||||
|
|
||||||
TargetSetUnit:ForEachUnitPerThreatLevel( 10, 0,
|
TargetSetUnit:ForEachUnitPerThreatLevel( 10, 0,
|
||||||
-- @param Wrapper.Unit#UNIT SmokeUnit
|
--- @param Wrapper.Unit#UNIT SmokeUnit
|
||||||
function( TargetUnit )
|
function( TargetUnit )
|
||||||
|
|
||||||
self:F( { TargetUnit = TargetUnit:GetName() } )
|
self:F( { TargetUnit = TargetUnit:GetName() } )
|
||||||
@@ -1255,7 +1251,7 @@ do -- DESIGNATE
|
|||||||
|
|
||||||
local RecceUnit = UnitData -- Wrapper.Unit#UNIT
|
local RecceUnit = UnitData -- Wrapper.Unit#UNIT
|
||||||
local RecceUnitDesc = RecceUnit:GetDesc()
|
local RecceUnitDesc = RecceUnit:GetDesc()
|
||||||
--self:F( { RecceUnit = RecceUnit:GetName(), RecceDescription = RecceUnitDesc } )x
|
--self:F( { RecceUnit = RecceUnit:GetName(), RecceDescription = RecceUnitDesc } )
|
||||||
|
|
||||||
if RecceUnit:IsLasing() == false then
|
if RecceUnit:IsLasing() == false then
|
||||||
--self:F( { IsDetected = RecceUnit:IsDetected( TargetUnit ), IsLOS = RecceUnit:IsLOS( TargetUnit ) } )
|
--self:F( { IsDetected = RecceUnit:IsDetected( TargetUnit ), IsLOS = RecceUnit:IsLOS( TargetUnit ) } )
|
||||||
@@ -1277,10 +1273,9 @@ do -- DESIGNATE
|
|||||||
local Spot = RecceUnit:LaseUnit( TargetUnit, LaserCode, Duration )
|
local Spot = RecceUnit:LaseUnit( TargetUnit, LaserCode, Duration )
|
||||||
local AttackSet = self.AttackSet
|
local AttackSet = self.AttackSet
|
||||||
local DesignateName = self.DesignateName
|
local DesignateName = self.DesignateName
|
||||||
local typename = TargetUnit:GetTypeName()
|
|
||||||
|
|
||||||
function Spot:OnAfterDestroyed( From, Event, To )
|
function Spot:OnAfterDestroyed( From, Event, To )
|
||||||
self.Recce:MessageToSetGroup( "Target " ..typename .. " destroyed. " .. TargetSetUnit:CountAlive() .. " targets left.",
|
self.Recce:MessageToSetGroup( "Target " .. TargetUnit:GetTypeName() .. " destroyed. " .. TargetSetUnit:Count() .. " targets left.",
|
||||||
5, AttackSet, self.DesignateName )
|
5, AttackSet, self.DesignateName )
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1288,7 +1283,7 @@ do -- DESIGNATE
|
|||||||
-- OK. We have assigned for the Recce a TargetUnit. We can exit the function.
|
-- OK. We have assigned for the Recce a TargetUnit. We can exit the function.
|
||||||
MarkingCount = MarkingCount + 1
|
MarkingCount = MarkingCount + 1
|
||||||
local TargetUnitType = TargetUnit:GetTypeName()
|
local TargetUnitType = TargetUnit:GetTypeName()
|
||||||
RecceUnit:MessageToSetGroup( "Marking " .. TargetUnitType .. " with laser " .. RecceUnit:GetSpot().LaserCode .. " for " .. Duration .. "s.",
|
RecceUnit:MessageToSetGroup( "Marking " .. TargetUnit:GetTypeName() .. " with laser " .. RecceUnit:GetSpot().LaserCode .. " for " .. Duration .. "s.",
|
||||||
10, self.AttackSet, DesignateName )
|
10, self.AttackSet, DesignateName )
|
||||||
if not MarkedTypes[TargetUnitType] then
|
if not MarkedTypes[TargetUnitType] then
|
||||||
MarkedTypes[TargetUnitType] = true
|
MarkedTypes[TargetUnitType] = true
|
||||||
@@ -1395,7 +1390,7 @@ do -- DESIGNATE
|
|||||||
local MarkedCount = 0
|
local MarkedCount = 0
|
||||||
|
|
||||||
TargetSetUnit:ForEachUnitPerThreatLevel( 10, 0,
|
TargetSetUnit:ForEachUnitPerThreatLevel( 10, 0,
|
||||||
-- @param Wrapper.Unit#UNIT SmokeUnit
|
--- @param Wrapper.Unit#UNIT SmokeUnit
|
||||||
function( SmokeUnit )
|
function( SmokeUnit )
|
||||||
|
|
||||||
if MarkedCount < self.MaximumMarkings then
|
if MarkedCount < self.MaximumMarkings then
|
||||||
@@ -1460,10 +1455,9 @@ do -- DESIGNATE
|
|||||||
-- @param #DESIGNATE self
|
-- @param #DESIGNATE self
|
||||||
-- @return #DESIGNATE
|
-- @return #DESIGNATE
|
||||||
function DESIGNATE:onafterDoneSmoking( From, Event, To, Index )
|
function DESIGNATE:onafterDoneSmoking( From, Event, To, Index )
|
||||||
if self.Designating[Index] ~= nil then
|
|
||||||
self.Designating[Index] = string.gsub( self.Designating[Index], "S", "" )
|
self.Designating[Index] = string.gsub( self.Designating[Index], "S", "" )
|
||||||
self:SetDesignateMenu()
|
self:SetDesignateMenu()
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- DoneIlluminating
|
--- DoneIlluminating
|
||||||
@@ -1476,3 +1470,5 @@ do -- DESIGNATE
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [DET - Detection](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/Functional/Detection)
|
-- [DET - Detection](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/DET%20-%20Detection)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -38,9 +38,8 @@
|
|||||||
-- @image Detection.JPG
|
-- @image Detection.JPG
|
||||||
|
|
||||||
do -- DETECTION_BASE
|
do -- DETECTION_BASE
|
||||||
|
|
||||||
---
|
--- @type DETECTION_BASE
|
||||||
-- @type DETECTION_BASE
|
|
||||||
-- @field Core.Set#SET_GROUP DetectionSetGroup The @{Core.Set} of GROUPs in the Forward Air Controller role.
|
-- @field Core.Set#SET_GROUP DetectionSetGroup The @{Core.Set} of GROUPs in the Forward Air Controller role.
|
||||||
-- @field DCS#Distance DetectionRange The range till which targets are accepted to be detected.
|
-- @field DCS#Distance DetectionRange The range till which targets are accepted to be detected.
|
||||||
-- @field #DETECTION_BASE.DetectedObjects DetectedObjects The list of detected objects.
|
-- @field #DETECTION_BASE.DetectedObjects DetectedObjects The list of detected objects.
|
||||||
@@ -92,11 +91,6 @@ do -- DETECTION_BASE
|
|||||||
--
|
--
|
||||||
-- DetectionObject:FilterCategories( { Unit.Category.AIRPLANE, Unit.Category.HELICOPTER } )
|
-- DetectionObject:FilterCategories( { Unit.Category.AIRPLANE, Unit.Category.HELICOPTER } )
|
||||||
--
|
--
|
||||||
--
|
|
||||||
-- ## Radar Blur - use to make the radar less exact, e.g. for WWII scenarios
|
|
||||||
--
|
|
||||||
-- * @{#DETECTION_BASE.SetRadarBlur}(): Set the radar blur to be used.
|
|
||||||
--
|
|
||||||
-- ## **DETECTION_ derived classes** group the detected units into a **DetectedItems[]** list
|
-- ## **DETECTION_ derived classes** group the detected units into a **DetectedItems[]** list
|
||||||
--
|
--
|
||||||
-- DETECTION_BASE derived classes build a list called DetectedItems[], which is essentially a first later
|
-- DETECTION_BASE derived classes build a list called DetectedItems[], which is essentially a first later
|
||||||
@@ -274,13 +268,11 @@ do -- DETECTION_BASE
|
|||||||
DetectedItems = {},
|
DetectedItems = {},
|
||||||
DetectedItemsByIndex = {},
|
DetectedItemsByIndex = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
---
|
--- @type DETECTION_BASE.DetectedObjects
|
||||||
-- @type DETECTION_BASE.DetectedObjects
|
|
||||||
-- @list <#DETECTION_BASE.DetectedObject>
|
-- @list <#DETECTION_BASE.DetectedObject>
|
||||||
|
|
||||||
---
|
--- @type DETECTION_BASE.DetectedObject
|
||||||
-- @type DETECTION_BASE.DetectedObject
|
|
||||||
-- @field #string Name
|
-- @field #string Name
|
||||||
-- @field #boolean IsVisible
|
-- @field #boolean IsVisible
|
||||||
-- @field #boolean KnowType
|
-- @field #boolean KnowType
|
||||||
@@ -291,9 +283,8 @@ do -- DETECTION_BASE
|
|||||||
-- @field #number LastTime
|
-- @field #number LastTime
|
||||||
-- @field #boolean LastPos
|
-- @field #boolean LastPos
|
||||||
-- @field #number LastVelocity
|
-- @field #number LastVelocity
|
||||||
|
|
||||||
---
|
--- @type DETECTION_BASE.DetectedItems
|
||||||
-- @type DETECTION_BASE.DetectedItems
|
|
||||||
-- @list <#DETECTION_BASE.DetectedItem>
|
-- @list <#DETECTION_BASE.DetectedItem>
|
||||||
|
|
||||||
--- Detected item data structure.
|
--- Detected item data structure.
|
||||||
@@ -531,7 +522,7 @@ do -- DETECTION_BASE
|
|||||||
|
|
||||||
do -- State Transition Handling
|
do -- State Transition Handling
|
||||||
|
|
||||||
-- @param #DETECTION_BASE self
|
--- @param #DETECTION_BASE self
|
||||||
-- @param #string From The From State string.
|
-- @param #string From The From State string.
|
||||||
-- @param #string Event The Event string.
|
-- @param #string Event The Event string.
|
||||||
-- @param #string To The To State string.
|
-- @param #string To The To State string.
|
||||||
@@ -539,13 +530,13 @@ do -- DETECTION_BASE
|
|||||||
self:__Detect( 1 )
|
self:__Detect( 1 )
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #DETECTION_BASE self
|
--- @param #DETECTION_BASE self
|
||||||
-- @param #string From The From State string.
|
-- @param #string From The From State string.
|
||||||
-- @param #string Event The Event string.
|
-- @param #string Event The Event string.
|
||||||
-- @param #string To The To State string.
|
-- @param #string To The To State string.
|
||||||
function DETECTION_BASE:onafterDetect( From, Event, To )
|
function DETECTION_BASE:onafterDetect( From, Event, To )
|
||||||
|
|
||||||
local DetectDelay = 0.15
|
local DetectDelay = 0.1
|
||||||
self.DetectionCount = 0
|
self.DetectionCount = 0
|
||||||
self.DetectionRun = 0
|
self.DetectionRun = 0
|
||||||
self:UnIdentifyAllDetectedObjects() -- Resets the DetectedObjectsIdentified table
|
self:UnIdentifyAllDetectedObjects() -- Resets the DetectedObjectsIdentified table
|
||||||
@@ -579,7 +570,7 @@ do -- DETECTION_BASE
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #DETECTION_BASE self
|
--- @param #DETECTION_BASE self
|
||||||
-- @param #number The amount of alive recce.
|
-- @param #number The amount of alive recce.
|
||||||
function DETECTION_BASE:CountAliveRecce()
|
function DETECTION_BASE:CountAliveRecce()
|
||||||
|
|
||||||
@@ -587,7 +578,7 @@ do -- DETECTION_BASE
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @param #DETECTION_BASE self
|
--- @param #DETECTION_BASE self
|
||||||
function DETECTION_BASE:ForEachAliveRecce( IteratorFunction, ... )
|
function DETECTION_BASE:ForEachAliveRecce( IteratorFunction, ... )
|
||||||
self:F2( arg )
|
self:F2( arg )
|
||||||
|
|
||||||
@@ -595,9 +586,8 @@ do -- DETECTION_BASE
|
|||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
---
|
--- @param #DETECTION_BASE self
|
||||||
-- @param #DETECTION_BASE self
|
|
||||||
-- @param #string From The From State string.
|
-- @param #string From The From State string.
|
||||||
-- @param #string Event The Event string.
|
-- @param #string Event The Event string.
|
||||||
-- @param #string To The To State string.
|
-- @param #string To The To State string.
|
||||||
@@ -605,7 +595,7 @@ do -- DETECTION_BASE
|
|||||||
-- @param #number DetectionTimeStamp Time stamp of detection event.
|
-- @param #number DetectionTimeStamp Time stamp of detection event.
|
||||||
function DETECTION_BASE:onafterDetection( From, Event, To, Detection, DetectionTimeStamp )
|
function DETECTION_BASE:onafterDetection( From, Event, To, Detection, DetectionTimeStamp )
|
||||||
|
|
||||||
self:T( { DetectedObjects = self.DetectedObjects } )
|
-- self:F( { DetectedObjects = self.DetectedObjects } )
|
||||||
|
|
||||||
self.DetectionRun = self.DetectionRun + 1
|
self.DetectionRun = self.DetectionRun + 1
|
||||||
|
|
||||||
@@ -613,14 +603,14 @@ do -- DETECTION_BASE
|
|||||||
|
|
||||||
if Detection and Detection:IsAlive() then
|
if Detection and Detection:IsAlive() then
|
||||||
|
|
||||||
self:T( { "DetectionGroup is Alive", Detection:GetName() } )
|
-- self:T( { "DetectionGroup is Alive", DetectionGroup:GetName() } )
|
||||||
|
|
||||||
local DetectionGroupName = Detection:GetName()
|
local DetectionGroupName = Detection:GetName()
|
||||||
local DetectionUnit = Detection:GetFirstUnitAlive()
|
local DetectionUnit = Detection:GetUnit( 1 )
|
||||||
|
|
||||||
local DetectedUnits = {}
|
local DetectedUnits = {}
|
||||||
|
|
||||||
local DetectedTargets = DetectionUnit:GetDetectedTargets(
|
local DetectedTargets = Detection:GetDetectedTargets(
|
||||||
self.DetectVisual,
|
self.DetectVisual,
|
||||||
self.DetectOptical,
|
self.DetectOptical,
|
||||||
self.DetectRadar,
|
self.DetectRadar,
|
||||||
@@ -629,30 +619,28 @@ do -- DETECTION_BASE
|
|||||||
self.DetectDLINK
|
self.DetectDLINK
|
||||||
)
|
)
|
||||||
|
|
||||||
--self:T( { DetectedTargets = DetectedTargets } )
|
self:F( { DetectedTargets = DetectedTargets } )
|
||||||
--self:T(UTILS.PrintTableToLog(DetectedTargets))
|
|
||||||
|
for DetectionObjectID, Detection in pairs( DetectedTargets ) do
|
||||||
|
|
||||||
for DetectionObjectID, Detection in pairs( DetectedTargets or {}) do
|
|
||||||
local DetectedObject = Detection.object -- DCS#Object
|
local DetectedObject = Detection.object -- DCS#Object
|
||||||
|
|
||||||
if DetectedObject and DetectedObject:isExist() and DetectedObject.id_ < 50000000 then -- and ( DetectedObject:getCategory() == Object.Category.UNIT or DetectedObject:getCategory() == Object.Category.STATIC ) then
|
if DetectedObject and DetectedObject:isExist() and DetectedObject.id_ < 50000000 then -- and ( DetectedObject:getCategory() == Object.Category.UNIT or DetectedObject:getCategory() == Object.Category.STATIC ) then
|
||||||
local DetectedObjectName = DetectedObject:getName()
|
local DetectedObjectName = DetectedObject:getName()
|
||||||
if not self.DetectedObjects[DetectedObjectName] then
|
if not self.DetectedObjects[DetectedObjectName] then
|
||||||
self.DetectedObjects[DetectedObjectName] = self.DetectedObjects[DetectedObjectName] or {}
|
self.DetectedObjects[DetectedObjectName] = self.DetectedObjects[DetectedObjectName] or {}
|
||||||
self.DetectedObjects[DetectedObjectName].Name = DetectedObjectName
|
self.DetectedObjects[DetectedObjectName].Name = DetectedObjectName
|
||||||
self.DetectedObjects[DetectedObjectName].Object = DetectedObject
|
self.DetectedObjects[DetectedObjectName].Object = DetectedObject
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for DetectionObjectName, DetectedObjectData in pairs( self.DetectedObjects or {}) do
|
for DetectionObjectName, DetectedObjectData in pairs( self.DetectedObjects ) do
|
||||||
|
|
||||||
local DetectedObject = DetectedObjectData.Object
|
local DetectedObject = DetectedObjectData.Object
|
||||||
|
|
||||||
if DetectedObject:isExist() then
|
if DetectedObject:isExist() then
|
||||||
|
|
||||||
local TargetIsDetected, TargetIsVisible, TargetKnowType, TargetKnowDistance, TargetLastTime, TargetLastPos, TargetLastVelocity = DetectionUnit:IsTargetDetected(
|
local TargetIsDetected, TargetIsVisible, TargetLastTime, TargetKnowType, TargetKnowDistance, TargetLastPos, TargetLastVelocity = DetectionUnit:IsTargetDetected(
|
||||||
DetectedObject,
|
DetectedObject,
|
||||||
self.DetectVisual,
|
self.DetectVisual,
|
||||||
self.DetectOptical,
|
self.DetectOptical,
|
||||||
@@ -724,31 +712,6 @@ do -- DETECTION_BASE
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Calculate radar blur probability
|
|
||||||
|
|
||||||
if self.RadarBlur then
|
|
||||||
MESSAGE:New("Radar Blur",10):ToLogIf(self.debug):ToAllIf(self.verbose)
|
|
||||||
local minheight = self.RadarBlurMinHeight or 250 -- meters
|
|
||||||
local thresheight = self.RadarBlurThresHeight or 90 -- 10% chance to find a low flying group
|
|
||||||
local thresblur = self.RadarBlurThresBlur or 85 -- 25% chance to escape the radar overall
|
|
||||||
local dist = math.floor(Distance)
|
|
||||||
if dist <= self.RadarBlurClosing then
|
|
||||||
thresheight = (((dist*dist)/self.RadarBlurClosingSquare)*thresheight)
|
|
||||||
thresblur = (((dist*dist)/self.RadarBlurClosingSquare)*thresblur)
|
|
||||||
end
|
|
||||||
local fheight = math.floor(math.random(1,10000)/100)
|
|
||||||
local fblur = math.floor(math.random(1,10000)/100)
|
|
||||||
local unit = UNIT:FindByName(DetectedObjectName)
|
|
||||||
if unit and unit:IsAlive() then
|
|
||||||
local AGL = unit:GetAltitude(true)
|
|
||||||
MESSAGE:New("Unit "..DetectedObjectName.." is at "..math.floor(AGL).."m. Distance "..math.floor(Distance).."km.",10):ToLogIf(self.debug):ToAllIf(self.verbose)
|
|
||||||
MESSAGE:New(string.format("fheight = %d/%d | fblur = %d/%d",fheight,thresheight,fblur,thresblur),10):ToLogIf(self.debug):ToAllIf(self.verbose)
|
|
||||||
if fblur > thresblur then DetectionAccepted = false end
|
|
||||||
if AGL <= minheight and fheight < thresheight then DetectionAccepted = false end
|
|
||||||
MESSAGE:New("Detection Accepted = "..tostring(DetectionAccepted),10):ToLogIf(self.debug):ToAllIf(self.verbose)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Calculate additional probabilities
|
-- Calculate additional probabilities
|
||||||
|
|
||||||
if not self.DetectedObjects[DetectedObjectName] and TargetIsVisible and self.DistanceProbability then
|
if not self.DetectedObjects[DetectedObjectName] and TargetIsVisible and self.DistanceProbability then
|
||||||
@@ -1048,24 +1011,7 @@ do -- DETECTION_BASE
|
|||||||
return self
|
return self
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Method to make the radar detection less accurate, e.g. for WWII scenarios.
|
|
||||||
-- @param #DETECTION_BASE self
|
|
||||||
-- @param #number minheight Minimum flight height to be detected, in meters AGL (above ground)
|
|
||||||
-- @param #number thresheight Threshold to escape the radar if flying below minheight, defaults to 90 (90% escape chance)
|
|
||||||
-- @param #number thresblur Threshold to be detected by the radar overall, defaults to 85 (85% chance to be found)
|
|
||||||
-- @param #number closing Closing-in in km - the limit of km from which on it becomes increasingly difficult to escape radar detection if flying towards the radar position. Should be about 1/3 of the radar detection radius in kilometers, defaults to 20.
|
|
||||||
-- @return #DETECTION_BASE self
|
|
||||||
function DETECTION_BASE:SetRadarBlur(minheight,thresheight,thresblur,closing)
|
|
||||||
self.RadarBlur = true
|
|
||||||
self.RadarBlurMinHeight = minheight or 250 -- meters
|
|
||||||
self.RadarBlurThresHeight = thresheight or 90 -- 10% chance to find a low flying group
|
|
||||||
self.RadarBlurThresBlur = thresblur or 85 -- 25% chance to escape the radar overall
|
|
||||||
self.RadarBlurClosing = closing or 20 -- 20km
|
|
||||||
self.RadarBlurClosingSquare = self.RadarBlurClosing * self.RadarBlurClosing
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
do
|
do
|
||||||
@@ -1408,7 +1354,7 @@ do -- DETECTION_BASE
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- @param DCS#Unit FoundDCSUnit
|
--- @param DCS#Unit FoundDCSUnit
|
||||||
-- @param Wrapper.Group#GROUP ReportGroup
|
-- @param Wrapper.Group#GROUP ReportGroup
|
||||||
-- @param Core.Set#SET_GROUP ReportSetGroup
|
-- @param Core.Set#SET_GROUP ReportSetGroup
|
||||||
local FindNearByFriendlies = function( FoundDCSUnit, ReportGroupData )
|
local FindNearByFriendlies = function( FoundDCSUnit, ReportGroupData )
|
||||||
@@ -1473,7 +1419,7 @@ do -- DETECTION_BASE
|
|||||||
DetectedItem.PlayersNearBy = nil
|
DetectedItem.PlayersNearBy = nil
|
||||||
|
|
||||||
_DATABASE:ForEachPlayer(
|
_DATABASE:ForEachPlayer(
|
||||||
-- @param Wrapper.Unit#UNIT PlayerUnit
|
--- @param Wrapper.Unit#UNIT PlayerUnit
|
||||||
function( PlayerUnitName )
|
function( PlayerUnitName )
|
||||||
local PlayerUnit = UNIT:FindByName( PlayerUnitName )
|
local PlayerUnit = UNIT:FindByName( PlayerUnitName )
|
||||||
|
|
||||||
@@ -2029,9 +1975,8 @@ do -- DETECTION_BASE
|
|||||||
end
|
end
|
||||||
|
|
||||||
do -- DETECTION_UNITS
|
do -- DETECTION_UNITS
|
||||||
|
|
||||||
---
|
--- @type DETECTION_UNITS
|
||||||
-- @type DETECTION_UNITS
|
|
||||||
-- @field DCS#Distance DetectionRange The range till which targets are detected.
|
-- @field DCS#Distance DetectionRange The range till which targets are detected.
|
||||||
-- @extends Functional.Detection#DETECTION_BASE
|
-- @extends Functional.Detection#DETECTION_BASE
|
||||||
|
|
||||||
@@ -2286,9 +2231,8 @@ do -- DETECTION_UNITS
|
|||||||
end
|
end
|
||||||
|
|
||||||
do -- DETECTION_TYPES
|
do -- DETECTION_TYPES
|
||||||
|
|
||||||
---
|
--- @type DETECTION_TYPES
|
||||||
-- @type DETECTION_TYPES
|
|
||||||
-- @extends Functional.Detection#DETECTION_BASE
|
-- @extends Functional.Detection#DETECTION_BASE
|
||||||
|
|
||||||
--- Will detect units within the battle zone.
|
--- Will detect units within the battle zone.
|
||||||
@@ -2490,9 +2434,8 @@ do -- DETECTION_TYPES
|
|||||||
end
|
end
|
||||||
|
|
||||||
do -- DETECTION_AREAS
|
do -- DETECTION_AREAS
|
||||||
|
|
||||||
---
|
--- @type DETECTION_AREAS
|
||||||
-- @type DETECTION_AREAS
|
|
||||||
-- @field DCS#Distance DetectionZoneRange The range till which targets are grouped upon the first detected target.
|
-- @field DCS#Distance DetectionZoneRange The range till which targets are grouped upon the first detected target.
|
||||||
-- @field #DETECTION_BASE.DetectedItems DetectedItems A list of areas containing the set of @{Wrapper.Unit}s, @{Core.Zone}s, the center @{Wrapper.Unit} within the zone, and ID of each area that was detected within a DetectionZoneRange.
|
-- @field #DETECTION_BASE.DetectedItems DetectedItems A list of areas containing the set of @{Wrapper.Unit}s, @{Core.Zone}s, the center @{Wrapper.Unit} within the zone, and ID of each area that was detected within a DetectionZoneRange.
|
||||||
-- @extends Functional.Detection#DETECTION_BASE
|
-- @extends Functional.Detection#DETECTION_BASE
|
||||||
@@ -3018,7 +2961,7 @@ do -- DETECTION_AREAS
|
|||||||
|
|
||||||
-- DetectedSet:Flush( self )
|
-- DetectedSet:Flush( self )
|
||||||
|
|
||||||
DetectedSet:ForEachUnit( -- @param Wrapper.Unit#UNIT DetectedUnit
|
DetectedSet:ForEachUnit( --- @param Wrapper.Unit#UNIT DetectedUnit
|
||||||
function( DetectedUnit )
|
function( DetectedUnit )
|
||||||
if DetectedUnit:IsAlive() then
|
if DetectedUnit:IsAlive() then
|
||||||
-- self:T( "Detected Set #" .. DetectedItem.ID .. ":" .. DetectedUnit:GetName() )
|
-- self:T( "Detected Set #" .. DetectedItem.ID .. ":" .. DetectedUnit:GetName() )
|
||||||
|
|||||||
@@ -16,13 +16,11 @@
|
|||||||
-- * Escort tactical situation reporting.
|
-- * Escort tactical situation reporting.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ## Additional Material:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- * **Demo Missions:** [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Escort)
|
-- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/ESC%20-%20Escorting)
|
||||||
-- * **YouTube videos:** None
|
--
|
||||||
-- * **Guides:** None
|
|
||||||
--
|
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- Allows you to interact with escorting AI on your flight and take the lead.
|
-- Allows you to interact with escorting AI on your flight and take the lead.
|
||||||
@@ -1154,6 +1152,8 @@ function ESCORT:_ReportTargetsScheduler()
|
|||||||
|
|
||||||
if self.EscortGroup:IsAlive() and self.EscortClient:IsAlive() then
|
if self.EscortGroup:IsAlive() and self.EscortClient:IsAlive() then
|
||||||
|
|
||||||
|
if true then
|
||||||
|
|
||||||
local EscortGroupName = self.EscortGroup:GetName()
|
local EscortGroupName = self.EscortGroup:GetName()
|
||||||
|
|
||||||
self.EscortMenuAttackNearbyTargets:RemoveSubMenus()
|
self.EscortMenuAttackNearbyTargets:RemoveSubMenus()
|
||||||
@@ -1224,6 +1224,177 @@ function ESCORT:_ReportTargetsScheduler()
|
|||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
else
|
||||||
|
-- local EscortGroupName = self.EscortGroup:GetName()
|
||||||
|
-- local EscortTargets = self.EscortGroup:GetDetectedTargets()
|
||||||
|
--
|
||||||
|
-- local ClientEscortTargets = self.EscortClient._EscortGroups[EscortGroupName].Targets
|
||||||
|
--
|
||||||
|
-- local EscortTargetMessages = ""
|
||||||
|
-- for EscortTargetID, EscortTarget in pairs( EscortTargets ) do
|
||||||
|
-- local EscortObject = EscortTarget.object
|
||||||
|
-- self:T( EscortObject )
|
||||||
|
-- if EscortObject and EscortObject:isExist() and EscortObject.id_ < 50000000 then
|
||||||
|
--
|
||||||
|
-- local EscortTargetUnit = UNIT:Find( EscortObject )
|
||||||
|
-- local EscortTargetUnitName = EscortTargetUnit:GetName()
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- -- local EscortTargetIsDetected,
|
||||||
|
-- -- EscortTargetIsVisible,
|
||||||
|
-- -- EscortTargetLastTime,
|
||||||
|
-- -- EscortTargetKnowType,
|
||||||
|
-- -- EscortTargetKnowDistance,
|
||||||
|
-- -- EscortTargetLastPos,
|
||||||
|
-- -- EscortTargetLastVelocity
|
||||||
|
-- -- = self.EscortGroup:IsTargetDetected( EscortObject )
|
||||||
|
-- --
|
||||||
|
-- -- self:T( { EscortTargetIsDetected,
|
||||||
|
-- -- EscortTargetIsVisible,
|
||||||
|
-- -- EscortTargetLastTime,
|
||||||
|
-- -- EscortTargetKnowType,
|
||||||
|
-- -- EscortTargetKnowDistance,
|
||||||
|
-- -- EscortTargetLastPos,
|
||||||
|
-- -- EscortTargetLastVelocity } )
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- local EscortTargetUnitVec3 = EscortTargetUnit:GetVec3()
|
||||||
|
-- local EscortVec3 = self.EscortGroup:GetVec3()
|
||||||
|
-- local Distance = ( ( EscortTargetUnitVec3.x - EscortVec3.x )^2 +
|
||||||
|
-- ( EscortTargetUnitVec3.y - EscortVec3.y )^2 +
|
||||||
|
-- ( EscortTargetUnitVec3.z - EscortVec3.z )^2
|
||||||
|
-- ) ^ 0.5 / 1000
|
||||||
|
--
|
||||||
|
-- self:T( { self.EscortGroup:GetName(), EscortTargetUnit:GetName(), Distance, EscortTarget } )
|
||||||
|
--
|
||||||
|
-- if Distance <= 15 then
|
||||||
|
--
|
||||||
|
-- if not ClientEscortTargets[EscortTargetUnitName] then
|
||||||
|
-- ClientEscortTargets[EscortTargetUnitName] = {}
|
||||||
|
-- end
|
||||||
|
-- ClientEscortTargets[EscortTargetUnitName].AttackUnit = EscortTargetUnit
|
||||||
|
-- ClientEscortTargets[EscortTargetUnitName].visible = EscortTarget.visible
|
||||||
|
-- ClientEscortTargets[EscortTargetUnitName].type = EscortTarget.type
|
||||||
|
-- ClientEscortTargets[EscortTargetUnitName].distance = EscortTarget.distance
|
||||||
|
-- else
|
||||||
|
-- if ClientEscortTargets[EscortTargetUnitName] then
|
||||||
|
-- ClientEscortTargets[EscortTargetUnitName] = nil
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- self:T( { "Sorting Targets Table:", ClientEscortTargets } )
|
||||||
|
-- table.sort( ClientEscortTargets, function( a, b ) return a.Distance < b.Distance end )
|
||||||
|
-- self:T( { "Sorted Targets Table:", ClientEscortTargets } )
|
||||||
|
--
|
||||||
|
-- -- Remove the sub menus of the Attack menu of the Escort for the EscortGroup.
|
||||||
|
-- self.EscortMenuAttackNearbyTargets:RemoveSubMenus()
|
||||||
|
--
|
||||||
|
-- if self.EscortMenuTargetAssistance then
|
||||||
|
-- self.EscortMenuTargetAssistance:RemoveSubMenus()
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- --for MenuIndex = 1, #self.EscortMenuAttackTargets do
|
||||||
|
-- -- self:T( { "Remove Menu:", self.EscortMenuAttackTargets[MenuIndex] } )
|
||||||
|
-- -- self.EscortMenuAttackTargets[MenuIndex] = self.EscortMenuAttackTargets[MenuIndex]:Remove()
|
||||||
|
-- --end
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- if ClientEscortTargets then
|
||||||
|
-- for ClientEscortTargetUnitName, ClientEscortTargetData in pairs( ClientEscortTargets ) do
|
||||||
|
--
|
||||||
|
-- for ClientEscortGroupName, EscortGroupData in pairs( self.EscortClient._EscortGroups ) do
|
||||||
|
--
|
||||||
|
-- if ClientEscortTargetData and ClientEscortTargetData.AttackUnit:IsAlive() then
|
||||||
|
--
|
||||||
|
-- local EscortTargetMessage = ""
|
||||||
|
-- local EscortTargetCategoryName = ClientEscortTargetData.AttackUnit:GetCategoryName()
|
||||||
|
-- local EscortTargetCategoryType = ClientEscortTargetData.AttackUnit:GetTypeName()
|
||||||
|
-- if ClientEscortTargetData.type then
|
||||||
|
-- EscortTargetMessage = EscortTargetMessage .. EscortTargetCategoryName .. " (" .. EscortTargetCategoryType .. ") at "
|
||||||
|
-- else
|
||||||
|
-- EscortTargetMessage = EscortTargetMessage .. "Unknown target at "
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- local EscortTargetUnitVec3 = ClientEscortTargetData.AttackUnit:GetVec3()
|
||||||
|
-- local EscortVec3 = self.EscortGroup:GetVec3()
|
||||||
|
-- local Distance = ( ( EscortTargetUnitVec3.x - EscortVec3.x )^2 +
|
||||||
|
-- ( EscortTargetUnitVec3.y - EscortVec3.y )^2 +
|
||||||
|
-- ( EscortTargetUnitVec3.z - EscortVec3.z )^2
|
||||||
|
-- ) ^ 0.5 / 1000
|
||||||
|
--
|
||||||
|
-- self:T( { self.EscortGroup:GetName(), ClientEscortTargetData.AttackUnit:GetName(), Distance, ClientEscortTargetData.AttackUnit } )
|
||||||
|
-- if ClientEscortTargetData.visible == false then
|
||||||
|
-- EscortTargetMessage = EscortTargetMessage .. string.format( "%.2f", Distance ) .. " estimated km"
|
||||||
|
-- else
|
||||||
|
-- EscortTargetMessage = EscortTargetMessage .. string.format( "%.2f", Distance ) .. " km"
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- if ClientEscortTargetData.visible then
|
||||||
|
-- EscortTargetMessage = EscortTargetMessage .. ", visual"
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- if ClientEscortGroupName == EscortGroupName then
|
||||||
|
--
|
||||||
|
-- MENU_GROUP_COMMAND:New( self.EscortClient,
|
||||||
|
-- EscortTargetMessage,
|
||||||
|
-- self.EscortMenuAttackNearbyTargets,
|
||||||
|
-- ESCORT._AttackTarget,
|
||||||
|
-- { ParamSelf = self,
|
||||||
|
-- ParamUnit = ClientEscortTargetData.AttackUnit
|
||||||
|
-- }
|
||||||
|
-- )
|
||||||
|
-- EscortTargetMessages = EscortTargetMessages .. "\n - " .. EscortTargetMessage
|
||||||
|
-- else
|
||||||
|
-- if self.EscortMenuTargetAssistance then
|
||||||
|
-- local MenuTargetAssistance = MENU_GROUP:New( self.EscortClient, EscortGroupData.EscortName, self.EscortMenuTargetAssistance )
|
||||||
|
-- MENU_GROUP_COMMAND:New( self.EscortClient,
|
||||||
|
-- EscortTargetMessage,
|
||||||
|
-- MenuTargetAssistance,
|
||||||
|
-- ESCORT._AssistTarget,
|
||||||
|
-- self,
|
||||||
|
-- EscortGroupData.EscortGroup,
|
||||||
|
-- ClientEscortTargetData.AttackUnit
|
||||||
|
-- )
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
-- else
|
||||||
|
-- ClientEscortTargetData = nil
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- if EscortTargetMessages ~= "" and self.ReportTargets == true then
|
||||||
|
-- self.EscortGroup:MessageToClient( "Detected targets within 15 km range:" .. EscortTargetMessages:gsub("\n$",""), 20, self.EscortClient )
|
||||||
|
-- else
|
||||||
|
-- self.EscortGroup:MessageToClient( "No targets detected!", 20, self.EscortClient )
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- if self.EscortMenuResumeMission then
|
||||||
|
-- self.EscortMenuResumeMission:RemoveSubMenus()
|
||||||
|
--
|
||||||
|
-- -- if self.EscortMenuResumeWayPoints then
|
||||||
|
-- -- for MenuIndex = 1, #self.EscortMenuResumeWayPoints do
|
||||||
|
-- -- self:T( { "Remove Menu:", self.EscortMenuResumeWayPoints[MenuIndex] } )
|
||||||
|
-- -- self.EscortMenuResumeWayPoints[MenuIndex] = self.EscortMenuResumeWayPoints[MenuIndex]:Remove()
|
||||||
|
-- -- end
|
||||||
|
-- -- end
|
||||||
|
--
|
||||||
|
-- local TaskPoints = self:RegisterRoute()
|
||||||
|
-- for WayPointID, WayPoint in pairs( TaskPoints ) do
|
||||||
|
-- local EscortVec3 = self.EscortGroup:GetVec3()
|
||||||
|
-- local Distance = ( ( WayPoint.x - EscortVec3.x )^2 +
|
||||||
|
-- ( WayPoint.y - EscortVec3.z )^2
|
||||||
|
-- ) ^ 0.5 / 1000
|
||||||
|
-- MENU_GROUP_COMMAND:New( self.EscortClient, "Waypoint " .. WayPointID .. " at " .. string.format( "%.2f", Distance ).. "km", self.EscortMenuResumeMission, ESCORT._ResumeMission, { ParamSelf = self, ParamWayPoint = WayPointID } )
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- return true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [MIT - Missile Trainer](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/MissileTrainer)
|
-- [MIT - Missile Trainer](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/MIT%20-%20Missile%20Trainer)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -53,8 +53,6 @@
|
|||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE.
|
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE.
|
||||||
-- Therefore, this class is considered to be deprecated and superseded by the [Functional.Fox](https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Functional.Fox.html) class, which provides the same functionality.
|
-- Therefore, this class is considered to be deprecated and superseded by the [Functional.Fox](https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Functional.Fox.html) class, which provides the same functionality.
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -33,11 +33,16 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ## Additional Material:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- * **Demo Missions:** [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/RAT)
|
-- ### [RAT - Random Air Traffic](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/RAT%20-%20Random%20Air%20Traffic)
|
||||||
-- * **YouTube videos:** [Random Air Traffic](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl0u4Zxywtg-mx_ov4vi68CO)
|
--
|
||||||
-- * **Guides:** None
|
-- ===
|
||||||
|
--
|
||||||
|
-- # YouTube Channel
|
||||||
|
--
|
||||||
|
-- ### [MOOSE YouTube Channel](https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg)
|
||||||
|
-- ### [MOOSE - RAT - Random Air Traffic](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl0u4Zxywtg-mx_ov4vi68CO)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -165,7 +170,7 @@
|
|||||||
--
|
--
|
||||||
-- * A specific departure and/or destination airport can be chosen.
|
-- * A specific departure and/or destination airport can be chosen.
|
||||||
-- * Valid coalitions can be set, e.g. only red, blue or neutral, all three "colours".
|
-- * Valid coalitions can be set, e.g. only red, blue or neutral, all three "colours".
|
||||||
-- * It is possible to start in air within a zone or within a zone above an airport of the map.
|
-- * It is possible to start in air within a zone defined in the mission editor or within a zone above an airport of the map.
|
||||||
--
|
--
|
||||||
-- ## Flight Plan
|
-- ## Flight Plan
|
||||||
--
|
--
|
||||||
@@ -1174,13 +1179,13 @@ function RAT:SetTakeoffAir()
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set possible departure ports. This can be an airport or a zone.
|
--- Set possible departure ports. This can be an airport or a zone defined in the mission editor.
|
||||||
-- @param #RAT self
|
-- @param #RAT self
|
||||||
-- @param #string departurenames Name or table of names of departure airports or zones.
|
-- @param #string departurenames Name or table of names of departure airports or zones.
|
||||||
-- @return #RAT RAT self object.
|
-- @return #RAT RAT self object.
|
||||||
-- @usage RAT:SetDeparture("Sochi-Adler") will spawn RAT objects at Sochi-Adler airport.
|
-- @usage RAT:SetDeparture("Sochi-Adler") will spawn RAT objects at Sochi-Adler airport.
|
||||||
-- @usage RAT:SetDeparture({"Sochi-Adler", "Gudauta"}) will spawn RAT aircraft radomly at Sochi-Adler or Gudauta airport.
|
-- @usage RAT:SetDeparture({"Sochi-Adler", "Gudauta"}) will spawn RAT aircraft radomly at Sochi-Adler or Gudauta airport.
|
||||||
-- @usage RAT:SetDeparture({"Zone A", "Gudauta"}) will spawn RAT aircraft in air randomly within Zone A, or within a zone around Gudauta airport. Note that this also requires RAT:takeoff("air") to be set.
|
-- @usage RAT:SetDeparture({"Zone A", "Gudauta"}) will spawn RAT aircraft in air randomly within Zone A, which has to be defined in the mission editor, or within a zone around Gudauta airport. Note that this also requires RAT:takeoff("air") to be set.
|
||||||
function RAT:SetDeparture(departurenames)
|
function RAT:SetDeparture(departurenames)
|
||||||
self:F2(departurenames)
|
self:F2(departurenames)
|
||||||
|
|
||||||
@@ -2052,10 +2057,6 @@ function RAT:_InitAircraft(DCSgroup)
|
|||||||
self.aircraft.length=16
|
self.aircraft.length=16
|
||||||
self.aircraft.height=5
|
self.aircraft.height=5
|
||||||
self.aircraft.width=9
|
self.aircraft.width=9
|
||||||
elseif DCStype == "Saab340" then -- <- These lines added
|
|
||||||
self.aircraft.length=19.73 -- <- These lines added
|
|
||||||
self.aircraft.height=6.97 -- <- These lines added
|
|
||||||
self.aircraft.width=21.44 -- <- These lines added
|
|
||||||
end
|
end
|
||||||
self.aircraft.box=math.max(self.aircraft.length,self.aircraft.width)
|
self.aircraft.box=math.max(self.aircraft.length,self.aircraft.width)
|
||||||
|
|
||||||
@@ -2536,7 +2537,7 @@ function RAT:_SetRoute(takeoff, landing, _departure, _destination, _waypoint)
|
|||||||
end
|
end
|
||||||
elseif self:_ZoneExists(_departure) then
|
elseif self:_ZoneExists(_departure) then
|
||||||
-- If it's not an airport, check whether it's a zone.
|
-- If it's not an airport, check whether it's a zone.
|
||||||
departure=ZONE:FindByName(_departure)
|
departure=ZONE:New(_departure)
|
||||||
else
|
else
|
||||||
local text=string.format("ERROR! Specified departure airport %s does not exist for %s.", _departure, self.alias)
|
local text=string.format("ERROR! Specified departure airport %s does not exist for %s.", _departure, self.alias)
|
||||||
self:E(RAT.id..text)
|
self:E(RAT.id..text)
|
||||||
@@ -2634,7 +2635,7 @@ function RAT:_SetRoute(takeoff, landing, _departure, _destination, _waypoint)
|
|||||||
end
|
end
|
||||||
|
|
||||||
elseif self:_ZoneExists(_destination) then
|
elseif self:_ZoneExists(_destination) then
|
||||||
destination=ZONE:FindByName(_destination)
|
destination=ZONE:New(_destination)
|
||||||
else
|
else
|
||||||
local text=string.format("ERROR: Specified destination airport/zone %s does not exist for %s!", _destination, self.alias)
|
local text=string.format("ERROR: Specified destination airport/zone %s does not exist for %s!", _destination, self.alias)
|
||||||
self:E(RAT.id.."ERROR: "..text)
|
self:E(RAT.id.."ERROR: "..text)
|
||||||
@@ -3141,7 +3142,7 @@ function RAT:_PickDeparture(takeoff)
|
|||||||
end
|
end
|
||||||
elseif self:_ZoneExists(name) then
|
elseif self:_ZoneExists(name) then
|
||||||
if takeoff==RAT.wp.air then
|
if takeoff==RAT.wp.air then
|
||||||
dep=ZONE:FindByName(name)
|
dep=ZONE:New(name)
|
||||||
else
|
else
|
||||||
self:E(RAT.id..string.format("ERROR! Takeoff is not in air. Cannot use %s as departure.", name))
|
self:E(RAT.id..string.format("ERROR! Takeoff is not in air. Cannot use %s as departure.", name))
|
||||||
end
|
end
|
||||||
@@ -3253,7 +3254,7 @@ function RAT:_PickDestination(departure, q, minrange, maxrange, random, landing)
|
|||||||
end
|
end
|
||||||
elseif self:_ZoneExists(name) then
|
elseif self:_ZoneExists(name) then
|
||||||
if landing==RAT.wp.air then
|
if landing==RAT.wp.air then
|
||||||
dest=ZONE:FindByName(name)
|
dest=ZONE:New(name)
|
||||||
else
|
else
|
||||||
self:E(RAT.id..string.format("ERROR! Landing is not in air. Cannot use zone %s as destination!", name))
|
self:E(RAT.id..string.format("ERROR! Landing is not in air. Cannot use zone %s as destination!", name))
|
||||||
end
|
end
|
||||||
@@ -4929,12 +4930,12 @@ function RAT:_AirportExists(name)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Test if a zone exists.
|
--- Test if a trigger zone defined in the mission editor exists.
|
||||||
-- @param #RAT self
|
-- @param #RAT self
|
||||||
-- @param #string name
|
-- @param #string name
|
||||||
-- @return #boolean True if zone exsits, false otherwise.
|
-- @return #boolean True if zone exsits, false otherwise.
|
||||||
function RAT:_ZoneExists(name)
|
function RAT:_ZoneExists(name)
|
||||||
local z=ZONE:FindByName(name) --trigger.misc.getZone(name) as suggested by @Viking on MOOSE discord #rat
|
local z=trigger.misc.getZone(name)
|
||||||
if z then
|
if z then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -19,7 +19,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [SCO - Scoring](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Scoring)
|
-- [SCO - Scoring](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SCO%20-%20Scoring)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -78,8 +78,7 @@
|
|||||||
-- ### Authors: **FlightControl**
|
-- ### Authors: **FlightControl**
|
||||||
--
|
--
|
||||||
-- ### Contributions:
|
-- ### Contributions:
|
||||||
--
|
--
|
||||||
-- * **Applevangelist**: Additional functionality, fixes.
|
|
||||||
-- * **Wingthor (TAW)**: Testing & Advice.
|
-- * **Wingthor (TAW)**: Testing & Advice.
|
||||||
-- * **Dutch-Baron (TAW)**: Testing & Advice.
|
-- * **Dutch-Baron (TAW)**: Testing & Advice.
|
||||||
-- * **Whisper**: Testing and Advice.
|
-- * **Whisper**: Testing and Advice.
|
||||||
@@ -117,13 +116,11 @@
|
|||||||
-- Special targets can be set that will give extra scores to the players when these are destroyed.
|
-- Special targets can be set that will give extra scores to the players when these are destroyed.
|
||||||
-- Use the methods @{#SCORING.AddUnitScore}() and @{#SCORING.RemoveUnitScore}() to specify a special additional score for a specific @{Wrapper.Unit}s.
|
-- Use the methods @{#SCORING.AddUnitScore}() and @{#SCORING.RemoveUnitScore}() to specify a special additional score for a specific @{Wrapper.Unit}s.
|
||||||
-- Use the methods @{#SCORING.AddStaticScore}() and @{#SCORING.RemoveStaticScore}() to specify a special additional score for a specific @{Wrapper.Static}s.
|
-- Use the methods @{#SCORING.AddStaticScore}() and @{#SCORING.RemoveStaticScore}() to specify a special additional score for a specific @{Wrapper.Static}s.
|
||||||
-- Use the method @{#SCORING.AddScoreSetGroup}() to specify a special additional score for a specific @{Wrapper.Group}s gathered in a @{Core.Set#SET_GROUP}.
|
-- Use the method @{#SCORING.SetGroupGroup}() to specify a special additional score for a specific @{Wrapper.Group}s.
|
||||||
--
|
--
|
||||||
-- local Scoring = SCORING:New( "Scoring File" )
|
-- local Scoring = SCORING:New( "Scoring File" )
|
||||||
-- Scoring:AddUnitScore( UNIT:FindByName( "Unit #001" ), 200 )
|
-- Scoring:AddUnitScore( UNIT:FindByName( "Unit #001" ), 200 )
|
||||||
-- Scoring:AddStaticScore( STATIC:FindByName( "Static #1" ), 100 )
|
-- 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.
|
-- 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.
|
-- Note that later in the mission, one can remove these scores set, for example, when the a goal achievement time limit is over.
|
||||||
@@ -229,7 +226,7 @@ SCORING = {
|
|||||||
ClassID = 0,
|
ClassID = 0,
|
||||||
Players = {},
|
Players = {},
|
||||||
AutoSave = true,
|
AutoSave = true,
|
||||||
version = "1.18.4"
|
version = "1.17.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
local _SCORINGCoalition = {
|
local _SCORINGCoalition = {
|
||||||
@@ -248,15 +245,13 @@ local _SCORINGCategory = {
|
|||||||
--- Creates a new SCORING object to administer the scoring achieved by players.
|
--- Creates a new SCORING object to administer the scoring achieved by players.
|
||||||
-- @param #SCORING self
|
-- @param #SCORING self
|
||||||
-- @param #string GameName The name of the game. This name is also logged in the CSV score file.
|
-- @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
|
-- @return #SCORING self
|
||||||
-- @usage
|
-- @usage
|
||||||
--
|
--
|
||||||
-- -- Define a new scoring object for the mission Gori Valley.
|
-- -- Define a new scoring object for the mission Gori Valley.
|
||||||
-- ScoringObject = SCORING:New( "Gori Valley" )
|
-- ScoringObject = SCORING:New( "Gori Valley" )
|
||||||
--
|
--
|
||||||
function SCORING:New( GameName, SavePath, AutoSave )
|
function SCORING:New( GameName )
|
||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, BASE:New() ) -- #SCORING
|
local self = BASE:Inherit( self, BASE:New() ) -- #SCORING
|
||||||
@@ -281,15 +276,9 @@ function SCORING:New( GameName, SavePath, AutoSave )
|
|||||||
self:SetMessagesZone( true )
|
self:SetMessagesZone( true )
|
||||||
|
|
||||||
-- Scales
|
-- Scales
|
||||||
|
|
||||||
self:SetScaleDestroyScore( 10 )
|
self:SetScaleDestroyScore( 10 )
|
||||||
self:SetScaleDestroyPenalty( 30 )
|
self:SetScaleDestroyPenalty( 30 )
|
||||||
|
|
||||||
-- Hitting a target multiple times before destoying it should not result in a higger score
|
|
||||||
-- Multiple hits is typically a results of bombs/missles missing their target but still inflict some spash damage
|
|
||||||
-- Making this configurable to anyone can enable this anyway if they want
|
|
||||||
self:SetScoreIncrementOnHit(0)
|
|
||||||
|
|
||||||
-- Default fratricide penalty level (maximum penalty that can be assigned to a player before he gets kicked).
|
-- Default fratricide penalty level (maximum penalty that can be assigned to a player before he gets kicked).
|
||||||
self:SetFratricide( self.ScaleDestroyPenalty * 3 )
|
self:SetFratricide( self.ScaleDestroyPenalty * 3 )
|
||||||
self.penaltyonfratricide = true
|
self.penaltyonfratricide = true
|
||||||
@@ -319,8 +308,7 @@ function SCORING:New( GameName, SavePath, AutoSave )
|
|||||||
end )
|
end )
|
||||||
|
|
||||||
-- Create the CSV file.
|
-- Create the CSV file.
|
||||||
self.AutoSavePath = SavePath
|
self.AutoSave = true
|
||||||
self.AutoSave = AutoSave or true
|
|
||||||
self:OpenCSV( GameName )
|
self:OpenCSV( GameName )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -434,31 +422,6 @@ function SCORING:AddScoreGroup( ScoreGroup, Score )
|
|||||||
return self
|
return self
|
||||||
end
|
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.
|
--- 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!
|
-- Note that if a @{Core.Zone} with the same name is already within the scoring added, the @{Core.Zone} (type) and Score will be replaced!
|
||||||
-- This allows for a dynamic destruction zone evolution within your mission.
|
-- This allows for a dynamic destruction zone evolution within your mission.
|
||||||
@@ -504,16 +467,6 @@ function SCORING:SetMessagesHit( OnOff )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Configure to increment score after a target has been hit.
|
|
||||||
-- @param #SCORING self
|
|
||||||
-- @param #number score amount of point to inclement score on each hit
|
|
||||||
-- @return #SCORING
|
|
||||||
function SCORING:SetScoreIncrementOnHit( score )
|
|
||||||
|
|
||||||
self.ScoreIncrementOnHit = score
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
|
|
||||||
--- If to send messages after a target has been hit.
|
--- If to send messages after a target has been hit.
|
||||||
-- @param #SCORING self
|
-- @param #SCORING self
|
||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
@@ -932,7 +885,6 @@ function SCORING:OnEventBirth( Event )
|
|||||||
Event.IniUnit.BirthTime = timer.getTime()
|
Event.IniUnit.BirthTime = timer.getTime()
|
||||||
if PlayerName then
|
if PlayerName then
|
||||||
self:_AddPlayerFromUnit( Event.IniUnit )
|
self:_AddPlayerFromUnit( Event.IniUnit )
|
||||||
self.Players[PlayerName].PlayerKills = 0
|
|
||||||
self:SetScoringMenu( Event.IniGroup )
|
self:SetScoringMenu( Event.IniGroup )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -985,7 +937,6 @@ function SCORING:_EventOnHit( Event )
|
|||||||
local TargetUnitCoalition = nil
|
local TargetUnitCoalition = nil
|
||||||
local TargetUnitCategory = nil
|
local TargetUnitCategory = nil
|
||||||
local TargetUnitType = nil
|
local TargetUnitType = nil
|
||||||
local TargetIsScenery = false
|
|
||||||
|
|
||||||
if Event.IniDCSUnit then
|
if Event.IniDCSUnit then
|
||||||
|
|
||||||
@@ -1026,12 +977,6 @@ function SCORING:_EventOnHit( Event )
|
|||||||
TargetCategory = Event.TgtCategory
|
TargetCategory = Event.TgtCategory
|
||||||
TargetType = Event.TgtTypeName
|
TargetType = Event.TgtTypeName
|
||||||
|
|
||||||
-- Scenery hit
|
|
||||||
if (not TargetCategory) and TargetUNIT ~= nil and TargetUnit:IsInstanceOf("SCENERY") then
|
|
||||||
TargetCategory = Unit.Category.STRUCTURE
|
|
||||||
TargetIsScenery = true
|
|
||||||
end
|
|
||||||
|
|
||||||
TargetUnitCoalition = _SCORINGCoalition[TargetCoalition]
|
TargetUnitCoalition = _SCORINGCoalition[TargetCoalition]
|
||||||
TargetUnitCategory = _SCORINGCategory[TargetCategory]
|
TargetUnitCategory = _SCORINGCategory[TargetCategory]
|
||||||
TargetUnitType = TargetType
|
TargetUnitType = TargetType
|
||||||
@@ -1068,11 +1013,11 @@ function SCORING:_EventOnHit( Event )
|
|||||||
PlayerHit.PenaltyHit = PlayerHit.PenaltyHit or 0
|
PlayerHit.PenaltyHit = PlayerHit.PenaltyHit or 0
|
||||||
PlayerHit.TimeStamp = PlayerHit.TimeStamp or 0
|
PlayerHit.TimeStamp = PlayerHit.TimeStamp or 0
|
||||||
PlayerHit.UNIT = PlayerHit.UNIT or TargetUNIT
|
PlayerHit.UNIT = PlayerHit.UNIT or TargetUNIT
|
||||||
-- After an instant kill we can't compute the threat level anymore. To fix this we compute at OnEventBirth
|
-- After an instant kill we can't compute the thread level anymore. To fix this we compute at OnEventBirth
|
||||||
if PlayerHit.UNIT.ThreatType == nil then
|
if PlayerHit.UNIT.ThreatType == nil then
|
||||||
PlayerHit.ThreatLevel, PlayerHit.ThreatType = PlayerHit.UNIT:GetThreatLevel()
|
PlayerHit.ThreatLevel, PlayerHit.ThreatType = PlayerHit.UNIT:GetThreatLevel()
|
||||||
-- if this fails for some reason, set a good default value
|
-- if this fails for some reason, set a good default value
|
||||||
if PlayerHit.ThreatType == nil or PlayerHit.ThreatType == "" then
|
if PlayerHit.ThreatType == nil then
|
||||||
PlayerHit.ThreatLevel = 1
|
PlayerHit.ThreatLevel = 1
|
||||||
PlayerHit.ThreatType = "Unknown"
|
PlayerHit.ThreatType = "Unknown"
|
||||||
end
|
end
|
||||||
@@ -1080,7 +1025,7 @@ function SCORING:_EventOnHit( Event )
|
|||||||
PlayerHit.ThreatLevel = PlayerHit.UNIT.ThreatLevel
|
PlayerHit.ThreatLevel = PlayerHit.UNIT.ThreatLevel
|
||||||
PlayerHit.ThreatType = PlayerHit.UNIT.ThreatType
|
PlayerHit.ThreatType = PlayerHit.UNIT.ThreatType
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Only grant hit scores if there was more than one second between the last hit.
|
-- Only grant hit scores if there was more than one second between the last hit.
|
||||||
if timer.getTime() - PlayerHit.TimeStamp > 1 then
|
if timer.getTime() - PlayerHit.TimeStamp > 1 then
|
||||||
PlayerHit.TimeStamp = timer.getTime()
|
PlayerHit.TimeStamp = timer.getTime()
|
||||||
@@ -1115,8 +1060,10 @@ function SCORING:_EventOnHit( Event )
|
|||||||
end
|
end
|
||||||
self:ScoreCSV( InitPlayerName, TargetPlayerName, "HIT_PENALTY", 1, -10, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
self:ScoreCSV( InitPlayerName, TargetPlayerName, "HIT_PENALTY", 1, -10, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
||||||
else
|
else
|
||||||
Player.Score = Player.Score + self.ScoreIncrementOnHit
|
-- Hitting a target multiple times before destoying it should not result in a higger score
|
||||||
PlayerHit.Score = PlayerHit.Score + self.ScoreIncrementOnHit
|
-- Multiple hits is typically a results of bombs/missles missing their target but still inflict some spash damage
|
||||||
|
-- Player.Score = Player.Score + 1
|
||||||
|
-- PlayerHit.Score = PlayerHit.Score + 1
|
||||||
PlayerHit.ScoreHit = PlayerHit.ScoreHit + 1
|
PlayerHit.ScoreHit = PlayerHit.ScoreHit + 1
|
||||||
if TargetPlayerName ~= nil then -- It is a player hitting another player ...
|
if TargetPlayerName ~= nil then -- It is a player hitting another player ...
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit enemy player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.ScoreHit .. " times. " ..
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit enemy player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.ScoreHit .. " times. " ..
|
||||||
@@ -1124,22 +1071,17 @@ function SCORING:_EventOnHit( Event )
|
|||||||
MESSAGE.Type.Update )
|
MESSAGE.Type.Update )
|
||||||
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
||||||
elseif TargetIsScenery ~= true then
|
else
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit enemy target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.ScoreHit .. " times. " ..
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit enemy target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.ScoreHit .. " times. " ..
|
||||||
"Score: " .. PlayerHit.Score .. ". Score Total:" .. Player.Score - Player.Penalty,
|
"Score: " .. PlayerHit.Score .. ". Score Total:" .. Player.Score - Player.Penalty,
|
||||||
MESSAGE.Type.Update )
|
MESSAGE.Type.Update )
|
||||||
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
||||||
elseif TargetIsScenery == true then
|
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit scenery object." .. " Score: " .. PlayerHit.Score .. ". Score Total:" .. Player.Score - Player.Penalty,
|
|
||||||
MESSAGE.Type.Update )
|
|
||||||
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
|
||||||
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
|
||||||
end
|
end
|
||||||
self:ScoreCSV( InitPlayerName, TargetPlayerName, "HIT_SCORE", 1, 1, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
self:ScoreCSV( InitPlayerName, TargetPlayerName, "HIT_SCORE", 1, 1, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
||||||
end
|
end
|
||||||
else -- A scenery object was hit.
|
else -- A scenery object was hit.
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit nothing special.",
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit scenery object.",
|
||||||
MESSAGE.Type.Update )
|
MESSAGE.Type.Update )
|
||||||
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
||||||
@@ -1184,9 +1126,9 @@ function SCORING:_EventOnHit( Event )
|
|||||||
PlayerHit.PenaltyHit = PlayerHit.PenaltyHit or 0
|
PlayerHit.PenaltyHit = PlayerHit.PenaltyHit or 0
|
||||||
PlayerHit.TimeStamp = PlayerHit.TimeStamp or 0
|
PlayerHit.TimeStamp = PlayerHit.TimeStamp or 0
|
||||||
PlayerHit.UNIT = PlayerHit.UNIT or TargetUNIT
|
PlayerHit.UNIT = PlayerHit.UNIT or TargetUNIT
|
||||||
-- After an instant kill we can't compute the threat level anymore. To fix this we compute at OnEventBirth
|
-- After an instant kill we can't compute the thread level anymore. To fix this we compute at OnEventBirth
|
||||||
if PlayerHit.UNIT.ThreatType == nil then
|
if PlayerHit.UNIT.ThreatType == nil then
|
||||||
PlayerHit.ThreatLevel, PlayerHit.ThreatType = PlayerHit.UNIT:GetThreatLevel()
|
PlayerHit.ThreatLevel, PlayerHit.ThreatType = PlayerHit.UNIT:GetThreatLevel()
|
||||||
-- if this fails for some reason, set a good default value
|
-- if this fails for some reason, set a good default value
|
||||||
if PlayerHit.ThreatType == nil then
|
if PlayerHit.ThreatType == nil then
|
||||||
PlayerHit.ThreatLevel = 1
|
PlayerHit.ThreatLevel = 1
|
||||||
@@ -1221,8 +1163,10 @@ function SCORING:_EventOnHit( Event )
|
|||||||
:ToCoalitionIf( Event.WeaponCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( Event.WeaponCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
||||||
self:ScoreCSV( Event.WeaponPlayerName, TargetPlayerName, "HIT_PENALTY", 1, -10, Event.WeaponName, Event.WeaponCoalition, Event.WeaponCategory, Event.WeaponTypeName, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
self:ScoreCSV( Event.WeaponPlayerName, TargetPlayerName, "HIT_PENALTY", 1, -10, Event.WeaponName, Event.WeaponCoalition, Event.WeaponCategory, Event.WeaponTypeName, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
||||||
else
|
else
|
||||||
Player.Score = Player.Score + self.ScoreIncrementOnHit
|
-- Hitting a target multiple times before destoying it should not result in a higger score
|
||||||
PlayerHit.Score = PlayerHit.Score + self.ScoreIncrementOnHit
|
-- Multiple hits is typically a results of bombs/missles missing their target but still inflict some spash damage
|
||||||
|
-- Player.Score = Player.Score + 1
|
||||||
|
-- PlayerHit.Score = PlayerHit.Score + 1
|
||||||
PlayerHit.ScoreHit = PlayerHit.ScoreHit + 1
|
PlayerHit.ScoreHit = PlayerHit.ScoreHit + 1
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. Event.WeaponPlayerName .. "' hit enemy target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " ..
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. Event.WeaponPlayerName .. "' hit enemy target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " ..
|
||||||
"Score: " .. PlayerHit.Score .. ". Score Total:" .. Player.Score - Player.Penalty,
|
"Score: " .. PlayerHit.Score .. ". Score Total:" .. Player.Score - Player.Penalty,
|
||||||
@@ -1330,18 +1274,13 @@ function SCORING:_EventOnDeadOrCrash( Event )
|
|||||||
TargetDestroy.Penalty = TargetDestroy.Penalty + ThreatPenalty
|
TargetDestroy.Penalty = TargetDestroy.Penalty + ThreatPenalty
|
||||||
TargetDestroy.PenaltyDestroy = TargetDestroy.PenaltyDestroy + 1
|
TargetDestroy.PenaltyDestroy = TargetDestroy.PenaltyDestroy + 1
|
||||||
|
|
||||||
|
|
||||||
--self:OnKillPvP(PlayerName, TargetPlayerName, true, TargetThreatLevel, Player.ThreatLevel, ThreatPenalty)
|
|
||||||
|
|
||||||
if Player.HitPlayers[TargetPlayerName] then -- A player destroyed another player
|
if Player.HitPlayers[TargetPlayerName] then -- A player destroyed another player
|
||||||
self:OnKillPvP(PlayerName, TargetPlayerName, true)
|
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed friendly player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed friendly player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
||||||
"Penalty: -" .. ThreatPenalty .. " = " .. Player.Score - Player.Penalty,
|
"Penalty: -" .. ThreatPenalty .. " = " .. Player.Score - Player.Penalty,
|
||||||
MESSAGE.Type.Information )
|
MESSAGE.Type.Information )
|
||||||
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
|
||||||
else
|
else
|
||||||
self:OnKillPvE(PlayerName, TargetUnitName, true, TargetThreatLevel, Player.ThreatLevel, ThreatPenalty)
|
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed friendly target " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed friendly target " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
||||||
"Penalty: -" .. ThreatPenalty .. " = " .. Player.Score - Player.Penalty,
|
"Penalty: -" .. ThreatPenalty .. " = " .. Player.Score - Player.Penalty,
|
||||||
MESSAGE.Type.Information )
|
MESSAGE.Type.Information )
|
||||||
@@ -1364,19 +1303,12 @@ function SCORING:_EventOnDeadOrCrash( Event )
|
|||||||
TargetDestroy.Score = TargetDestroy.Score + ThreatScore
|
TargetDestroy.Score = TargetDestroy.Score + ThreatScore
|
||||||
TargetDestroy.ScoreDestroy = TargetDestroy.ScoreDestroy + 1
|
TargetDestroy.ScoreDestroy = TargetDestroy.ScoreDestroy + 1
|
||||||
if Player.HitPlayers[TargetPlayerName] then -- A player destroyed another player
|
if Player.HitPlayers[TargetPlayerName] then -- A player destroyed another player
|
||||||
if Player.PlayerKills ~= nil then
|
|
||||||
Player.PlayerKills = Player.PlayerKills + 1
|
|
||||||
else
|
|
||||||
Player.PlayerKills = 1
|
|
||||||
end
|
|
||||||
self:OnKillPvP(PlayerName, TargetPlayerName, false, TargetThreatLevel, Player.ThreatLevel, ThreatScore)
|
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed enemy player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed enemy player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
||||||
"Score: +" .. ThreatScore .. " = " .. Player.Score - Player.Penalty,
|
"Score: +" .. ThreatScore .. " = " .. Player.Score - Player.Penalty,
|
||||||
MESSAGE.Type.Information )
|
MESSAGE.Type.Information )
|
||||||
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
|
||||||
else
|
else
|
||||||
self:OnKillPvE(PlayerName, TargetUnitName, false, TargetThreatLevel, Player.ThreatLevel, ThreatScore)
|
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed enemy " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed enemy " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
||||||
"Score: +" .. ThreatScore .. " = " .. Player.Score - Player.Penalty,
|
"Score: +" .. ThreatScore .. " = " .. Player.Score - Player.Penalty,
|
||||||
MESSAGE.Type.Information )
|
MESSAGE.Type.Information )
|
||||||
@@ -1854,11 +1786,10 @@ end
|
|||||||
function SCORING:OpenCSV( ScoringCSV )
|
function SCORING:OpenCSV( ScoringCSV )
|
||||||
self:F( ScoringCSV )
|
self:F( ScoringCSV )
|
||||||
|
|
||||||
if lfs and io and os and self.AutoSave == true then
|
if lfs and io and os and self.AutoSave then
|
||||||
if ScoringCSV then
|
if ScoringCSV then
|
||||||
self.ScoringCSV = ScoringCSV
|
self.ScoringCSV = ScoringCSV
|
||||||
local path = self.AutoSavePath or lfs.writedir() .. [[Logs\]]
|
local fdir = lfs.writedir() .. [[Logs\]] .. self.ScoringCSV .. " " .. os.date( "%Y-%m-%d %H-%M-%S" ) .. ".csv"
|
||||||
local fdir = path .. self.ScoringCSV .. " " .. os.date( "%Y-%m-%d %H-%M-%S" ) .. ".csv"
|
|
||||||
|
|
||||||
self.CSVFile, self.err = io.open( fdir, "w+" )
|
self.CSVFile, self.err = io.open( fdir, "w+" )
|
||||||
if not self.CSVFile then
|
if not self.CSVFile then
|
||||||
@@ -1976,26 +1907,3 @@ function SCORING:SwitchAutoSave(OnOff)
|
|||||||
self.AutoSave = OnOff
|
self.AutoSave = OnOff
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Handles the event when one player kill another player
|
|
||||||
-- @param #SCORING self
|
|
||||||
-- @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(PlayerName, TargetPlayerName, IsTeamKill, TargetThreatLevel, PlayerThreatLevel, Score)
|
|
||||||
|
|
||||||
end
|
|
||||||
--- Handles the event when one player kill another player
|
|
||||||
-- @param #SCORING self
|
|
||||||
-- @param #string PlayerName The attacking player
|
|
||||||
-- @param #string TargetUnitName the name of the killed unit
|
|
||||||
-- @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(PlayerName, TargetUnitName, IsTeamKill, TargetThreatLevel, PlayerThreatLevel, Score)
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|||||||
@@ -13,13 +13,13 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [SEV - SEAD Evasion](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Sead)
|
-- [SEV - SEAD Evasion](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SEV%20-%20SEAD%20Evasion)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Authors: **applevangelist**, **FlightControl**
|
-- ### Authors: **FlightControl**, **applevangelist**
|
||||||
--
|
--
|
||||||
-- Last Update: Dec 2024
|
-- Last Update: Oct 2023
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -28,16 +28,6 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
-- @type SEAD
|
-- @type SEAD
|
||||||
-- @field #string ClassName The Class Name.
|
|
||||||
-- @field #table TargetSkill Table of target skills.
|
|
||||||
-- @field #table SEADGroupPrefixes Table of SEAD prefixes.
|
|
||||||
-- @field #table SuppressedGroups Table of currently suppressed groups.
|
|
||||||
-- @field #number EngagementRange Engagement Range.
|
|
||||||
-- @field #number Padding Padding in seconds.
|
|
||||||
-- @field #function CallBack Callback function for suppression plans.
|
|
||||||
-- @field #boolean UseCallBack Switch for callback function to be used.
|
|
||||||
-- @field #boolean debug Debug switch.
|
|
||||||
-- @field #boolen WeaponTrack Track switch, if true track weapon speed for 30 secs.
|
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
--- Make SAM sites execute evasive and defensive behaviour when being fired upon.
|
--- Make SAM sites execute evasive and defensive behaviour when being fired upon.
|
||||||
@@ -66,11 +56,10 @@ SEAD = {
|
|||||||
SEADGroupPrefixes = {},
|
SEADGroupPrefixes = {},
|
||||||
SuppressedGroups = {},
|
SuppressedGroups = {},
|
||||||
EngagementRange = 75, -- default 75% engagement range Feature Request #1355
|
EngagementRange = 75, -- default 75% engagement range Feature Request #1355
|
||||||
Padding = 15,
|
Padding = 10,
|
||||||
CallBack = nil,
|
CallBack = nil,
|
||||||
UseCallBack = false,
|
UseCallBack = false,
|
||||||
debug = false,
|
debug = false,
|
||||||
WeaponTrack = false,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Missile enumerators
|
--- Missile enumerators
|
||||||
@@ -80,7 +69,6 @@ SEAD = {
|
|||||||
["AGM_122"] = "AGM_122",
|
["AGM_122"] = "AGM_122",
|
||||||
["AGM_84"] = "AGM_84",
|
["AGM_84"] = "AGM_84",
|
||||||
["AGM_45"] = "AGM_45",
|
["AGM_45"] = "AGM_45",
|
||||||
["AGM_65"] = "AGM_65",
|
|
||||||
["ALARM"] = "ALARM",
|
["ALARM"] = "ALARM",
|
||||||
["LD-10"] = "LD-10",
|
["LD-10"] = "LD-10",
|
||||||
["X_58"] = "X_58",
|
["X_58"] = "X_58",
|
||||||
@@ -100,7 +88,6 @@ SEAD = {
|
|||||||
-- km and mach
|
-- km and mach
|
||||||
["AGM_88"] = { 150, 3},
|
["AGM_88"] = { 150, 3},
|
||||||
["AGM_45"] = { 12, 2},
|
["AGM_45"] = { 12, 2},
|
||||||
["AGM_65"] = { 16, 0.9},
|
|
||||||
["AGM_122"] = { 16.5, 2.3},
|
["AGM_122"] = { 16.5, 2.3},
|
||||||
["AGM_84"] = { 280, 0.8},
|
["AGM_84"] = { 280, 0.8},
|
||||||
["ALARM"] = { 45, 2},
|
["ALARM"] = { 45, 2},
|
||||||
@@ -157,7 +144,7 @@ function SEAD:New( SEADGroupPrefixes, Padding )
|
|||||||
self:AddTransition("*", "ManageEvasion", "*")
|
self:AddTransition("*", "ManageEvasion", "*")
|
||||||
self:AddTransition("*", "CalculateHitZone", "*")
|
self:AddTransition("*", "CalculateHitZone", "*")
|
||||||
|
|
||||||
self:I("*** SEAD - Started Version 0.4.9")
|
self:I("*** SEAD - Started Version 0.4.5")
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -333,6 +320,9 @@ function SEAD:onafterCalculateHitZone(From,Event,To,SEADWeapon,pos0,height,SEADG
|
|||||||
end
|
end
|
||||||
|
|
||||||
local seadset = SET_GROUP:New():FilterPrefixes(self.SEADGroupPrefixes):FilterZones({targetzone}):FilterOnce()
|
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 tgtgrp = seadset:GetRandom()
|
||||||
local _targetgroup = nil
|
local _targetgroup = nil
|
||||||
local _targetgroupname = "none"
|
local _targetgroupname = "none"
|
||||||
@@ -384,7 +374,7 @@ function SEAD:onafterManageEvasion(From,Event,To,_targetskill,_targetgroup,SEADP
|
|||||||
reach = wpndata[1] * 1.1
|
reach = wpndata[1] * 1.1
|
||||||
local mach = wpndata[2]
|
local mach = wpndata[2]
|
||||||
wpnspeed = math.floor(mach * 340.29)
|
wpnspeed = math.floor(mach * 340.29)
|
||||||
if Weapon and Weapon:GetSpeed() > 0 then
|
if Weapon then
|
||||||
wpnspeed = Weapon:GetSpeed()
|
wpnspeed = Weapon:GetSpeed()
|
||||||
self:T(string.format("*** SEAD - Weapon Speed from WEAPON: %f m/s",wpnspeed))
|
self:T(string.format("*** SEAD - Weapon Speed from WEAPON: %f m/s",wpnspeed))
|
||||||
end
|
end
|
||||||
@@ -411,7 +401,7 @@ function SEAD:onafterManageEvasion(From,Event,To,_targetskill,_targetgroup,SEADP
|
|||||||
grp:EnableEmission(false)
|
grp:EnableEmission(false)
|
||||||
end
|
end
|
||||||
grp:OptionAlarmStateGreen() -- needed else we cannot move around
|
grp:OptionAlarmStateGreen() -- needed else we cannot move around
|
||||||
grp:RelocateGroundRandomInRadius(20,300,false,false,"Diamond",true)
|
grp:RelocateGroundRandomInRadius(20,300,false,false,"Diamond")
|
||||||
if self.UseCallBack then
|
if self.UseCallBack then
|
||||||
local object = self.CallBack
|
local object = self.CallBack
|
||||||
object:SeadSuppressionStart(grp,name,attacker)
|
object:SeadSuppressionStart(grp,name,attacker)
|
||||||
@@ -465,38 +455,29 @@ end
|
|||||||
-- @return #SEAD self
|
-- @return #SEAD self
|
||||||
function SEAD:HandleEventShot( EventData )
|
function SEAD:HandleEventShot( EventData )
|
||||||
self:T( { EventData.id } )
|
self:T( { EventData.id } )
|
||||||
|
local SEADPlane = EventData.IniUnit -- Wrapper.Unit#UNIT
|
||||||
|
local SEADGroup = EventData.IniGroup -- Wrapper.Group#GROUP
|
||||||
|
local SEADPlanePos = SEADPlane:GetCoordinate() -- Core.Point#COORDINATE
|
||||||
|
local SEADUnit = EventData.IniDCSUnit
|
||||||
|
local SEADUnitName = EventData.IniDCSUnitName
|
||||||
local SEADWeapon = EventData.Weapon -- Identify the weapon fired
|
local SEADWeapon = EventData.Weapon -- Identify the weapon fired
|
||||||
local SEADWeaponName = EventData.WeaponName or "None" -- return weapon type
|
local SEADWeaponName = EventData.WeaponName -- return weapon type
|
||||||
|
|
||||||
if self:_CheckHarms(SEADWeaponName) then
|
|
||||||
--UTILS.PrintTableToLog(EventData)
|
|
||||||
local SEADPlane = EventData.IniUnit -- Wrapper.Unit#UNIT
|
|
||||||
|
|
||||||
if not SEADPlane then return self end -- case IniUnit is empty
|
|
||||||
|
|
||||||
local SEADGroup = EventData.IniGroup -- Wrapper.Group#GROUP
|
|
||||||
local SEADPlanePos = SEADPlane:GetCoordinate() -- Core.Point#COORDINATE
|
|
||||||
local SEADUnit = EventData.IniDCSUnit
|
|
||||||
local SEADUnitName = EventData.IniDCSUnitName
|
|
||||||
|
|
||||||
local WeaponWrapper = WEAPON:New(EventData.Weapon) -- Wrapper.Weapon#WEAPON
|
|
||||||
|
|
||||||
self:T( "*** SEAD - Missile Launched = " .. SEADWeaponName)
|
|
||||||
|
|
||||||
|
local WeaponWrapper = WEAPON:New(EventData.Weapon)
|
||||||
|
--local SEADWeaponSpeed = WeaponWrapper:GetSpeed() -- mps
|
||||||
|
|
||||||
|
self:T( "*** SEAD - Missile Launched = " .. SEADWeaponName)
|
||||||
|
--self:T({ SEADWeapon })
|
||||||
|
|
||||||
|
if self:_CheckHarms(SEADWeaponName) then
|
||||||
self:T( '*** SEAD - Weapon Match' )
|
self:T( '*** SEAD - Weapon Match' )
|
||||||
if self.WeaponTrack == true then
|
|
||||||
WeaponWrapper:SetFuncTrack(function(weapon) env.info(string.format("*** Weapon Speed: %d m/s",weapon:GetSpeed() or -1)) end)
|
|
||||||
WeaponWrapper:StartTrack(0.1)
|
|
||||||
WeaponWrapper:StopTrack(30)
|
|
||||||
end
|
|
||||||
local _targetskill = "Random"
|
local _targetskill = "Random"
|
||||||
local _targetgroupname = "none"
|
local _targetgroupname = "none"
|
||||||
local _target = EventData.Weapon:getTarget() -- Identify target
|
local _target = EventData.Weapon:getTarget() -- Identify target
|
||||||
if not _target or self.debug then -- AGM-88 or 154 w/o target data
|
if not _target or self.debug then -- AGM-88 or 154 w/o target data
|
||||||
self:E("***** SEAD - No target data for " .. (SEADWeaponName or "None"))
|
self:E("***** SEAD - No target data for " .. (SEADWeaponName or "None"))
|
||||||
if string.find(SEADWeaponName,"AGM_88",1,true) or string.find(SEADWeaponName,"AGM_154",1,true) then
|
if string.find(SEADWeaponName,"AGM_88",1,true) or string.find(SEADWeaponName,"AGM_154",1,true) then
|
||||||
self:T("**** Tracking AGM-88/154 with no target data.")
|
self:I("**** Tracking AGM-88/154 with no target data.")
|
||||||
local pos0 = SEADPlane:GetCoordinate()
|
local pos0 = SEADPlane:GetCoordinate()
|
||||||
local fheight = SEADPlane:GetHeight()
|
local fheight = SEADPlane:GetHeight()
|
||||||
self:__CalculateHitZone(20,SEADWeapon,pos0,fheight,SEADGroup,SEADWeaponName)
|
self:__CalculateHitZone(20,SEADWeapon,pos0,fheight,SEADGroup,SEADWeaponName)
|
||||||
@@ -542,7 +523,7 @@ function SEAD:HandleEventShot( EventData )
|
|||||||
end
|
end
|
||||||
if SEADGroupFound == true then -- yes we are being attacked
|
if SEADGroupFound == true then -- yes we are being attacked
|
||||||
if string.find(SEADWeaponName,"ADM_141",1,true) then
|
if string.find(SEADWeaponName,"ADM_141",1,true) then
|
||||||
self:__ManageEvasion(2,_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,2,WeaponWrapper)
|
self:__ManageEvasion(2,_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,0,WeaponWrapper)
|
||||||
else
|
else
|
||||||
self:ManageEvasion(_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,0,WeaponWrapper)
|
self:ManageEvasion(_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,0,WeaponWrapper)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- ### [SHORAD - Short Range Air Defense](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Shorad)
|
-- ### [SHORAD - Short Range Air Defense](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SRD%20-%20SHORAD%20Defense)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
-- @image Functional.Shorad.jpg
|
-- @image Functional.Shorad.jpg
|
||||||
--
|
--
|
||||||
-- Date: Nov 2021
|
-- Date: Nov 2021
|
||||||
-- Last Update: Jan 2025
|
-- Last Update: Nov 2023
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
--- **SHORAD** class, extends Core.Base#BASE
|
--- **SHORAD** class, extends Core.Base#BASE
|
||||||
@@ -41,14 +41,10 @@
|
|||||||
-- @field #boolean DefendMavs Default true, intercept incoming AG-Missiles
|
-- @field #boolean DefendMavs Default true, intercept incoming AG-Missiles
|
||||||
-- @field #number DefenseLowProb Default 70, minimum detection limit
|
-- @field #number DefenseLowProb Default 70, minimum detection limit
|
||||||
-- @field #number DefenseHighProb Default 90, maximum detection limit
|
-- @field #number DefenseHighProb Default 90, maximum detection limit
|
||||||
-- @field #boolean UseEmOnOff Decide if we are using Emission on/off (default) or AlarmState red/green
|
-- @field #boolean UseEmOnOff Decide if we are using Emission on/off (default) or AlarmState red/green.
|
||||||
-- @field #boolean shootandscoot If true, shoot and scoot between zones
|
-- @field #boolean shootandscoot
|
||||||
-- @field #number SkateNumber Number of zones to consider
|
-- @field #number SkateNumber
|
||||||
-- @field Core.Set#SET_ZONE SkateZones Zones in this set are considered
|
-- @field Core.Set#SET_ZONE SkateZones
|
||||||
-- @field #number minscootdist Min distance of the next zone
|
|
||||||
-- @field #number maxscootdist Max distance of the next zone
|
|
||||||
-- @field #boolean scootrandomcoord If true, use a random coordinate in the zone and not the center
|
|
||||||
-- @field #string scootformation Formation to take for scooting, e.g. "Vee" or "Cone"
|
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
|
|
||||||
@@ -81,15 +77,14 @@
|
|||||||
--
|
--
|
||||||
-- `myshorad = SHORAD:New("RedShorad", "Red SHORAD", SamSet, 25000, 600, "red")`
|
-- `myshorad = SHORAD:New("RedShorad", "Red SHORAD", SamSet, 25000, 600, "red")`
|
||||||
--
|
--
|
||||||
-- ## Customization options
|
-- ## Customize options
|
||||||
--
|
--
|
||||||
-- * myshorad:SwitchDebug(debug)
|
-- * SHORAD:SwitchDebug(debug)
|
||||||
-- * myshorad:SwitchHARMDefense(onoff)
|
-- * SHORAD:SwitchHARMDefense(onoff)
|
||||||
-- * myshorad:SwitchAGMDefense(onoff)
|
-- * SHORAD:SwitchAGMDefense(onoff)
|
||||||
-- * myshorad:SetDefenseLimits(low,high)
|
-- * SHORAD:SetDefenseLimits(low,high)
|
||||||
-- * myshorad:SetActiveTimer(seconds)
|
-- * SHORAD:SetActiveTimer(seconds)
|
||||||
-- * myshorad:SetDefenseRadius(meters)
|
-- * SHORAD:SetDefenseRadius(meters)
|
||||||
-- * myshorad:AddScootZones(ZoneSet,Number,Random,Formation)
|
|
||||||
--
|
--
|
||||||
-- @field #SHORAD
|
-- @field #SHORAD
|
||||||
SHORAD = {
|
SHORAD = {
|
||||||
@@ -112,9 +107,6 @@ SHORAD = {
|
|||||||
shootandscoot = false,
|
shootandscoot = false,
|
||||||
SkateNumber = 3,
|
SkateNumber = 3,
|
||||||
SkateZones = nil,
|
SkateZones = nil,
|
||||||
minscootdist = 100,
|
|
||||||
maxscootdist = 3000,
|
|
||||||
scootrandomcoord = false,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@@ -182,7 +174,7 @@ do
|
|||||||
self.DefenseHighProb = 90 -- probability to detect a missile shot, high margin
|
self.DefenseHighProb = 90 -- probability to detect a missile shot, high margin
|
||||||
self.UseEmOnOff = true -- Decide if we are using Emission on/off (default) or AlarmState red/green
|
self.UseEmOnOff = true -- Decide if we are using Emission on/off (default) or AlarmState red/green
|
||||||
if UseEmOnOff == false then self.UseEmOnOff = UseEmOnOff end
|
if UseEmOnOff == false then self.UseEmOnOff = UseEmOnOff end
|
||||||
self:I("*** SHORAD - Started Version 0.3.4")
|
self:I("*** SHORAD - Started Version 0.3.2")
|
||||||
-- Set the string id for output to DCS.log file.
|
-- Set the string id for output to DCS.log file.
|
||||||
self.lid=string.format("SHORAD %s | ", self.name)
|
self.lid=string.format("SHORAD %s | ", self.name)
|
||||||
self:_InitState()
|
self:_InitState()
|
||||||
@@ -227,16 +219,12 @@ do
|
|||||||
-- @param #SHORAD self
|
-- @param #SHORAD self
|
||||||
-- @param Core.Set#SET_ZONE ZoneSet Set of zones to be used. Units will move around to the next (random) zone between 100m and 3000m away.
|
-- @param Core.Set#SET_ZONE ZoneSet Set of zones to be used. Units will move around to the next (random) zone between 100m and 3000m away.
|
||||||
-- @param #number Number Number of closest zones to be considered, defaults to 3.
|
-- @param #number Number Number of closest zones to be considered, defaults to 3.
|
||||||
-- @param #boolean Random If true, use a random coordinate inside the next zone to scoot to.
|
|
||||||
-- @param #string Formation Formation to use, defaults to "Cone". See mission editor dropdown for options.
|
|
||||||
-- @return #SHORAD self
|
-- @return #SHORAD self
|
||||||
function SHORAD:AddScootZones(ZoneSet, Number, Random, Formation)
|
function SHORAD:AddScootZones(ZoneSet, Number)
|
||||||
self:T(self.lid .. " AddScootZones")
|
self:T(self.lid .. " AddScootZones")
|
||||||
self.SkateZones = ZoneSet
|
self.SkateZones = ZoneSet
|
||||||
self.SkateNumber = Number or 3
|
self.SkateNumber = Number or 3
|
||||||
self.shootandscoot = true
|
self.shootandscoot = true
|
||||||
self.scootrandomcoord = Random
|
|
||||||
self.scootformation = Formation or "Cone"
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -443,9 +431,7 @@ do
|
|||||||
for _,_groups in pairs (shoradset) do
|
for _,_groups in pairs (shoradset) do
|
||||||
local groupname = _groups:GetName()
|
local groupname = _groups:GetName()
|
||||||
if string.find(groupname, tgtgrp, 1, true) then
|
if string.find(groupname, tgtgrp, 1, true) then
|
||||||
if _groups:IsSAM() then
|
returnname = true
|
||||||
returnname = true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return returnname
|
return returnname
|
||||||
@@ -472,7 +458,6 @@ do
|
|||||||
-- @param #number Radius Radius of the #ZONE
|
-- @param #number Radius Radius of the #ZONE
|
||||||
-- @param #number ActiveTimer Number of seconds to stay active
|
-- @param #number ActiveTimer Number of seconds to stay active
|
||||||
-- @param #number TargetCat (optional) Category, i.e. Object.Category.UNIT or Object.Category.STATIC
|
-- @param #number TargetCat (optional) Category, i.e. Object.Category.UNIT or Object.Category.STATIC
|
||||||
-- @param #boolean ShotAt If true, function is called after a shot
|
|
||||||
-- @return #SHORAD self
|
-- @return #SHORAD self
|
||||||
-- @usage Use this function to integrate with other systems, example
|
-- @usage Use this function to integrate with other systems, example
|
||||||
--
|
--
|
||||||
@@ -482,7 +467,7 @@ do
|
|||||||
-- mymantis = MANTIS:New("BlueMantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs")
|
-- mymantis = MANTIS:New("BlueMantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs")
|
||||||
-- mymantis:AddShorad(myshorad,720)
|
-- mymantis:AddShorad(myshorad,720)
|
||||||
-- mymantis:Start()
|
-- mymantis:Start()
|
||||||
function SHORAD:onafterWakeUpShorad(From, Event, To, TargetGroup, Radius, ActiveTimer, TargetCat, ShotAt)
|
function SHORAD:onafterWakeUpShorad(From, Event, To, TargetGroup, Radius, ActiveTimer, TargetCat)
|
||||||
self:T(self.lid .. " WakeUpShorad")
|
self:T(self.lid .. " WakeUpShorad")
|
||||||
self:T({TargetGroup, Radius, ActiveTimer, TargetCat})
|
self:T({TargetGroup, Radius, ActiveTimer, TargetCat})
|
||||||
local targetcat = TargetCat or Object.Category.UNIT
|
local targetcat = TargetCat or Object.Category.UNIT
|
||||||
@@ -524,27 +509,7 @@ do
|
|||||||
-- go through set and find the one(s) to activate
|
-- go through set and find the one(s) to activate
|
||||||
local TDiff = 4
|
local TDiff = 4
|
||||||
for _,_group in pairs (shoradset) do
|
for _,_group in pairs (shoradset) do
|
||||||
|
if _group:IsAnyInZone(targetzone) then
|
||||||
local groupname = _group:GetName()
|
|
||||||
|
|
||||||
if groupname == TargetGroup and ShotAt==true then
|
|
||||||
-- Shot at a SHORAD group
|
|
||||||
if self.UseEmOnOff then
|
|
||||||
_group:EnableEmission(false)
|
|
||||||
end
|
|
||||||
_group:OptionAlarmStateGreen()
|
|
||||||
self.ActiveGroups[groupname] = nil
|
|
||||||
local text = string.format("Shot at SHORAD %s! Evading!", _group:GetName())
|
|
||||||
self:T(text)
|
|
||||||
local m = MESSAGE:New(text,10,"SHORAD"):ToAllIf(self.debug)
|
|
||||||
|
|
||||||
--Shoot and Scoot
|
|
||||||
if self.shootandscoot then
|
|
||||||
self:__ShootAndScoot(1,_group)
|
|
||||||
end
|
|
||||||
|
|
||||||
elseif _group:IsAnyInZone(targetzone) or groupname == TargetGroup then
|
|
||||||
-- shot at a group we protect
|
|
||||||
local text = string.format("Waking up SHORAD %s", _group:GetName())
|
local text = string.format("Waking up SHORAD %s", _group:GetName())
|
||||||
self:T(text)
|
self:T(text)
|
||||||
local m = MESSAGE:New(text,10,"SHORAD"):ToAllIf(self.debug)
|
local m = MESSAGE:New(text,10,"SHORAD"):ToAllIf(self.debug)
|
||||||
@@ -552,6 +517,7 @@ do
|
|||||||
_group:EnableEmission(true)
|
_group:EnableEmission(true)
|
||||||
end
|
end
|
||||||
_group:OptionAlarmStateRed()
|
_group:OptionAlarmStateRed()
|
||||||
|
local groupname = _group:GetName()
|
||||||
if self.ActiveGroups[groupname] == nil then -- no timer yet for this group
|
if self.ActiveGroups[groupname] == nil then -- no timer yet for this group
|
||||||
self.ActiveGroups[groupname] = { Timing = ActiveTimer }
|
self.ActiveGroups[groupname] = { Timing = ActiveTimer }
|
||||||
local endtime = timer.getTime() + (ActiveTimer * math.random(75,100) / 100 ) -- randomize wakeup a bit
|
local endtime = timer.getTime() + (ActiveTimer * math.random(75,100) / 100 ) -- randomize wakeup a bit
|
||||||
@@ -629,7 +595,7 @@ do
|
|||||||
_targetgroupname = tgtgrp:GetName() -- group name
|
_targetgroupname = tgtgrp:GetName() -- group name
|
||||||
_targetskill = tgtgrp:GetUnit(1):GetSkill()
|
_targetskill = tgtgrp:GetUnit(1):GetSkill()
|
||||||
self:T("*** Found Target = ".. _targetgroupname)
|
self:T("*** Found Target = ".. _targetgroupname)
|
||||||
self:WakeUpShorad(_targetgroupname, self.Radius, self.ActiveTimer, Object.Category.UNIT,true)
|
self:WakeUpShorad(_targetgroupname, self.Radius, self.ActiveTimer, Object.Category.UNIT)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -647,8 +613,8 @@ do
|
|||||||
function SHORAD:onafterShootAndScoot(From,Event,To,Shorad)
|
function SHORAD:onafterShootAndScoot(From,Event,To,Shorad)
|
||||||
self:T( { From,Event,To } )
|
self:T( { From,Event,To } )
|
||||||
local possibleZones = {}
|
local possibleZones = {}
|
||||||
local mindist = self.minscootdist or 100
|
local mindist = 100
|
||||||
local maxdist = self.maxscootdist or 3000
|
local maxdist = 3000
|
||||||
if Shorad and Shorad:IsAlive() then
|
if Shorad and Shorad:IsAlive() then
|
||||||
local NowCoord = Shorad:GetCoordinate()
|
local NowCoord = Shorad:GetCoordinate()
|
||||||
for _,_zone in pairs(self.SkateZones.Set) do
|
for _,_zone in pairs(self.SkateZones.Set) do
|
||||||
@@ -664,11 +630,7 @@ do
|
|||||||
if rand == 0 then rand = 1 end
|
if rand == 0 then rand = 1 end
|
||||||
self:T(self.lid .. " ShootAndScoot to zone "..rand)
|
self:T(self.lid .. " ShootAndScoot to zone "..rand)
|
||||||
local ToCoordinate = possibleZones[rand]:GetCoordinate()
|
local ToCoordinate = possibleZones[rand]:GetCoordinate()
|
||||||
if self.scootrandomcoord then
|
Shorad:RouteGroundTo(ToCoordinate,20,"Cone",1)
|
||||||
ToCoordinate = possibleZones[rand]:GetRandomCoordinate(nil,nil,{land.SurfaceType.LAND,land.SurfaceType.ROAD})
|
|
||||||
end
|
|
||||||
local formation = self.scootformation or "Cone"
|
|
||||||
Shorad:RouteGroundTo(ToCoordinate,20,formation,1)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
@@ -758,7 +720,7 @@ do
|
|||||||
-- if being shot at, find closest SHORADs to activate
|
-- if being shot at, find closest SHORADs to activate
|
||||||
if shotatsams or shotatus then
|
if shotatsams or shotatus then
|
||||||
self:T({shotatsams=shotatsams,shotatus=shotatus})
|
self:T({shotatsams=shotatsams,shotatus=shotatus})
|
||||||
self:WakeUpShorad(targetgroupname, self.Radius, self.ActiveTimer, targetcat, true)
|
self:WakeUpShorad(targetgroupname, self.Radius, self.ActiveTimer, targetcat)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -769,4 +731,4 @@ do
|
|||||||
end
|
end
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- SHORAD end
|
-- SHORAD end
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
-- @field #number respawndelay Delay before respawn in seconds.
|
-- @field #number respawndelay Delay before respawn in seconds.
|
||||||
-- @field #number runwaydestroyed Time stamp timer.getAbsTime() when the runway was destroyed.
|
-- @field #number runwaydestroyed Time stamp timer.getAbsTime() when the runway was destroyed.
|
||||||
-- @field #number runwayrepairtime Time in seconds until runway will be repaired after it was destroyed. Default is 3600 sec (one hour).
|
-- @field #number runwayrepairtime Time in seconds until runway will be repaired after it was destroyed. Default is 3600 sec (one hour).
|
||||||
-- @field OPS.FlightControl#FLIGHTCONTROL flightcontrol Flight control of this warehouse.
|
-- @field Ops.FlightControl#FLIGHTCONTROL flightcontrol Flight control of this warehouse.
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
--- Have your assets at the right place at the right time - or not!
|
--- Have your assets at the right place at the right time - or not!
|
||||||
@@ -1629,7 +1629,7 @@ WAREHOUSE = {
|
|||||||
-- @field #boolean arrived If true, asset arrived at its destination.
|
-- @field #boolean arrived If true, asset arrived at its destination.
|
||||||
--
|
--
|
||||||
-- @field #number damage Damage of asset group in percent.
|
-- @field #number damage Damage of asset group in percent.
|
||||||
-- @field Ops.Airwing#AIRWING.Payload payload The payload of the asset.
|
-- @field Ops.AirWing#AIRWING.Payload payload The payload of the asset.
|
||||||
-- @field Ops.OpsGroup#OPSGROUP flightgroup The flightgroup object.
|
-- @field Ops.OpsGroup#OPSGROUP flightgroup The flightgroup object.
|
||||||
-- @field Ops.Cohort#COHORT cohort The cohort this asset belongs to.
|
-- @field Ops.Cohort#COHORT cohort The cohort this asset belongs to.
|
||||||
-- @field Ops.Legion#LEGION legion The legion this asset belonts to.
|
-- @field Ops.Legion#LEGION legion The legion this asset belonts to.
|
||||||
@@ -3153,7 +3153,7 @@ end
|
|||||||
-- @param #WAREHOUSE self
|
-- @param #WAREHOUSE self
|
||||||
-- @return Core.Point#COORDINATE The coordinate of the warehouse.
|
-- @return Core.Point#COORDINATE The coordinate of the warehouse.
|
||||||
function WAREHOUSE:GetCoordinate()
|
function WAREHOUSE:GetCoordinate()
|
||||||
return self.warehouse:GetCoord()
|
return self.warehouse:GetCoordinate()
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get 3D vector of warehouse static.
|
--- Get 3D vector of warehouse static.
|
||||||
@@ -3414,7 +3414,7 @@ end
|
|||||||
-- FSM states
|
-- FSM states
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
--- On after Start event. Starts the warehouse. Adds event handlers and schedules status updates of reqests and queue.
|
--- On after Start event. Starts the warehouse. Addes event handlers and schedules status updates of reqests and queue.
|
||||||
-- @param #WAREHOUSE self
|
-- @param #WAREHOUSE self
|
||||||
-- @param #string From From state.
|
-- @param #string From From state.
|
||||||
-- @param #string Event Event.
|
-- @param #string Event Event.
|
||||||
@@ -3595,7 +3595,6 @@ function WAREHOUSE:onafterStatus(From, Event, To)
|
|||||||
local Trepair=self:GetRunwayRepairtime()
|
local Trepair=self:GetRunwayRepairtime()
|
||||||
self:I(self.lid..string.format("Runway destroyed! Will be repaired in %d sec", Trepair))
|
self:I(self.lid..string.format("Runway destroyed! Will be repaired in %d sec", Trepair))
|
||||||
if Trepair==0 then
|
if Trepair==0 then
|
||||||
self.runwaydestroyed = nil
|
|
||||||
self:RunwayRepaired()
|
self:RunwayRepaired()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -5393,8 +5392,7 @@ function WAREHOUSE:onafterRunwayDestroyed(From, Event, To)
|
|||||||
self:_InfoMessage(text)
|
self:_InfoMessage(text)
|
||||||
|
|
||||||
self.runwaydestroyed=timer.getAbsTime()
|
self.runwaydestroyed=timer.getAbsTime()
|
||||||
|
|
||||||
return self
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- On after "RunwayRepaired" event.
|
--- On after "RunwayRepaired" event.
|
||||||
@@ -5409,8 +5407,7 @@ function WAREHOUSE:onafterRunwayRepaired(From, Event, To)
|
|||||||
self:_InfoMessage(text)
|
self:_InfoMessage(text)
|
||||||
|
|
||||||
self.runwaydestroyed=nil
|
self.runwaydestroyed=nil
|
||||||
|
|
||||||
return self
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -6047,7 +6044,7 @@ function WAREHOUSE:_SpawnAssetAircraft(alias, asset, request, parking, uncontrol
|
|||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
if parking and #parking<#template.units and not airstart then
|
if #parking<#template.units and not airstart then
|
||||||
local text=string.format("ERROR: Not enough parking! Free parking = %d < %d aircraft to be spawned.", #parking, #template.units)
|
local text=string.format("ERROR: Not enough parking! Free parking = %d < %d aircraft to be spawned.", #parking, #template.units)
|
||||||
self:_DebugMessage(text)
|
self:_DebugMessage(text)
|
||||||
return nil
|
return nil
|
||||||
@@ -6089,7 +6086,7 @@ function WAREHOUSE:_SpawnAssetAircraft(alias, asset, request, parking, uncontrol
|
|||||||
terminal=parking[i].TerminalID
|
terminal=parking[i].TerminalID
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Debug and terminal then
|
if self.Debug then
|
||||||
local text=string.format("Spawnplace unit %s terminal %d.", unit.name, terminal)
|
local text=string.format("Spawnplace unit %s terminal %d.", unit.name, terminal)
|
||||||
coord:MarkToAll(text)
|
coord:MarkToAll(text)
|
||||||
env.info(text)
|
env.info(text)
|
||||||
@@ -6732,7 +6729,7 @@ end
|
|||||||
-- @param Wrapper.Group#GROUP deadgroup Group of unit that died.
|
-- @param Wrapper.Group#GROUP deadgroup Group of unit that died.
|
||||||
-- @param #WAREHOUSE.Pendingitem request Request that needs to be updated.
|
-- @param #WAREHOUSE.Pendingitem request Request that needs to be updated.
|
||||||
function WAREHOUSE:_UnitDead(deadunit, deadgroup, request)
|
function WAREHOUSE:_UnitDead(deadunit, deadgroup, request)
|
||||||
--self:F(self.lid.."FF unit dead "..deadunit:GetName())
|
self:F(self.lid.."FF unit dead "..deadunit:GetName())
|
||||||
|
|
||||||
-- Find opsgroup.
|
-- Find opsgroup.
|
||||||
local opsgroup=_DATABASE:FindOpsGroup(deadgroup)
|
local opsgroup=_DATABASE:FindOpsGroup(deadgroup)
|
||||||
@@ -6893,7 +6890,7 @@ function WAREHOUSE:_CheckConquered()
|
|||||||
for _,_unit in pairs(units) do
|
for _,_unit in pairs(units) do
|
||||||
local unit=_unit --Wrapper.Unit#UNIT
|
local unit=_unit --Wrapper.Unit#UNIT
|
||||||
|
|
||||||
local distance=coord:Get2DDistance(unit:GetCoord())
|
local distance=coord:Get2DDistance(unit:GetCoordinate())
|
||||||
|
|
||||||
-- Filter only alive groud units. Also check distance again, because the scan routine might give some larger distances.
|
-- Filter only alive groud units. Also check distance again, because the scan routine might give some larger distances.
|
||||||
if unit:IsGround() and unit:IsAlive() and distance <= radius then
|
if unit:IsGround() and unit:IsAlive() and distance <= radius then
|
||||||
@@ -7407,8 +7404,6 @@ function WAREHOUSE:_CheckRequestNow(request)
|
|||||||
|
|
||||||
-- Check if at least one (cargo) asset is available.
|
-- Check if at least one (cargo) asset is available.
|
||||||
if _nassets>0 then
|
if _nassets>0 then
|
||||||
|
|
||||||
local asset=_assets[1] --#WAREHOUSE.Assetitem
|
|
||||||
|
|
||||||
-- Get the attibute of the requested asset.
|
-- Get the attibute of the requested asset.
|
||||||
_assetattribute=_assets[1].attribute
|
_assetattribute=_assets[1].attribute
|
||||||
@@ -7419,24 +7414,11 @@ function WAREHOUSE:_CheckRequestNow(request)
|
|||||||
if _assetcategory==Group.Category.AIRPLANE or _assetcategory==Group.Category.HELICOPTER then
|
if _assetcategory==Group.Category.AIRPLANE or _assetcategory==Group.Category.HELICOPTER then
|
||||||
|
|
||||||
if self.airbase and self.airbase:GetCoalition()==self:GetCoalition() then
|
if self.airbase and self.airbase:GetCoalition()==self:GetCoalition() then
|
||||||
|
|
||||||
-- Check if DCS warehouse of airbase has enough assets
|
|
||||||
if self.airbase.storage then
|
|
||||||
local nS=self.airbase.storage:GetAmount(asset.unittype)
|
|
||||||
local nA=asset.nunits*request.nasset -- Number of units requested
|
|
||||||
if nS<nA then
|
|
||||||
local text=string.format("Warehouse %s: Request denied! DCS Warehouse has only %d assets of type %s ==> NOT enough to spawn the requested %d asset units (%d groups)",
|
|
||||||
self.alias, nS, asset.unittype, nA, request.nasset)
|
|
||||||
self:_InfoMessage(text, 5)
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
if self:IsRunwayOperational() or _assetairstart then
|
if self:IsRunwayOperational() or _assetairstart then
|
||||||
|
|
||||||
if _assetairstart then
|
if _assetairstart then
|
||||||
-- Airstart no need to check parking
|
-- Airstart no need to check parking
|
||||||
else
|
else
|
||||||
|
|
||||||
-- Check parking.
|
-- Check parking.
|
||||||
@@ -7548,9 +7530,6 @@ function WAREHOUSE:_CheckRequestNow(request)
|
|||||||
self:_InfoMessage(text, 5)
|
self:_InfoMessage(text, 5)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif _assetcategory==Group.Category.AIRPLANE or _assetcategory==Group.Category.HELICOPTER then
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -7946,12 +7925,10 @@ function WAREHOUSE:_FindParkingForAssets(airbase, assets)
|
|||||||
local clients=_DATABASE.CLIENTS
|
local clients=_DATABASE.CLIENTS
|
||||||
for clientname, client in pairs(clients) do
|
for clientname, client in pairs(clients) do
|
||||||
local template=_DATABASE:GetGroupTemplateFromUnitName(clientname)
|
local template=_DATABASE:GetGroupTemplateFromUnitName(clientname)
|
||||||
if template then
|
local units=template.units
|
||||||
local units=template.units
|
for i,unit in pairs(units) do
|
||||||
for i,unit in pairs(units) do
|
local coord=COORDINATE:New(unit.x, unit.alt, unit.y)
|
||||||
local coord=COORDINATE:New(unit.x, unit.alt, unit.y)
|
coords[unit.name]=coord
|
||||||
coords[unit.name]=coord
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -8122,11 +8099,9 @@ function WAREHOUSE:_FindParkingForAssets(airbase, assets)
|
|||||||
-- Debug output for occupied spots.
|
-- Debug output for occupied spots.
|
||||||
if self.Debug then
|
if self.Debug then
|
||||||
local coord=problem.coord --Core.Point#COORDINATE
|
local coord=problem.coord --Core.Point#COORDINATE
|
||||||
if coord then
|
local text=string.format("Obstacle %s [type=%s] blocking spot=%d! Size=%.1f m and distance=%.1f m.", problem.name, problem.type, _termid, problem.size, problem.dist)
|
||||||
local text=string.format("Obstacle %s [type=%s] blocking spot=%d! Size=%.1f m and distance=%.1f m.", problem.name, problem.type, _termid, problem.size, problem.dist)
|
self:I(self.lid..text)
|
||||||
self:I(self.lid..text)
|
coord:MarkToAll(string.format(text))
|
||||||
coord:MarkToAll(text)
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
self:T(self.lid..string.format("Parking spot %d is occupied or not big enough!", _termid))
|
self:T(self.lid..string.format("Parking spot %d is occupied or not big enough!", _termid))
|
||||||
end
|
end
|
||||||
@@ -8435,14 +8410,12 @@ function WAREHOUSE:_GetAttribute(group)
|
|||||||
local attribute=WAREHOUSE.Attribute.OTHER_UNKNOWN --#WAREHOUSE.Attribute
|
local attribute=WAREHOUSE.Attribute.OTHER_UNKNOWN --#WAREHOUSE.Attribute
|
||||||
|
|
||||||
if group then
|
if group then
|
||||||
|
|
||||||
local groupCat=group:GetCategory()
|
|
||||||
|
|
||||||
-----------
|
-----------
|
||||||
--- Air ---
|
--- Air ---
|
||||||
-----------
|
-----------
|
||||||
-- Planes
|
-- Planes
|
||||||
local transportplane=group:HasAttribute("Transports") and group:HasAttribute("Planes") and groupCat==Group.Category.AIRPLANE
|
local transportplane=group:HasAttribute("Transports") and group:HasAttribute("Planes")
|
||||||
local awacs=group:HasAttribute("AWACS")
|
local awacs=group:HasAttribute("AWACS")
|
||||||
local fighter=group:HasAttribute("Fighters") or group:HasAttribute("Interceptors") or group:HasAttribute("Multirole fighters") or (group:HasAttribute("Bombers") and not group:HasAttribute("Strategic bombers"))
|
local fighter=group:HasAttribute("Fighters") or group:HasAttribute("Interceptors") or group:HasAttribute("Multirole fighters") or (group:HasAttribute("Bombers") and not group:HasAttribute("Strategic bombers"))
|
||||||
local bomber=group:HasAttribute("Strategic bombers")
|
local bomber=group:HasAttribute("Strategic bombers")
|
||||||
@@ -8597,6 +8570,7 @@ end
|
|||||||
-- @param #WAREHOUSE.Queueitem qitem Item of queue to be removed.
|
-- @param #WAREHOUSE.Queueitem qitem Item of queue to be removed.
|
||||||
-- @param #table queue The queue from which the item should be deleted.
|
-- @param #table queue The queue from which the item should be deleted.
|
||||||
function WAREHOUSE:_DeleteQueueItem(qitem, queue)
|
function WAREHOUSE:_DeleteQueueItem(qitem, queue)
|
||||||
|
self:F({qitem=qitem, queue=queue})
|
||||||
|
|
||||||
for i=1,#queue do
|
for i=1,#queue do
|
||||||
local _item=queue[i] --#WAREHOUSE.Queueitem
|
local _item=queue[i] --#WAREHOUSE.Queueitem
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [CAZ - Capture Zones](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/ZoneCaptureCoalition)
|
-- [CAZ - Capture Zones](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CAZ%20-%20Capture%20Zones)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -7,8 +7,6 @@
|
|||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
||||||
-- Therefore, this class is considered to be deprecated
|
-- Therefore, this class is considered to be deprecated
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -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.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ _SCHEDULEDISPATCHER = SCHEDULEDISPATCHER:New() -- Core.ScheduleDispatcher#SCHEDU
|
|||||||
_DATABASE = DATABASE:New() -- Core.Database#DATABASE
|
_DATABASE = DATABASE:New() -- Core.Database#DATABASE
|
||||||
|
|
||||||
--- Settings
|
--- Settings
|
||||||
_SETTINGS = SETTINGS:Set() -- Core.Settings#SETTINGS
|
_SETTINGS = SETTINGS:Set()
|
||||||
_SETTINGS:SetPlayerMenuOn()
|
_SETTINGS:SetPlayerMenuOn()
|
||||||
|
|
||||||
--- Register cargos.
|
--- Register cargos.
|
||||||
|
|||||||
@@ -1,157 +1,180 @@
|
|||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Enums.lua' )
|
__Moose.Include( 'Scripts/Moose/Utilities/Enums.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Utils.lua' )
|
__Moose.Include( 'Scripts/Moose/Utilities/FiFo.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Profiler.lua' )
|
__Moose.Include( 'Scripts/Moose/Utilities/Profiler.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/FiFo.lua' )
|
__Moose.Include( 'Scripts/Moose/Utilities/Socket.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Socket.lua' )
|
__Moose.Include( 'Scripts/Moose/Utilities/STTS.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Utilities/Templates.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Utilities/Utils.lua' )
|
||||||
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Base.lua' )
|
__Moose.Include( 'Scripts/Moose/Core/Base.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Astar.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Beacon.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Condition.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/UserFlag.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Report.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Scheduler.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/ScheduleDispatcher.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Event.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Settings.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Menu.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Zone.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Zone_Detection.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Database.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Set.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Point.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Velocity.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Message.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Fsm.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Spawn.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/SpawnStatic.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Timer.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Goal.lua' )
|
|
||||||
__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/Wrapper/Object.lua' )
|
__Moose.Include( 'Scripts/Moose/Core/Astar.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Identifiable.lua' )
|
__Moose.Include( 'Scripts/Moose/Core/Beacon.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Positionable.lua' )
|
__Moose.Include( 'Scripts/Moose/Core/Condition.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Controllable.lua' )
|
__Moose.Include( 'Scripts/Moose/Core/ClientMenu.lua')
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Group.lua' )
|
__Moose.Include( 'Scripts/Moose/Core/Database.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Unit.lua' )
|
__Moose.Include( 'Scripts/Moose/Core/Event.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Client.lua' )
|
__Moose.Include( 'Scripts/Moose/Core/Fsm.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Static.lua' )
|
__Moose.Include( 'Scripts/Moose/Core/Goal.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Airbase.lua' )
|
__Moose.Include( 'Scripts/Moose/Core/MarkerOps_Base.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Scenery.lua' )
|
__Moose.Include( 'Scripts/Moose/Core/Menu.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Marker.lua' )
|
__Moose.Include( 'Scripts/Moose/Core/Message.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Weapon.lua' )
|
__Moose.Include( 'Scripts/Moose/Core/Point.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Net.lua' )
|
__Moose.Include( 'Scripts/Moose/Core/Report.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Storage.lua' )
|
__Moose.Include( 'Scripts/Moose/Core/ScheduleDispatcher.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/DynamicCargo.lua' )
|
__Moose.Include( 'Scripts/Moose/Core/Scheduler.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Core/Set.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Core/Settings.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Core/Spawn.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Core/SpawnStatic.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Core/Spot.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Core/TextAndSound.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Core/Timer.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Core/UserFlag.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Core/Velocity.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Core/Zone_Detection.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Core/Zone.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Core/Pathline.lua' )
|
||||||
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/Cargo.lua' )
|
__Moose.Include( 'Scripts/Moose/Wrapper/Airbase.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/CargoUnit.lua' )
|
__Moose.Include( 'Scripts/Moose/Wrapper/Client.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/CargoSlingload.lua' )
|
__Moose.Include( 'Scripts/Moose/Wrapper/Controllable.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/CargoCrate.lua' )
|
__Moose.Include( 'Scripts/Moose/Wrapper/Group.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/CargoGroup.lua' )
|
__Moose.Include( 'Scripts/Moose/Wrapper/Identifiable.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Wrapper/Marker.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Wrapper/Object.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Wrapper/Positionable.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Wrapper/Scenery.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Wrapper/Static.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Wrapper/Unit.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Wrapper/Weapon.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Wrapper/Net.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Wrapper/Storage.lua' )
|
||||||
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Scoring.lua' )
|
__Moose.Include( 'Scripts/Moose/Cargo/Cargo.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/CleanUp.lua' )
|
__Moose.Include( 'Scripts/Moose/Cargo/CargoUnit.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Movement.lua' )
|
__Moose.Include( 'Scripts/Moose/Cargo/CargoSlingload.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Sead.lua' )
|
__Moose.Include( 'Scripts/Moose/Cargo/CargoCrate.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Escort.lua' )
|
__Moose.Include( 'Scripts/Moose/Cargo/CargoGroup.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/MissileTrainer.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/ATC_Ground.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Detection.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/DetectionZones.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Designate.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/RAT.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Range.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/ZoneGoal.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/ZoneGoalCoalition.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/ZoneCaptureCoalition.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Artillery.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Suppression.lua' )
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/PseudoATC.lua' )
|
|
||||||
__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/ClientWatch.lua' )
|
|
||||||
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Airboss.lua' )
|
__Moose.Include( 'Scripts/Moose/Functional/AICSAR.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/RecoveryTanker.lua' )
|
__Moose.Include( 'Scripts/Moose/Functional/AmmoTruck.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/RescueHelo.lua' )
|
__Moose.Include( 'Scripts/Moose/Functional/Artillery.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/ATIS.lua' )
|
__Moose.Include( 'Scripts/Moose/Functional/ATC_Ground.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/CTLD.lua' )
|
__Moose.Include( 'Scripts/Moose/Functional/Autolase.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/CSAR.lua' )
|
__Moose.Include( 'Scripts/Moose/Functional/CleanUp.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Functional/Designate.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Functional/Detection.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Functional/DetectionZones.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Functional/Escort.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Functional/Fox.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Functional/Mantis.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Functional/MissileTrainer.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Functional/Movement.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Functional/PseudoATC.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Functional/Range.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Functional/RAT.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Functional/Scoring.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Functional/Sead.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Functional/Shorad.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Functional/Suppression.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Functional/Warehouse.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Functional/ZoneCaptureCoalition.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Functional/ZoneGoal.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Functional/ZoneGoalCargo.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/Functional/ZoneGoalCoalition.lua' )
|
||||||
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Balancer.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/Airboss.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Air.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/AirWing.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Air_Patrol.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/ArmyGroup.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Air_Engage.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/ATIS.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2A_Patrol.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/Auftrag.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2A_Cap.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/Awacs.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2A_Gci.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/Brigade.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2A_Dispatcher.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/Chief.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2G_BAI.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/Cohort.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2G_CAS.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/Commander.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2G_SEAD.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/CSAR.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2G_Dispatcher.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/CTLD.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Patrol.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/Fleet.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_CAP.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/FlightControl.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_CAS.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/FlightGroup.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_BAI.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/Flotilla.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Formation.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/Intelligence.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Escort.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/Legion.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Escort_Request.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/NavyGroup.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Escort_Dispatcher.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/Operation.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Escort_Dispatcher_Request.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/OpsGroup.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/OpsTransport.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_APC.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/OpsZone.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Helicopter.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/Platoon.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Airplane.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/PlayerTask.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Ship.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/PlayerRecce.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Dispatcher.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/RecoveryTanker.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Dispatcher_APC.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/RescueHelo.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Dispatcher_Helicopter.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/Squadron.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Dispatcher_Airplane.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/Target.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Dispatcher_Ship.lua' )
|
__Moose.Include( 'Scripts/Moose/Ops/EasyGCICAP.lua' )
|
||||||
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Actions/Act_Assign.lua' )
|
__Moose.Include( 'Scripts/Moose/AI/AI_Balancer.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Actions/Act_Route.lua' )
|
__Moose.Include( 'Scripts/Moose/AI/AI_Air.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Actions/Act_Account.lua' )
|
__Moose.Include( 'Scripts/Moose/AI/AI_Air_Patrol.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Actions/Act_Assist.lua' )
|
__Moose.Include( 'Scripts/Moose/AI/AI_Air_Engage.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_A2A_Patrol.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_A2A_Cap.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_A2A_Gci.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_A2A_Dispatcher.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_A2G_BAI.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_A2G_CAS.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_A2G_SEAD.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_A2G_Dispatcher.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_Patrol.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_CAP.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_CAS.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_BAI.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_Formation.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_Escort.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_Escort_Request.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_Escort_Dispatcher.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_Escort_Dispatcher_Request.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_APC.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_Helicopter.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_Airplane.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_Ship.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_Dispatcher.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_Dispatcher_APC.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_Dispatcher_Helicopter.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_Dispatcher_Airplane.lua' )
|
||||||
|
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_Dispatcher_Ship.lua' )
|
||||||
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Shapes/ShapeBase.lua' )
|
__Moose.Include( 'Scripts/Moose/Actions/Act_Assign.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Shapes/Circle.lua' )
|
__Moose.Include( 'Scripts/Moose/Actions/Act_Route.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Shapes/Cube.lua' )
|
__Moose.Include( 'Scripts/Moose/Actions/Act_Account.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Shapes/Line.lua' )
|
__Moose.Include( 'Scripts/Moose/Actions/Act_Assist.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( 'Scripts/Moose/Sound/Radio.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Sound/SoundOutput.lua' )
|
__Moose.Include( 'Scripts/Moose/Sound/RadioQueue.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Sound/Radio.lua' )
|
__Moose.Include( 'Scripts/Moose/Sound/RadioSpeech.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Sound/RadioQueue.lua' )
|
__Moose.Include( 'Scripts/Moose/Sound/SoundOutput.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Sound/RadioSpeech.lua' )
|
__Moose.Include( 'Scripts/Moose/Sound/SRS.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Sound/SRS.lua' )
|
__Moose.Include( 'Scripts/Moose/Sound/UserSound.lua' )
|
||||||
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/CommandCenter.lua' )
|
__Moose.Include( 'Scripts/Moose/Tasking/CommandCenter.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Mission.lua' )
|
__Moose.Include( 'Scripts/Moose/Tasking/Mission.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task.lua' )
|
__Moose.Include( 'Scripts/Moose/Tasking/Task.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/TaskInfo.lua' )
|
__Moose.Include( 'Scripts/Moose/Tasking/TaskInfo.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Manager.lua' )
|
__Moose.Include( 'Scripts/Moose/Tasking/Task_Manager.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/DetectionManager.lua' )
|
__Moose.Include( 'Scripts/Moose/Tasking/DetectionManager.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_A2G_Dispatcher.lua' )
|
__Moose.Include( 'Scripts/Moose/Tasking/Task_A2G_Dispatcher.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_A2G.lua' )
|
__Moose.Include( 'Scripts/Moose/Tasking/Task_A2G.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_A2A_Dispatcher.lua' )
|
__Moose.Include( 'Scripts/Moose/Tasking/Task_A2A_Dispatcher.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_A2A.lua' )
|
__Moose.Include( 'Scripts/Moose/Tasking/Task_A2A.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_CARGO.lua' )
|
__Moose.Include( 'Scripts/Moose/Tasking/Task_CARGO.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Cargo_Transport.lua' )
|
__Moose.Include( 'Scripts/Moose/Tasking/Task_Cargo_Transport.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Cargo_CSAR.lua' )
|
__Moose.Include( 'Scripts/Moose/Tasking/Task_Cargo_CSAR.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Cargo_Dispatcher.lua' )
|
__Moose.Include( 'Scripts/Moose/Tasking/Task_Cargo_Dispatcher.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Capture_Zone.lua' )
|
__Moose.Include( 'Scripts/Moose/Tasking/Task_Capture_Zone.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Capture_Dispatcher.lua' )
|
__Moose.Include( 'Scripts/Moose/Tasking/Task_Capture_Dispatcher.lua' )
|
||||||
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Globals.lua' )
|
__Moose.Include( 'Scripts/Moose/Globals.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' )
|
||||||
File diff suppressed because it is too large
Load Diff
1561
Moose Development/Moose/Ops/AirWing.lua
Normal file
1561
Moose Development/Moose/Ops/AirWing.lua
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
2320
Moose Development/Moose/Ops/ArmyGroup.lua
Normal file
2320
Moose Development/Moose/Ops/ArmyGroup.lua
Normal file
File diff suppressed because it is too large
Load Diff
6793
Moose Development/Moose/Ops/Auftrag.lua
Normal file
6793
Moose Development/Moose/Ops/Auftrag.lua
Normal file
File diff suppressed because it is too large
Load Diff
6920
Moose Development/Moose/Ops/Awacs.lua
Normal file
6920
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%20-%20Brigade).
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
|
--
|
||||||
|
-- ### 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_GROUP:New():FilterCoalitions("blue"):FilterPrefixes("AID"):FilterCategoryGround():FilterOnce()
|
||||||
|
-- UTILS.SaveSetOfGroups(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.LoadSetOfGroups(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
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user