mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-13 01:06:45 +00:00
Compare commits
854 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3fac5ac9f0 | |||
| d83cabbab6 | |||
| 5f9d4405b1 | |||
| bdd9efa2cc | |||
| a778e910f7 | |||
| 24b09e22f7 | |||
| b40331b04e | |||
| 2d1fcb9be8 | |||
| 5fcd394ddd | |||
| 7a0f53ebf3 | |||
| a2580122de | |||
| a6de09a0ca | |||
| 5e3b50c158 | |||
| 2262f27d18 | |||
| 4668132b37 | |||
| 1fc526e80f | |||
| ceb77e2837 | |||
| 6f7a29d372 | |||
| 137f0251fb | |||
| e375f3a401 | |||
| 10986f8a0d | |||
| 16dc3860f7 | |||
| 1355f2f562 | |||
| e620062a95 | |||
| 333ed629bb | |||
| 813b9d90aa | |||
| c87e91d845 | |||
| 5fc39daa9d | |||
| 09372df86d | |||
| 7c0605e82f | |||
| a847d890ba | |||
| 778ae1b8e5 | |||
| 1f1ab1664c | |||
| 6df4fffafd | |||
| dade17a67f | |||
| 64be0ffee5 | |||
| 59ceb01d19 | |||
| 783e29f189 | |||
| 42d8a9f59d | |||
| 9e7caba089 | |||
| af39a3ae9c | |||
| 399f9883a9 | |||
| 9815216bd5 | |||
| ce01534535 | |||
| aec65209d0 | |||
| c985d40ca0 | |||
| d0ca76926e | |||
| 1fd15bcd4d | |||
| 90b588420f | |||
| 073e619015 | |||
| 3a0d2a5c51 | |||
| d9528292af | |||
| 07a76ced88 | |||
| 830dd05514 | |||
| ca7949d8c4 | |||
| a3805118a0 | |||
| 34fde09c12 | |||
| 983d518a69 | |||
| c14dec7412 | |||
| 78ab7547f3 | |||
| 2e6957984f | |||
| 433a66d530 | |||
| 7081448c40 | |||
| 7d3ad15f39 | |||
| c7c1bcfff4 | |||
| d0728afee7 | |||
| 4f25c9a408 | |||
| 01330bf00c | |||
| 01de638b8e | |||
| 3e8c7ad1df | |||
| 22c6a03161 | |||
| 7868a2e9de | |||
| b7db198125 | |||
| dd8b2caa24 | |||
| 1e4cfd473c | |||
| 4364cb8e53 | |||
| 044fb66ca0 | |||
| 84857d2a32 | |||
| cc17027a7a | |||
| 02db5ba532 | |||
| fc52e06318 | |||
| 0f5f2658a6 | |||
| 27d36f3e0d | |||
| 9ce1b90eb1 | |||
| 38c19b1442 | |||
| d3419d218a | |||
| 2f34526c55 | |||
| f9dcc9d95c | |||
| ebc355ee6a | |||
| a0b49fbd67 | |||
| ae213c4cf1 | |||
| 8dea86b921 | |||
| 44003a8fda | |||
| b883bb1e62 | |||
| db35a67bd7 | |||
| 1bfc98fa99 | |||
| efb687cbb5 | |||
| 668f12391e | |||
| dfaccd6aa5 | |||
| 2220f1829f | |||
| 76fde11f47 | |||
| bc5946c76e | |||
| 1f041a8acf | |||
| 892cb90d62 | |||
| 3d7172fdf7 | |||
| 3fa3644e1e | |||
| 28411d2093 | |||
| 26deaca166 | |||
| 1346317ad9 | |||
| e11bb71c2d | |||
| 95baed1aac | |||
| 3b364c7650 | |||
| 2a4e242eb2 | |||
| 39471212d3 | |||
| 8b2237d183 | |||
| 6c1a4f1e0d | |||
| abc26b1e5c | |||
| b338f486e5 | |||
| b761078c18 | |||
| 202d649085 | |||
| 616690391c | |||
| e1e0095d9b | |||
| 465c395294 | |||
| a8cbf81851 | |||
| 0e78e9c92b | |||
| 7c4d640690 | |||
| 73bddddba4 | |||
| 833206a3b5 | |||
| 743baac945 | |||
| 0764d076db | |||
| 504aa19c03 | |||
| 9a3effd063 | |||
| d4a49ae68b | |||
| ca1018f80b | |||
| b9bd8d88a9 | |||
| 21412e0061 | |||
| 5761e11157 | |||
| 7d3f1235e7 | |||
| 473001c95b | |||
| 532cc0b4df | |||
| 08fb4e3736 | |||
| 6b7e66efa5 | |||
| 18fd587ab0 | |||
| 5fd8139f00 | |||
| ac68744deb | |||
| cec02bc44f | |||
| a924a0b641 | |||
| ee15b04142 | |||
| 2c67a66d88 | |||
| 1fdb3b7daa | |||
| 181ed6046e | |||
| ba14330281 | |||
| 4c890d18d1 | |||
| 2eb4118d56 | |||
| 67d53034df | |||
| b4d1118c88 | |||
| dcc15afb89 | |||
| a5632ec3a4 | |||
| 0804a3567a | |||
| ef8c71d27c | |||
| 879ea847e9 | |||
| be3c418919 | |||
| be3db86470 | |||
| 67b43e2c68 | |||
| 577fefab3a | |||
| 2ad111dd50 | |||
| 2c749bf5c9 | |||
| 24eaa7441c | |||
| 523375c765 | |||
| ac42b56b8e | |||
| 82f4c9d526 | |||
| 5b8416d5fd | |||
| 874fa7ad69 | |||
| 2205100942 | |||
| 801475e146 | |||
| d7ee243a00 | |||
| a105ddba3d | |||
| 70c29de695 | |||
| d5ceabadb0 | |||
| 8bd39b41f4 | |||
| b263cddc07 | |||
| a712d74e2e | |||
| 613d33d731 | |||
| c7e694dfb8 | |||
| d6c9195555 | |||
| 50298e4109 | |||
| 1253e241ff | |||
| 3389d3284a | |||
| b10819220c | |||
| 244abe2bbb | |||
| 4b1a1cbcff | |||
| 378e76e45b | |||
| f7f28877da | |||
| e3d2dec91f | |||
| 470c4ef13c | |||
| 241b31fcec | |||
| 3dd069d7d6 | |||
| 77c4fd7696 | |||
| aca4e4d7ca | |||
| dcd278e2a1 | |||
| 2f81fcb0c0 | |||
| 8cf11de774 | |||
| b62f2afd8d | |||
| 176bd0eb8b | |||
| 70ee6a1121 | |||
| 10edd2f9d0 | |||
| 408321decf | |||
| 11acb578f6 | |||
| 383eff4cd6 | |||
| 6cda61c9dd | |||
| 4d8abe7f57 | |||
| c6bb7c8bbd | |||
| bd3042410b | |||
| 7c9cf96d2e | |||
| ef30bd36a5 | |||
| 5286926609 | |||
| ab14fbd11c | |||
| 5bde0c7605 | |||
| 4f2d8144e9 | |||
| cb61177252 | |||
| 736204d163 | |||
| 1e15509001 | |||
| cca6b0cf55 | |||
| bfa8719ec3 | |||
| fd0e6053ee | |||
| f99eac0de4 | |||
| 89b06fb7a6 | |||
| 3652376d42 | |||
| 3d1207a079 | |||
| 3953f0e7fc | |||
| 3e727f7777 | |||
| 5621579b5e | |||
| 091083b5aa | |||
| b0d0fb9ae1 | |||
| 57ce6bcec2 | |||
| 7a1cfa9fe3 | |||
| 71b5492903 | |||
| 5ff4d84a9a | |||
| c71d0ed7cf | |||
| d64dadd9a9 | |||
| 370bfc893d | |||
| 0f30f3b1a0 | |||
| 50e55e1df2 | |||
| 51911d3292 | |||
| bff60bdb69 | |||
| 219353faad | |||
| 4c4ecccb01 | |||
| 0e1cbe45b9 | |||
| aac3f64638 | |||
| 34937c2cf6 | |||
| 74c19f1058 | |||
| 42ca05af57 | |||
| 1cbdafda65 | |||
| 960746245f | |||
| 595b9132e8 | |||
| 4b50d8f16f | |||
| c320f1a0a7 | |||
| 82b5269040 | |||
| 45aebff48e | |||
| 80bf992806 | |||
| f2e22579ed | |||
| 2dc908d926 | |||
| 1f9725530f | |||
| d3e6b0366b | |||
| 1545add510 | |||
| c85f575888 | |||
| 9f8428c7ba | |||
| 5eef138507 | |||
| 8c6c1e481b | |||
| 14d6085b69 | |||
| d13173e336 | |||
| ced01a993d | |||
| fa80f0a162 | |||
| 02e59b23c5 | |||
| 80b2b26018 | |||
| e3f523d648 | |||
| 5b86bf9605 | |||
| c5ece16753 | |||
| 4c2a89ee29 | |||
| 4505b60859 | |||
| e8c75b8795 | |||
| 7e21a1070a | |||
| 2ce9f26e26 | |||
| bfaca9dd5f | |||
| 30819dad72 | |||
| e946916fc0 | |||
| 2eeca4451c | |||
| ee17d3e995 | |||
| a48e09b434 | |||
| 27ea85ea57 | |||
| 3baf52d307 | |||
| 0faa0036ee | |||
| 79189d4d93 | |||
| f859522052 | |||
| 8d886a75d6 | |||
| 5a772ad05e | |||
| a16e22818d | |||
| 0cc959bf34 | |||
| 2fcb31f3ac | |||
| aa948b57d8 | |||
| 6ca459b38c | |||
| 79da4cbf27 | |||
| e5a60a2ef1 | |||
| 7e2ae60e43 | |||
| 51f134538d | |||
| 0ee7a38c61 | |||
| 15dd2cf735 | |||
| e895642157 | |||
| 154026fbf8 | |||
| d7969e9455 | |||
| 7dcff7ec9c | |||
| 0e6bf1f46b | |||
| 67e52120d4 | |||
| 4b84d227f0 | |||
| 2fce93d925 | |||
| df0dbc9108 | |||
| db6354b60d | |||
| 4307ddcad3 | |||
| daa734009e | |||
| 86e13df303 | |||
| 65cf53ce28 | |||
| 2e167358bb | |||
| 78d1a215e4 | |||
| 14daca9a72 | |||
| 48dba742ad | |||
| 2ca847e845 | |||
| 11c74ddc17 | |||
| c38917fa2f | |||
| 1847a2372c | |||
| fd155f8277 | |||
| 531132e8a7 | |||
| 7464406a17 | |||
| bd5c1af335 | |||
| 53f556a4e6 | |||
| 0ddf8762c2 | |||
| 2893bfb290 | |||
| d984a1b142 | |||
| f10d676921 | |||
| f02b774242 | |||
| 5ede860361 | |||
| d0d52246f4 | |||
| 748aa131e4 | |||
| 1b4e170271 | |||
| a3d56b6d1b | |||
| 33bd928076 | |||
| 23df6bbc2a | |||
| f2fc321ded | |||
| 0b3fc515e0 | |||
| e50d54f6bc | |||
| 6e60a66d0c | |||
| 11f0b2899d | |||
| 581138b5bc | |||
| 0ce3a189c3 | |||
| 08f2c29014 | |||
| 9208d7a70d | |||
| 4076ff5bb5 | |||
| dcd4d0ab62 | |||
| 056b761ebc | |||
| 0532c54cd5 | |||
| 298c569f93 | |||
| 32dbb520d6 | |||
| 6af66db4c3 | |||
| ff84d682bd | |||
| d2b7d46227 | |||
| 58f4eead1c | |||
| f3bafd5803 | |||
| bb07e1935e | |||
| 2946c2e225 | |||
| 088436c5ce | |||
| 2e386be2f6 | |||
| 797bf0047b | |||
| 9c0c93507a | |||
| f29d055ca3 | |||
| baf7123364 | |||
| 1468641563 | |||
| f6b6a6a577 | |||
| 4d7d34b71f | |||
| 82bea9d5ff | |||
| 35d91c9c94 | |||
| 8b08942c4d | |||
| a44ad5c755 | |||
| b7236eeb58 | |||
| eb84ad3cee | |||
| 09933b307b | |||
| 91a34ac4d8 | |||
| 21babb548c | |||
| 11967bd608 | |||
| ea6e63dc9b | |||
| 28c8d99878 | |||
| 547579ffb0 | |||
| 4fda8cc5fb | |||
| 697042eac6 | |||
| 30d6936f1d | |||
| 4ac583e434 | |||
| b315375ade | |||
| becaf47a66 | |||
| e26647c2ca | |||
| 4ddd278471 | |||
| 72e31b90a9 | |||
| fa762fe0fc | |||
| aca5846209 | |||
| 4fd7d7cba9 | |||
| 677d888d96 | |||
| 06c3ca0079 | |||
| 9280a1224d | |||
| 406dbb707a | |||
| 4758af61c2 | |||
| 729c1f5e33 | |||
| fce7b07014 | |||
| 8386fe5f67 | |||
| 4696569f83 | |||
| 2c695e187f | |||
| 048ab6acfe | |||
| 84230e2360 | |||
| f2783c46c2 | |||
| ca9913e38b | |||
| df1bc5c55d | |||
| ff951c69d9 | |||
| e53a80783e | |||
| a1fb09285b | |||
| f2f7c88299 | |||
| e2bf1f727d | |||
| 65315251b5 | |||
| 2a9e98c21e | |||
| b40c1e4575 | |||
| 9ea8443286 | |||
| a9befc4d96 | |||
| f5d6d31b10 | |||
| 65fb22b6cc | |||
| d0346c4aa3 | |||
| 96da09b9e0 | |||
| c1d468b35f | |||
| 109270d717 | |||
| f80e7a2166 | |||
| 9b95e71d75 | |||
| de6c7d636b | |||
| f57beab6d2 | |||
| 29414bfd21 | |||
| 60b8a5f5af | |||
| db6dc7b77e | |||
| aaf3553597 | |||
| 4e50bd213c | |||
| c813e2dbc4 | |||
| 4c81333a0a | |||
| 761d83a68f | |||
| 3d93c268b3 | |||
| 79b1f1615f | |||
| d6a0fff993 | |||
| 8d45ea00e8 | |||
| 47f010cb28 | |||
| 2d17c4d21a | |||
| d14b7e8f4c | |||
| f76fa58a5f | |||
| d8b046491b | |||
| d9748ef147 | |||
| b20eb84d19 | |||
| 64d7946c06 | |||
| c8b36b8c99 | |||
| c2be4fbcf1 | |||
| b052fc6243 | |||
| 8385b1d21a | |||
| 58d9637c5d | |||
| d4f4465b0a | |||
| 5fe77956cb | |||
| e0a108e00d | |||
| d640acc7cc | |||
| acf37f6133 | |||
| 8dcd22f18c | |||
| 2d086a62f0 | |||
| 47ad2499d4 | |||
| 5d510807c9 | |||
| dd771a089c | |||
| 3f927b16e5 | |||
| 5ba8f9e0e8 | |||
| 833a0561c3 | |||
| 0338fd5d33 | |||
| ea2175bba8 | |||
| cf48b21073 | |||
| 0835022c5c | |||
| a70ad71689 | |||
| f306361317 | |||
| 0347e42fc7 | |||
| 7557e79c0c | |||
| 9cc32ff8dc | |||
| 1b7eef5419 | |||
| 029bdc3bd1 | |||
| b052d99349 | |||
| 93acd870ea | |||
| 4fe1318e7c | |||
| 93cdb92e76 | |||
| 6ffe69484c | |||
| 39b89d937e | |||
| 501ab70992 | |||
| b488d43d78 | |||
| 6ac46addf0 | |||
| 33259be4d9 | |||
| e4cea7b3c4 | |||
| 3bdf4b4c76 | |||
| 6f5f89a0ee | |||
| 46f70dd8a6 | |||
| e2e9bd7de0 | |||
| 1b01b89343 | |||
| 4e36ed170b | |||
| bf0ad93bf7 | |||
| a51afeda14 | |||
| e46b148721 | |||
| 8765ebe2c6 | |||
| b55b11be09 | |||
| 2a7dbad02a | |||
| aeac2eb3d7 | |||
| e83c8c3ee0 | |||
| d65042c640 | |||
| c72cdd8f0b | |||
| 7e2f8771b5 | |||
| 3ccfcdbd0f | |||
| 44b3f41ae4 | |||
| c5dec374c8 | |||
| 3f384d72ab | |||
| 1d5952b4a5 | |||
| 8eec7fcc9e | |||
| db7e94d879 | |||
| 16f3dcbbb4 | |||
| f482dac491 | |||
| f6f3189504 | |||
| 73fa021476 | |||
| 071554bfc5 | |||
| cd8abd97c5 | |||
| 1527b53c76 | |||
| e25eeee0cc | |||
| bbc7f7e14c | |||
| 0261020796 | |||
| b9830a8437 | |||
| 257530d421 | |||
| caaee4f551 | |||
| 5f7115f4fe | |||
| 9ec92a8fca | |||
| a14435ce54 | |||
| e82e4f7dd7 | |||
| c7ef270d4d | |||
| 7cc040c234 | |||
| 9227ba9ecd | |||
| a9a56b3738 | |||
| e7fb073bab | |||
| 0d1fc2fbf2 | |||
| f86b3505b2 | |||
| e89b921f3e | |||
| 0d18ce086c | |||
| 8fb126682f | |||
| 63a0224ea4 | |||
| ebe486c69a | |||
| 69fa6f4ee6 | |||
| 702ec75935 | |||
| 1c4e3cb801 | |||
| 465ec216ea | |||
| ab516e0cd8 | |||
| d803b51e84 | |||
| 53f89fd42c | |||
| c72f109553 | |||
| f2ba2022c2 | |||
| 92e03522db | |||
| 9716162739 | |||
| 4eea8fcadd | |||
| 5b37e7b249 | |||
| 5b7e0ce375 | |||
| 0ae9be49da | |||
| c250712e53 | |||
| bda4efc634 | |||
| 566ebb67e3 | |||
| e84e16f58b | |||
| 55ffe37a79 | |||
| 6c21dfa48c | |||
| b31fc3ed44 | |||
| 68548f4581 | |||
| 42fd2322d2 | |||
| 8382eb9cd8 | |||
| 585901dc7d | |||
| 2a7213c1b7 | |||
| f837e9dec7 | |||
| cd4fb0c6c5 | |||
| b8d44643c1 | |||
| 230d9d82bf | |||
| 47d01f18c1 | |||
| c089e56060 | |||
| 8a1c9c0e54 | |||
| 87f1a5ed0d | |||
| a4fd55e87d | |||
| d2d6fac7df | |||
| 5243a408cc | |||
| bc3f9ed7c0 | |||
| b224739df3 | |||
| 0f4162a9a9 | |||
| ff26e4d1dc | |||
| 6b270916c4 | |||
| 1f17fd89a4 | |||
| b3a006096c | |||
| a8e35a552d | |||
| 6903e252d2 | |||
| 6ee1afc670 | |||
| ff6704f123 | |||
| 3b8bbdd4c1 | |||
| c770f4cb68 | |||
| 7e5a97e7c7 | |||
| 9ce1d360d6 | |||
| f342ba758e | |||
| 6f473faa92 | |||
| dd37a42470 | |||
| 018d8eecf6 | |||
| fe9d841af5 | |||
| 88e1bbd60d | |||
| d0491b3b5a | |||
| e078e48853 | |||
| f789fbac70 | |||
| bc3a5271dc | |||
| 4d4b8862c2 | |||
| 31b75b7d17 | |||
| fac7a5fdc6 | |||
| cfca4fdc46 | |||
| cca5a5d55d | |||
| 3243c92331 | |||
| 49191fb144 | |||
| eab37d5e48 | |||
| f739062463 | |||
| e838431b28 | |||
| c22304f2b0 | |||
| 1c10bfea92 | |||
| c97d2ecaba | |||
| 2dc9f19d78 | |||
| 89a9d1d0a4 | |||
| cf7d41cd7f | |||
| fd191be274 | |||
| 31bdde130a | |||
| afe542cc63 | |||
| 494550fe91 | |||
| 29c0d81c27 | |||
| e79c2481da | |||
| 89a902fd57 | |||
| 460ad9db39 | |||
| ae604fd847 | |||
| 099f059eec | |||
| c3bba7d1fc | |||
| db71610d72 | |||
| 4b8d120f20 | |||
| 1dc31cc852 | |||
| 68b97773fe | |||
| 3c0e977584 | |||
| f03a48b118 | |||
| c489a88106 | |||
| a4704d0e2f | |||
| 4747dae51a | |||
| b1e8ba74a8 | |||
| 641707f37b | |||
| 7538f63c00 | |||
| 67924c894d | |||
| 52ed645f6c | |||
| 7c8f212b03 | |||
| 9f41cc51be | |||
| 85c73cb0a5 | |||
| 1b1f8e0d2c | |||
| f87126f22c | |||
| 6390b223b0 | |||
| b635490e47 | |||
| 62e8302753 | |||
| cac7b39823 | |||
| bfaf88f017 | |||
| cc79dc74d4 | |||
| af3c579a03 | |||
| a508c63279 | |||
| 427a11bd0f | |||
| 6f3133d48c | |||
| 4f4e8b17c1 | |||
| aa7f26ac79 | |||
| 084caad5d7 | |||
| 0850796368 | |||
| 343bf05c2c | |||
| ff58649954 | |||
| bbf793febe | |||
| 3e40d72e25 | |||
| 1c1daa4ebe | |||
| fdcda6e5f3 | |||
| a50dde7f2b | |||
| 1fb4cb1c4f | |||
| cd0f854f41 | |||
| 52c2401d93 | |||
| f071c674d0 | |||
| 02a87d9fe0 | |||
| 3c53f627c2 | |||
| 12d68a41ca | |||
| 2dfde7d1fd | |||
| c011d38313 | |||
| 6c4a64601f | |||
| 68350d6824 | |||
| 434f985e77 | |||
| 2e6cac7bee | |||
| ba1dcfcdba | |||
| b5965bbf81 | |||
| b346dabdf8 | |||
| a0429458d0 | |||
| 1376a16812 | |||
| 847dc1839f | |||
| 4267314260 | |||
| b5110c8554 | |||
| 0dd4da1db4 | |||
| 1f1d1e4f2f | |||
| 4d4f8e9d61 | |||
| 522eb8b256 | |||
| 6fe883a17a | |||
| b662ecc76b | |||
| fbbdac9b7e | |||
| 6dd69eb6db | |||
| 1b6aeff005 | |||
| de380614fb | |||
| 4287774d9f | |||
| bcbda4eb64 | |||
| f6fdff927b | |||
| 58ce4b001e | |||
| 6bba2fec0b | |||
| 5d2656d679 | |||
| 9a360a3bd5 | |||
| 217b8fe71e | |||
| 65a729a2d6 | |||
| 7868930fcb | |||
| 67248a290c | |||
| 32ae4986ca | |||
| 2a0086d3fe | |||
| 0bc52eb331 | |||
| 75a6a798ac | |||
| 067285f870 | |||
| 5353be482e | |||
| 8075be92a7 | |||
| 826ae86cb7 | |||
| f453619c78 | |||
| 475153be4c | |||
| ca20e059a6 | |||
| 2044068393 | |||
| 5f734a0d17 | |||
| 2c3e9e992d | |||
| ef27daa282 | |||
| 1b8c9367a3 | |||
| e36ade55d2 | |||
| 19047843cc | |||
| 2d631cba3f | |||
| 9ccfcb8fb1 | |||
| a8e58b8121 | |||
| dcc968c290 | |||
| 174454b8c5 | |||
| 36aa697936 | |||
| d30a53333c | |||
| 8bace684c2 | |||
| 30b89328f1 | |||
| aa5163fe3a | |||
| b38dc62be7 | |||
| 097e0a3214 | |||
| 6d9333aa94 | |||
| b5c9598cb0 | |||
| 6947bcfcf2 | |||
| bc454fdec2 | |||
| 166a7ab7db | |||
| db06154ad7 | |||
| f459372720 | |||
| f5d2439d69 | |||
| fa43a6c40b | |||
| 04c092b9ef | |||
| 7af920891d | |||
| 5056187fb9 | |||
| d9d333a7af | |||
| 72c5c2ee4d | |||
| 8f73a4c27c | |||
| 25936a526d | |||
| f4b83a97a9 | |||
| 8bc735288f | |||
| 3360f511ee | |||
| f64ec74d1c | |||
| b885ef7767 | |||
| f8afa1cb78 | |||
| 22f5104805 | |||
| e95eb2768d | |||
| 266e34a92d | |||
| f6091cd117 | |||
| 500a7f938f | |||
| f408c11506 | |||
| 9fafdea0bb | |||
| b4058ecab2 | |||
| 7306cc1102 | |||
| 21aadc14b1 | |||
| fbf2c4c721 | |||
| eed6119193 | |||
| 6db2e333ad | |||
| 9d3cb4cc1b | |||
| 0eb9dfc7de | |||
| 9d500186d1 | |||
| f80265786d | |||
| 4eb0f8e9ca | |||
| 5a583671a7 | |||
| 7b9d8d375d | |||
| 6406ce696b | |||
| e560c3ffdd | |||
| 7393cb2cbe | |||
| 74bd41743b | |||
| 56d4143a05 | |||
| 1093e55ea8 | |||
| bcbe872c7d | |||
| cc95c45fb0 | |||
| bf60c535bc | |||
| feb99e9405 | |||
| 6c36910ac7 | |||
| d60f20a162 | |||
| 9fde88d61a | |||
| 430b4a274c | |||
| dc26134845 | |||
| 5996426119 | |||
| 36d9460cdf | |||
| 0d9d0be0c3 | |||
| adad7ef901 | |||
| 1561f49c9c | |||
| bb6bb20179 | |||
| e032781a92 | |||
| 07cac604cf | |||
| aa7d0b1e25 | |||
| 28cb44874f | |||
| 13a8babe75 | |||
| 616f204f5b | |||
| 87dda49113 | |||
| 211e1b41b0 | |||
| 018830b539 | |||
| d92d2d07c5 | |||
| cd316e6719 | |||
| 046e49ac6b | |||
| 52e66ae969 | |||
| 0fb8fd8886 | |||
| ca15d7cb00 | |||
| 1086c61ccf | |||
| 77f9721102 | |||
| 059d8ccfc0 | |||
| bd9022c010 | |||
| 261a389ca5 | |||
| b05683d384 | |||
| 708838c404 | |||
| d7df08d754 | |||
| 974a56b135 | |||
| 92b21aa5c1 | |||
| 85c551cc59 | |||
| 0e2dff4e6b | |||
| f33ccee7b1 | |||
| 5c9e3570e2 | |||
| 7277221905 | |||
| 497ac367ba | |||
| 51102e47ae | |||
| 92e2414612 | |||
| 3ca4898860 | |||
| 7643568706 | |||
| e4d6e6d80e | |||
| 3684a023da | |||
| 99ebebe13c | |||
| b0c8f05f38 |
@@ -1,87 +0,0 @@
|
|||||||
version: 2.4.a.{build}
|
|
||||||
shallow_clone: true
|
|
||||||
skip_branch_with_pr: false
|
|
||||||
skip_commits:
|
|
||||||
message: /!nobuild/
|
|
||||||
skip_tags: false
|
|
||||||
|
|
||||||
environment:
|
|
||||||
access_token_documentation:
|
|
||||||
secure: JVBVVL8uJUcLXN+48eRdELEeCGOGCCaMzCqutsUqNuaZ/KblG5ZTt7+LV4UKv/0f
|
|
||||||
LUAROCKS_VER: 2.4.1
|
|
||||||
LUA_VER: 5.1.5
|
|
||||||
LUA: lua5.3
|
|
||||||
matrix:
|
|
||||||
- LUA_VER: 5.1.5
|
|
||||||
|
|
||||||
platform:
|
|
||||||
- x64
|
|
||||||
|
|
||||||
|
|
||||||
init:
|
|
||||||
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
|
|
||||||
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
|
|
||||||
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
|
|
||||||
throw "There are newer queued builds for this pull request, failing early." }
|
|
||||||
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
|
||||||
|
|
||||||
install:
|
|
||||||
- cmd:
|
|
||||||
# Outcomment if lua environment invalidates and needs to be reinstalled, otherwise all will run from the cache.
|
|
||||||
call choco install 7zip.commandline
|
|
||||||
call choco install lua51
|
|
||||||
call choco install luarocks
|
|
||||||
call refreshenv
|
|
||||||
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
|
|
||||||
cmd: PATH = %PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\bin
|
|
||||||
cmd: set LUA_PATH = %LUA_PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\share\lua\5.1\?.lua;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\share\lua\5.1\?\init.lua
|
|
||||||
cmd: set LUA_CPATH = %LUA_CPATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\lib\lua\5.1\?.dll
|
|
||||||
call luarocks install luasrcdiet
|
|
||||||
call luarocks install checks
|
|
||||||
call luarocks install luadocumentor
|
|
||||||
call luarocks install luacheck
|
|
||||||
|
|
||||||
|
|
||||||
cache:
|
|
||||||
C:\ProgramData\chocolatey\lib
|
|
||||||
C:\ProgramData\chocolatey\bin
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
build_script:
|
|
||||||
- ps: |
|
|
||||||
if( $env:appveyor_repo_branch -eq 'master' -or $env:appveyor_repo_branch -eq 'develop' )
|
|
||||||
{
|
|
||||||
echo "Hello World!"
|
|
||||||
$apiUrl = 'https://ci.appveyor.com/api'
|
|
||||||
$token = 'v2.6hcv3ige78kg3yvg4ge8'
|
|
||||||
$headers = @{
|
|
||||||
"Authorization" = "Bearer $token"
|
|
||||||
"Content-type" = "application/json"
|
|
||||||
}
|
|
||||||
$RequestBody = @{ accountName = 'FlightControl-Master'; projectSlug = 'moose-include'; branch = "$env:appveyor_repo_branch"; environmentVariables = @{} } | ConvertTo-Json
|
|
||||||
# Generate the new version ...
|
|
||||||
$project = Invoke-RestMethod -method Post -Uri "$apiUrl/builds" -Headers $headers -Body $RequestBody
|
|
||||||
}
|
|
||||||
- ps: |
|
|
||||||
if( $env:appveyor_repo_branch -eq 'master' -or $env:appveyor_repo_branch -eq 'develop' )
|
|
||||||
{
|
|
||||||
$apiUrl = 'https://ci.appveyor.com/api'
|
|
||||||
$token = 'v2.6hcv3ige78kg3yvg4ge8'
|
|
||||||
$headers = @{
|
|
||||||
"Authorization" = "Bearer $token"
|
|
||||||
"Content-type" = "application/json"
|
|
||||||
}
|
|
||||||
$RequestBody = @{ accountName = 'FlightControl-Master'; projectSlug = 'moose-docs'; branch = "$env:appveyor_repo_branch"; environmentVariables = @{} } | ConvertTo-Json
|
|
||||||
# get project with last build details
|
|
||||||
$project = Invoke-RestMethod -method Post -Uri "$apiUrl/builds" -Headers $headers -Body $RequestBody
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
test: off
|
|
||||||
# test_script:
|
|
||||||
# - cmd: luacheck "Moose Development\Moose\moose.lua" "Moose Mission Setup\moose.lua"
|
|
||||||
|
|
||||||
|
|
||||||
on_finish:
|
|
||||||
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
|
||||||
@@ -15,3 +15,7 @@
|
|||||||
*.PDF diff=astextplain
|
*.PDF diff=astextplain
|
||||||
*.rtf diff=astextplain
|
*.rtf diff=astextplain
|
||||||
*.RTF diff=astextplain
|
*.RTF diff=astextplain
|
||||||
|
|
||||||
|
# Avoid Windows line endings on shell scripts
|
||||||
|
# Needed for dockerfile builds
|
||||||
|
*.sh text eol=lf
|
||||||
|
|||||||
@@ -5,6 +5,15 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
- develop
|
- develop
|
||||||
|
paths:
|
||||||
|
- 'Moose Setup/**/*.lua'
|
||||||
|
- 'Moose Development/**/*.lua'
|
||||||
|
- 'Moose Development/**/*.py'
|
||||||
|
- 'Moose Development/**/*.html'
|
||||||
|
- '.github/workflows/build-docs.yml'
|
||||||
|
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Build:
|
Build:
|
||||||
@@ -48,6 +57,7 @@ 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
|
||||||
|
|||||||
@@ -5,6 +5,13 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
- develop
|
- develop
|
||||||
|
paths:
|
||||||
|
- 'Moose Setup/**/*.lua'
|
||||||
|
- 'Moose Development/**/*.lua'
|
||||||
|
- '.github/workflows/build-includes.yml'
|
||||||
|
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Build:
|
Build:
|
||||||
@@ -40,6 +47,7 @@ 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
|
||||||
@@ -88,10 +96,6 @@ 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
|
||||||
#########################################################################
|
#########################################################################
|
||||||
@@ -101,6 +105,10 @@ 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
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ on:
|
|||||||
branches: ["master"]
|
branches: ["master"]
|
||||||
paths:
|
paths:
|
||||||
- 'docs/**'
|
- 'docs/**'
|
||||||
- '.github/workflows/pages.yml'
|
- '.github/workflows/gh-pages.yml'
|
||||||
|
|
||||||
# Allows you to run this workflow manually from the Actions tab
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
@@ -33,7 +33,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- 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@v3
|
uses: actions/configure-pages@v4
|
||||||
- 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@v1
|
uses: actions/upload-pages-artifact@v3
|
||||||
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@v1
|
uses: actions/deploy-pages@v4
|
||||||
|
|
||||||
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@v3
|
uses: actions/setup-node@v4
|
||||||
- run: npm install linkinator
|
- run: npm install linkinator
|
||||||
- run: npx linkinator https://flightcontrol-master.github.io/MOOSE/ --recurse
|
- 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
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ local.properties
|
|||||||
## Ignore Visual Studio temporary files, build results, and
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
## files generated by popular Visual Studio add-ons.
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
|
||||||
|
.vscode
|
||||||
|
|
||||||
# User-specific files
|
# User-specific files
|
||||||
*.suo
|
*.suo
|
||||||
*.user
|
*.user
|
||||||
@@ -226,6 +228,9 @@ 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
|
||||||
|
|||||||
@@ -91,12 +91,12 @@
|
|||||||
-- An optional @{Core.Zone} can be set,
|
-- An optional @{Core.Zone} can be set,
|
||||||
-- that will define when the AI will engage with the detected airborne enemy targets.
|
-- that will define when the AI will engage with the detected airborne enemy targets.
|
||||||
-- Use the method @{#AI_A2A_CAP.SetEngageZone}() to define that Zone.
|
-- Use the method @{#AI_A2A_CAP.SetEngageZone}() to define that Zone.
|
||||||
--
|
--
|
||||||
-- # 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
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_A2A_CAP
|
-- @field #AI_A2A_CAP
|
||||||
@@ -123,7 +123,7 @@ function AI_A2A_CAP:New2( AICap, EngageMinSpeed, EngageMaxSpeed, EngageFloorAlti
|
|||||||
|
|
||||||
-- Multiple inheritance ... :-)
|
-- Multiple inheritance ... :-)
|
||||||
local AI_Air = AI_AIR:New( AICap )
|
local AI_Air = AI_AIR:New( AICap )
|
||||||
local AI_Air_Patrol = AI_AIR_PATROL:New( AI_Air, AICap, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType ) -- #AI_AIR_PATROL
|
local AI_Air_Patrol = AI_AIR_PATROL:New( AI_Air, AICap, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
||||||
local AI_Air_Engage = AI_AIR_ENGAGE:New( AI_Air_Patrol, AICap, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType )
|
local AI_Air_Engage = AI_AIR_ENGAGE:New( AI_Air_Patrol, AICap, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType )
|
||||||
local self = BASE:Inherit( self, AI_Air_Engage ) --#AI_A2A_CAP
|
local self = BASE:Inherit( self, AI_Air_Engage ) --#AI_A2A_CAP
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [AID-A2A - AI A2A Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-A2A%20-%20AI%20A2A%20Dispatching)
|
-- [AID-A2A - AI A2A Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -176,12 +176,12 @@
|
|||||||
-- Per one, two, three, four?
|
-- Per one, two, three, four?
|
||||||
--
|
--
|
||||||
-- **The default grouping is 1. That means, that each spawned defender will act individually.**
|
-- **The default grouping is 1. That means, that each spawned defender will act individually.**
|
||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # 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
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Authors: **FlightControl** rework of GCICAP + introduction of new concepts (squadrons).
|
-- ### Authors: **FlightControl** rework of GCICAP + introduction of new concepts (squadrons).
|
||||||
@@ -310,7 +310,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
-- Use the method @{#AI_A2A_DISPATCHER.SetEngageRadius}() to set a specific Engage Radius.
|
-- Use the method @{#AI_A2A_DISPATCHER.SetEngageRadius}() to set a specific Engage Radius.
|
||||||
-- **The Engage Radius is defined for ALL squadrons which are operational.**
|
-- **The Engage Radius is defined for ALL squadrons which are operational.**
|
||||||
--
|
--
|
||||||
-- Demonstration Mission: [AID-019 - AI_A2A - Engage Range Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/release-2-2-pre/AID%20-%20AI%20Dispatching/AID-019%20-%20AI_A2A%20-%20Engage%20Range%20Test)
|
-- Demonstration Mission: [AID-019 - AI_A2A - Engage Range Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher/AID-A2A-019%20-%20Engage%20Range%20Test)
|
||||||
--
|
--
|
||||||
-- In this example an Engage Radius is set to various values.
|
-- In this example an Engage Radius is set to various values.
|
||||||
--
|
--
|
||||||
@@ -333,7 +333,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
-- Use the method @{#AI_A2A_DISPATCHER.SetGciRadius}() to set a specific controlled ground intercept radius.
|
-- Use the method @{#AI_A2A_DISPATCHER.SetGciRadius}() to set a specific controlled ground intercept radius.
|
||||||
-- **The Ground Controlled Intercept radius is defined for ALL squadrons which are operational.**
|
-- **The Ground Controlled Intercept radius is defined for ALL squadrons which are operational.**
|
||||||
--
|
--
|
||||||
-- Demonstration Mission: [AID-013 - AI_A2A - Intercept Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/release-2-2-pre/AID%20-%20AI%20Dispatching/AID-013%20-%20AI_A2A%20-%20Intercept%20Test)
|
-- Demonstration Mission: [AID-013 - AI_A2A - Intercept Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher/AID-A2A-013%20-%20Intercept%20Test)
|
||||||
--
|
--
|
||||||
-- In these examples, the Gci Radius is set to various values:
|
-- In these examples, the Gci Radius is set to various values:
|
||||||
--
|
--
|
||||||
@@ -366,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/release-2-2-pre/AID%20-%20AI%20Dispatching/AID-009 - AI_A2A - Border Test)
|
-- Demonstration Mission: [AID-009 - AI_A2A - Border Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher/AID-A2A-009%20-%20Border%20Test)
|
||||||
--
|
--
|
||||||
-- In this example a border is set for the CCCP A2A dispatcher:
|
-- In this example a border is set for the CCCP A2A dispatcher:
|
||||||
--
|
--
|
||||||
@@ -1151,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:I( "Captured " .. AirbaseName )
|
self:T( "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:I( "Squadron " .. SquadronName .. " captured." )
|
self:T( "Squadron " .. SquadronName .. " captured." )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1233,7 +1233,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
--
|
--
|
||||||
-- **Use the method @{#AI_A2A_DISPATCHER.SetEngageRadius}() to modify the default Engage Radius for ALL squadrons.**
|
-- **Use the method @{#AI_A2A_DISPATCHER.SetEngageRadius}() to modify the default Engage Radius for ALL squadrons.**
|
||||||
--
|
--
|
||||||
-- Demonstration Mission: [AID-019 - AI_A2A - Engage Range Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/release-2-2-pre/AID%20-%20AI%20Dispatching/AID-019%20-%20AI_A2A%20-%20Engage%20Range%20Test)
|
-- Demonstration Mission: [AID-019 - AI_A2A - Engage Range Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher/AID-A2A-019%20-%20Engage%20Range%20Test)
|
||||||
--
|
--
|
||||||
-- @param #AI_A2A_DISPATCHER self
|
-- @param #AI_A2A_DISPATCHER self
|
||||||
-- @param #number EngageRadius (Optional, Default = 100000) The radius to report friendlies near the target.
|
-- @param #number EngageRadius (Optional, Default = 100000) The radius to report friendlies near the target.
|
||||||
@@ -1283,7 +1283,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
-- Use the method @{#AI_A2A_DISPATCHER.SetGciRadius}() to set a specific controlled ground intercept radius.
|
-- Use the method @{#AI_A2A_DISPATCHER.SetGciRadius}() to set a specific controlled ground intercept radius.
|
||||||
-- **The Ground Controlled Intercept radius is defined for ALL squadrons which are operational.**
|
-- **The Ground Controlled Intercept radius is defined for ALL squadrons which are operational.**
|
||||||
--
|
--
|
||||||
-- Demonstration Mission: [AID-013 - AI_A2A - Intercept Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/release-2-2-pre/AID%20-%20AI%20Dispatching/AID-013%20-%20AI_A2A%20-%20Intercept%20Test)
|
-- Demonstration Mission: [AID-013 - AI_A2A - Intercept Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher/AID-A2A-013%20-%20Intercept%20Test)
|
||||||
--
|
--
|
||||||
-- @param #AI_A2A_DISPATCHER self
|
-- @param #AI_A2A_DISPATCHER self
|
||||||
-- @param #number GciRadius (Optional, Default = 200000) The radius to ground control intercept detected targets from the nearest airbase.
|
-- @param #number GciRadius (Optional, Default = 200000) The radius to ground control intercept detected targets from the nearest airbase.
|
||||||
@@ -1828,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:I( { CAP = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, Zone, PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageAltType } } )
|
self:T( { CAP = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, Zone, PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageAltType } } )
|
||||||
|
|
||||||
-- Add the CAP to the EWR network.
|
-- Add the CAP to the EWR network.
|
||||||
|
|
||||||
@@ -2085,7 +2085,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
Intercept.EngageCeilingAltitude = EngageCeilingAltitude
|
Intercept.EngageCeilingAltitude = EngageCeilingAltitude
|
||||||
Intercept.EngageAltType = EngageAltType
|
Intercept.EngageAltType = EngageAltType
|
||||||
|
|
||||||
self:I( { GCI = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
self:T( { GCI = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set squadron GCI.
|
--- Set squadron GCI.
|
||||||
@@ -3000,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:I("***** AI_A2A_DISPATCHER:CountDefendersToBeEngaged() *****\nThis is supposed to be a UNIT:")
|
--self:T("***** AI_A2A_DISPATCHER:CountDefendersToBeEngaged() *****\nThis is supposed to be a UNIT:")
|
||||||
if AIFriendly then
|
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:I("Class Name: " .. classname)
|
--self:T("Class Name: " .. classname)
|
||||||
--self:I("Unit Name: " .. unitname)
|
--self:T("Unit Name: " .. unitname)
|
||||||
--self:I({AIFriendly})
|
--self:T({AIFriendly})
|
||||||
end
|
end
|
||||||
local Friendly = nil
|
local Friendly = nil
|
||||||
if AIFriendly and AIFriendly:IsAlive() then
|
if AIFriendly and AIFriendly:IsAlive() then
|
||||||
--self:I("AIFriendly alive, getting GROUP")
|
--self:T("AIFriendly alive, getting GROUP")
|
||||||
Friendly = AIFriendly:GetGroup() -- Wrapper.Group#GROUP
|
Friendly = AIFriendly:GetGroup() -- Wrapper.Group#GROUP
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -3257,7 +3257,8 @@ do -- AI_A2A_DISPATCHER
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_A2A_DISPATCHER self
|
--- AI_A2A_Fsm:onafterHome
|
||||||
|
-- @param #AI_A2A_DISPATCHER self
|
||||||
function AI_A2A_Fsm:onafterHome( Defender, From, Event, To, Action )
|
function AI_A2A_Fsm:onafterHome( Defender, From, Event, To, Action )
|
||||||
if Defender and Defender:IsAlive() then
|
if Defender and Defender:IsAlive() then
|
||||||
self:F( { "CAP Home", Defender:GetName() } )
|
self:F( { "CAP Home", Defender:GetName() } )
|
||||||
@@ -3505,7 +3506,8 @@ do -- AI_A2A_DISPATCHER
|
|||||||
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_A2A_DISPATCHER self
|
--- function Fsm:onafterLostControl
|
||||||
|
-- @param #AI_A2A_DISPATCHER self
|
||||||
function Fsm:onafterLostControl( Defender, From, Event, To )
|
function Fsm:onafterLostControl( Defender, From, Event, To )
|
||||||
self:F( { "GCI LostControl", Defender:GetName() } )
|
self:F( { "GCI LostControl", Defender:GetName() } )
|
||||||
self:GetParent( self ).onafterHome( self, Defender, From, Event, To )
|
self:GetParent( self ).onafterHome( self, Defender, From, Event, To )
|
||||||
@@ -3518,7 +3520,8 @@ do -- AI_A2A_DISPATCHER
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_A2A_DISPATCHER self
|
--- function Fsm:onafterHome
|
||||||
|
-- @param #AI_A2A_DISPATCHER self
|
||||||
function Fsm:onafterHome( DefenderGroup, From, Event, To, Action )
|
function Fsm:onafterHome( DefenderGroup, From, Event, To, Action )
|
||||||
self:F( { "GCI Home", DefenderGroup:GetName() } )
|
self:F( { "GCI Home", DefenderGroup:GetName() } )
|
||||||
self:GetParent( self ).onafterHome( self, DefenderGroup, From, Event, To )
|
self:GetParent( self ).onafterHome( self, DefenderGroup, From, Event, To )
|
||||||
@@ -3949,7 +3952,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.
|
||||||
@@ -3959,7 +3962,7 @@ do
|
|||||||
--
|
--
|
||||||
-- # Demo Missions
|
-- # Demo Missions
|
||||||
--
|
--
|
||||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-A2A%20-%20AI%20A2A%20Dispatching)
|
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -4319,23 +4322,23 @@ do
|
|||||||
|
|
||||||
-- Setup squadrons
|
-- Setup squadrons
|
||||||
|
|
||||||
self:I( { Airbases = AirbaseNames } )
|
self:T( { Airbases = AirbaseNames } )
|
||||||
|
|
||||||
self:I( "Defining Templates for Airbases ..." )
|
self:T( "Defining Templates for Airbases ..." )
|
||||||
for AirbaseID, AirbaseName in pairs( AirbaseNames ) do
|
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:I( { Airbase = AirbaseName } )
|
self:T( { 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:I( { Template = Template:GetName() } )
|
self:T( { Template = Template:GetName() } )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if Templates then
|
if Templates then
|
||||||
@@ -4351,13 +4354,13 @@ do
|
|||||||
self.CAPTemplates:FilterPrefixes( CapPrefixes )
|
self.CAPTemplates:FilterPrefixes( CapPrefixes )
|
||||||
self.CAPTemplates:FilterOnce()
|
self.CAPTemplates:FilterOnce()
|
||||||
|
|
||||||
self:I( "Setting up CAP ..." )
|
self:T( "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:I( { CAPZoneGroup = CAPID } )
|
self:T( { 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()
|
||||||
@@ -4365,7 +4368,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:I( { AirbaseDistance = Distance } )
|
self:T( { AirbaseDistance = Distance } )
|
||||||
if Distance < AirbaseDistance then
|
if Distance < AirbaseDistance then
|
||||||
AirbaseDistance = Distance
|
AirbaseDistance = Distance
|
||||||
AirbaseClosest = Airbase
|
AirbaseClosest = Airbase
|
||||||
@@ -4373,7 +4376,7 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if AirbaseClosest then
|
if AirbaseClosest then
|
||||||
self:I( { CAPAirbase = AirbaseClosest:GetName() } )
|
self:T( { CAPAirbase = AirbaseClosest:GetName() } )
|
||||||
self:SetSquadronCap( AirbaseClosest:GetName(), CAPZone, 6000, 10000, 500, 800, 800, 1200, "RADIO" )
|
self: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
|
||||||
@@ -4381,14 +4384,14 @@ do
|
|||||||
|
|
||||||
-- Setup GCI.
|
-- Setup GCI.
|
||||||
-- GCI is setup for all Squadrons.
|
-- GCI is setup for all Squadrons.
|
||||||
self:I( "Setting up GCI ..." )
|
self:T( "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:I( { GCIAirbase = AirbaseName } )
|
self:T( { GCIAirbase = AirbaseName } )
|
||||||
self:SetSquadronGci( AirbaseName, 800, 1200 )
|
self:SetSquadronGci( AirbaseName, 800, 1200 )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -14,47 +14,31 @@
|
|||||||
|
|
||||||
|
|
||||||
--- @type AI_A2A_GCI
|
--- @type AI_A2A_GCI
|
||||||
-- @extends AI.AI_A2A#AI_A2A
|
-- @extends AI.AI_Air_Engage#AI_AIR_ENGAGE
|
||||||
|
|
||||||
|
|
||||||
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
|
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- The AI_A2A_GCI is assigned a @{Wrapper.Group} and this must be done before the AI_A2A_GCI process can be started using the **Start** event.
|
-- The AI_A2A_GCI is assigned a @{Wrapper.Group} and this must be done before the AI_A2A_GCI process can be started using the **Start** event.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits.
|
-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits.
|
||||||
-- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits.
|
-- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- This cycle will continue.
|
-- This cycle will continue.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- During the patrol, the AI will detect enemy targets, which are reported through the **Detected** event.
|
-- During the patrol, the AI will detect enemy targets, which are reported through the **Detected** event.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- When enemies are detected, the AI will automatically engage the enemy.
|
-- When enemies are detected, the AI will automatically engage the enemy.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- Until a fuel or damage threshold has been reached by the AI, or when the AI is commanded to RTB.
|
-- Until a fuel or damage threshold has been reached by the AI, or when the AI is commanded to RTB.
|
||||||
-- When the fuel threshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
|
-- When the fuel threshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- ## 1. AI_A2A_GCI constructor
|
-- ## 1. AI_A2A_GCI constructor
|
||||||
--
|
--
|
||||||
-- * @{#AI_A2A_GCI.New}(): Creates a new AI_A2A_GCI object.
|
-- * @{#AI_A2A_GCI.New}(): Creates a new AI_A2A_GCI object.
|
||||||
--
|
--
|
||||||
-- ## 2. AI_A2A_GCI is a FSM
|
-- ## 2. AI_A2A_GCI is a FSM
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- ### 2.1 AI_A2A_GCI States
|
-- ### 2.1 AI_A2A_GCI States
|
||||||
--
|
--
|
||||||
-- * **None** ( Group ): The process is not started yet.
|
-- * **None** ( Group ): The process is not started yet.
|
||||||
@@ -75,29 +59,11 @@
|
|||||||
-- * **@{#AI_A2A_GCI.Destroyed}**: The AI has destroyed all bogeys @{Wrapper.Unit}s assigned in the CAS task.
|
-- * **@{#AI_A2A_GCI.Destroyed}**: The AI has destroyed all bogeys @{Wrapper.Unit}s assigned in the CAS task.
|
||||||
-- * **Status** ( Group ): The AI is checking status (fuel and damage). When the thresholds have been reached, the AI will RTB.
|
-- * **Status** ( Group ): The AI is checking status (fuel and damage). When the thresholds have been reached, the AI will RTB.
|
||||||
--
|
--
|
||||||
-- ## 3. Set the Range of Engagement
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
-- 
|
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
||||||
|
-- Therefore, this class is considered to be deprecated
|
||||||
--
|
--
|
||||||
-- An optional range can be set in meters,
|
|
||||||
-- that will define when the AI will engage with the detected airborne enemy targets.
|
|
||||||
-- The range can be beyond or smaller than the range of the Patrol Zone.
|
|
||||||
-- The range is applied at the position of the AI.
|
|
||||||
-- Use the method @{AI.AI_GCI#AI_A2A_GCI.SetEngageRange}() to define that range.
|
|
||||||
--
|
|
||||||
-- ## 4. Set the Zone of Engagement
|
|
||||||
--
|
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- An optional @{Core.Zone} can be set,
|
|
||||||
-- that will define when the AI will engage with the detected airborne enemy targets.
|
|
||||||
-- Use the method @{AI.AI_CAP#AI_CAP_ZONE.SetEngageZone}() to define that Zone.
|
|
||||||
--
|
|
||||||
-- # Developer Note
|
|
||||||
--
|
|
||||||
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
|
||||||
-- Therefore, this class is considered to be deprecated
|
|
||||||
--
|
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_A2A_GCI
|
-- @field #AI_A2A_GCI
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
|
|
||||||
--- @type AI_A2A_PATROL
|
--- @type AI_A2A_PATROL
|
||||||
-- @extends AI.AI_A2A#AI_A2A
|
-- @extends AI.AI_Air_Patrol#AI_AIR_PATROL
|
||||||
|
|
||||||
--- Implements the core functions to patrol a @{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}.
|
||||||
--
|
--
|
||||||
@@ -111,12 +111,12 @@
|
|||||||
-- When the AI is damaged, it is required that a new Patrol is started. However, damage cannon be foreseen early on.
|
-- When the AI is damaged, it is required that a new Patrol is started. However, damage cannon be foreseen early on.
|
||||||
-- Therefore, when the damage threshold is reached, the AI will return immediately to the home base (RTB).
|
-- Therefore, when the damage threshold is reached, the AI will return immediately to the home base (RTB).
|
||||||
-- Use the method @{#AI_A2A_PATROL.ManageDamage}() to have this proces in place.
|
-- Use the method @{#AI_A2A_PATROL.ManageDamage}() to have this proces in place.
|
||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # 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
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_A2A_PATROL
|
-- @field #AI_A2A_PATROL
|
||||||
|
|||||||
@@ -12,15 +12,16 @@
|
|||||||
-- @image AI_Air_To_Ground_Engage.JPG
|
-- @image AI_Air_To_Ground_Engage.JPG
|
||||||
|
|
||||||
--- @type AI_A2G_BAI
|
--- @type AI_A2G_BAI
|
||||||
-- @extends AI.AI_A2A_Engage#AI_A2A_Engage -- TODO: Documentation. This class does not exist, unable to determine what it extends.
|
-- @extends AI.AI_Air_Patrol#AI_AIR_PATROL
|
||||||
|
-- @extends AI.AI_Air_Engage#AI_AIR_ENGAGE
|
||||||
|
|
||||||
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
|
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
|
||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # 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
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_A2G_BAI
|
-- @field #AI_A2G_BAI
|
||||||
@@ -46,7 +47,7 @@ AI_A2G_BAI = {
|
|||||||
function AI_A2G_BAI:New2( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
function AI_A2G_BAI:New2( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
||||||
|
|
||||||
local AI_Air = AI_AIR:New( AIGroup )
|
local AI_Air = AI_AIR:New( AIGroup )
|
||||||
local AI_Air_Patrol = AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType ) -- #AI_AIR_PATROL
|
local AI_Air_Patrol = AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
||||||
local AI_Air_Engage = AI_AIR_ENGAGE:New( AI_Air_Patrol, AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType )
|
local AI_Air_Engage = AI_AIR_ENGAGE:New( AI_Air_Patrol, AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType )
|
||||||
local self = BASE:Inherit( self, AI_Air_Engage )
|
local self = BASE:Inherit( self, AI_Air_Engage )
|
||||||
|
|
||||||
|
|||||||
@@ -12,15 +12,16 @@
|
|||||||
-- @image AI_Air_To_Ground_Engage.JPG
|
-- @image AI_Air_To_Ground_Engage.JPG
|
||||||
|
|
||||||
--- @type AI_A2G_CAS
|
--- @type AI_A2G_CAS
|
||||||
-- @extends AI.AI_A2G_Patrol#AI_AIR_PATROL TODO: Documentation. This class does not exist, unable to determine what it extends.
|
-- @extends AI.AI_Air_Patrol#AI_AIR_PATROL
|
||||||
|
-- @extends AI.AI_Air_Engage#AI_AIR_ENGAGE
|
||||||
|
|
||||||
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
|
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
|
||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # 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
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_A2G_CAS
|
-- @field #AI_A2G_CAS
|
||||||
@@ -46,7 +47,7 @@ AI_A2G_CAS = {
|
|||||||
function AI_A2G_CAS:New2( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
function AI_A2G_CAS:New2( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
||||||
|
|
||||||
local AI_Air = AI_AIR:New( AIGroup )
|
local AI_Air = AI_AIR:New( AIGroup )
|
||||||
local AI_Air_Patrol = AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType ) -- #AI_AIR_PATROL
|
local AI_Air_Patrol = AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
||||||
local AI_Air_Engage = AI_AIR_ENGAGE:New( AI_Air_Patrol, AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType )
|
local AI_Air_Engage = AI_AIR_ENGAGE:New( AI_Air_Patrol, AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType )
|
||||||
local self = BASE:Inherit( self, AI_Air_Engage )
|
local self = BASE:Inherit( self, AI_Air_Engage )
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [AID-A2G - AI A2G Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-A2G%20-%20AI%20A2G%20Dispatching)
|
-- [AID-A2G - AI A2G Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2G_Dispatcher)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -253,12 +253,12 @@
|
|||||||
--
|
--
|
||||||
-- **The default grouping is 1. That means, that each spawned defender will act individually.**
|
-- **The default grouping is 1. That means, that each spawned defender will act individually.**
|
||||||
-- But you can specify a number between 1 and 4, so that the defenders will act as a group.
|
-- But you can specify a number between 1 and 4, so that the defenders will act as a group.
|
||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # 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
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **FlightControl** rework of GCICAP + introduction of new concepts (squadrons).
|
-- ### Author: **FlightControl** rework of GCICAP + introduction of new concepts (squadrons).
|
||||||
@@ -296,8 +296,6 @@ do -- AI_A2G_DISPATCHER
|
|||||||
--
|
--
|
||||||
-- ## 1. AI\_A2G\_DISPATCHER constructor:
|
-- ## 1. AI\_A2G\_DISPATCHER constructor:
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
--
|
--
|
||||||
-- The @{#AI_A2G_DISPATCHER.New}() method creates a new AI_A2G_DISPATCHER instance.
|
-- The @{#AI_A2G_DISPATCHER.New}() method creates a new AI_A2G_DISPATCHER instance.
|
||||||
--
|
--
|
||||||
@@ -311,8 +309,6 @@ do -- AI_A2G_DISPATCHER
|
|||||||
-- A reconnaissance network, is used to detect enemy ground targets,
|
-- A reconnaissance network, is used to detect enemy ground targets,
|
||||||
-- potentially group them into areas, and to understand the position, level of threat of the enemy.
|
-- potentially group them into areas, and to understand the position, level of threat of the enemy.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- As explained in the introduction, depending on the type of mission you want to achieve, different types of units can be applied to detect ground enemy targets.
|
-- As explained in the introduction, depending on the type of mission you want to achieve, different types of units can be applied to detect ground enemy targets.
|
||||||
-- Ground based units are very useful to act as a reconnaissance, but they lack sometimes the visibility to detect targets at greater range.
|
-- Ground based units are very useful to act as a reconnaissance, but they lack sometimes the visibility to detect targets at greater range.
|
||||||
-- Recce are very useful to acquire the position of enemy ground targets when spread out over the battlefield at strategic positions.
|
-- Recce are very useful to acquire the position of enemy ground targets when spread out over the battlefield at strategic positions.
|
||||||
@@ -686,8 +682,6 @@ do -- AI_A2G_DISPATCHER
|
|||||||
--
|
--
|
||||||
-- Use the method @{#AI_A2G_DISPATCHER.SetSquadronGrouping}() to set the grouping of aircraft when spawned in.
|
-- Use the method @{#AI_A2G_DISPATCHER.SetSquadronGrouping}() to set the grouping of aircraft when spawned in.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- In the case of **on call** engagement, the @{#AI_A2G_DISPATCHER.SetSquadronGrouping}() method has additional behaviour.
|
-- In the case of **on call** engagement, the @{#AI_A2G_DISPATCHER.SetSquadronGrouping}() method has additional behaviour.
|
||||||
-- When there aren't enough patrol flights airborne, a on call will be initiated for the remaining
|
-- When there aren't enough patrol flights airborne, a on call will be initiated for the remaining
|
||||||
-- targets to be engaged. Depending on the grouping parameter, the spawned flights for on call aircraft are grouped into this setting.
|
-- targets to be engaged. Depending on the grouping parameter, the spawned flights for on call aircraft are grouped into this setting.
|
||||||
@@ -701,8 +695,6 @@ do -- AI_A2G_DISPATCHER
|
|||||||
-- The effectiveness can be set with the **overhead parameter**. This is a number that is used to calculate the amount of Units that dispatching command will allocate to GCI in surplus of detected amount of units.
|
-- The effectiveness can be set with the **overhead parameter**. This is a number that is used to calculate the amount of Units that dispatching command will allocate to GCI in surplus of detected amount of units.
|
||||||
-- The **default value** of the overhead parameter is 1.0, which means **equal balance**.
|
-- The **default value** of the overhead parameter is 1.0, which means **equal balance**.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- However, depending on the (type of) aircraft (strength and payload) in the squadron and the amount of resources available, this parameter can be changed.
|
-- However, depending on the (type of) aircraft (strength and payload) in the squadron and the amount of resources available, this parameter can be changed.
|
||||||
--
|
--
|
||||||
-- The @{#AI_A2G_DISPATCHER.SetSquadronOverhead}() method can be used to tweak the defense strength,
|
-- The @{#AI_A2G_DISPATCHER.SetSquadronOverhead}() method can be used to tweak the defense strength,
|
||||||
@@ -848,8 +840,6 @@ do -- AI_A2G_DISPATCHER
|
|||||||
--
|
--
|
||||||
-- For example, the following setup will set the default refuel tanker to "Tanker":
|
-- For example, the following setup will set the default refuel tanker to "Tanker":
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- -- Set the default tanker for refuelling to "Tanker", when the default fuel threshold has reached 90% fuel left.
|
-- -- Set the default tanker for refuelling to "Tanker", when the default fuel threshold has reached 90% fuel left.
|
||||||
-- A2GDispatcher:SetDefaultFuelThreshold( 0.9 )
|
-- A2GDispatcher:SetDefaultFuelThreshold( 0.9 )
|
||||||
-- A2GDispatcher:SetDefaultTanker( "Tanker" )
|
-- A2GDispatcher:SetDefaultTanker( "Tanker" )
|
||||||
@@ -914,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.
|
||||||
@@ -952,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.
|
||||||
@@ -1146,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 )
|
||||||
@@ -1157,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:I( "Parked resources for squadron " .. DefenderSquadron.Name )
|
self:T( "Parked resources for squadron " .. DefenderSquadron.Name )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -1211,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
|
||||||
@@ -1228,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:I( "Captured " .. AirbaseName )
|
self:T( "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:I( "Squadron " .. SquadronName .. " captured." )
|
self:T( "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" )
|
||||||
@@ -1271,7 +1261,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||||
end
|
end
|
||||||
DefenderUnit:Destroy()
|
DefenderUnit:Destroy()
|
||||||
self:ResourcePark( Squadron, Defender )
|
self:ResourcePark( Squadron )
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if DefenderUnit:GetLife() ~= DefenderUnit:GetLife0() then
|
if DefenderUnit:GetLife() ~= DefenderUnit:GetLife0() then
|
||||||
@@ -1283,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
|
||||||
@@ -1299,7 +1289,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||||
end
|
end
|
||||||
DefenderUnit:Destroy()
|
DefenderUnit:Destroy()
|
||||||
self:ResourcePark( Squadron, Defender )
|
self:ResourcePark( Squadron )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1307,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 )
|
||||||
@@ -1315,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
|
||||||
@@ -1361,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 **400000** or **40km**. Override the default defense radius when the era of the warfare is early, or,
|
-- The **default** defense radius is defined as **40000** or **40km**. Override the default defense radius when the era of the warfare is early, or,
|
||||||
-- when you don't want to let the AI_A2G_DISPATCHER react immediately when a certain border or area is not being crossed.
|
-- 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 = 200000) The defense radius to engage detected targets from the nearest capable and available squadron airbase.
|
-- @param #number DefenseRadius (Optional, Default = 20000) The defense radius to engage detected targets from the nearest capable and available squadron airbase.
|
||||||
-- @return #AI_A2G_DISPATCHER
|
-- @return #AI_A2G_DISPATCHER
|
||||||
-- @usage
|
-- @usage
|
||||||
--
|
--
|
||||||
@@ -1383,7 +1373,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
--
|
--
|
||||||
function AI_A2G_DISPATCHER:SetDefenseRadius( DefenseRadius )
|
function AI_A2G_DISPATCHER:SetDefenseRadius( DefenseRadius )
|
||||||
|
|
||||||
self.DefenseRadius = DefenseRadius or 100000
|
self.DefenseRadius = DefenseRadius or 40000
|
||||||
|
|
||||||
self.Detection:SetAcceptRange( self.DefenseRadius )
|
self.Detection:SetAcceptRange( self.DefenseRadius )
|
||||||
|
|
||||||
@@ -1878,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
|
||||||
@@ -2154,7 +2144,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
Sead.EngageAltType = EngageAltType
|
Sead.EngageAltType = EngageAltType
|
||||||
Sead.Defend = true
|
Sead.Defend = true
|
||||||
|
|
||||||
self:I( { SEAD = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
self:T( { SEAD = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -2244,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:I( { SEAD = { Zone:GetName(), PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
self:T( { SEAD = { Zone:GetName(), PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -2305,7 +2295,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
Cas.EngageAltType = EngageAltType
|
Cas.EngageAltType = EngageAltType
|
||||||
Cas.Defend = true
|
Cas.Defend = true
|
||||||
|
|
||||||
self:I( { CAS = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
self:T( { CAS = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -2395,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:I( { CAS = { Zone:GetName(), PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
self:T( { CAS = { Zone:GetName(), PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -2456,7 +2446,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
Bai.EngageAltType = EngageAltType
|
Bai.EngageAltType = EngageAltType
|
||||||
Bai.Defend = true
|
Bai.Defend = true
|
||||||
|
|
||||||
self:I( { BAI = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
self:T( { BAI = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -2546,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:I( { BAI = { Zone:GetName(), PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
self:T( { BAI = { Zone:GetName(), PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -3379,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()
|
||||||
@@ -3390,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()
|
||||||
@@ -3806,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 )
|
||||||
@@ -3823,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 )
|
||||||
@@ -3904,7 +3894,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
||||||
|
|
||||||
if Squadron then
|
if Squadron then
|
||||||
local FirstUnit = AttackSetUnit:GetFirst()
|
local FirstUnit = AttackSetUnit:GetRandomSurely()
|
||||||
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 )
|
||||||
@@ -3943,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 )
|
||||||
@@ -3960,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 )
|
||||||
|
|||||||
@@ -14,66 +14,43 @@
|
|||||||
|
|
||||||
|
|
||||||
--- @type AI_A2G_SEAD
|
--- @type AI_A2G_SEAD
|
||||||
-- @extends AI.AI_A2G_Patrol#AI_AIR_PATROL
|
-- @extends AI.AI_Air_Patrol#AI_AIR_PATROL
|
||||||
|
-- @extends AI.AI_Air_Engage#AI_AIR_ENGAGE
|
||||||
|
|
||||||
|
|
||||||
--- Implements the core functions to SEAD intruders. Use the Engage trigger to intercept intruders.
|
--- Implements the core functions to SEAD intruders. Use the Engage trigger to intercept intruders.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- The AI_A2G_SEAD is assigned a @{Wrapper.Group} and this must be done before the AI_A2G_SEAD process can be started using the **Start** event.
|
-- The AI_A2G_SEAD is assigned a @{Wrapper.Group} and this must be done before the AI_A2G_SEAD process can be started using the **Start** event.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits.
|
-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits.
|
||||||
-- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits.
|
-- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- This cycle will continue.
|
-- This cycle will continue.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- During the patrol, the AI will detect enemy targets, which are reported through the **Detected** event.
|
-- During the patrol, the AI will detect enemy targets, which are reported through the **Detected** event.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- When enemies are detected, the AI will automatically engage the enemy.
|
-- When enemies are detected, the AI will automatically engage the enemy.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- Until a fuel or damage threshold has been reached by the AI, or when the AI is commanded to RTB.
|
-- Until a fuel or damage threshold has been reached by the AI, or when the AI is commanded to RTB.
|
||||||
-- When the fuel threshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
|
-- When the fuel threshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- ## 1. AI_A2G_SEAD constructor
|
-- ## 1. AI_A2G_SEAD constructor
|
||||||
--
|
--
|
||||||
-- * @{#AI_A2G_SEAD.New}(): Creates a new AI_A2G_SEAD object.
|
-- * @{#AI_A2G_SEAD.New}(): Creates a new AI_A2G_SEAD object.
|
||||||
--
|
--
|
||||||
-- ## 3. Set the Range of Engagement
|
-- ## 3. Set the Range of Engagement
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- An optional range can be set in meters,
|
-- An optional range can be set in meters,
|
||||||
-- that will define when the AI will engage with the detected airborne enemy targets.
|
-- that will define when the AI will engage with the detected airborne enemy targets.
|
||||||
-- The range can be beyond or smaller than the range of the Patrol Zone.
|
-- The range can be beyond or smaller than the range of the Patrol Zone.
|
||||||
-- The range is applied at the position of the AI.
|
-- The range is applied at the position of the AI.
|
||||||
-- Use the method @{AI.AI_GCI#AI_A2G_SEAD.SetEngageRange}() to define that range.
|
-- Use the method @{#AI_AIR_PATROL.SetEngageRange}() to define that range.
|
||||||
--
|
--
|
||||||
-- ## 4. Set the Zone of Engagement
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
-- 
|
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
||||||
|
-- Therefore, this class is considered to be deprecated
|
||||||
--
|
--
|
||||||
-- An optional @{Core.Zone} can be set,
|
|
||||||
-- that will define when the AI will engage with the detected airborne enemy targets.
|
|
||||||
-- Use the method @{AI.AI_CAP#AI_CAP_ZONE.SetEngageZone}() to define that Zone. -- TODO: Documentation. Check that this is actually correct. The originally referenced class does not exist.
|
|
||||||
--
|
|
||||||
-- # Developer Note
|
|
||||||
--
|
|
||||||
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
|
||||||
-- Therefore, this class is considered to be deprecated
|
|
||||||
--
|
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_A2G_SEAD
|
-- @field #AI_A2G_SEAD
|
||||||
@@ -99,7 +76,7 @@ AI_A2G_SEAD = {
|
|||||||
function AI_A2G_SEAD:New2( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
function AI_A2G_SEAD:New2( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
||||||
|
|
||||||
local AI_Air = AI_AIR:New( AIGroup )
|
local AI_Air = AI_AIR:New( AIGroup )
|
||||||
local AI_Air_Patrol = AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType ) -- #AI_AIR_PATROL
|
local AI_Air_Patrol = AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
||||||
local AI_Air_Engage = AI_AIR_ENGAGE:New( AI_Air_Patrol, AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType )
|
local AI_Air_Engage = AI_AIR_ENGAGE:New( AI_Air_Patrol, AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType )
|
||||||
local self = BASE:Inherit( self, AI_Air_Engage )
|
local self = BASE:Inherit( self, AI_Air_Engage )
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
-- @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}.
|
||||||
@@ -45,12 +45,12 @@
|
|||||||
-- * **Start**: Start the transport process.
|
-- * **Start**: Start the transport process.
|
||||||
-- * **Stop**: Stop the transport process.
|
-- * **Stop**: Stop the transport process.
|
||||||
-- * **Monitor**: Monitor and take action.
|
-- * **Monitor**: Monitor and take action.
|
||||||
--
|
--
|
||||||
-- # 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
|
||||||
--
|
--
|
||||||
-- @field #AI_AIR
|
-- @field #AI_AIR
|
||||||
AI_AIR = {
|
AI_AIR = {
|
||||||
ClassName = "AI_AIR",
|
ClassName = "AI_AIR",
|
||||||
@@ -264,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()
|
||||||
@@ -446,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
|
||||||
@@ -465,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:I( self.Controllable:GetName() .. " is too far from home base, RTB!" )
|
self:T( self.Controllable:GetName() .. " is too far from home base, RTB!" )
|
||||||
self:Hold( 300 )
|
self:Hold( 300 )
|
||||||
RTB = false
|
RTB = false
|
||||||
end
|
end
|
||||||
@@ -489,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:I( self.Controllable:GetName() .. " is out of fuel: " .. Fuel .. " ... Refuelling at Tanker!" )
|
self:T( self.Controllable:GetName() .. " is out of fuel: " .. Fuel .. " ... Refuelling at Tanker!" )
|
||||||
self:Refuel()
|
self:Refuel()
|
||||||
else
|
else
|
||||||
self:I( self.Controllable:GetName() .. " is out of fuel: " .. Fuel .. " ... RTB!" )
|
self:T( self.Controllable:GetName() .. " is out of fuel: " .. Fuel .. " ... RTB!" )
|
||||||
local OldAIControllable = self.Controllable
|
local 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 )
|
||||||
@@ -518,7 +518,7 @@ function AI_AIR:onafterStatus()
|
|||||||
-- Note that a group can consist of more units, so if one unit is damaged of a group, the mission may continue.
|
-- 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:I( self.Controllable:GetName() .. " is damaged: " .. Damage .. " ... RTB!" )
|
self:T( self.Controllable:GetName() .. " is damaged: " .. Damage .. " ... RTB!" )
|
||||||
self:Damaged()
|
self:Damaged()
|
||||||
RTB = true
|
RTB = true
|
||||||
self:SetStatusOff()
|
self:SetStatusOff()
|
||||||
@@ -536,7 +536,7 @@ function AI_AIR:onafterStatus()
|
|||||||
if Damage ~= InitialLife then
|
if Damage ~= InitialLife then
|
||||||
self:Damaged()
|
self:Damaged()
|
||||||
else
|
else
|
||||||
self:I( self.Controllable:GetName() .. " control lost! " )
|
self:T( self.Controllable:GetName() .. " control lost! " )
|
||||||
|
|
||||||
self:LostControl()
|
self:LostControl()
|
||||||
end
|
end
|
||||||
@@ -560,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() } )
|
||||||
@@ -571,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() } )
|
||||||
@@ -598,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 } )
|
||||||
@@ -617,7 +617,10 @@ 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 )
|
||||||
@@ -638,13 +641,13 @@ function AI_AIR:onafterRTB( AIGroup, From, Event, To )
|
|||||||
local ToAirbaseCoord = ToTargetCoord2
|
local ToAirbaseCoord = ToTargetCoord2
|
||||||
|
|
||||||
if Distance < 5000 then
|
if Distance < 5000 then
|
||||||
self:I( "RTB and near the airbase!" )
|
self:T( "RTB and near the airbase!" )
|
||||||
self:Home()
|
self:Home()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if not AIGroup:InAir() == true then
|
if not AIGroup:InAir() == true then
|
||||||
self:I( "Not anymore in the air, considered Home." )
|
self:T( "Not anymore in the air, considered Home." )
|
||||||
self:Home()
|
self:Home()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -686,12 +689,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:I( "Group " .. self.Controllable:GetName() .. " ... Home! ( " .. self:GetState() .. " )" )
|
self:T( "Group " .. self.Controllable:GetName() .. " ... Home! ( " .. self:GetState() .. " )" )
|
||||||
|
|
||||||
if AIGroup and AIGroup:IsAlive() then
|
if AIGroup and AIGroup:IsAlive() then
|
||||||
end
|
end
|
||||||
@@ -700,15 +703,17 @@ 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:I( "Group " .. self.Controllable:GetName() .. " ... Holding! ( " .. self:GetState() .. " )" )
|
self:T( "Group " .. self.Controllable:GetName() .. " ... Holding! ( " .. self:GetState() .. " )" )
|
||||||
|
|
||||||
if AIGroup and AIGroup:IsAlive() then
|
if AIGroup and AIGroup:IsAlive() then
|
||||||
local OrbitTask = AIGroup:TaskOrbitCircle( math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude ), self.PatrolMinSpeed )
|
local Coordinate = AIGroup:GetCoordinate()
|
||||||
|
if Coordinate == nil then return end
|
||||||
|
local OrbitTask = AIGroup:TaskOrbitCircle( math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude ), self.PatrolMinSpeed, Coordinate )
|
||||||
local TimedOrbitTask = AIGroup:TaskControlled( OrbitTask, AIGroup:TaskCondition( nil, nil, nil, nil, HoldTime , nil ) )
|
local 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 )
|
||||||
@@ -722,17 +727,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:I( { "AI_AIR.Resume:", AIGroup:GetName() } )
|
AIGroup:T( { "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 } )
|
||||||
@@ -744,7 +749,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:I( "Group " .. self.Controllable:GetName() .. " ... Refuelling! State=" .. self:GetState() .. ", Refuelling tanker " .. self.TankerName )
|
self:T( "Group " .. self.Controllable:GetName() .. " ... Refuelling! State=" .. self:GetState() .. ", Refuelling tanker " .. self.TankerName )
|
||||||
|
|
||||||
local RefuelRoute = {}
|
local RefuelRoute = {}
|
||||||
|
|
||||||
@@ -798,13 +803,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 )
|
||||||
|
|
||||||
@@ -815,7 +820,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 )
|
||||||
|
|
||||||
@@ -824,7 +829,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:
|
||||||
--
|
--
|
||||||
-- [AID-AIR - AI AIR Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching)
|
-- [AI_A2A_Dispatcher](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -292,8 +292,6 @@ do -- AI_AIR_DISPATCHER
|
|||||||
--
|
--
|
||||||
-- ## 1. AI\_AIR\_DISPATCHER constructor:
|
-- ## 1. AI\_AIR\_DISPATCHER constructor:
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
--
|
--
|
||||||
-- The @{#AI_AIR_DISPATCHER.New}() method creates a new AI_AIR_DISPATCHER instance.
|
-- The @{#AI_AIR_DISPATCHER.New}() method creates a new AI_AIR_DISPATCHER instance.
|
||||||
--
|
--
|
||||||
@@ -306,8 +304,6 @@ do -- AI_AIR_DISPATCHER
|
|||||||
-- A reconnaissance network, is used to detect enemy ground targets,
|
-- A reconnaissance network, is used to detect enemy ground targets,
|
||||||
-- potentially group them into areas, and to understand the position, level of threat of the enemy.
|
-- potentially group them into areas, and to understand the position, level of threat of the enemy.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- As explained in the introduction, depending on the type of mission you want to achieve, different types of units can be applied to detect ground enemy targets.
|
-- As explained in the introduction, depending on the type of mission you want to achieve, different types of units can be applied to detect ground enemy targets.
|
||||||
-- Ground based units are very useful to act as a reconnaissance, but they lack sometimes the visibility to detect targets at greater range.
|
-- Ground based units are very useful to act as a reconnaissance, but they lack sometimes the visibility to detect targets at greater range.
|
||||||
-- Recce are very useful to acquire the position of enemy ground targets when spread out over the battlefield at strategic positions.
|
-- Recce are very useful to acquire the position of enemy ground targets when spread out over the battlefield at strategic positions.
|
||||||
@@ -673,8 +669,6 @@ do -- AI_AIR_DISPATCHER
|
|||||||
--
|
--
|
||||||
-- Use the method @{#AI_AIR_DISPATCHER.SetSquadronGrouping}() to set the grouping of aircraft when spawned in.
|
-- Use the method @{#AI_AIR_DISPATCHER.SetSquadronGrouping}() to set the grouping of aircraft when spawned in.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- In the case of **on call** engagement, the @{#AI_AIR_DISPATCHER.SetSquadronGrouping}() method has additional behaviour.
|
-- In the case of **on call** engagement, the @{#AI_AIR_DISPATCHER.SetSquadronGrouping}() method has additional behaviour.
|
||||||
-- When there aren't enough patrol flights airborne, a on call will be initiated for the remaining
|
-- When there aren't enough patrol flights airborne, a on call will be initiated for the remaining
|
||||||
-- targets to be engaged. Depending on the grouping parameter, the spawned flights for on call aircraft are grouped into this setting.
|
-- targets to be engaged. Depending on the grouping parameter, the spawned flights for on call aircraft are grouped into this setting.
|
||||||
@@ -688,8 +682,6 @@ do -- AI_AIR_DISPATCHER
|
|||||||
-- The effectiveness can be set with the **overhead parameter**. This is a number that is used to calculate the amount of Units that dispatching command will allocate to GCI in surplus of detected amount of units.
|
-- The effectiveness can be set with the **overhead parameter**. This is a number that is used to calculate the amount of Units that dispatching command will allocate to GCI in surplus of detected amount of units.
|
||||||
-- The **default value** of the overhead parameter is 1.0, which means **equal balance**.
|
-- The **default value** of the overhead parameter is 1.0, which means **equal balance**.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- However, depending on the (type of) aircraft (strength and payload) in the squadron and the amount of resources available, this parameter can be changed.
|
-- However, depending on the (type of) aircraft (strength and payload) in the squadron and the amount of resources available, this parameter can be changed.
|
||||||
--
|
--
|
||||||
-- The @{#AI_AIR_DISPATCHER.SetSquadronOverhead}() method can be used to tweak the defense strength,
|
-- The @{#AI_AIR_DISPATCHER.SetSquadronOverhead}() method can be used to tweak the defense strength,
|
||||||
@@ -835,8 +827,6 @@ do -- AI_AIR_DISPATCHER
|
|||||||
--
|
--
|
||||||
-- For example, the following setup will set the default refuel tanker to "Tanker":
|
-- For example, the following setup will set the default refuel tanker to "Tanker":
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- -- Define the CAP
|
-- -- Define the CAP
|
||||||
-- A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-34" }, 20 )
|
-- A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-34" }, 20 )
|
||||||
-- A2ADispatcher:SetSquadronCap( "Sochi", ZONE:New( "PatrolZone" ), 4000, 8000, 600, 800, 1000, 1300 )
|
-- A2ADispatcher:SetSquadronCap( "Sochi", ZONE:New( "PatrolZone" ), 4000, 8000, 600, 800, 1000, 1300 )
|
||||||
@@ -910,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.
|
||||||
@@ -948,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
|
||||||
@@ -1140,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 )
|
||||||
@@ -1151,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:I( "Parked resources for squadron " .. DefenderSquadron.Name )
|
self:T( "Parked resources for squadron " .. DefenderSquadron.Name )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -1204,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
|
||||||
@@ -1221,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:I( "Captured " .. AirbaseName )
|
self:T( "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:I( "Squadron " .. SquadronName .. " captured." )
|
self:T( "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" )
|
||||||
@@ -1262,7 +1252,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||||
end
|
end
|
||||||
DefenderUnit:Destroy()
|
DefenderUnit:Destroy()
|
||||||
self:ResourcePark( Squadron, Defender )
|
self:ResourcePark( Squadron )
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if DefenderUnit:GetLife() ~= DefenderUnit:GetLife0() then
|
if DefenderUnit:GetLife() ~= DefenderUnit:GetLife0() then
|
||||||
@@ -1273,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
|
||||||
@@ -1289,31 +1279,31 @@ do -- AI_AIR_DISPATCHER
|
|||||||
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||||
end
|
end
|
||||||
DefenderUnit:Destroy()
|
DefenderUnit:Destroy()
|
||||||
self:ResourcePark( Squadron, Defender )
|
self:ResourcePark( Squadron )
|
||||||
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
|
||||||
@@ -1877,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
|
||||||
@@ -2779,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 {}
|
||||||
@@ -2792,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 {}
|
||||||
@@ -2805,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 )
|
||||||
|
|||||||
@@ -13,57 +13,31 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- @type AI_AIR_ENGAGE
|
-- @type AI_AIR_ENGAGE
|
||||||
-- @extends AI.AI_AIR#AI_AIR
|
-- @extends AI.AI_AIR#AI_AIR
|
||||||
|
|
||||||
|
|
||||||
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
|
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- The AI_AIR_ENGAGE is assigned a @{Wrapper.Group} and this must be done before the AI_AIR_ENGAGE process can be started using the **Start** event.
|
-- The AI_AIR_ENGAGE is assigned a @{Wrapper.Group} and this must be done before the AI_AIR_ENGAGE process can be started using the **Start** event.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits.
|
-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits.
|
||||||
-- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits.
|
-- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- This cycle will continue.
|
-- This cycle will continue.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- During the patrol, the AI will detect enemy targets, which are reported through the **Detected** event.
|
-- During the patrol, the AI will detect enemy targets, which are reported through the **Detected** event.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- When enemies are detected, the AI will automatically engage the enemy.
|
-- When enemies are detected, the AI will automatically engage the enemy.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- Until a fuel or damage threshold has been reached by the AI, or when the AI is commanded to RTB.
|
-- Until a fuel or damage threshold has been reached by the AI, or when the AI is commanded to RTB.
|
||||||
-- When the fuel threshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
|
-- When the fuel threshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
|
||||||
--
|
--
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- ## 1. AI_AIR_ENGAGE constructor
|
-- ## 1. AI_AIR_ENGAGE constructor
|
||||||
--
|
--
|
||||||
-- * @{#AI_AIR_ENGAGE.New}(): Creates a new AI_AIR_ENGAGE object.
|
-- * @{#AI_AIR_ENGAGE.New}(): Creates a new AI_AIR_ENGAGE object.
|
||||||
--
|
--
|
||||||
-- ## 3. Set the Range of Engagement
|
-- ## 2. Set the Zone of Engagement
|
||||||
--
|
|
||||||
-- 
|
|
||||||
--
|
|
||||||
-- An optional range can be set in meters,
|
|
||||||
-- that will define when the AI will engage with the detected airborne enemy targets.
|
|
||||||
-- The range can be beyond or smaller than the range of the Patrol Zone.
|
|
||||||
-- The range is applied at the position of the AI.
|
|
||||||
-- Use the method @{AI.AI_GCI#AI_AIR_ENGAGE.SetEngageRange}() to define that range.
|
|
||||||
--
|
|
||||||
-- ## 4. Set the Zone of Engagement
|
|
||||||
--
|
|
||||||
-- 
|
|
||||||
--
|
--
|
||||||
-- An optional @{Core.Zone} can be set,
|
-- An optional @{Core.Zone} can be set,
|
||||||
-- that will define when the AI will engage with the detected airborne enemy targets.
|
-- that will define when the AI will engage with the detected airborne enemy targets.
|
||||||
@@ -74,6 +48,11 @@
|
|||||||
-- 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
|
||||||
--
|
--
|
||||||
|
-- # Developer Note
|
||||||
|
--
|
||||||
|
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
||||||
|
-- Therefore, this class is considered to be deprecated
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_AIR_ENGAGE
|
-- @field #AI_AIR_ENGAGE
|
||||||
@@ -372,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.
|
||||||
@@ -382,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.
|
||||||
@@ -395,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 } )
|
||||||
@@ -408,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:I(string.format("AI_AIR_ENGAGE.___EngageRoute: %s", tostring(AIGroup:GetName())))
|
Fsm:T(string.format("AI_AIR_ENGAGE.___EngageRoute: %s", tostring(AIGroup:GetName())))
|
||||||
|
|
||||||
if AIGroup and AIGroup:IsAlive() then
|
if AIGroup and AIGroup:IsAlive() then
|
||||||
Fsm:__EngageRoute( Fsm.TaskDelay or 0.1, AttackSetUnit )
|
Fsm:__EngageRoute( Fsm.TaskDelay or 0.1, AttackSetUnit )
|
||||||
@@ -418,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:I( { DefenderGroup, From, Event, To, AttackSetUnit } )
|
self:T( { DefenderGroup, From, Event, To, AttackSetUnit } )
|
||||||
|
|
||||||
local DefenderGroupName = DefenderGroup:GetName()
|
local DefenderGroupName = DefenderGroup:GetName()
|
||||||
|
|
||||||
@@ -447,7 +426,13 @@ 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:GetFirst():GetPointVec3()
|
local TargetCoord = AttackSetUnit:GetRandomSurely():GetPointVec3()
|
||||||
|
|
||||||
|
if TargetCoord == nil then
|
||||||
|
self:Return()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
TargetCoord:SetY( EngageAltitude ) -- Ground targets don't have an altitude.
|
TargetCoord:SetY( EngageAltitude ) -- Ground targets don't have an altitude.
|
||||||
|
|
||||||
local TargetDistance = DefenderCoord:Get2DDistance( TargetCoord )
|
local TargetDistance = DefenderCoord:Get2DDistance( TargetCoord )
|
||||||
@@ -456,12 +441,12 @@ function AI_AIR_ENGAGE:onafterEngageRoute( DefenderGroup, From, Event, To, Attac
|
|||||||
-- TODO: A factor of * 3 is way too close. This causes the AI not to engange until merged sometimes!
|
-- TODO: A factor of * 3 is way too close. This causes the AI not to engange until merged sometimes!
|
||||||
if TargetDistance <= EngageDistance * 9 then
|
if TargetDistance <= EngageDistance * 9 then
|
||||||
|
|
||||||
self:I(string.format("AI_AIR_ENGAGE onafterEngageRoute ==> __Engage - target distance = %.1f km", TargetDistance/1000))
|
--self:T(string.format("AI_AIR_ENGAGE onafterEngageRoute ==> __Engage - target distance = %.1f km", TargetDistance/1000))
|
||||||
self:__Engage( 0.1, AttackSetUnit )
|
self:__Engage( 0.1, AttackSetUnit )
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
self:I(string.format("FF AI_AIR_ENGAGE onafterEngageRoute ==> Routing - target distance = %.1f km", TargetDistance/1000))
|
--self:T(string.format("FF AI_AIR_ENGAGE onafterEngageRoute ==> Routing - target distance = %.1f km", TargetDistance/1000))
|
||||||
|
|
||||||
local EngageRoute = {}
|
local EngageRoute = {}
|
||||||
local AttackTasks = {}
|
local AttackTasks = {}
|
||||||
@@ -493,16 +478,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:I( DefenderGroupName .. ": No targets found -> Going RTB")
|
self:T( 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:I(string.format("AI_AIR_ENGAGE.___Engage: %s", tostring(AIGroup:GetName())))
|
Fsm:T(string.format("AI_AIR_ENGAGE.___Engage: %s", tostring(AIGroup:GetName())))
|
||||||
|
|
||||||
if AIGroup and AIGroup:IsAlive() then
|
if AIGroup and AIGroup:IsAlive() then
|
||||||
local delay=Fsm.TaskDelay or 0.1
|
local delay=Fsm.TaskDelay or 0.1
|
||||||
@@ -511,7 +496,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.
|
||||||
@@ -537,7 +522,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:GetFirst():GetPointVec3()
|
local TargetCoord = AttackSetUnit:GetRandomSurely():GetPointVec3()
|
||||||
if not TargetCoord then
|
if not TargetCoord then
|
||||||
self:Return()
|
self:Return()
|
||||||
return
|
return
|
||||||
@@ -568,12 +553,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:I( DefenderGroupName .. ": No valid targets found -> Going RTB")
|
self:T( 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:I(text)
|
self:T(text)
|
||||||
DefenderGroup:OptionROEOpenFire()
|
DefenderGroup:OptionROEOpenFire()
|
||||||
DefenderGroup:OptionROTEvadeFire()
|
DefenderGroup:OptionROTEvadeFire()
|
||||||
DefenderGroup:OptionKeepWeaponsOnThreat()
|
DefenderGroup:OptionKeepWeaponsOnThreat()
|
||||||
@@ -590,13 +575,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:I( DefenderGroupName .. ": No targets found -> returning.")
|
self:T( 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() } )
|
||||||
|
|||||||
@@ -79,21 +79,13 @@
|
|||||||
-- that will define when the AI will engage with the detected airborne enemy targets.
|
-- that will define when the AI will engage with the detected airborne enemy targets.
|
||||||
-- The range can be beyond or smaller than the range of the Patrol Zone.
|
-- The range can be beyond or smaller than the range of the Patrol Zone.
|
||||||
-- The range is applied at the position of the AI.
|
-- The range is applied at the position of the AI.
|
||||||
-- Use the method @{AI.AI_CAP#AI_AIR_PATROL.SetEngageRange}() to define that range.
|
-- Use the method @{#AI_AIR_PATROL.SetEngageRange}() to define that range.
|
||||||
--
|
--
|
||||||
-- ## 4. Set the Zone of Engagement
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
-- 
|
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
||||||
|
-- Therefore, this class is considered to be deprecated
|
||||||
--
|
--
|
||||||
-- An optional @{Core.Zone} can be set,
|
|
||||||
-- that will define when the AI will engage with the detected airborne enemy targets.
|
|
||||||
-- Use the method @{AI.AI_CAP#AI_AIR_PATROL.SetEngageZone}() to define that Zone.
|
|
||||||
--
|
|
||||||
-- # Developer Note
|
|
||||||
--
|
|
||||||
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
|
||||||
-- Therefore, this class is considered to be deprecated
|
|
||||||
--
|
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_AIR_PATROL
|
-- @field #AI_AIR_PATROL
|
||||||
|
|||||||
@@ -13,17 +13,17 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- @type AI_AIR_SQUADRON
|
-- @type AI_AIR_SQUADRON
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
|
|
||||||
--- Implements the core functions modeling squadrons for airplanes and helicopters.
|
--- Implements the core functions modeling squadrons for airplanes and helicopters.
|
||||||
--
|
--
|
||||||
-- # 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
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_AIR_SQUADRON
|
-- @field #AI_AIR_SQUADRON
|
||||||
@@ -38,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:I( { Air_Squadron = { SquadronName, AirbaseName, TemplatePrefixes, ResourceCount } } )
|
self:T( { 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/BAI%20-%20Battlefield%20Air%20Interdiction)
|
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_BAI)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
-- ### Contributions:
|
-- ### Contributions:
|
||||||
--
|
--
|
||||||
-- * **[Gunterlund](http://forums.eagle.ru:8080/member.php?u=75036)**: Test case revision.
|
-- * **Gunterlund**: Test case revision.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -130,12 +130,12 @@
|
|||||||
-- AIBAIZone:SearchOff()
|
-- AIBAIZone:SearchOff()
|
||||||
--
|
--
|
||||||
-- Searching can be switched back on with the method @{#AI_BAI_ZONE.SearchOn}(). Use the method @{#AI_BAI_ZONE.SearchOnOff}() to flexibily switch searching on or off.
|
-- Searching can be switched back on with the method @{#AI_BAI_ZONE.SearchOn}(). Use the method @{#AI_BAI_ZONE.SearchOnOff}() to flexibily switch searching on or off.
|
||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # 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
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_BAI_ZONE
|
-- @field #AI_BAI_ZONE
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AIB%20-%20AI%20Balancing)
|
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Balancer)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
-- ### Contributions:
|
-- ### Contributions:
|
||||||
--
|
--
|
||||||
-- * **[Dutch_Baron](https://forums.eagle.ru/member.php?u=112075)**: Working together with James has resulted in the creation of the AI_BALANCER class. James has shared his ideas on balancing AI with air units, and together we made a first design which you can use now :-)
|
-- * **Dutch_Baron**: Working together with James has resulted in the creation of the AI_BALANCER class. James has shared his ideas on balancing AI with air units, and together we made a first design which you can use now :-)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
--
|
--
|
||||||
-- The parent class @{Core.Fsm#FSM_SET} manages the functionality to control the Finite State Machine (FSM).
|
-- The parent class @{Core.Fsm#FSM_SET} manages the functionality to control the Finite State Machine (FSM).
|
||||||
-- The mission designer can tailor the behaviour of the AI_BALANCER, by defining event and state transition methods.
|
-- The mission designer can tailor the behaviour of the AI_BALANCER, by defining event and state transition methods.
|
||||||
-- An explanation about state and event transition methods can be found in the @{FSM} module documentation.
|
-- An explanation about state and event transition methods can be found in the @{Core.Fsm} module documentation.
|
||||||
--
|
--
|
||||||
-- The mission designer can tailor the AI_BALANCER behaviour, by implementing a state or event handling method for the following:
|
-- The mission designer can tailor the AI_BALANCER behaviour, by implementing a state or event handling method for the following:
|
||||||
--
|
--
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
--
|
--
|
||||||
-- ## 2. AI_BALANCER is a FSM
|
-- ## 2. AI_BALANCER is a FSM
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
-- ### 2.1. AI_BALANCER States
|
-- ### 2.1. AI_BALANCER States
|
||||||
--
|
--
|
||||||
@@ -85,12 +85,12 @@
|
|||||||
--
|
--
|
||||||
-- Note that when AI returns to an airbase, the AI_BALANCER will trigger the **Return** event and the AI will return,
|
-- Note that when AI returns to an airbase, the AI_BALANCER will trigger the **Return** event and the AI will return,
|
||||||
-- otherwise the AI_BALANCER will trigger a **Destroy** event, and the AI will be destroyed.
|
-- otherwise the AI_BALANCER will trigger a **Destroy** event, and the AI will be destroyed.
|
||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # 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
|
||||||
--
|
--
|
||||||
-- @field #AI_BALANCER
|
-- @field #AI_BALANCER
|
||||||
AI_BALANCER = {
|
AI_BALANCER = {
|
||||||
ClassName = "AI_BALANCER",
|
ClassName = "AI_BALANCER",
|
||||||
@@ -168,7 +168,8 @@ function AI_BALANCER:ReturnToHomeAirbase( ReturnThresholdRange )
|
|||||||
self.ReturnThresholdRange = ReturnThresholdRange
|
self.ReturnThresholdRange = ReturnThresholdRange
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_BALANCER self
|
--- AI_BALANCER:onenterSpawning
|
||||||
|
-- @param #AI_BALANCER self
|
||||||
-- @param Core.Set#SET_GROUP SetGroup
|
-- @param Core.Set#SET_GROUP SetGroup
|
||||||
-- @param #string ClientName
|
-- @param #string ClientName
|
||||||
-- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
@@ -190,7 +191,8 @@ function AI_BALANCER:onenterSpawning( SetGroup, From, Event, To, ClientName )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_BALANCER self
|
--- AI_BALANCER:onenterDestroying
|
||||||
|
-- @param #AI_BALANCER self
|
||||||
-- @param Core.Set#SET_GROUP SetGroup
|
-- @param Core.Set#SET_GROUP SetGroup
|
||||||
-- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
function AI_BALANCER:onenterDestroying( SetGroup, From, Event, To, ClientName, AIGroup )
|
function AI_BALANCER:onenterDestroying( SetGroup, From, Event, To, ClientName, AIGroup )
|
||||||
@@ -233,15 +235,16 @@ function AI_BALANCER:onenterReturning( SetGroup, From, Event, To, AIGroup )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- AI_BALANCER:onenterMonitoring
|
||||||
--- @param #AI_BALANCER self
|
-- @param #AI_BALANCER self
|
||||||
function AI_BALANCER:onenterMonitoring( SetGroup )
|
function AI_BALANCER:onenterMonitoring( SetGroup )
|
||||||
|
|
||||||
self:T2( { self.SetClient:Count() } )
|
self:T2( { self.SetClient:Count() } )
|
||||||
--self.SetClient:Flush()
|
--self.SetClient:Flush()
|
||||||
|
|
||||||
self.SetClient:ForEachClient(
|
self.SetClient:ForEachClient(
|
||||||
--- @param Wrapper.Client#CLIENT Client
|
--- SetClient:ForEachClient
|
||||||
|
-- @param Wrapper.Client#CLIENT Client
|
||||||
function( Client )
|
function( Client )
|
||||||
self:T3(Client.ClientName)
|
self:T3(Client.ClientName)
|
||||||
|
|
||||||
@@ -264,7 +267,8 @@ function AI_BALANCER:onenterMonitoring( SetGroup )
|
|||||||
self:T2( RangeZone )
|
self:T2( RangeZone )
|
||||||
|
|
||||||
_DATABASE:ForEachPlayerUnit(
|
_DATABASE:ForEachPlayerUnit(
|
||||||
--- @param Wrapper.Unit#UNIT RangeTestUnit
|
--- Nameless function
|
||||||
|
-- @param Wrapper.Unit#UNIT RangeTestUnit
|
||||||
function( RangeTestUnit, RangeZone, AIGroup, PlayerInRange )
|
function( RangeTestUnit, RangeZone, AIGroup, PlayerInRange )
|
||||||
self:T2( { PlayerInRange, RangeTestUnit.UnitName, RangeZone.ZoneName } )
|
self:T2( { PlayerInRange, RangeTestUnit.UnitName, RangeZone.ZoneName } )
|
||||||
if RangeTestUnit:IsInZone( RangeZone ) == true then
|
if RangeTestUnit:IsInZone( RangeZone ) == true then
|
||||||
@@ -276,7 +280,8 @@ function AI_BALANCER:onenterMonitoring( SetGroup )
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
--- @param Core.Zone#ZONE_RADIUS RangeZone
|
--- Nameless function
|
||||||
|
-- @param Core.Zone#ZONE_RADIUS RangeZone
|
||||||
-- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
function( RangeZone, AIGroup, PlayerInRange )
|
function( RangeZone, AIGroup, PlayerInRange )
|
||||||
if PlayerInRange.Value == false then
|
if PlayerInRange.Value == false then
|
||||||
@@ -307,6 +312,3 @@ 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/CAP%20-%20Combat%20Air%20Patrol)
|
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_CAP)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -20,11 +20,11 @@
|
|||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
-- ### Contributions:
|
-- ### Contributions:
|
||||||
--
|
--
|
||||||
-- * **[Quax](https://forums.eagle.ru/member.php?u=90530)**: Concept, Advice & Testing.
|
-- * **Quax**: Concept, Advice & Testing.
|
||||||
-- * **[Pikey](https://forums.eagle.ru/member.php?u=62835)**: Concept, Advice & Testing.
|
-- * **Pikey**: Concept, Advice & Testing.
|
||||||
-- * **[Gunterlund](http://forums.eagle.ru:8080/member.php?u=75036)**: Test case revision.
|
-- * **Gunterlund**: Test case revision.
|
||||||
-- * **[Whisper](http://forums.eagle.ru/member.php?u=3829): Testing.
|
-- * **Whisper**: Testing.
|
||||||
-- * **[Delta99](https://forums.eagle.ru/member.php?u=125166): Testing.
|
-- * **Delta99**: Testing.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -112,12 +112,12 @@
|
|||||||
-- An optional @{Core.Zone} can be set,
|
-- An optional @{Core.Zone} can be set,
|
||||||
-- that will define when the AI will engage with the detected airborne enemy targets.
|
-- that will define when the AI will engage with the detected airborne enemy targets.
|
||||||
-- Use the method @{#AI_CAP_ZONE.SetEngageZone}() to define that Zone.
|
-- Use the method @{#AI_CAP_ZONE.SetEngageZone}() to define that Zone.
|
||||||
--
|
--
|
||||||
-- # 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
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_CAP_ZONE
|
-- @field #AI_CAP_ZONE
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CAS%20-%20Close%20Air%20Support)
|
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_CAS)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -22,9 +22,9 @@
|
|||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
-- ### Contributions:
|
-- ### Contributions:
|
||||||
--
|
--
|
||||||
-- * **[Quax](https://forums.eagle.ru/member.php?u=90530)**: Concept, Advice & Testing.
|
-- * **Quax**: Concept, Advice & Testing.
|
||||||
-- * **[Pikey](https://forums.eagle.ru/member.php?u=62835)**: Concept, Advice & Testing.
|
-- * **Pikey**: Concept, Advice & Testing.
|
||||||
-- * **[Gunterlund](http://forums.eagle.ru:8080/member.php?u=75036)**: Test case revision.
|
-- * **Gunterlund**: Test case revision.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -118,12 +118,12 @@
|
|||||||
-- * **@{#AI_CAS_ZONE.Destroy}**: The AI has destroyed a target @{Wrapper.Unit}.
|
-- * **@{#AI_CAS_ZONE.Destroy}**: The AI has destroyed a target @{Wrapper.Unit}.
|
||||||
-- * **@{#AI_CAS_ZONE.Destroyed}**: The AI has destroyed all target @{Wrapper.Unit}s assigned in the CAS task.
|
-- * **@{#AI_CAS_ZONE.Destroyed}**: The AI has destroyed all target @{Wrapper.Unit}s assigned in the CAS task.
|
||||||
-- * **Status**: The AI is checking status (fuel and damage). When the thresholds have been reached, the AI will RTB.
|
-- * **Status**: The AI is checking status (fuel and damage). When the thresholds have been reached, the AI will RTB.
|
||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # 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
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_CAS_ZONE
|
-- @field #AI_CAS_ZONE
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
-- @module AI.AI_Cargo
|
-- @module AI.AI_Cargo
|
||||||
-- @image Cargo.JPG
|
-- @image Cargo.JPG
|
||||||
|
|
||||||
--- @type AI_CARGO
|
-- @type AI_CARGO
|
||||||
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
||||||
|
|
||||||
|
|
||||||
@@ -25,12 +25,12 @@
|
|||||||
-- * @{AI.AI_Cargo_APC} - Cargo transportation using APCs and other vehicles between zones.
|
-- * @{AI.AI_Cargo_APC} - Cargo transportation using APCs and other vehicles between zones.
|
||||||
-- * @{AI.AI_Cargo_Helicopter} - Cargo transportation using helicopters between zones.
|
-- * @{AI.AI_Cargo_Helicopter} - Cargo transportation using helicopters between zones.
|
||||||
-- * @{AI.AI_Cargo_Airplane} - Cargo transportation using airplanes to and from airbases.
|
-- * @{AI.AI_Cargo_Airplane} - Cargo transportation using airplanes to and from airbases.
|
||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # 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
|
||||||
--
|
--
|
||||||
-- @field #AI_CARGO
|
-- @field #AI_CARGO
|
||||||
AI_CARGO = {
|
AI_CARGO = {
|
||||||
ClassName = "AI_CARGO",
|
ClassName = "AI_CARGO",
|
||||||
@@ -547,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:I({ IsEmpty = IsEmpty })
|
self:T({ IsEmpty = IsEmpty })
|
||||||
if not IsEmpty then
|
if not IsEmpty then
|
||||||
AllUnloaded = false
|
AllUnloaded = false
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -75,12 +75,12 @@
|
|||||||
-- Using the @{#AI_CARGO_APC.Pickup}() method, you are able to direct the APCs towards a point on the battlefield to board/load the cargo at the specific coordinate.
|
-- Using the @{#AI_CARGO_APC.Pickup}() method, you are able to direct the APCs towards a point on the battlefield to board/load the cargo at the specific coordinate.
|
||||||
-- The APCs will follow nearby roads as much as possible, to ensure fast and clean cargo transportation between the objects and villages in the simulation environment.
|
-- The APCs will follow nearby roads as much as possible, to ensure fast and clean cargo transportation between the objects and villages in the simulation environment.
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # 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
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
-- @field #AI_CARGO_APC
|
-- @field #AI_CARGO_APC
|
||||||
AI_CARGO_APC = {
|
AI_CARGO_APC = {
|
||||||
|
|||||||
@@ -41,12 +41,12 @@
|
|||||||
-- marginal impact on the overall battlefield simulation. Fortunately, the firing strength of infantry is limited, and thus, respacing healthy infantry every
|
-- marginal impact on the overall battlefield simulation. Fortunately, the firing strength of infantry is limited, and thus, respacing healthy infantry every
|
||||||
-- time is not so much of an issue ...
|
-- time is not so much of an issue ...
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # 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
|
||||||
--
|
--
|
||||||
-- @field #AI_CARGO_AIRPLANE
|
-- @field #AI_CARGO_AIRPLANE
|
||||||
AI_CARGO_AIRPLANE = {
|
AI_CARGO_AIRPLANE = {
|
||||||
ClassName = "AI_CARGO_AIRPLANE",
|
ClassName = "AI_CARGO_AIRPLANE",
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
--
|
--
|
||||||
-- Test missions can be located on the main GITHUB site.
|
-- Test missions can be located on the main GITHUB site.
|
||||||
--
|
--
|
||||||
-- [FlightControl-Master/MOOSE_MISSIONS/AID - AI Dispatching/AID-CGO - AI Cargo Dispatching/](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/AID%20-%20AI%20Dispatching/AID-CGO%20-%20AI%20Cargo%20Dispatching)
|
-- [FlightControl-Master/MOOSE_MISSIONS/AID - AI Dispatching/AID-CGO - AI Cargo Dispatching/](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Cargo_Dispatcher)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -100,12 +100,12 @@
|
|||||||
--
|
--
|
||||||
-- Yes, please ensure that the zones are declared using the @{Core.Zone} classes.
|
-- Yes, please ensure that the zones are declared using the @{Core.Zone} classes.
|
||||||
-- Possible zones that function at the moment are ZONE, ZONE_GROUP, ZONE_UNIT, ZONE_POLYGON.
|
-- Possible zones that function at the moment are ZONE, ZONE_GROUP, ZONE_UNIT, ZONE_POLYGON.
|
||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # 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
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
@@ -116,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.
|
||||||
@@ -583,10 +583,12 @@ AI_CARGO_DISPATCHER = {
|
|||||||
PickupCargo = {}
|
PickupCargo = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
--- @field #list
|
--- List of AI_Cargo
|
||||||
|
-- @field #list
|
||||||
AI_CARGO_DISPATCHER.AI_Cargo = {}
|
AI_CARGO_DISPATCHER.AI_Cargo = {}
|
||||||
|
|
||||||
--- @field #list
|
--- List of PickupCargo
|
||||||
|
-- @field #list
|
||||||
AI_CARGO_DISPATCHER.PickupCargo = {}
|
AI_CARGO_DISPATCHER.PickupCargo = {}
|
||||||
|
|
||||||
|
|
||||||
@@ -1159,7 +1161,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:I(text)
|
self:T(text)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -137,12 +137,12 @@
|
|||||||
-- Use @{#AI_CARGO_DISPATCHER_APC.SetHomeZone}() to specify the home zone.
|
-- Use @{#AI_CARGO_DISPATCHER_APC.SetHomeZone}() to specify the home zone.
|
||||||
--
|
--
|
||||||
-- If no home zone is specified, the APCs will wait near the deploy zone for a new pickup command.
|
-- If no home zone is specified, the APCs will wait near the deploy zone for a new pickup command.
|
||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # 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
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_CARGO_DISPATCHER_APC
|
-- @field #AI_CARGO_DISPATCHER_APC
|
||||||
|
|||||||
@@ -108,12 +108,12 @@
|
|||||||
--
|
--
|
||||||
-- **There are a lot of templates available that allows you to quickly setup an event handler for a specific event type!**
|
-- **There are a lot of templates available that allows you to quickly setup an event handler for a specific event type!**
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # 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
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
-- @field #AI_CARGO_DISPATCHER_AIRPLANE
|
-- @field #AI_CARGO_DISPATCHER_AIRPLANE
|
||||||
AI_CARGO_DISPATCHER_AIRPLANE = {
|
AI_CARGO_DISPATCHER_AIRPLANE = {
|
||||||
|
|||||||
@@ -140,12 +140,12 @@
|
|||||||
-- Use @{#AI_CARGO_DISPATCHER_HELICOPTER.SetHomeZone}() to specify the home zone.
|
-- Use @{#AI_CARGO_DISPATCHER_HELICOPTER.SetHomeZone}() to specify the home zone.
|
||||||
--
|
--
|
||||||
-- If no home zone is specified, the helicopters will wait near the deploy zone for a new pickup command.
|
-- If no home zone is specified, the helicopters will wait near the deploy zone for a new pickup command.
|
||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # 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
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_CARGO_DISPATCHER_HELICOPTER
|
-- @field #AI_CARGO_DISPATCHER_HELICOPTER
|
||||||
|
|||||||
@@ -130,12 +130,12 @@
|
|||||||
-- Use @{#AI_CARGO_DISPATCHER_SHIP.SetHomeZone}() to specify the home zone.
|
-- Use @{#AI_CARGO_DISPATCHER_SHIP.SetHomeZone}() to specify the home zone.
|
||||||
--
|
--
|
||||||
-- If no home zone is specified, the Ship will wait near the deploy zone for a new pickup command.
|
-- If no home zone is specified, the Ship will wait near the deploy zone for a new pickup command.
|
||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # 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
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_CARGO_DISPATCHER_SHIP
|
-- @field #AI_CARGO_DISPATCHER_SHIP
|
||||||
|
|||||||
@@ -41,12 +41,12 @@
|
|||||||
-- marginal impact on the overall battlefield simulation. Fortunately, the firing strength of infantry is limited, and thus, respacing healthy infantry every
|
-- marginal impact on the overall battlefield simulation. Fortunately, the firing strength of infantry is limited, and thus, respacing healthy infantry every
|
||||||
-- time is not so much of an issue ...
|
-- time is not so much of an issue ...
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # 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
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_CARGO_HELICOPTER
|
-- @field #AI_CARGO_HELICOPTER
|
||||||
|
|||||||
@@ -54,12 +54,12 @@
|
|||||||
-- Using the @{#AI_CARGO_SHIP.Pickup}() method, you are able to direct the Ship towards a Pickup zone to board/load the cargo at the specified
|
-- Using the @{#AI_CARGO_SHIP.Pickup}() method, you are able to direct the Ship towards a Pickup zone to board/load the cargo at the specified
|
||||||
-- coordinate. The Ship will follow the Shipping Lane to ensure consistent cargo transportation within the simulation environment.
|
-- coordinate. The Ship will follow the Shipping Lane to ensure consistent cargo transportation within the simulation environment.
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # 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
|
||||||
--
|
--
|
||||||
-- @field #AI_CARGO_SHIP
|
-- @field #AI_CARGO_SHIP
|
||||||
AI_CARGO_SHIP = {
|
AI_CARGO_SHIP = {
|
||||||
ClassName = "AI_CARGO_SHIP",
|
ClassName = "AI_CARGO_SHIP",
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/ESC%20-%20Escorting)
|
-- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Escort)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -174,12 +174,12 @@
|
|||||||
-- EscortPlanes = AI_ESCORT:New( EscortUnit, EscortGroup, "Desert", "Welcome to the mission. You are escorted by a plane with code name 'Desert', which can be instructed through the F10 radio menu." )
|
-- EscortPlanes = AI_ESCORT:New( EscortUnit, EscortGroup, "Desert", "Welcome to the mission. You are escorted by a plane with code name 'Desert', which can be instructed through the F10 radio menu." )
|
||||||
-- EscortPlanes:MenusAirplanes() -- create menus for airplanes
|
-- EscortPlanes:MenusAirplanes() -- create menus for airplanes
|
||||||
-- EscortPlanes:__Start(2)
|
-- EscortPlanes:__Start(2)
|
||||||
--
|
--
|
||||||
-- # 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
|
||||||
--
|
--
|
||||||
-- @field #AI_ESCORT
|
-- @field #AI_ESCORT
|
||||||
AI_ESCORT = {
|
AI_ESCORT = {
|
||||||
ClassName = "AI_ESCORT",
|
ClassName = "AI_ESCORT",
|
||||||
@@ -199,13 +199,6 @@ AI_ESCORT = {
|
|||||||
-- @field Functional.Detection#DETECTION_AREAS
|
-- @field Functional.Detection#DETECTION_AREAS
|
||||||
AI_ESCORT.Detection = nil
|
AI_ESCORT.Detection = nil
|
||||||
|
|
||||||
--- MENUPARAM type
|
|
||||||
-- @type MENUPARAM
|
|
||||||
-- @field #AI_ESCORT ParamSelf
|
|
||||||
-- @field #Distance ParamDistance
|
|
||||||
-- @field #function ParamFunction
|
|
||||||
-- @field #string ParamMessage
|
|
||||||
|
|
||||||
--- AI_ESCORT class constructor for an AI group
|
--- AI_ESCORT class constructor for an AI group
|
||||||
-- @param #AI_ESCORT self
|
-- @param #AI_ESCORT self
|
||||||
-- @param Wrapper.Client#CLIENT EscortUnit The client escorted by the EscortGroup.
|
-- @param Wrapper.Client#CLIENT EscortUnit The client escorted by the EscortGroup.
|
||||||
@@ -268,7 +261,7 @@ function AI_ESCORT:New( EscortUnit, EscortGroupSet, EscortName, EscortBriefing )
|
|||||||
|
|
||||||
|
|
||||||
EscortGroupSet:ForEachGroup(
|
EscortGroupSet:ForEachGroup(
|
||||||
-- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
-- Set EscortGroup known at EscortUnit.
|
-- Set EscortGroup known at EscortUnit.
|
||||||
if not self.PlayerUnit._EscortGroups then
|
if not self.PlayerUnit._EscortGroups then
|
||||||
@@ -350,7 +343,7 @@ function AI_ESCORT:onafterStart( EscortGroupSet )
|
|||||||
self:F()
|
self:F()
|
||||||
|
|
||||||
EscortGroupSet:ForEachGroup(
|
EscortGroupSet:ForEachGroup(
|
||||||
-- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
EscortGroup:WayPointInitialize()
|
EscortGroup:WayPointInitialize()
|
||||||
|
|
||||||
@@ -388,7 +381,7 @@ function AI_ESCORT:onafterStart( EscortGroupSet )
|
|||||||
self:_InitFlightMenus()
|
self:_InitFlightMenus()
|
||||||
|
|
||||||
self.EscortGroupSet:ForSomeGroupAlive(
|
self.EscortGroupSet:ForSomeGroupAlive(
|
||||||
-- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
|
|
||||||
self:_InitEscortMenus( EscortGroup )
|
self:_InitEscortMenus( EscortGroup )
|
||||||
@@ -419,7 +412,7 @@ function AI_ESCORT:onafterStop( EscortGroupSet )
|
|||||||
self:F()
|
self:F()
|
||||||
|
|
||||||
EscortGroupSet:ForEachGroup(
|
EscortGroupSet:ForEachGroup(
|
||||||
-- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
EscortGroup:WayPointInitialize()
|
EscortGroup:WayPointInitialize()
|
||||||
|
|
||||||
@@ -563,12 +556,12 @@ function AI_ESCORT:SetFlightMenuFormation( Formation )
|
|||||||
|
|
||||||
if MenuFormation then
|
if MenuFormation then
|
||||||
local Arguments = MenuFormation.Arguments
|
local Arguments = MenuFormation.Arguments
|
||||||
--self:I({Arguments=unpack(Arguments)})
|
--self:T({Arguments=unpack(Arguments)})
|
||||||
local FlightMenuFormation = MENU_GROUP:New( self.PlayerGroup, "Formation", self.MainMenu )
|
local 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, ... )
|
||||||
self.EscortGroupSet:ForSomeGroupAlive(
|
self.EscortGroupSet:ForSomeGroupAlive(
|
||||||
-- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup, self, Formation, Arguments )
|
function( EscortGroup, self, Formation, Arguments )
|
||||||
if EscortGroup:IsAir() then
|
if EscortGroup:IsAir() then
|
||||||
self:E({FormationID=FormationID})
|
self:E({FormationID=FormationID})
|
||||||
@@ -1249,7 +1242,7 @@ function AI_ESCORT:MenuAssistedAttack()
|
|||||||
self:F()
|
self:F()
|
||||||
|
|
||||||
self.EscortGroupSet:ForSomeGroupAlive(
|
self.EscortGroupSet:ForSomeGroupAlive(
|
||||||
-- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
if not EscortGroup:IsAir() then
|
if not EscortGroup:IsAir() then
|
||||||
-- Request assistance from other escorts.
|
-- Request assistance from other escorts.
|
||||||
@@ -1446,7 +1439,7 @@ function AI_ESCORT:_FlightHoldPosition( OrbitGroup, OrbitHeight, OrbitSeconds )
|
|||||||
local EscortUnit = self.PlayerUnit
|
local EscortUnit = self.PlayerUnit
|
||||||
|
|
||||||
self.EscortGroupSet:ForEachGroupAlive(
|
self.EscortGroupSet:ForEachGroupAlive(
|
||||||
-- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup, OrbitGroup )
|
function( EscortGroup, OrbitGroup )
|
||||||
if EscortGroup:IsAir() then
|
if EscortGroup:IsAir() then
|
||||||
if OrbitGroup == nil then
|
if OrbitGroup == nil then
|
||||||
@@ -1474,7 +1467,7 @@ end
|
|||||||
function AI_ESCORT:_FlightJoinUp()
|
function AI_ESCORT:_FlightJoinUp()
|
||||||
|
|
||||||
self.EscortGroupSet:ForEachGroupAlive(
|
self.EscortGroupSet:ForEachGroupAlive(
|
||||||
-- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
if EscortGroup:IsAir() then
|
if EscortGroup:IsAir() then
|
||||||
self:_JoinUp( EscortGroup )
|
self:_JoinUp( EscortGroup )
|
||||||
@@ -1501,7 +1494,7 @@ end
|
|||||||
function AI_ESCORT:_FlightFormationTrail( XStart, XSpace, YStart )
|
function AI_ESCORT:_FlightFormationTrail( XStart, XSpace, YStart )
|
||||||
|
|
||||||
self.EscortGroupSet:ForEachGroupAlive(
|
self.EscortGroupSet:ForEachGroupAlive(
|
||||||
-- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
if EscortGroup:IsAir() then
|
if EscortGroup:IsAir() then
|
||||||
self:_EscortFormationTrail( EscortGroup, XStart, XSpace, YStart )
|
self:_EscortFormationTrail( EscortGroup, XStart, XSpace, YStart )
|
||||||
@@ -1528,7 +1521,7 @@ end
|
|||||||
function AI_ESCORT:_FlightFormationStack( XStart, XSpace, YStart, YSpace )
|
function AI_ESCORT:_FlightFormationStack( XStart, XSpace, YStart, YSpace )
|
||||||
|
|
||||||
self.EscortGroupSet:ForEachGroupAlive(
|
self.EscortGroupSet:ForEachGroupAlive(
|
||||||
-- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
if EscortGroup:IsAir() then
|
if EscortGroup:IsAir() then
|
||||||
self:_EscortFormationStack( EscortGroup, XStart, XSpace, YStart, YSpace )
|
self:_EscortFormationStack( EscortGroup, XStart, XSpace, YStart, YSpace )
|
||||||
@@ -1551,7 +1544,7 @@ end
|
|||||||
function AI_ESCORT:_FlightFlare( Color, Message )
|
function AI_ESCORT:_FlightFlare( Color, Message )
|
||||||
|
|
||||||
self.EscortGroupSet:ForEachGroupAlive(
|
self.EscortGroupSet:ForEachGroupAlive(
|
||||||
-- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
if EscortGroup:IsAir() then
|
if EscortGroup:IsAir() then
|
||||||
self:_Flare( EscortGroup, Color, Message )
|
self:_Flare( EscortGroup, Color, Message )
|
||||||
@@ -1574,7 +1567,7 @@ end
|
|||||||
function AI_ESCORT:_FlightSmoke( Color, Message )
|
function AI_ESCORT:_FlightSmoke( Color, Message )
|
||||||
|
|
||||||
self.EscortGroupSet:ForEachGroupAlive(
|
self.EscortGroupSet:ForEachGroupAlive(
|
||||||
-- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
if EscortGroup:IsAir() then
|
if EscortGroup:IsAir() then
|
||||||
self:_Smoke( EscortGroup, Color, Message )
|
self:_Smoke( EscortGroup, Color, Message )
|
||||||
@@ -1605,7 +1598,7 @@ end
|
|||||||
function AI_ESCORT:_FlightSwitchReportNearbyTargets( ReportTargets )
|
function AI_ESCORT:_FlightSwitchReportNearbyTargets( ReportTargets )
|
||||||
|
|
||||||
self.EscortGroupSet:ForEachGroupAlive(
|
self.EscortGroupSet:ForEachGroupAlive(
|
||||||
-- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
if EscortGroup:IsAir() then
|
if EscortGroup:IsAir() then
|
||||||
self:_EscortSwitchReportNearbyTargets( EscortGroup, ReportTargets )
|
self:_EscortSwitchReportNearbyTargets( EscortGroup, ReportTargets )
|
||||||
@@ -1813,7 +1806,7 @@ end
|
|||||||
function AI_ESCORT:_FlightAttackTarget( DetectedItem )
|
function AI_ESCORT:_FlightAttackTarget( DetectedItem )
|
||||||
|
|
||||||
self.EscortGroupSet:ForEachGroupAlive(
|
self.EscortGroupSet:ForEachGroupAlive(
|
||||||
-- @param Core.Group#GROUP EscortGroup
|
-- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup, DetectedItem )
|
function( EscortGroup, DetectedItem )
|
||||||
if EscortGroup:IsAir() then
|
if EscortGroup:IsAir() then
|
||||||
self:_AttackTarget( EscortGroup, DetectedItem )
|
self:_AttackTarget( EscortGroup, DetectedItem )
|
||||||
|
|||||||
@@ -15,17 +15,17 @@
|
|||||||
-- @image MOOSE.JPG
|
-- @image MOOSE.JPG
|
||||||
|
|
||||||
|
|
||||||
--- @type AI_ESCORT_DISPATCHER
|
-- @type AI_ESCORT_DISPATCHER
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
|
|
||||||
--- Models the automatic assignment of AI escorts to player flights.
|
--- Models the automatic assignment of AI escorts to player flights.
|
||||||
--
|
--
|
||||||
-- # 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
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_ESCORT_DISPATCHER
|
-- @field #AI_ESCORT_DISPATCHER
|
||||||
@@ -33,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 = {}
|
||||||
|
|
||||||
|
|
||||||
@@ -102,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 )
|
||||||
|
|
||||||
@@ -110,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:I({EscortAirbase= self.EscortAirbase } )
|
self:T({EscortAirbase= self.EscortAirbase } )
|
||||||
self:I({PlayerGroupName = PlayerGroupName } )
|
self:T({PlayerGroupName = PlayerGroupName } )
|
||||||
self:I({PlayerGroup = PlayerGroup})
|
self:T({PlayerGroup = PlayerGroup})
|
||||||
self:I({FirstGroup = self.CarrierSet:GetFirst()})
|
self:T({FirstGroup = self.CarrierSet:GetFirst()})
|
||||||
self:I({FindGroup = self.CarrierSet:FindGroup( PlayerGroupName )})
|
self:T({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
|
||||||
@@ -125,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 )
|
||||||
|
|
||||||
@@ -133,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:I({EscortAirbase= self.EscortAirbase } )
|
self:T({EscortAirbase= self.EscortAirbase } )
|
||||||
self:I({PlayerGroupName = PlayerGroupName } )
|
self:T({PlayerGroupName = PlayerGroupName } )
|
||||||
self:I({PlayerGroup = PlayerGroup})
|
self:T({PlayerGroup = PlayerGroup})
|
||||||
self:I({FirstGroup = self.CarrierSet:GetFirst()})
|
self:T({FirstGroup = self.CarrierSet:GetFirst()})
|
||||||
self:I({FindGroup = self.CarrierSet:FindGroup( PlayerGroupName )})
|
self:T({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:I({EscortGroup = EscortGroup})
|
self:T({EscortGroup = EscortGroup})
|
||||||
|
|
||||||
self:ScheduleOnce( 1,
|
self:ScheduleOnce( 1,
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
|
|||||||
@@ -20,12 +20,12 @@
|
|||||||
|
|
||||||
|
|
||||||
--- Models the assignment of AI escorts to player flights upon request using the radio menu.
|
--- Models the assignment of AI escorts to player flights upon request using the radio menu.
|
||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # 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
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_ESCORT_DISPATCHER_REQUEST
|
-- @field #AI_ESCORT_DISPATCHER_REQUEST
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/ESC%20-%20Escorting)
|
-- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Escort)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -136,12 +136,12 @@
|
|||||||
--
|
--
|
||||||
-- Escort groups can have their own mission. This menu item will allow the escort group to resume their Mission from a given waypoint.
|
-- Escort groups can have their own mission. This menu item will allow the escort group to resume their Mission from a given waypoint.
|
||||||
-- Note that this is really fantastic, as you now have the dynamic of taking control of the escort groups, and allowing them to resume their path or mission.
|
-- Note that this is really fantastic, as you now have the dynamic of taking control of the escort groups, and allowing them to resume their path or mission.
|
||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # 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
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Authors: **FlightControl**
|
-- ### Authors: **FlightControl**
|
||||||
@@ -297,7 +297,7 @@ function AI_ESCORT_REQUEST:onafterStop( EscortGroupSet )
|
|||||||
self:F()
|
self:F()
|
||||||
|
|
||||||
EscortGroupSet:ForEachGroup(
|
EscortGroupSet:ForEachGroup(
|
||||||
--- @param Core.Group#GROUP EscortGroup
|
--- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
EscortGroup:WayPointInitialize()
|
EscortGroup:WayPointInitialize()
|
||||||
|
|
||||||
|
|||||||
@@ -8,11 +8,11 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/FOR%20-%20Formation)
|
-- ## Additional Material:
|
||||||
--
|
--
|
||||||
-- ===
|
-- * **Demo Missions:** [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Formation)
|
||||||
--
|
-- * **YouTube videos:** [Playlist](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl0bFIJ9jIdYM22uaWmIN4oz)
|
||||||
-- ### [YouTube Playlist](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl0bFIJ9jIdYM22uaWmIN4oz)
|
-- * **Guides:** None
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -31,11 +31,11 @@
|
|||||||
-- @field Core.Set#SET_GROUP FollowGroupSet
|
-- @field Core.Set#SET_GROUP FollowGroupSet
|
||||||
-- @field #string FollowName
|
-- @field #string FollowName
|
||||||
-- @field #AI_FORMATION.MODE FollowMode The mode the escort is in.
|
-- @field #AI_FORMATION.MODE FollowMode The mode the escort is in.
|
||||||
-- @field Scheduler#SCHEDULER FollowScheduler The instance of the SCHEDULER class.
|
-- @field Core.Scheduler#SCHEDULER FollowScheduler The instance of the SCHEDULER class.
|
||||||
-- @field #number FollowDistance The current follow distance.
|
-- @field #number FollowDistance The current follow distance.
|
||||||
-- @field #boolean ReportTargets If true, nearby targets are reported.
|
-- @field #boolean ReportTargets If true, nearby targets are reported.
|
||||||
-- @Field DCSTypes#AI.Option.Air.val.ROE OptionROE Which ROE is set to the FollowGroup.
|
-- @field DCS#AI.Option.Air.val.ROE OptionROE Which ROE is set to the FollowGroup.
|
||||||
-- @field DCSTypes#AI.Option.Air.val.REACTION_ON_THREAT OptionReactionOnThreat Which REACTION_ON_THREAT is set to the FollowGroup.
|
-- @field DCS#AI.Option.Air.val.REACTION_ON_THREAT OptionReactionOnThreat Which REACTION_ON_THREAT is set to the FollowGroup.
|
||||||
-- @field #number dtFollow Time step between position updates.
|
-- @field #number dtFollow Time step between position updates.
|
||||||
|
|
||||||
|
|
||||||
@@ -92,12 +92,12 @@
|
|||||||
-- local LargeFormation = AI_FORMATION:New( LeaderUnit, FollowGroupSet, "Center Wing Formation", "Briefing" )
|
-- local LargeFormation = AI_FORMATION:New( LeaderUnit, FollowGroupSet, "Center Wing Formation", "Briefing" )
|
||||||
-- LargeFormation:FormationCenterWing( 500, 50, 0, 250, 250 )
|
-- LargeFormation:FormationCenterWing( 500, 50, 0, 250, 250 )
|
||||||
-- LargeFormation:__Start( 1 )
|
-- LargeFormation:__Start( 1 )
|
||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # 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
|
||||||
--
|
--
|
||||||
-- @field #AI_FORMATION
|
-- @field #AI_FORMATION
|
||||||
AI_FORMATION = {
|
AI_FORMATION = {
|
||||||
ClassName = "AI_FORMATION",
|
ClassName = "AI_FORMATION",
|
||||||
@@ -164,15 +164,6 @@ AI_FORMATION.__Enum.ReportType = {
|
|||||||
Ground = "G",
|
Ground = "G",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- MENUPARAM type
|
|
||||||
-- @type MENUPARAM
|
|
||||||
-- @field #AI_FORMATION ParamSelf
|
|
||||||
-- @field #number ParamDistance
|
|
||||||
-- @field #function ParamFunction
|
|
||||||
-- @field #string ParamMessage
|
|
||||||
|
|
||||||
--- AI_FORMATION class constructor for an AI group
|
--- AI_FORMATION class constructor for an AI group
|
||||||
-- @param #AI_FORMATION self
|
-- @param #AI_FORMATION self
|
||||||
-- @param Wrapper.Unit#UNIT FollowUnit The UNIT leading the FolllowGroupSet.
|
-- @param Wrapper.Unit#UNIT FollowUnit The UNIT leading the FolllowGroupSet.
|
||||||
@@ -1005,7 +996,7 @@ function AI_FORMATION:SetFlightModeMission( FollowGroup )
|
|||||||
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Mission )
|
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Mission )
|
||||||
else
|
else
|
||||||
self.FollowGroupSet:ForSomeGroupAlive(
|
self.FollowGroupSet:ForSomeGroupAlive(
|
||||||
--- @param Core.Group#GROUP EscortGroup
|
--- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( FollowGroup )
|
function( FollowGroup )
|
||||||
FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) )
|
FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) )
|
||||||
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Mission )
|
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Mission )
|
||||||
@@ -1029,7 +1020,7 @@ function AI_FORMATION:SetFlightModeAttack( FollowGroup )
|
|||||||
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Attack )
|
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Attack )
|
||||||
else
|
else
|
||||||
self.FollowGroupSet:ForSomeGroupAlive(
|
self.FollowGroupSet:ForSomeGroupAlive(
|
||||||
--- @param Core.Group#GROUP EscortGroup
|
--- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( FollowGroup )
|
function( FollowGroup )
|
||||||
FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) )
|
FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) )
|
||||||
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Attack )
|
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Attack )
|
||||||
@@ -1053,7 +1044,7 @@ function AI_FORMATION:SetFlightModeFormation( FollowGroup )
|
|||||||
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Formation )
|
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Formation )
|
||||||
else
|
else
|
||||||
self.FollowGroupSet:ForSomeGroupAlive(
|
self.FollowGroupSet:ForSomeGroupAlive(
|
||||||
--- @param Core.Group#GROUP EscortGroup
|
--- @param Wrapper.Group#GROUP EscortGroup
|
||||||
function( FollowGroup )
|
function( FollowGroup )
|
||||||
FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) )
|
FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) )
|
||||||
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Formation )
|
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Formation )
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/PAT%20-%20Patrolling)
|
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Patrol)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -27,8 +27,8 @@
|
|||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
-- ### Contributions:
|
-- ### Contributions:
|
||||||
--
|
--
|
||||||
-- * **[Dutch_Baron](https://forums.eagle.ru/member.php?u=112075)**: Working together with James has resulted in the creation of the AI_BALANCER class. James has shared his ideas on balancing AI with air units, and together we made a first design which you can use now :-)
|
-- * **Dutch_Baron**: Working together with James has resulted in the creation of the AI_BALANCER class. James has shared his ideas on balancing AI with air units, and together we made a first design which you can use now :-)
|
||||||
-- * **[Pikey](https://forums.eagle.ru/member.php?u=62835)**: Testing and API concept review.
|
-- * **Pikey**: Testing and API concept review.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -144,12 +144,12 @@
|
|||||||
-- When the AI is damaged, it is required that a new AIControllable is started. However, damage cannon be foreseen early on.
|
-- When the AI is damaged, it is required that a new AIControllable is started. However, damage cannon be foreseen early on.
|
||||||
-- Therefore, when the damage threshold is reached, the AI will return immediately to the home base (RTB).
|
-- Therefore, when the damage threshold is reached, the AI will return immediately to the home base (RTB).
|
||||||
-- Use the method @{#AI_PATROL_ZONE.ManageDamage}() to have this process in place.
|
-- Use the method @{#AI_PATROL_ZONE.ManageDamage}() to have this process in place.
|
||||||
--
|
--
|
||||||
-- # 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
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @field #AI_PATROL_ZONE
|
-- @field #AI_PATROL_ZONE
|
||||||
@@ -652,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
|
||||||
@@ -705,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 )
|
||||||
@@ -822,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()
|
||||||
|
|
||||||
@@ -838,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:I( self.Controllable:GetName() .. " is out of fuel:" .. Fuel .. ", RTB!" )
|
self:T( self.Controllable:GetName() .. " is out of fuel:" .. Fuel .. ", RTB!" )
|
||||||
local OldAIControllable = self.Controllable
|
local 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 )
|
||||||
@@ -852,7 +852,7 @@ function AI_PATROL_ZONE:onafterStatus()
|
|||||||
-- 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:I( self.Controllable:GetName() .. " is damaged:" .. Damage .. ", RTB!" )
|
self:T( self.Controllable:GetName() .. " is damaged:" .. Damage .. ", RTB!" )
|
||||||
RTB = true
|
RTB = true
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -864,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()
|
||||||
|
|
||||||
@@ -903,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 )
|
||||||
|
|
||||||
@@ -920,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 )
|
||||||
|
|
||||||
@@ -929,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 )
|
||||||
|
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ end -- ACT_ACCOUNT
|
|||||||
|
|
||||||
do -- ACT_ACCOUNT_DEADS
|
do -- ACT_ACCOUNT_DEADS
|
||||||
|
|
||||||
--- # @{#ACT_ACCOUNT_DEADS} FSM class, extends @{Core.Fsm.Account#ACT_ACCOUNT}
|
--- # @{#ACT_ACCOUNT_DEADS} FSM class, extends @{#ACT_ACCOUNT}
|
||||||
--
|
--
|
||||||
-- The ACT_ACCOUNT_DEADS class accounts (detects, counts and reports) successful kills of DCS units.
|
-- The ACT_ACCOUNT_DEADS class accounts (detects, counts and reports) successful kills of DCS units.
|
||||||
-- The process is given a @{Core.Set} of units that will be tracked upon successful destruction.
|
-- The process is given a @{Core.Set} of units that will be tracked upon successful destruction.
|
||||||
|
|||||||
@@ -51,15 +51,15 @@
|
|||||||
-- * **After** the state transition.
|
-- * **After** the state transition.
|
||||||
-- The state transition method needs to start with the name **OnAfter + the name of the state**.
|
-- The state transition method needs to start with the name **OnAfter + the name of the state**.
|
||||||
-- These state transition methods need to provide a return value, which is specified at the function description.
|
-- These state transition methods need to provide a return value, which is specified at the function description.
|
||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # 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) @{#ACT_ASSIGN_ACCEPT} class, extends @{Core.Fsm.Assign#ACT_ASSIGN}
|
-- # 1) @{#ACT_ASSIGN_ACCEPT} class, extends @{Core.Fsm#ACT_ASSIGN}
|
||||||
--
|
--
|
||||||
-- The ACT_ASSIGN_ACCEPT class accepts by default a task for a player. No player intervention is allowed to reject the task.
|
-- The ACT_ASSIGN_ACCEPT class accepts by default a task for a player. No player intervention is allowed to reject the task.
|
||||||
--
|
--
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # 2) @{#ACT_ASSIGN_MENU_ACCEPT} class, extends @{Core.Fsm.Assign#ACT_ASSIGN}
|
-- # 2) @{#ACT_ASSIGN_MENU_ACCEPT} class, extends @{Core.Fsm#ACT_ASSIGN}
|
||||||
--
|
--
|
||||||
-- The ACT_ASSIGN_MENU_ACCEPT class accepts a task when the player accepts the task through an added menu option.
|
-- The ACT_ASSIGN_MENU_ACCEPT class accepts a task when the player accepts the task through an added menu option.
|
||||||
-- This assignment type is useful to conditionally allow the player to choose whether or not he would accept the task.
|
-- This assignment type is useful to conditionally allow the player to choose whether or not he would accept the task.
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # 1) @{#ACT_ASSIST_SMOKE_TARGETS_ZONE} class, extends @{Core.Fsm.Route#ACT_ASSIST}
|
-- # 1) @{#ACT_ASSIST_SMOKE_TARGETS_ZONE} class, extends @{#ACT_ASSIST}
|
||||||
--
|
--
|
||||||
-- The ACT_ASSIST_SMOKE_TARGETS_ZONE class implements the core functions to smoke targets in a @{Core.Zone}.
|
-- The ACT_ASSIST_SMOKE_TARGETS_ZONE class implements the core functions to smoke targets in a @{Core.Zone}.
|
||||||
-- The targets are smoked within a certain range around each target, simulating a realistic smoking behaviour.
|
-- The targets are smoked within a certain range around each target, simulating a realistic smoking behaviour.
|
||||||
@@ -57,12 +57,12 @@
|
|||||||
-- # 1.1) ACT_ASSIST_SMOKE_TARGETS_ZONE constructor:
|
-- # 1.1) ACT_ASSIST_SMOKE_TARGETS_ZONE constructor:
|
||||||
--
|
--
|
||||||
-- * @{#ACT_ASSIST_SMOKE_TARGETS_ZONE.New}(): Creates a new ACT_ASSIST_SMOKE_TARGETS_ZONE object.
|
-- * @{#ACT_ASSIST_SMOKE_TARGETS_ZONE.New}(): Creates a new ACT_ASSIST_SMOKE_TARGETS_ZONE object.
|
||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # 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
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @module Actions.Act_Assist
|
-- @module Actions.Act_Assist
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # 1) @{#ACT_ROUTE_ZONE} class, extends @{Core.Fsm.Route#ACT_ROUTE}
|
-- # 1) @{#ACT_ROUTE_ZONE} class, extends @{#ACT_ROUTE}
|
||||||
--
|
--
|
||||||
-- The ACT_ROUTE_ZONE class implements the core functions to route an AIR @{Wrapper.Controllable} player @{Wrapper.Unit} to a @{Core.Zone}.
|
-- The ACT_ROUTE_ZONE class implements the core functions to route an AIR @{Wrapper.Controllable} player @{Wrapper.Unit} to a @{Core.Zone}.
|
||||||
-- The player receives on perioding times messages with the coordinates of the route to follow.
|
-- The player receives on perioding times messages with the coordinates of the route to follow.
|
||||||
@@ -69,12 +69,12 @@
|
|||||||
-- # 1.1) ACT_ROUTE_ZONE constructor:
|
-- # 1.1) ACT_ROUTE_ZONE constructor:
|
||||||
--
|
--
|
||||||
-- * @{#ACT_ROUTE_ZONE.New}(): Creates a new ACT_ROUTE_ZONE object.
|
-- * @{#ACT_ROUTE_ZONE.New}(): Creates a new ACT_ROUTE_ZONE object.
|
||||||
--
|
--
|
||||||
-- # 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
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @module Actions.Act_Route
|
-- @module Actions.Act_Route
|
||||||
|
|||||||
@@ -86,7 +86,7 @@
|
|||||||
-- There are also dispatchers that make AI work together to transport cargo automatically!!!
|
-- There are also dispatchers that make AI work together to transport cargo automatically!!!
|
||||||
--
|
--
|
||||||
-- - @{AI.AI_Cargo_Dispatcher_APC} derived classes will create for your dynamic cargo handlers controlled by AI ground vehicle groups (APCs) to transport cargo between sites.
|
-- - @{AI.AI_Cargo_Dispatcher_APC} derived classes will create for your dynamic cargo handlers controlled by AI ground vehicle groups (APCs) to transport cargo between sites.
|
||||||
-- - @{AI.AI_Cargo_Dispatcher_Helicopters} derived classes will create for your dynamic cargo handlers controlled by AI helicopter groups to transport cargo between sites.
|
-- - @{AI.AI_Cargo_Dispatcher_Helicopter} derived classes will create for your dynamic cargo handlers controlled by AI helicopter groups to transport cargo between sites.
|
||||||
--
|
--
|
||||||
-- ## 3.3) Cargo transportation tasking.
|
-- ## 3.3) Cargo transportation tasking.
|
||||||
--
|
--
|
||||||
@@ -233,12 +233,12 @@
|
|||||||
-- Note that this option is optional, so can be omitted. The default value of the RR is 250 meters.
|
-- Note that this option is optional, so can be omitted. The default value of the RR is 250 meters.
|
||||||
-- * **NR=** Provide the maximum range in meters when the cargo units will be boarded within the carrier during boarding.
|
-- * **NR=** Provide the maximum range in meters when the cargo units will be boarded within the carrier during boarding.
|
||||||
-- Note that this option is optional, so can be omitted. The default value of the RR is 10 meters.
|
-- Note that this option is optional, so can be omitted. The default value of the RR is 10 meters.
|
||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # 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
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
@@ -370,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.
|
||||||
@@ -398,7 +398,7 @@ do -- CARGO
|
|||||||
--
|
--
|
||||||
-- * AI Armoured Personnel Carriers to transport cargo and engage in battles, using the @{AI.AI_Cargo_APC#AI_CARGO_APC} class.
|
-- * AI Armoured Personnel Carriers to transport cargo and engage in battles, using the @{AI.AI_Cargo_APC#AI_CARGO_APC} class.
|
||||||
-- * AI Helicopters to transport cargo, using the @{AI.AI_Cargo_Helicopter#AI_CARGO_HELICOPTER} class.
|
-- * AI Helicopters to transport cargo, using the @{AI.AI_Cargo_Helicopter#AI_CARGO_HELICOPTER} class.
|
||||||
-- * AI Planes to transport cargo, using the @{AI.AI_Cargo_Plane#AI_CARGO_PLANE} class.
|
-- * AI Planes to transport cargo, using the @{AI.AI_Cargo_Airplane#AI_CARGO_AIRPLANE} class.
|
||||||
-- * AI Ships is planned.
|
-- * AI Ships is planned.
|
||||||
--
|
--
|
||||||
-- The above cargo classes are also used by the TASK\_CARGO\_ classes to allow human players to transport cargo as part of a tasking:
|
-- The above cargo classes are also used by the TASK\_CARGO\_ classes to allow human players to transport cargo as part of a tasking:
|
||||||
@@ -433,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.
|
||||||
@@ -447,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:F( { Type, Name, Weight, LoadRadius, NearRadius } )
|
self:T( { Type, Name, Weight, LoadRadius, NearRadius } )
|
||||||
|
|
||||||
self:SetStartState( "UnLoaded" )
|
self:SetStartState( "UnLoaded" )
|
||||||
self:AddTransition( { "UnLoaded", "Boarding" }, "Board", "Boarding" )
|
self:AddTransition( { "UnLoaded", "Boarding" }, "Board", "Boarding" )
|
||||||
@@ -711,7 +711,7 @@ do -- CARGO
|
|||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return #CARGO
|
-- @return #CARGO
|
||||||
function CARGO:Spawn( PointVec2 )
|
function CARGO:Spawn( PointVec2 )
|
||||||
self:F()
|
self:T()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -812,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:F( { Coordinate, LoadRadius = self.LoadRadius } )
|
self:T( { Coordinate, LoadRadius = self.LoadRadius } )
|
||||||
|
|
||||||
local Distance = 0
|
local Distance = 0
|
||||||
if self:IsUnLoaded() then
|
if self:IsUnLoaded() then
|
||||||
@@ -832,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:F( { Coordinate } )
|
self:T( { Coordinate } )
|
||||||
|
|
||||||
local Distance = 0
|
local Distance = 0
|
||||||
if self:IsUnLoaded() then
|
if self:IsUnLoaded() then
|
||||||
@@ -853,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:F( { PointVec2 = PointVec2, NearRadius = NearRadius } )
|
--self:T( { PointVec2 = PointVec2, NearRadius = NearRadius } )
|
||||||
|
|
||||||
if self.CargoObject:IsAlive() then
|
if self.CargoObject:IsAlive() then
|
||||||
--local Distance = PointVec2:Get2DDistance( self.CargoObject:GetPointVec2() )
|
--local Distance = PointVec2:Get2DDistance( self.CargoObject:GetPointVec2() )
|
||||||
--self:F( { CargoObjectName = self.CargoObject:GetName() } )
|
--self:T( { CargoObjectName = self.CargoObject:GetName() } )
|
||||||
--self:F( { CargoObjectVec2 = self.CargoObject:GetVec2() } )
|
--self:T( { CargoObjectVec2 = self.CargoObject:GetVec2() } )
|
||||||
--self:F( { PointVec2 = PointVec2:GetVec2() } )
|
--self:T( { PointVec2 = PointVec2:GetVec2() } )
|
||||||
local Distance = Coordinate:Get2DDistance( self.CargoObject:GetCoordinate() )
|
local Distance = Coordinate:Get2DDistance( self.CargoObject:GetCoordinate() )
|
||||||
--self:F( { Distance = Distance, NearRadius = NearRadius or "nil" } )
|
--self:T( { Distance = Distance, NearRadius = NearRadius or "nil" } )
|
||||||
|
|
||||||
if Distance <= NearRadius then
|
if Distance <= NearRadius then
|
||||||
--self:F( { PointVec2 = PointVec2, NearRadius = NearRadius, IsNear = true } )
|
--self:T( { PointVec2 = PointVec2, NearRadius = NearRadius, IsNear = true } )
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--self:F( { PointVec2 = PointVec2, NearRadius = NearRadius, IsNear = false } )
|
--self:T( { PointVec2 = PointVec2, NearRadius = NearRadius, IsNear = false } )
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -878,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:F( { Zone } )
|
--self:T( { Zone } )
|
||||||
|
|
||||||
if self:IsLoaded() then
|
if self:IsLoaded() then
|
||||||
return Zone:IsPointVec2InZone( self.CargoCarrier:GetPointVec2() )
|
return Zone:IsPointVec2InZone( self.CargoCarrier:GetPointVec2() )
|
||||||
else
|
else
|
||||||
--self:F( { Size = self.CargoObject:GetSize(), Units = self.CargoObject:GetUnits() } )
|
--self:T( { Size = self.CargoObject:GetSize(), Units = self.CargoObject:GetUnits() } )
|
||||||
if self.CargoObject:GetSize() ~= 0 then
|
if self.CargoObject:GetSize() ~= 0 then
|
||||||
return Zone:IsPointVec2InZone( self.CargoObject:GetPointVec2() )
|
return Zone:IsPointVec2InZone( self.CargoObject:GetPointVec2() )
|
||||||
else
|
else
|
||||||
@@ -980,7 +980,7 @@ do -- CARGO
|
|||||||
|
|
||||||
--- Report to a Carrier Group with a Flaring signal.
|
--- Report to a Carrier Group with a Flaring signal.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param Utils#UTILS.FlareColor FlareColor the color of the flare.
|
-- @param Utilities.Utils#UTILS.FlareColor FlareColor the color of the flare.
|
||||||
-- @return #CARGO
|
-- @return #CARGO
|
||||||
function CARGO:ReportFlare( FlareColor )
|
function CARGO:ReportFlare( FlareColor )
|
||||||
|
|
||||||
@@ -989,7 +989,7 @@ do -- CARGO
|
|||||||
|
|
||||||
--- Report to a Carrier Group with a Smoking signal.
|
--- Report to a Carrier Group with a Smoking signal.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param Utils#UTILS.SmokeColor SmokeColor the color of the smoke.
|
-- @param Utilities.Utils#UTILS.SmokeColor SmokeColor the color of the smoke.
|
||||||
-- @return #CARGO
|
-- @return #CARGO
|
||||||
function CARGO:ReportSmoke( SmokeColor )
|
function CARGO:ReportSmoke( SmokeColor )
|
||||||
|
|
||||||
@@ -1034,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
|
||||||
|
|
||||||
@@ -1056,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:F( { Type, Name, LoadRadius, NearRadius } )
|
self:T( { Type, Name, LoadRadius, NearRadius } )
|
||||||
|
|
||||||
-- Descriptors.
|
-- Descriptors.
|
||||||
local Desc=CargoObject:GetDesc()
|
local Desc=CargoObject:GetDesc()
|
||||||
@@ -1086,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:F( { CargoName = self:GetName() } )
|
self:T( { CargoName = self:GetName() } )
|
||||||
--_EVENTDISPATCHER:CreateEventDeleteCargo( self )
|
--_EVENTDISPATCHER:CreateEventDeleteCargo( self )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -1123,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:F({NearUnit=NearUnit})
|
self:T({NearUnit=NearUnit})
|
||||||
local NearUnitCoalition = NearUnit:GetCoalition()
|
local NearUnitCoalition = NearUnit:GetCoalition()
|
||||||
local CargoCoalition = self:GetCoalition()
|
local CargoCoalition = self:GetCoalition()
|
||||||
if NearUnitCoalition == CargoCoalition then
|
if NearUnitCoalition == CargoCoalition then
|
||||||
local Attributes = NearUnit:GetDesc()
|
local Attributes = NearUnit:GetDesc()
|
||||||
self:F({Desc=Attributes})
|
self:T({Desc=Attributes})
|
||||||
if NearUnit:HasAttribute( "Trucks" ) then
|
if NearUnit:HasAttribute( "Trucks" ) then
|
||||||
MESSAGE:New( Message, 20, NearUnit:GetCallsign() .. " reporting - Cargo " .. self:GetName() ):ToGroup( TaskGroup )
|
MESSAGE:New( Message, 20, NearUnit:GetCallsign() .. " reporting - Cargo " .. self:GetName() ):ToGroup( TaskGroup )
|
||||||
break
|
break
|
||||||
@@ -1142,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"
|
||||||
@@ -1158,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:F( { Type, Name, Weight, LoadRadius, NearRadius } )
|
self:T( { Type, Name, Weight, LoadRadius, NearRadius } )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -1178,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"
|
||||||
@@ -1195,7 +1195,7 @@ do -- CARGO_PACKAGE
|
|||||||
-- @return #CARGO_PACKAGE
|
-- @return #CARGO_PACKAGE
|
||||||
function CARGO_PACKAGE:New( CargoCarrier, Type, Name, Weight, LoadRadius, NearRadius )
|
function CARGO_PACKAGE:New( CargoCarrier, Type, Name, Weight, LoadRadius, NearRadius )
|
||||||
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoCarrier, Type, Name, Weight, LoadRadius, NearRadius ) ) -- #CARGO_PACKAGE
|
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoCarrier, Type, Name, Weight, LoadRadius, NearRadius ) ) -- #CARGO_PACKAGE
|
||||||
self:F( { Type, Name, Weight, LoadRadius, NearRadius } )
|
self:T( { Type, Name, Weight, LoadRadius, NearRadius } )
|
||||||
|
|
||||||
self:T( CargoCarrier )
|
self:T( CargoCarrier )
|
||||||
self.CargoCarrier = CargoCarrier
|
self.CargoCarrier = CargoCarrier
|
||||||
@@ -1213,7 +1213,7 @@ end
|
|||||||
-- @param #number BoardDistance
|
-- @param #number BoardDistance
|
||||||
-- @param #number Angle
|
-- @param #number Angle
|
||||||
function CARGO_PACKAGE:onafterOnBoard( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
|
function CARGO_PACKAGE:onafterOnBoard( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
|
||||||
self:F()
|
self:T()
|
||||||
|
|
||||||
self.CargoInAir = self.CargoCarrier:InAir()
|
self.CargoInAir = self.CargoCarrier:InAir()
|
||||||
|
|
||||||
@@ -1246,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:F()
|
self:T()
|
||||||
|
|
||||||
local CargoCarrierPoint = CargoCarrier:GetCoordinate()
|
local CargoCarrierPoint = CargoCarrier:GetCoordinate()
|
||||||
|
|
||||||
@@ -1271,7 +1271,7 @@ end
|
|||||||
-- @param #number LoadDistance
|
-- @param #number LoadDistance
|
||||||
-- @param #number Angle
|
-- @param #number Angle
|
||||||
function CARGO_PACKAGE:onafterOnBoarded( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
|
function CARGO_PACKAGE:onafterOnBoarded( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
|
||||||
self:F()
|
self:T()
|
||||||
|
|
||||||
if self:IsNear( CargoCarrier ) then
|
if self:IsNear( CargoCarrier ) then
|
||||||
self:__Load( 1, CargoCarrier, Speed, LoadDistance, Angle )
|
self:__Load( 1, CargoCarrier, Speed, LoadDistance, Angle )
|
||||||
@@ -1292,7 +1292,7 @@ end
|
|||||||
-- @param #number Radius
|
-- @param #number Radius
|
||||||
-- @param #number Angle
|
-- @param #number Angle
|
||||||
function CARGO_PACKAGE:onafterUnBoard( From, Event, To, CargoCarrier, Speed, UnLoadDistance, UnBoardDistance, Radius, Angle )
|
function CARGO_PACKAGE:onafterUnBoard( From, Event, To, CargoCarrier, Speed, UnLoadDistance, UnBoardDistance, Radius, Angle )
|
||||||
self:F()
|
self:T()
|
||||||
|
|
||||||
self.CargoInAir = self.CargoCarrier:InAir()
|
self.CargoInAir = self.CargoCarrier:InAir()
|
||||||
|
|
||||||
@@ -1331,7 +1331,7 @@ end
|
|||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
-- @param #number Speed
|
-- @param #number Speed
|
||||||
function CARGO_PACKAGE:onafterUnBoarded( From, Event, To, CargoCarrier, Speed )
|
function CARGO_PACKAGE:onafterUnBoarded( From, Event, To, CargoCarrier, Speed )
|
||||||
self:F()
|
self:T()
|
||||||
|
|
||||||
if self:IsNear( CargoCarrier ) then
|
if self:IsNear( CargoCarrier ) then
|
||||||
self:__UnLoad( 1, CargoCarrier, Speed )
|
self:__UnLoad( 1, CargoCarrier, Speed )
|
||||||
@@ -1350,7 +1350,7 @@ end
|
|||||||
-- @param #number LoadDistance
|
-- @param #number LoadDistance
|
||||||
-- @param #number Angle
|
-- @param #number Angle
|
||||||
function CARGO_PACKAGE:onafterLoad( From, Event, To, CargoCarrier, Speed, LoadDistance, Angle )
|
function CARGO_PACKAGE:onafterLoad( From, Event, To, CargoCarrier, Speed, LoadDistance, Angle )
|
||||||
self:F()
|
self:T()
|
||||||
|
|
||||||
self.CargoCarrier = CargoCarrier
|
self.CargoCarrier = CargoCarrier
|
||||||
|
|
||||||
@@ -1378,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:F()
|
self:T()
|
||||||
|
|
||||||
local StartPointVec2 = self.CargoCarrier:GetPointVec2()
|
local StartPointVec2 = self.CargoCarrier:GetPointVec2()
|
||||||
local CargoCarrierHeading = self.CargoCarrier:GetHeading() -- Get Heading of object in degrees.
|
local CargoCarrierHeading = self.CargoCarrier:GetHeading() -- Get Heading of object in degrees.
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ do -- CARGO_CRATE
|
|||||||
-- @return #CARGO_CRATE
|
-- @return #CARGO_CRATE
|
||||||
function CARGO_CRATE:New( CargoStatic, Type, Name, LoadRadius, NearRadius )
|
function CARGO_CRATE:New( CargoStatic, Type, Name, LoadRadius, NearRadius )
|
||||||
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoStatic, Type, Name, nil, LoadRadius, NearRadius ) ) -- #CARGO_CRATE
|
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoStatic, Type, Name, nil, LoadRadius, NearRadius ) ) -- #CARGO_CRATE
|
||||||
self:F( { Type, Name, NearRadius } )
|
self:T( { Type, Name, NearRadius } )
|
||||||
|
|
||||||
self.CargoObject = CargoStatic -- Wrapper.Static#STATIC
|
self.CargoObject = CargoStatic -- Wrapper.Static#STATIC
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ do -- CARGO_CRATE
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#POINT_VEC2
|
-- @param Core.Point#POINT_VEC2
|
||||||
function CARGO_CRATE:onenterUnLoaded( From, Event, To, ToPointVec2 )
|
function CARGO_CRATE:onenterUnLoaded( From, Event, To, ToPointVec2 )
|
||||||
--self:F( { ToPointVec2, From, Event, To } )
|
--self:T( { ToPointVec2, From, Event, To } )
|
||||||
|
|
||||||
local Angle = 180
|
local Angle = 180
|
||||||
local Speed = 10
|
local Speed = 10
|
||||||
@@ -153,7 +153,7 @@ do -- CARGO_CRATE
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
function CARGO_CRATE:onenterLoaded( From, Event, To, CargoCarrier )
|
function CARGO_CRATE:onenterLoaded( From, Event, To, CargoCarrier )
|
||||||
--self:F( { From, Event, To, CargoCarrier } )
|
--self:T( { From, Event, To, CargoCarrier } )
|
||||||
|
|
||||||
self.CargoCarrier = CargoCarrier
|
self.CargoCarrier = CargoCarrier
|
||||||
|
|
||||||
@@ -190,7 +190,7 @@ do -- CARGO_CRATE
|
|||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
-- @return #boolean true if the Cargo Crate is within the report radius.
|
-- @return #boolean true if the Cargo Crate is within the report radius.
|
||||||
function CARGO_CRATE:IsInReportRadius( Coordinate )
|
function CARGO_CRATE:IsInReportRadius( Coordinate )
|
||||||
--self:F( { Coordinate, LoadRadius = self.LoadRadius } )
|
--self:T( { Coordinate, LoadRadius = self.LoadRadius } )
|
||||||
|
|
||||||
local Distance = 0
|
local Distance = 0
|
||||||
if self:IsUnLoaded() then
|
if self:IsUnLoaded() then
|
||||||
@@ -210,7 +210,7 @@ do -- CARGO_CRATE
|
|||||||
-- @param Core.Point#Coordinate Coordinate
|
-- @param Core.Point#Coordinate Coordinate
|
||||||
-- @return #boolean true if the Cargo Crate is within the loading radius.
|
-- @return #boolean true if the Cargo Crate is within the loading radius.
|
||||||
function CARGO_CRATE:IsInLoadRadius( Coordinate )
|
function CARGO_CRATE:IsInLoadRadius( Coordinate )
|
||||||
--self:F( { Coordinate, LoadRadius = self.NearRadius } )
|
--self:T( { Coordinate, LoadRadius = self.NearRadius } )
|
||||||
|
|
||||||
local Distance = 0
|
local Distance = 0
|
||||||
if self:IsUnLoaded() then
|
if self:IsUnLoaded() then
|
||||||
@@ -231,7 +231,7 @@ do -- CARGO_CRATE
|
|||||||
-- @return Core.Point#COORDINATE The current Coordinate of the first Cargo of the CargoGroup.
|
-- @return Core.Point#COORDINATE The current Coordinate of the first Cargo of the CargoGroup.
|
||||||
-- @return #nil There is no valid Cargo in the CargoGroup.
|
-- @return #nil There is no valid Cargo in the CargoGroup.
|
||||||
function CARGO_CRATE:GetCoordinate()
|
function CARGO_CRATE:GetCoordinate()
|
||||||
--self:F()
|
--self:T()
|
||||||
|
|
||||||
return self.CargoObject:GetCoordinate()
|
return self.CargoObject:GetCoordinate()
|
||||||
end
|
end
|
||||||
@@ -261,7 +261,7 @@ do -- CARGO_CRATE
|
|||||||
-- @param #CARGO_CRATE self
|
-- @param #CARGO_CRATE self
|
||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
function CARGO_CRATE:RouteTo( Coordinate )
|
function CARGO_CRATE:RouteTo( Coordinate )
|
||||||
self:F( {Coordinate = Coordinate } )
|
self:T( {Coordinate = Coordinate } )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -274,7 +274,7 @@ do -- CARGO_CRATE
|
|||||||
-- @return #boolean The Cargo is near to the Carrier.
|
-- @return #boolean The Cargo is near to the Carrier.
|
||||||
-- @return #nil The Cargo is not near to the Carrier.
|
-- @return #nil The Cargo is not near to the Carrier.
|
||||||
function CARGO_CRATE:IsNear( CargoCarrier, NearRadius )
|
function CARGO_CRATE:IsNear( CargoCarrier, NearRadius )
|
||||||
self:F( {NearRadius = NearRadius } )
|
self:T( {NearRadius = NearRadius } )
|
||||||
|
|
||||||
return self:IsNear( CargoCarrier:GetCoordinate(), NearRadius )
|
return self:IsNear( CargoCarrier:GetCoordinate(), NearRadius )
|
||||||
end
|
end
|
||||||
@@ -283,7 +283,7 @@ do -- CARGO_CRATE
|
|||||||
-- @param #CARGO_CRATE self
|
-- @param #CARGO_CRATE self
|
||||||
function CARGO_CRATE:Respawn()
|
function CARGO_CRATE:Respawn()
|
||||||
|
|
||||||
self:F( { "Respawning crate " .. self:GetName() } )
|
self:T( { "Respawning crate " .. self:GetName() } )
|
||||||
|
|
||||||
|
|
||||||
-- Respawn the group...
|
-- Respawn the group...
|
||||||
@@ -300,7 +300,7 @@ do -- CARGO_CRATE
|
|||||||
-- @param #CARGO_CRATE self
|
-- @param #CARGO_CRATE self
|
||||||
function CARGO_CRATE:onafterReset()
|
function CARGO_CRATE:onafterReset()
|
||||||
|
|
||||||
self:F( { "Reset crate " .. self:GetName() } )
|
self:T( { "Reset crate " .. self:GetName() } )
|
||||||
|
|
||||||
|
|
||||||
-- Respawn the group...
|
-- Respawn the group...
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ do -- CARGO_GROUP
|
|||||||
|
|
||||||
-- Inherit CAROG_REPORTABLE
|
-- Inherit CAROG_REPORTABLE
|
||||||
local self = BASE:Inherit( self, CARGO_REPORTABLE:New( Type, Name, 0, LoadRadius, NearRadius ) ) -- #CARGO_GROUP
|
local self = BASE:Inherit( self, CARGO_REPORTABLE:New( Type, Name, 0, LoadRadius, NearRadius ) ) -- #CARGO_GROUP
|
||||||
self:F( { Type, Name, LoadRadius } )
|
self:T( { Type, Name, LoadRadius } )
|
||||||
|
|
||||||
self.CargoSet = SET_CARGO:New()
|
self.CargoSet = SET_CARGO:New()
|
||||||
self.CargoGroup = CargoGroup
|
self.CargoGroup = CargoGroup
|
||||||
@@ -146,7 +146,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param #CARGO_GROUP self
|
-- @param #CARGO_GROUP self
|
||||||
function CARGO_GROUP:Respawn()
|
function CARGO_GROUP:Respawn()
|
||||||
|
|
||||||
self:F( { "Respawning" } )
|
self:T( { "Respawning" } )
|
||||||
|
|
||||||
for CargoID, CargoData in pairs( self.CargoSet:GetSet() ) do
|
for CargoID, CargoData in pairs( self.CargoSet:GetSet() ) do
|
||||||
local Cargo = CargoData -- Cargo.Cargo#CARGO
|
local Cargo = CargoData -- Cargo.Cargo#CARGO
|
||||||
@@ -227,7 +227,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param #CARGO_GROUP self
|
-- @param #CARGO_GROUP self
|
||||||
function CARGO_GROUP:Regroup()
|
function CARGO_GROUP:Regroup()
|
||||||
|
|
||||||
self:F("Regroup")
|
self:T("Regroup")
|
||||||
|
|
||||||
if self.Grouped == false then
|
if self.Grouped == false then
|
||||||
|
|
||||||
@@ -241,7 +241,7 @@ do -- CARGO_GROUP
|
|||||||
for CargoUnitName, CargoUnit in pairs( self.CargoSet:GetSet() ) do
|
for CargoUnitName, CargoUnit in pairs( self.CargoSet:GetSet() ) do
|
||||||
local CargoUnit = CargoUnit -- Cargo.CargoUnit#CARGO_UNIT
|
local CargoUnit = CargoUnit -- Cargo.CargoUnit#CARGO_UNIT
|
||||||
|
|
||||||
self:F( { CargoUnit:GetName(), UnLoaded = CargoUnit:IsUnLoaded() } )
|
self:T( { CargoUnit:GetName(), UnLoaded = CargoUnit:IsUnLoaded() } )
|
||||||
|
|
||||||
if CargoUnit:IsUnLoaded() then
|
if CargoUnit:IsUnLoaded() then
|
||||||
|
|
||||||
@@ -258,7 +258,7 @@ do -- CARGO_GROUP
|
|||||||
-- Then we register the new group in the database
|
-- Then we register the new group in the database
|
||||||
self.CargoGroup = GROUP:NewTemplate( GroupTemplate, GroupTemplate.CoalitionID, GroupTemplate.CategoryID, GroupTemplate.CountryID )
|
self.CargoGroup = GROUP:NewTemplate( GroupTemplate, GroupTemplate.CoalitionID, GroupTemplate.CategoryID, GroupTemplate.CountryID )
|
||||||
|
|
||||||
self:F( { "Regroup", GroupTemplate } )
|
self:T( { "Regroup", GroupTemplate } )
|
||||||
|
|
||||||
-- Now we spawn the new group based on the template created.
|
-- Now we spawn the new group based on the template created.
|
||||||
self.CargoObject = _DATABASE:Spawn( GroupTemplate )
|
self.CargoObject = _DATABASE:Spawn( GroupTemplate )
|
||||||
@@ -271,7 +271,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function CARGO_GROUP:OnEventCargoDead( EventData )
|
function CARGO_GROUP:OnEventCargoDead( EventData )
|
||||||
|
|
||||||
self:E(EventData)
|
self:T(EventData)
|
||||||
|
|
||||||
local Destroyed = false
|
local Destroyed = false
|
||||||
|
|
||||||
@@ -296,7 +296,7 @@ do -- CARGO_GROUP
|
|||||||
|
|
||||||
if Destroyed then
|
if Destroyed then
|
||||||
self:Destroyed()
|
self:Destroyed()
|
||||||
self:E( { "Cargo group destroyed" } )
|
self:T( { "Cargo group destroyed" } )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -309,14 +309,14 @@ do -- CARGO_GROUP
|
|||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
||||||
function CARGO_GROUP:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ... )
|
function CARGO_GROUP:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||||
self:F( { CargoCarrier.UnitName, From, Event, To, NearRadius = NearRadius } )
|
self:T( { CargoCarrier.UnitName, From, Event, To, NearRadius = NearRadius } )
|
||||||
|
|
||||||
NearRadius = NearRadius or self.NearRadius
|
NearRadius = NearRadius or self.NearRadius
|
||||||
|
|
||||||
-- For each Cargo object within the CARGO_GROUPED, route each object to the CargoLoadPointVec2
|
-- For each Cargo object within the CARGO_GROUPED, route each object to the CargoLoadPointVec2
|
||||||
self.CargoSet:ForEach(
|
self.CargoSet:ForEach(
|
||||||
function( Cargo, ... )
|
function( Cargo, ... )
|
||||||
self:F( { "Board Unit", Cargo:GetName( ), Cargo:IsDestroyed(), Cargo.CargoObject:IsAlive() } )
|
self:T( { "Board Unit", Cargo:GetName( ), Cargo:IsDestroyed(), Cargo.CargoObject:IsAlive() } )
|
||||||
local CargoGroup = Cargo.CargoObject --Wrapper.Group#GROUP
|
local CargoGroup = Cargo.CargoObject --Wrapper.Group#GROUP
|
||||||
CargoGroup:OptionAlarmStateGreen()
|
CargoGroup:OptionAlarmStateGreen()
|
||||||
Cargo:__Board( 1, CargoCarrier, NearRadius, ... )
|
Cargo:__Board( 1, CargoCarrier, NearRadius, ... )
|
||||||
@@ -334,7 +334,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
function CARGO_GROUP:onafterLoad( From, Event, To, CargoCarrier, ... )
|
function CARGO_GROUP:onafterLoad( From, Event, To, CargoCarrier, ... )
|
||||||
--self:F( { From, Event, To, CargoCarrier, ...} )
|
--self:T( { From, Event, To, CargoCarrier, ...} )
|
||||||
|
|
||||||
if From == "UnLoaded" then
|
if From == "UnLoaded" then
|
||||||
-- For each Cargo object within the CARGO_GROUP, load each cargo to the CargoCarrier.
|
-- For each Cargo object within the CARGO_GROUP, load each cargo to the CargoCarrier.
|
||||||
@@ -359,7 +359,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
||||||
function CARGO_GROUP:onafterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
|
function CARGO_GROUP:onafterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||||
--self:F( { CargoCarrier.UnitName, From, Event, To } )
|
--self:T( { CargoCarrier.UnitName, From, Event, To } )
|
||||||
|
|
||||||
local Boarded = true
|
local Boarded = true
|
||||||
local Cancelled = false
|
local Cancelled = false
|
||||||
@@ -393,7 +393,7 @@ do -- CARGO_GROUP
|
|||||||
if not Boarded then
|
if not Boarded then
|
||||||
self:__Boarding( -5, CargoCarrier, NearRadius, ... )
|
self:__Boarding( -5, CargoCarrier, NearRadius, ... )
|
||||||
else
|
else
|
||||||
self:F("Group Cargo is loaded")
|
self:T("Group Cargo is loaded")
|
||||||
self:__Load( 1, CargoCarrier, ... )
|
self:__Load( 1, CargoCarrier, ... )
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -413,7 +413,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
||||||
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
||||||
function CARGO_GROUP:onafterUnBoard( From, Event, To, ToPointVec2, NearRadius, ... )
|
function CARGO_GROUP:onafterUnBoard( From, Event, To, ToPointVec2, NearRadius, ... )
|
||||||
self:F( {From, Event, To, ToPointVec2, NearRadius } )
|
self:T( {From, Event, To, ToPointVec2, NearRadius } )
|
||||||
|
|
||||||
NearRadius = NearRadius or 25
|
NearRadius = NearRadius or 25
|
||||||
|
|
||||||
@@ -456,7 +456,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
||||||
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
||||||
function CARGO_GROUP:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... )
|
function CARGO_GROUP:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... )
|
||||||
--self:F( { From, Event, To, ToPointVec2, NearRadius } )
|
--self:T( { From, Event, To, ToPointVec2, NearRadius } )
|
||||||
|
|
||||||
--local NearRadius = NearRadius or 25
|
--local NearRadius = NearRadius or 25
|
||||||
|
|
||||||
@@ -493,7 +493,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
||||||
function CARGO_GROUP:onafterUnLoad( From, Event, To, ToPointVec2, ... )
|
function CARGO_GROUP:onafterUnLoad( From, Event, To, ToPointVec2, ... )
|
||||||
--self:F( { From, Event, To, ToPointVec2 } )
|
--self:T( { From, Event, To, ToPointVec2 } )
|
||||||
|
|
||||||
if From == "Loaded" then
|
if From == "Loaded" then
|
||||||
|
|
||||||
@@ -611,7 +611,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param #CARGO_GROUP self
|
-- @param #CARGO_GROUP self
|
||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
function CARGO_GROUP:RouteTo( Coordinate )
|
function CARGO_GROUP:RouteTo( Coordinate )
|
||||||
--self:F( {Coordinate = Coordinate } )
|
--self:T( {Coordinate = Coordinate } )
|
||||||
|
|
||||||
-- For each Cargo within the CargoSet, route each object to the Coordinate
|
-- For each Cargo within the CargoSet, route each object to the Coordinate
|
||||||
self.CargoSet:ForEach(
|
self.CargoSet:ForEach(
|
||||||
@@ -629,13 +629,13 @@ do -- CARGO_GROUP
|
|||||||
-- @param #number NearRadius
|
-- @param #number NearRadius
|
||||||
-- @return #boolean The Cargo is near to the Carrier or #nil if the Cargo is not near to the Carrier.
|
-- @return #boolean The Cargo is near to the Carrier or #nil if the Cargo is not near to the Carrier.
|
||||||
function CARGO_GROUP:IsNear( CargoCarrier, NearRadius )
|
function CARGO_GROUP:IsNear( CargoCarrier, NearRadius )
|
||||||
self:F( {NearRadius = NearRadius } )
|
self:T( {NearRadius = NearRadius } )
|
||||||
|
|
||||||
for _, Cargo in pairs( self.CargoSet:GetSet() ) do
|
for _, Cargo in pairs( self.CargoSet:GetSet() ) do
|
||||||
local Cargo = Cargo -- Cargo.Cargo#CARGO
|
local Cargo = Cargo -- Cargo.Cargo#CARGO
|
||||||
if Cargo:IsAlive() then
|
if Cargo:IsAlive() then
|
||||||
if Cargo:IsNear( CargoCarrier:GetCoordinate(), NearRadius ) then
|
if Cargo:IsNear( CargoCarrier:GetCoordinate(), NearRadius ) then
|
||||||
self:F( "Near" )
|
self:T( "Near" )
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -649,7 +649,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
-- @return #boolean true if the Cargo Group is within the load radius.
|
-- @return #boolean true if the Cargo Group is within the load radius.
|
||||||
function CARGO_GROUP:IsInLoadRadius( Coordinate )
|
function CARGO_GROUP:IsInLoadRadius( Coordinate )
|
||||||
--self:F( { Coordinate } )
|
--self:T( { Coordinate } )
|
||||||
|
|
||||||
local Cargo = self:GetFirstAlive() -- Cargo.Cargo#CARGO
|
local Cargo = self:GetFirstAlive() -- Cargo.Cargo#CARGO
|
||||||
|
|
||||||
@@ -669,7 +669,7 @@ do -- CARGO_GROUP
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
self:F( { Distance = Distance, LoadRadius = self.LoadRadius } )
|
self:T( { Distance = Distance, LoadRadius = self.LoadRadius } )
|
||||||
if Distance <= self.LoadRadius then
|
if Distance <= self.LoadRadius then
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
@@ -687,12 +687,12 @@ do -- CARGO_GROUP
|
|||||||
-- @param Core.Point#Coordinate Coordinate
|
-- @param Core.Point#Coordinate Coordinate
|
||||||
-- @return #boolean true if the Cargo Group is within the report radius.
|
-- @return #boolean true if the Cargo Group is within the report radius.
|
||||||
function CARGO_GROUP:IsInReportRadius( Coordinate )
|
function CARGO_GROUP:IsInReportRadius( Coordinate )
|
||||||
--self:F( { Coordinate } )
|
--self:T( { Coordinate } )
|
||||||
|
|
||||||
local Cargo = self:GetFirstAlive() -- Cargo.Cargo#CARGO
|
local Cargo = self:GetFirstAlive() -- Cargo.Cargo#CARGO
|
||||||
|
|
||||||
if Cargo then
|
if Cargo then
|
||||||
self:F( { Cargo } )
|
self:T( { Cargo } )
|
||||||
local Distance = 0
|
local Distance = 0
|
||||||
if Cargo:IsUnLoaded() then
|
if Cargo:IsUnLoaded() then
|
||||||
Distance = Coordinate:Get2DDistance( Cargo.CargoObject:GetCoordinate() )
|
Distance = Coordinate:Get2DDistance( Cargo.CargoObject:GetCoordinate() )
|
||||||
@@ -738,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:F( { Zone } )
|
--self:T( { Zone } )
|
||||||
|
|
||||||
local Cargo = self.CargoSet:GetFirst() -- Cargo.Cargo#CARGO
|
local Cargo = self.CargoSet:GetFirst() -- Cargo.Cargo#CARGO
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ do -- CARGO_SLINGLOAD
|
|||||||
-- @return #CARGO_SLINGLOAD
|
-- @return #CARGO_SLINGLOAD
|
||||||
function CARGO_SLINGLOAD:New( CargoStatic, Type, Name, LoadRadius, NearRadius )
|
function CARGO_SLINGLOAD:New( CargoStatic, Type, Name, LoadRadius, NearRadius )
|
||||||
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoStatic, Type, Name, nil, LoadRadius, NearRadius ) ) -- #CARGO_SLINGLOAD
|
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoStatic, Type, Name, nil, LoadRadius, NearRadius ) ) -- #CARGO_SLINGLOAD
|
||||||
self:F( { Type, Name, NearRadius } )
|
self:T( { Type, Name, NearRadius } )
|
||||||
|
|
||||||
self.CargoObject = CargoStatic
|
self.CargoObject = CargoStatic
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ do -- CARGO_SLINGLOAD
|
|||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
-- @return #boolean true if the Cargo Crate is within the report radius.
|
-- @return #boolean true if the Cargo Crate is within the report radius.
|
||||||
function CARGO_SLINGLOAD:IsInReportRadius( Coordinate )
|
function CARGO_SLINGLOAD:IsInReportRadius( Coordinate )
|
||||||
--self:F( { Coordinate, LoadRadius = self.LoadRadius } )
|
--self:T( { Coordinate, LoadRadius = self.LoadRadius } )
|
||||||
|
|
||||||
local Distance = 0
|
local Distance = 0
|
||||||
if self:IsUnLoaded() then
|
if self:IsUnLoaded() then
|
||||||
@@ -149,7 +149,7 @@ do -- CARGO_SLINGLOAD
|
|||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
-- @return #boolean true if the Cargo Slingload is within the loading radius.
|
-- @return #boolean true if the Cargo Slingload is within the loading radius.
|
||||||
function CARGO_SLINGLOAD:IsInLoadRadius( Coordinate )
|
function CARGO_SLINGLOAD:IsInLoadRadius( Coordinate )
|
||||||
--self:F( { Coordinate } )
|
--self:T( { Coordinate } )
|
||||||
|
|
||||||
local Distance = 0
|
local Distance = 0
|
||||||
if self:IsUnLoaded() then
|
if self:IsUnLoaded() then
|
||||||
@@ -169,7 +169,7 @@ do -- CARGO_SLINGLOAD
|
|||||||
-- @return Core.Point#COORDINATE The current Coordinate of the first Cargo of the CargoGroup.
|
-- @return Core.Point#COORDINATE The current Coordinate of the first Cargo of the CargoGroup.
|
||||||
-- @return #nil There is no valid Cargo in the CargoGroup.
|
-- @return #nil There is no valid Cargo in the CargoGroup.
|
||||||
function CARGO_SLINGLOAD:GetCoordinate()
|
function CARGO_SLINGLOAD:GetCoordinate()
|
||||||
--self:F()
|
--self:T()
|
||||||
|
|
||||||
return self.CargoObject:GetCoordinate()
|
return self.CargoObject:GetCoordinate()
|
||||||
end
|
end
|
||||||
@@ -199,7 +199,7 @@ do -- CARGO_SLINGLOAD
|
|||||||
-- @param #CARGO_SLINGLOAD self
|
-- @param #CARGO_SLINGLOAD self
|
||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
function CARGO_SLINGLOAD:RouteTo( Coordinate )
|
function CARGO_SLINGLOAD:RouteTo( Coordinate )
|
||||||
--self:F( {Coordinate = Coordinate } )
|
--self:T( {Coordinate = Coordinate } )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -212,7 +212,7 @@ do -- CARGO_SLINGLOAD
|
|||||||
-- @return #boolean The Cargo is near to the Carrier.
|
-- @return #boolean The Cargo is near to the Carrier.
|
||||||
-- @return #nil The Cargo is not near to the Carrier.
|
-- @return #nil The Cargo is not near to the Carrier.
|
||||||
function CARGO_SLINGLOAD:IsNear( CargoCarrier, NearRadius )
|
function CARGO_SLINGLOAD:IsNear( CargoCarrier, NearRadius )
|
||||||
--self:F( {NearRadius = NearRadius } )
|
--self:T( {NearRadius = NearRadius } )
|
||||||
|
|
||||||
return self:IsNear( CargoCarrier:GetCoordinate(), NearRadius )
|
return self:IsNear( CargoCarrier:GetCoordinate(), NearRadius )
|
||||||
end
|
end
|
||||||
@@ -222,7 +222,7 @@ do -- CARGO_SLINGLOAD
|
|||||||
-- @param #CARGO_SLINGLOAD self
|
-- @param #CARGO_SLINGLOAD self
|
||||||
function CARGO_SLINGLOAD:Respawn()
|
function CARGO_SLINGLOAD:Respawn()
|
||||||
|
|
||||||
--self:F( { "Respawning slingload " .. self:GetName() } )
|
--self:T( { "Respawning slingload " .. self:GetName() } )
|
||||||
|
|
||||||
|
|
||||||
-- Respawn the group...
|
-- Respawn the group...
|
||||||
@@ -239,7 +239,7 @@ do -- CARGO_SLINGLOAD
|
|||||||
-- @param #CARGO_SLINGLOAD self
|
-- @param #CARGO_SLINGLOAD self
|
||||||
function CARGO_SLINGLOAD:onafterReset()
|
function CARGO_SLINGLOAD:onafterReset()
|
||||||
|
|
||||||
--self:F( { "Reset slingload " .. self:GetName() } )
|
--self:T( { "Reset slingload " .. self:GetName() } )
|
||||||
|
|
||||||
|
|
||||||
-- Respawn the group...
|
-- Respawn the group...
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ do -- CARGO_UNIT
|
|||||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
||||||
-- @param #number NearRadius (optional) Defaut 25 m.
|
-- @param #number NearRadius (optional) Defaut 25 m.
|
||||||
function CARGO_UNIT:onenterUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
function CARGO_UNIT:onenterUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
||||||
self:F( { From, Event, To, ToPointVec2, NearRadius } )
|
self:T( { From, Event, To, ToPointVec2, NearRadius } )
|
||||||
|
|
||||||
local Angle = 180
|
local Angle = 180
|
||||||
local Speed = 60
|
local Speed = 60
|
||||||
@@ -114,7 +114,7 @@ do -- CARGO_UNIT
|
|||||||
else
|
else
|
||||||
self.CargoObject:ReSpawnAt( FromPointVec2, CargoDeployHeading )
|
self.CargoObject:ReSpawnAt( FromPointVec2, CargoDeployHeading )
|
||||||
end
|
end
|
||||||
self:F( { "CargoUnits:", self.CargoObject:GetGroup():GetName() } )
|
self:T( { "CargoUnits:", self.CargoObject:GetGroup():GetName() } )
|
||||||
self.CargoCarrier = nil
|
self.CargoCarrier = nil
|
||||||
|
|
||||||
local Points = {}
|
local Points = {}
|
||||||
@@ -148,7 +148,7 @@ do -- CARGO_UNIT
|
|||||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
||||||
-- @param #number NearRadius (optional) Defaut 100 m.
|
-- @param #number NearRadius (optional) Defaut 100 m.
|
||||||
function CARGO_UNIT:onleaveUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
function CARGO_UNIT:onleaveUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
||||||
self:F( { From, Event, To, ToPointVec2, NearRadius } )
|
self:T( { From, Event, To, ToPointVec2, NearRadius } )
|
||||||
|
|
||||||
local Angle = 180
|
local Angle = 180
|
||||||
local Speed = 10
|
local Speed = 10
|
||||||
@@ -174,7 +174,7 @@ do -- CARGO_UNIT
|
|||||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
||||||
-- @param #number NearRadius (optional) Defaut 100 m.
|
-- @param #number NearRadius (optional) Defaut 100 m.
|
||||||
function CARGO_UNIT:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
function CARGO_UNIT:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
||||||
self:F( { From, Event, To, ToPointVec2, NearRadius } )
|
self:T( { From, Event, To, ToPointVec2, NearRadius } )
|
||||||
|
|
||||||
self.CargoInAir = self.CargoObject:InAir()
|
self.CargoInAir = self.CargoObject:InAir()
|
||||||
|
|
||||||
@@ -199,7 +199,7 @@ do -- CARGO_UNIT
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#POINT_VEC2
|
-- @param Core.Point#POINT_VEC2
|
||||||
function CARGO_UNIT:onenterUnLoaded( From, Event, To, ToPointVec2 )
|
function CARGO_UNIT:onenterUnLoaded( From, Event, To, ToPointVec2 )
|
||||||
self:F( { ToPointVec2, From, Event, To } )
|
self:T( { ToPointVec2, From, Event, To } )
|
||||||
|
|
||||||
local Angle = 180
|
local Angle = 180
|
||||||
local Speed = 10
|
local Speed = 10
|
||||||
@@ -236,7 +236,7 @@ do -- CARGO_UNIT
|
|||||||
-- @param Wrapper.Group#GROUP CargoCarrier
|
-- @param Wrapper.Group#GROUP CargoCarrier
|
||||||
-- @param #number NearRadius
|
-- @param #number NearRadius
|
||||||
function CARGO_UNIT:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ... )
|
function CARGO_UNIT:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||||
self:F( { From, Event, To, CargoCarrier, NearRadius = NearRadius } )
|
self:T( { From, Event, To, CargoCarrier, NearRadius = NearRadius } )
|
||||||
|
|
||||||
self.CargoInAir = self.CargoObject:InAir()
|
self.CargoInAir = self.CargoObject:InAir()
|
||||||
|
|
||||||
@@ -244,7 +244,7 @@ do -- CARGO_UNIT
|
|||||||
local MaxSpeed = Desc.speedMaxOffRoad
|
local MaxSpeed = Desc.speedMaxOffRoad
|
||||||
local TypeName = Desc.typeName
|
local TypeName = Desc.typeName
|
||||||
|
|
||||||
--self:F({Unit=self.CargoObject:GetName()})
|
--self:T({Unit=self.CargoObject:GetName()})
|
||||||
|
|
||||||
-- A cargo unit can only be boarded if it is not dead
|
-- A cargo unit can only be boarded if it is not dead
|
||||||
|
|
||||||
@@ -298,9 +298,9 @@ do -- CARGO_UNIT
|
|||||||
-- @param Wrapper.Client#CLIENT CargoCarrier
|
-- @param Wrapper.Client#CLIENT CargoCarrier
|
||||||
-- @param #number NearRadius Default 25 m.
|
-- @param #number NearRadius Default 25 m.
|
||||||
function CARGO_UNIT:onafterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
|
function CARGO_UNIT:onafterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||||
self:F( { From, Event, To, CargoCarrier:GetName(), NearRadius = NearRadius } )
|
self:T( { From, Event, To, CargoCarrier:GetName(), NearRadius = NearRadius } )
|
||||||
|
|
||||||
self:F( { IsAlive=self.CargoObject:IsAlive() } )
|
self:T( { IsAlive=self.CargoObject:IsAlive() } )
|
||||||
|
|
||||||
if CargoCarrier and CargoCarrier:IsAlive() then -- and self.CargoObject and self.CargoObject:IsAlive() then
|
if CargoCarrier and CargoCarrier:IsAlive() then -- and self.CargoObject and self.CargoObject:IsAlive() then
|
||||||
if (CargoCarrier:IsAir() and not CargoCarrier:InAir()) or true then
|
if (CargoCarrier:IsAir() and not CargoCarrier:InAir()) or true then
|
||||||
@@ -321,7 +321,7 @@ do -- CARGO_UNIT
|
|||||||
local Angle = 180
|
local Angle = 180
|
||||||
local Distance = 0
|
local Distance = 0
|
||||||
|
|
||||||
--self:F({Unit=self.CargoObject:GetName()})
|
--self:T({Unit=self.CargoObject:GetName()})
|
||||||
|
|
||||||
local CargoCarrierPointVec2 = CargoCarrier:GetPointVec2()
|
local CargoCarrierPointVec2 = CargoCarrier:GetPointVec2()
|
||||||
local CargoCarrierHeading = CargoCarrier:GetHeading() -- Get Heading of object in degrees.
|
local CargoCarrierHeading = CargoCarrier:GetHeading() -- Get Heading of object in degrees.
|
||||||
@@ -348,7 +348,7 @@ do -- CARGO_UNIT
|
|||||||
self.CargoObject:SetCommand( self.CargoObject:CommandStopRoute( true ) )
|
self.CargoObject:SetCommand( self.CargoObject:CommandStopRoute( true ) )
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
self:E("Something is wrong")
|
self:T("Something is wrong")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -361,11 +361,11 @@ do -- CARGO_UNIT
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||||
function CARGO_UNIT:onenterLoaded( From, Event, To, CargoCarrier )
|
function CARGO_UNIT:onenterLoaded( From, Event, To, CargoCarrier )
|
||||||
self:F( { From, Event, To, CargoCarrier } )
|
self:T( { From, Event, To, CargoCarrier } )
|
||||||
|
|
||||||
self.CargoCarrier = CargoCarrier
|
self.CargoCarrier = CargoCarrier
|
||||||
|
|
||||||
--self:F({Unit=self.CargoObject:GetName()})
|
--self:T({Unit=self.CargoObject:GetName()})
|
||||||
|
|
||||||
-- Only destroy the CargoObject if there is a CargoObject (packages don't have CargoObjects).
|
-- Only destroy the CargoObject if there is a CargoObject (packages don't have CargoObjects).
|
||||||
if self.CargoObject then
|
if self.CargoObject then
|
||||||
|
|||||||
@@ -112,7 +112,7 @@
|
|||||||
--
|
--
|
||||||
-- # Calculate the Path
|
-- # Calculate the Path
|
||||||
--
|
--
|
||||||
-- Finally, we have to calculate the path. This is done by the @{ASTAR.GetPath}(*ExcludeStart, ExcludeEnd*) function. This function returns a table of nodes, which
|
-- Finally, we have to calculate the path. This is done by the @{#GetPath}(*ExcludeStart, ExcludeEnd*) function. This function returns a table of nodes, which
|
||||||
-- describe the optimal path from the start node to the end node.
|
-- describe the optimal path from the start node to the end node.
|
||||||
--
|
--
|
||||||
-- By default, the start and end node are include in the table that is returned.
|
-- By default, the start and end node are include in the table that is returned.
|
||||||
|
|||||||
@@ -1144,6 +1144,28 @@ 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.
|
||||||
@@ -1168,7 +1190,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, UTILS.BasicSerialize( Arguments ) ) )
|
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "F", self.ClassName, self.ClassID, Function, BASE:_Serialize(Arguments) ) )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1242,7 +1264,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, UTILS.BasicSerialize( Arguments ) ) )
|
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s", LineCurrent, LineFrom, "T", self.ClassName, self.ClassID, BASE:_Serialize(Arguments) ) )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1314,7 +1336,7 @@ function BASE:E( Arguments )
|
|||||||
|
|
||||||
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "E", self.ClassName, self.ClassID, Function, UTILS.BasicSerialize( Arguments ) ) )
|
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, BASE:_Serialize(Arguments) ) )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -1341,39 +1363,8 @@ function BASE:I( Arguments )
|
|||||||
|
|
||||||
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "I", self.ClassName, self.ClassID, Function, UTILS.BasicSerialize( Arguments ) ) )
|
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, BASE:_Serialize(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,6 +8,10 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
|
-- ### [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
|
||||||
@@ -34,11 +38,13 @@
|
|||||||
-- @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.
|
||||||
@@ -286,6 +292,7 @@ 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
|
||||||
|
|
||||||
@@ -380,6 +387,8 @@ function BEACON:RadioBeacon(FileName, Frequency, Modulation, Power, BeaconDurati
|
|||||||
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
|
||||||
@@ -390,7 +399,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
|
||||||
@@ -416,7 +425,9 @@ 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
|
||||||
trigger.action.radioTransmission(FileName, self.Positionable:GetPositionVec3(), Modulation, true, Frequency, Power, tostring(self.ID))
|
BEACON.UniqueName = BEACON.UniqueName + 1
|
||||||
|
self.BeaconName = "MooseBeacon"..tostring(BEACON.UniqueName)
|
||||||
|
trigger.action.radioTransmission(FileName, self.Positionable:GetPositionVec3(), Modulation, true, Frequency, Power, self.BeaconName)
|
||||||
|
|
||||||
if BeaconDuration then -- Schedule the stop of the BEACON if asked by the MD
|
if BeaconDuration then -- Schedule the stop of the BEACON if asked by the MD
|
||||||
SCHEDULER:New( nil,
|
SCHEDULER:New( nil,
|
||||||
@@ -425,6 +436,7 @@ function BEACON:RadioBeacon(FileName, Frequency, Modulation, Power, BeaconDurati
|
|||||||
end, {}, BeaconDuration)
|
end, {}, BeaconDuration)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Stops the Radio Beacon
|
--- Stops the Radio Beacon
|
||||||
@@ -433,7 +445,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(tostring(self.ID))
|
trigger.action.stopRadioTransmission(self.BeaconName)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
--
|
--
|
||||||
-- @module Core.ClientMenu
|
-- @module Core.ClientMenu
|
||||||
-- @image Core_Menu.JPG
|
-- @image Core_Menu.JPG
|
||||||
-- last change: Sept 2023
|
-- last change: May 2024
|
||||||
|
|
||||||
-- TODO
|
-- TODO
|
||||||
----------------------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------------------
|
||||||
@@ -51,6 +51,7 @@
|
|||||||
-- @field #boolean Generic
|
-- @field #boolean Generic
|
||||||
-- @field #boolean debug
|
-- @field #boolean debug
|
||||||
-- @field #CLIENTMENUMANAGER Controller
|
-- @field #CLIENTMENUMANAGER Controller
|
||||||
|
-- @field #active boolean
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -58,7 +59,7 @@
|
|||||||
CLIENTMENU = {
|
CLIENTMENU = {
|
||||||
ClassName = "CLIENTMENUE",
|
ClassName = "CLIENTMENUE",
|
||||||
lid = "",
|
lid = "",
|
||||||
version = "0.1.1",
|
version = "0.1.2",
|
||||||
name = nil,
|
name = nil,
|
||||||
path = nil,
|
path = nil,
|
||||||
group = nil,
|
group = nil,
|
||||||
@@ -70,6 +71,7 @@ CLIENTMENU = {
|
|||||||
debug = false,
|
debug = false,
|
||||||
Controller = nil,
|
Controller = nil,
|
||||||
groupname = nil,
|
groupname = nil,
|
||||||
|
active = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -78,7 +80,7 @@ CLIENTMENU_ID = 0
|
|||||||
|
|
||||||
--- Create an new CLIENTMENU object.
|
--- Create an new CLIENTMENU object.
|
||||||
-- @param #CLIENTMENU self
|
-- @param #CLIENTMENU self
|
||||||
-- @param Wrapper.Client#CLIENT Client The client for whom this entry is.
|
-- @param Wrapper.Client#CLIENT Client The client for whom this entry is. Leave as nil for a generic entry.
|
||||||
-- @param #string Text Text of the F10 menu entry.
|
-- @param #string Text Text of the F10 menu entry.
|
||||||
-- @param #CLIENTMENU Parent The parent menu entry.
|
-- @param #CLIENTMENU Parent The parent menu entry.
|
||||||
-- @param #string Function (optional) Function to call when the entry is used.
|
-- @param #string Function (optional) Function to call when the entry is used.
|
||||||
@@ -114,7 +116,7 @@ function CLIENTMENU:NewEntry(Client,Text,Parent,Function,...)
|
|||||||
if self.Functionargs and self.debug then
|
if self.Functionargs and self.debug then
|
||||||
self:T({"Functionargs",self.Functionargs})
|
self:T({"Functionargs",self.Functionargs})
|
||||||
end
|
end
|
||||||
if not self.Generic then
|
if not self.Generic and self.active == false then
|
||||||
if Function ~= nil then
|
if Function ~= nil then
|
||||||
local ErrorHandler = function( errmsg )
|
local ErrorHandler = function( errmsg )
|
||||||
env.info( "MOOSE Error in CLIENTMENU COMMAND function: " .. errmsg )
|
env.info( "MOOSE Error in CLIENTMENU COMMAND function: " .. errmsg )
|
||||||
@@ -133,8 +135,10 @@ function CLIENTMENU:NewEntry(Client,Text,Parent,Function,...)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.path = missionCommands.addCommandForGroup(self.GroupID,Text,self.parentpath, self.CallHandler)
|
self.path = missionCommands.addCommandForGroup(self.GroupID,Text,self.parentpath, self.CallHandler)
|
||||||
|
self.active = true
|
||||||
else
|
else
|
||||||
self.path = missionCommands.addSubMenuForGroup(self.GroupID,Text,self.parentpath)
|
self.path = missionCommands.addSubMenuForGroup(self.GroupID,Text,self.parentpath)
|
||||||
|
self.active = true
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if self.parentpath then
|
if self.parentpath then
|
||||||
@@ -200,6 +204,7 @@ function CLIENTMENU:RemoveF10()
|
|||||||
if not status then
|
if not status then
|
||||||
self:I(string.format("**** Error Removing Menu Entry %s for %s!",tostring(self.name),self.groupname))
|
self:I(string.format("**** Error Removing Menu Entry %s for %s!",tostring(self.name),self.groupname))
|
||||||
end
|
end
|
||||||
|
self.active = false
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -304,6 +309,8 @@ end
|
|||||||
-- @field #table menutree
|
-- @field #table menutree
|
||||||
-- @field #number entrycount
|
-- @field #number entrycount
|
||||||
-- @field #boolean debug
|
-- @field #boolean debug
|
||||||
|
-- @field #table PlayerMenu
|
||||||
|
-- @field #number Coalition
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
--- *As a child my family's menu consisted of two choices: take it, or leave it.*
|
--- *As a child my family's menu consisted of two choices: take it, or leave it.*
|
||||||
@@ -322,6 +329,22 @@ end
|
|||||||
--
|
--
|
||||||
-- Many functions can either change the tree for one client or for all clients.
|
-- Many functions can either change the tree for one client or for all clients.
|
||||||
--
|
--
|
||||||
|
-- ## Conceptual remarks
|
||||||
|
--
|
||||||
|
-- There's a couple of things to fully understand:
|
||||||
|
--
|
||||||
|
-- 1) **CLIENTMENUMANAGER** manages a set of entries from **CLIENTMENU**, it's main purpose is to administer the *shadow menu tree*, ie. a menu structure which is not
|
||||||
|
-- (yet) visible to any client
|
||||||
|
-- 2) The entries are **CLIENTMENU** objects, which are linked in a tree form. There's two ways to create them:
|
||||||
|
-- A) in the manager with ":NewEntry()" which initially
|
||||||
|
-- adds it to the shadow menu **only**
|
||||||
|
-- B) stand-alone directly as `CLIENTMENU:NewEntry()` - here it depends on whether or not you gave a CLIENT object if the entry is created as generic entry or pushed
|
||||||
|
-- a **specific** client. **Be aware** though that the entries are not managed by the CLIENTMANAGER before the next step!
|
||||||
|
-- A generic entry can be added to the manager (and the shadow tree) with `:AddEntry()` - this will also push it to all clients(!) if no client is given, or a specific client only.
|
||||||
|
-- 3) Pushing only works for alive clients.
|
||||||
|
-- 4) Live and shadow tree entries are managed via the CLIENTMENUMANAGER object.
|
||||||
|
-- 5) `Propagate()`refreshes the menu tree for all, or a single client.
|
||||||
|
--
|
||||||
-- ## Create a base reference tree and send to all clients
|
-- ## Create a base reference tree and send to all clients
|
||||||
--
|
--
|
||||||
-- local clientset = SET_CLIENT:New():FilterStart()
|
-- local clientset = SET_CLIENT:New():FilterStart()
|
||||||
@@ -345,7 +368,7 @@ end
|
|||||||
-- local mymenu_lv3b = menumgr:NewEntry("Level 3 aab",mymenu_lv2a)
|
-- local mymenu_lv3b = menumgr:NewEntry("Level 3 aab",mymenu_lv2a)
|
||||||
-- local mymenu_lv3c = menumgr:NewEntry("Level 3 aac",mymenu_lv2a)
|
-- local mymenu_lv3c = menumgr:NewEntry("Level 3 aac",mymenu_lv2a)
|
||||||
--
|
--
|
||||||
-- menumgr:Propagate()
|
-- menumgr:Propagate() -- propagate **once** to all clients in the SET_CLIENT
|
||||||
--
|
--
|
||||||
-- ## Remove a single entry's subtree
|
-- ## Remove a single entry's subtree
|
||||||
--
|
--
|
||||||
@@ -386,11 +409,15 @@ end
|
|||||||
--
|
--
|
||||||
-- menumgr:ResetMenuComplete()
|
-- 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
|
-- @field #CLIENTMENUMANAGER
|
||||||
CLIENTMENUMANAGER = {
|
CLIENTMENUMANAGER = {
|
||||||
ClassName = "CLIENTMENUMANAGER",
|
ClassName = "CLIENTMENUMANAGER",
|
||||||
lid = "",
|
lid = "",
|
||||||
version = "0.1.1",
|
version = "0.1.5a",
|
||||||
name = nil,
|
name = nil,
|
||||||
clientset = nil,
|
clientset = nil,
|
||||||
menutree = {},
|
menutree = {},
|
||||||
@@ -399,27 +426,109 @@ CLIENTMENUMANAGER = {
|
|||||||
entrycount = 0,
|
entrycount = 0,
|
||||||
rootentries = {},
|
rootentries = {},
|
||||||
debug = true,
|
debug = true,
|
||||||
|
PlayerMenu = {},
|
||||||
|
Coalition = nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Create a new ClientManager instance.
|
--- Create a new ClientManager instance.
|
||||||
-- @param #CLIENTMENUMANAGER self
|
-- @param #CLIENTMENUMANAGER self
|
||||||
-- @param Core.Set#SET_CLIENT ClientSet The set of clients to manage.
|
-- @param Core.Set#SET_CLIENT ClientSet The set of clients to manage.
|
||||||
-- @param #string Alias The name of this manager.
|
-- @param #string Alias The name of this manager.
|
||||||
|
-- @param #number Coalition (Optional) Coalition of this Manager, defaults to coalition.side.BLUE
|
||||||
-- @return #CLIENTMENUMANAGER self
|
-- @return #CLIENTMENUMANAGER self
|
||||||
function CLIENTMENUMANAGER:New(ClientSet, Alias)
|
function CLIENTMENUMANAGER:New(ClientSet, Alias, Coalition)
|
||||||
-- Inherit everything from FSM class.
|
-- Inherit everything from FSM class.
|
||||||
local self=BASE:Inherit(self, BASE:New()) -- #CLIENTMENUMANAGER
|
local self=BASE:Inherit(self, BASE:New()) -- #CLIENTMENUMANAGER
|
||||||
self.clientset = ClientSet
|
self.clientset = ClientSet
|
||||||
|
self.PlayerMenu = {}
|
||||||
self.name = Alias or "Nightshift"
|
self.name = Alias or "Nightshift"
|
||||||
|
self.Coalition = Coalition or coalition.side.BLUE
|
||||||
-- Log id.
|
-- Log id.
|
||||||
self.lid=string.format("CLIENTMENUMANAGER %s | %s | ", self.version, self.name)
|
self.lid=string.format("CLIENTMENUMANAGER %s | %s | ", self.version, self.name)
|
||||||
if self.debug then
|
if self.debug then
|
||||||
self:T(self.lid.."Created")
|
self:I(self.lid.."Created")
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Create a new entry in the generic structure.
|
--- [Internal] Event handling
|
||||||
|
-- @param #CLIENTMENUMANAGER self
|
||||||
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
|
-- @return #CLIENTMENUMANAGER self
|
||||||
|
function CLIENTMENUMANAGER:_EventHandler(EventData)
|
||||||
|
self:T(self.lid.."_EventHandler: "..EventData.id)
|
||||||
|
--self:I(self.lid.."_EventHandler: "..tostring(EventData.IniPlayerName))
|
||||||
|
if EventData.id == EVENTS.PlayerLeaveUnit or EventData.id == EVENTS.Ejection or EventData.id == EVENTS.Crash or EventData.id == EVENTS.PilotDead then
|
||||||
|
self:T(self.lid.."Leave event for player: "..tostring(EventData.IniPlayerName))
|
||||||
|
local Client = _DATABASE:FindClient( EventData.IniUnitName )
|
||||||
|
if Client then
|
||||||
|
self:ResetMenu(Client)
|
||||||
|
end
|
||||||
|
elseif (EventData.id == EVENTS.PlayerEnterAircraft) and EventData.IniCoalition == self.Coalition then
|
||||||
|
if EventData.IniPlayerName and EventData.IniGroup then
|
||||||
|
if (not self.clientset:IsIncludeObject(_DATABASE:FindClient( EventData.IniUnitName ))) then
|
||||||
|
self:T(self.lid.."Client not in SET: "..EventData.IniPlayerName)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
--self:I(self.lid.."Join event for player: "..EventData.IniPlayerName)
|
||||||
|
local player = _DATABASE:FindClient( EventData.IniUnitName )
|
||||||
|
self:Propagate(player)
|
||||||
|
end
|
||||||
|
elseif EventData.id == EVENTS.PlayerEnterUnit then
|
||||||
|
-- special for CA slots
|
||||||
|
local grp = GROUP:FindByName(EventData.IniGroupName)
|
||||||
|
if grp:IsGround() then
|
||||||
|
self:T(string.format("Player %s entered GROUND unit %s!",EventData.IniPlayerName,EventData.IniUnitName))
|
||||||
|
local IsPlayer = EventData.IniDCSUnit:getPlayerName()
|
||||||
|
if IsPlayer then
|
||||||
|
|
||||||
|
local client=_DATABASE.CLIENTS[EventData.IniDCSUnitName] --Wrapper.Client#CLIENT
|
||||||
|
|
||||||
|
-- Add client in case it does not exist already.
|
||||||
|
if not client then
|
||||||
|
|
||||||
|
-- Debug info.
|
||||||
|
self:I(string.format("Player '%s' joined ground unit '%s' of group '%s'", tostring(EventData.IniPlayerName), tostring(EventData.IniDCSUnitName), tostring(EventData.IniDCSGroupName)))
|
||||||
|
|
||||||
|
client=_DATABASE:AddClient(EventData.IniDCSUnitName)
|
||||||
|
|
||||||
|
-- Add player.
|
||||||
|
client:AddPlayer(EventData.IniPlayerName)
|
||||||
|
|
||||||
|
-- Add player.
|
||||||
|
if not _DATABASE.PLAYERS[EventData.IniPlayerName] then
|
||||||
|
_DATABASE:AddPlayer( EventData.IniUnitName, EventData.IniPlayerName )
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Player settings.
|
||||||
|
local Settings = SETTINGS:Set( EventData.IniPlayerName )
|
||||||
|
Settings:SetPlayerMenu(EventData.IniUnit)
|
||||||
|
end
|
||||||
|
--local player = _DATABASE:FindClient( EventData.IniPlayerName )
|
||||||
|
self:Propagate(client)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Set this Client Manager to auto-propagate menus **once** to newly joined players. Useful if you have **one** menu structure only. Does not automatically push follow-up changes to the client(s).
|
||||||
|
-- @param #CLIENTMENUMANAGER self
|
||||||
|
-- @return #CLIENTMENUMANAGER self
|
||||||
|
function CLIENTMENUMANAGER:InitAutoPropagation()
|
||||||
|
-- Player Events
|
||||||
|
self:HandleEvent(EVENTS.PlayerLeaveUnit, self._EventHandler)
|
||||||
|
self:HandleEvent(EVENTS.Ejection, self._EventHandler)
|
||||||
|
self:HandleEvent(EVENTS.Crash, self._EventHandler)
|
||||||
|
self:HandleEvent(EVENTS.PilotDead, self._EventHandler)
|
||||||
|
self:HandleEvent(EVENTS.PlayerEnterAircraft, self._EventHandler)
|
||||||
|
self:HandleEvent(EVENTS.PlayerEnterUnit, self._EventHandler)
|
||||||
|
self:SetEventPriority(5)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Create a new entry in the **generic** structure.
|
||||||
-- @param #CLIENTMENUMANAGER self
|
-- @param #CLIENTMENUMANAGER self
|
||||||
-- @param #string Text Text of the F10 menu entry.
|
-- @param #string Text Text of the F10 menu entry.
|
||||||
-- @param #CLIENTMENU Parent The parent menu entry.
|
-- @param #CLIENTMENU Parent The parent menu entry.
|
||||||
@@ -571,7 +680,8 @@ end
|
|||||||
-- @return #CLIENTMENU Entry
|
-- @return #CLIENTMENU Entry
|
||||||
function CLIENTMENUMANAGER:Propagate(Client)
|
function CLIENTMENUMANAGER:Propagate(Client)
|
||||||
self:T(self.lid.."Propagate")
|
self:T(self.lid.."Propagate")
|
||||||
self:T(Client)
|
--self:I(UTILS.PrintTableToLog(Client,1))
|
||||||
|
local knownunits = {} -- track so we can ID multi seated
|
||||||
local Set = self.clientset.Set
|
local Set = self.clientset.Set
|
||||||
if Client then
|
if Client then
|
||||||
Set = {Client}
|
Set = {Client}
|
||||||
@@ -580,34 +690,42 @@ function CLIENTMENUMANAGER:Propagate(Client)
|
|||||||
for _,_client in pairs(Set) do
|
for _,_client in pairs(Set) do
|
||||||
local client = _client -- Wrapper.Client#CLIENT
|
local client = _client -- Wrapper.Client#CLIENT
|
||||||
if client and client:IsAlive() then
|
if client and client:IsAlive() then
|
||||||
local playername = client:GetPlayerName()
|
local playerunit = client:GetName()
|
||||||
if not self.playertree[playername] then
|
--local playergroup = client:GetGroup()
|
||||||
self.playertree[playername] = {}
|
local playername = client:GetPlayerName() or "none"
|
||||||
end
|
if not knownunits[playerunit] then
|
||||||
for level,branch in pairs (self.menutree) do
|
knownunits[playerunit] = true
|
||||||
self:T("Building branch:" .. level)
|
else
|
||||||
for _,leaf in pairs(branch) do
|
self:I("Player in multi seat unit: "..playername)
|
||||||
self:T("Building leaf:" .. leaf)
|
break -- multi seat already build
|
||||||
local entry = self:FindEntryByUUID(leaf)
|
end
|
||||||
if entry then
|
if not self.playertree[playername] then
|
||||||
self:T("Found generic entry:" .. entry.UUID)
|
self.playertree[playername] = {}
|
||||||
local parent = nil
|
end
|
||||||
if entry.Parent and entry.Parent.UUID then
|
for level,branch in pairs (self.menutree) do
|
||||||
parent = self.playertree[playername][entry.Parent.UUID] or self:FindEntryByUUID(entry.Parent.UUID)
|
self:T("Building branch:" .. level)
|
||||||
end
|
for _,leaf in pairs(branch) do
|
||||||
self.playertree[playername][entry.UUID] = CLIENTMENU:NewEntry(client,entry.name,parent,entry.Function,unpack(entry.Functionargs))
|
self:T("Building leaf:" .. leaf)
|
||||||
self.playertree[playername][entry.UUID].Once = entry.Once
|
local entry = self:FindEntryByUUID(leaf)
|
||||||
else
|
if entry then
|
||||||
self:T("NO generic entry for:" .. leaf)
|
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
|
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
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Push a single previously created entry into the menu structure of all clients.
|
--- Push a single previously created entry into the F10 menu structure of all clients.
|
||||||
-- @param #CLIENTMENUMANAGER self
|
-- @param #CLIENTMENUMANAGER self
|
||||||
-- @param #CLIENTMENU Entry The entry to add.
|
-- @param #CLIENTMENU Entry The entry to add.
|
||||||
-- @param Wrapper.Client#CLIENT Client (optional) If given, make this change only for this client.
|
-- @param Wrapper.Client#CLIENT Client (optional) If given, make this change only for this client.
|
||||||
@@ -615,6 +733,7 @@ end
|
|||||||
function CLIENTMENUMANAGER:AddEntry(Entry,Client)
|
function CLIENTMENUMANAGER:AddEntry(Entry,Client)
|
||||||
self:T(self.lid.."AddEntry")
|
self:T(self.lid.."AddEntry")
|
||||||
local Set = self.clientset.Set
|
local Set = self.clientset.Set
|
||||||
|
local knownunits = {}
|
||||||
if Client then
|
if Client then
|
||||||
Set = {Client}
|
Set = {Client}
|
||||||
end
|
end
|
||||||
@@ -622,6 +741,13 @@ function CLIENTMENUMANAGER:AddEntry(Entry,Client)
|
|||||||
local client = _client -- Wrapper.Client#CLIENT
|
local client = _client -- Wrapper.Client#CLIENT
|
||||||
if client and client:IsAlive() then
|
if client and client:IsAlive() then
|
||||||
local playername = client:GetPlayerName()
|
local playername = client:GetPlayerName()
|
||||||
|
local unitname = client:GetName()
|
||||||
|
if not knownunits[unitname] then
|
||||||
|
knownunits[unitname] = true
|
||||||
|
else
|
||||||
|
self:I("Player in multi seat unit: "..playername)
|
||||||
|
break
|
||||||
|
end
|
||||||
if Entry then
|
if Entry then
|
||||||
self:T("Adding generic entry:" .. Entry.UUID)
|
self:T("Adding generic entry:" .. Entry.UUID)
|
||||||
local parent = nil
|
local parent = nil
|
||||||
@@ -792,4 +918,3 @@ end
|
|||||||
-- End ClientMenu
|
-- End ClientMenu
|
||||||
--
|
--
|
||||||
----------------------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Example Missions:
|
-- ## Example Missions:
|
||||||
--
|
--
|
||||||
-- Demo missions can be found on [github](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/OPS%20-%20Operation).
|
-- Demo missions can be found on [github](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/Core/Condition).
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -37,6 +37,8 @@
|
|||||||
-- @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.
|
||||||
-- @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.
|
||||||
@@ -93,6 +95,8 @@ DATABASE = {
|
|||||||
OPSZONES = {},
|
OPSZONES = {},
|
||||||
PATHLINES = {},
|
PATHLINES = {},
|
||||||
STORAGES = {},
|
STORAGES = {},
|
||||||
|
STNS={},
|
||||||
|
SADL={},
|
||||||
}
|
}
|
||||||
|
|
||||||
local _DATABASECoalition =
|
local _DATABASECoalition =
|
||||||
@@ -126,6 +130,8 @@ function DATABASE:New()
|
|||||||
self:SetEventPriority( 1 )
|
self:SetEventPriority( 1 )
|
||||||
|
|
||||||
self:HandleEvent( EVENTS.Birth, self._EventOnBirth )
|
self:HandleEvent( EVENTS.Birth, self._EventOnBirth )
|
||||||
|
-- DCS 2.9 fixed CA event for players -- TODO: reset unit when leaving
|
||||||
|
self:HandleEvent( EVENTS.PlayerEnterUnit, self._EventOnPlayerEnterUnit )
|
||||||
self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
|
self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
|
||||||
self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash )
|
self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash )
|
||||||
self:HandleEvent( EVENTS.RemoveUnit, self._EventOnDeadOrCrash )
|
self:HandleEvent( EVENTS.RemoveUnit, self._EventOnDeadOrCrash )
|
||||||
@@ -487,8 +493,30 @@ 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
|
||||||
@@ -531,6 +559,25 @@ 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
|
||||||
|
|
||||||
@@ -680,7 +727,7 @@ do -- cargo
|
|||||||
--- Finds an CARGO based on the CargoName.
|
--- Finds an CARGO based on the CargoName.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #string CargoName
|
-- @param #string CargoName
|
||||||
-- @return Wrapper.Cargo#CARGO The found CARGO.
|
-- @return Cargo.Cargo#CARGO The found CARGO.
|
||||||
function DATABASE:FindCargo( CargoName )
|
function DATABASE:FindCargo( CargoName )
|
||||||
|
|
||||||
local CargoFound = self.CARGOS[CargoName]
|
local CargoFound = self.CARGOS[CargoName]
|
||||||
@@ -754,7 +801,7 @@ end -- cargo
|
|||||||
|
|
||||||
--- Finds a CLIENT based on the ClientName.
|
--- Finds a CLIENT based on the ClientName.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param #string ClientName
|
-- @param #string ClientName - Note this is the UNIT name of the client!
|
||||||
-- @return Wrapper.Client#CLIENT The found CLIENT.
|
-- @return Wrapper.Client#CLIENT The found CLIENT.
|
||||||
function DATABASE:FindClient( ClientName )
|
function DATABASE:FindClient( ClientName )
|
||||||
|
|
||||||
@@ -810,6 +857,7 @@ function DATABASE:AddPlayer( UnitName, PlayerName )
|
|||||||
self.PLAYERUNITS[PlayerName] = self:FindUnit( UnitName )
|
self.PLAYERUNITS[PlayerName] = self:FindUnit( UnitName )
|
||||||
self.PLAYERSJOINED[PlayerName] = PlayerName
|
self.PLAYERSJOINED[PlayerName] = PlayerName
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Deletes a player from the DATABASE based on the Player Name.
|
--- Deletes a player from the DATABASE based on the Player Name.
|
||||||
@@ -884,7 +932,7 @@ function DATABASE:Spawn( SpawnTemplate )
|
|||||||
SpawnTemplate.CountryID = nil
|
SpawnTemplate.CountryID = nil
|
||||||
SpawnTemplate.CategoryID = nil
|
SpawnTemplate.CategoryID = nil
|
||||||
|
|
||||||
self:_RegisterGroupTemplate( SpawnTemplate, SpawnCoalitionID, SpawnCategoryID, SpawnCountryID )
|
self:_RegisterGroupTemplate( SpawnTemplate, SpawnCoalitionID, SpawnCategoryID, SpawnCountryID, SpawnTemplate.name )
|
||||||
|
|
||||||
self:T3( SpawnTemplate )
|
self:T3( SpawnTemplate )
|
||||||
coalition.addGroup( SpawnCountryID, SpawnCategoryID, SpawnTemplate )
|
coalition.addGroup( SpawnCountryID, SpawnCategoryID, SpawnTemplate )
|
||||||
@@ -986,6 +1034,27 @@ function DATABASE:_RegisterGroupTemplate( GroupTemplate, CoalitionSide, Category
|
|||||||
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:I("Register STN "..tostring(UnitTemplate.AddPropAircraft.STN_L16).." for ".. UnitTemplate.name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if UnitTemplate.AddPropAircraft.SADL_TN then
|
||||||
|
local sadl = UTILS.OctalToDecimal(UnitTemplate.AddPropAircraft.SADL_TN)
|
||||||
|
if sadl == nil or sadl < 1 then
|
||||||
|
self:E("WARNING: Invalid SADL "..tostring(UnitTemplate.AddPropAircraft.SADL_TN).." for ".. UnitTemplate.name)
|
||||||
|
else
|
||||||
|
self.SADL[sadl] = UnitTemplate.name
|
||||||
|
self:I("Register SADL "..tostring(UnitTemplate.AddPropAircraft.SADL_TN).." for ".. UnitTemplate.name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
UnitNames[#UnitNames+1] = self.Templates.Units[UnitTemplate.name].UnitName
|
UnitNames[#UnitNames+1] = self.Templates.Units[UnitTemplate.name].UnitName
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -999,15 +1068,92 @@ 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 = self.Templates.Groups[GroupName].Template
|
local GroupTemplate=nil
|
||||||
GroupTemplate.SpawnCoalitionID = self.Templates.Groups[GroupName].CoalitionID
|
if self.Templates.Groups[GroupName] then
|
||||||
GroupTemplate.SpawnCategoryID = self.Templates.Groups[GroupName].CategoryID
|
GroupTemplate = self.Templates.Groups[GroupName].Template
|
||||||
GroupTemplate.SpawnCountryID = self.Templates.Groups[GroupName].CountryID
|
GroupTemplate.SpawnCoalitionID = self.Templates.Groups[GroupName].CoalitionID
|
||||||
|
GroupTemplate.SpawnCategoryID = self.Templates.Groups[GroupName].CategoryID
|
||||||
|
GroupTemplate.SpawnCountryID = self.Templates.Groups[GroupName].CountryID
|
||||||
|
end
|
||||||
return GroupTemplate
|
return GroupTemplate
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1300,8 +1446,16 @@ 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[airbase.category], tostring(DCSAirbaseName), airbaseUID, #airbase.runways, airbase.NparkingTotal)
|
local text=string.format("Register %s: %s (UID=%d), Runways=%d, Parking=%d [", AIRBASE.CategoryName[category], tostring(DCSAirbaseName), airbaseUID, #airbase.runways, airbase.NparkingTotal)
|
||||||
for _,terminalType in pairs(AIRBASE.TerminalType) do
|
for _,terminalType in pairs(AIRBASE.TerminalType) do
|
||||||
if airbase.NparkingTerminal and airbase.NparkingTerminal[terminalType] then
|
if airbase.NparkingTerminal and airbase.NparkingTerminal[terminalType] then
|
||||||
text=text..string.format("%d=%d ", terminalType, airbase.NparkingTerminal[terminalType])
|
text=text..string.format("%d=%d ", terminalType, airbase.NparkingTerminal[terminalType])
|
||||||
@@ -1470,39 +1624,43 @@ function DATABASE:_EventOnDeadOrCrash( Event )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Handles the OnPlayerEnterUnit event to fill the active players table (with the unit filter applied).
|
--- Handles the OnPlayerEnterUnit event to fill the active players table for CA units (with the unit filter applied).
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
-- @param Core.Event#EVENTDATA Event
|
-- @param Core.Event#EVENTDATA Event
|
||||||
function DATABASE:_EventOnPlayerEnterUnit( Event )
|
function DATABASE:_EventOnPlayerEnterUnit( Event )
|
||||||
self:F2( { Event } )
|
self:F2( { Event } )
|
||||||
|
|
||||||
if Event.IniDCSUnit then
|
if Event.IniDCSUnit then
|
||||||
if Event.IniObjectCategory == 1 then
|
-- Player entering a CA slot
|
||||||
|
if Event.IniObjectCategory == 1 and Event.IniGroup and Event.IniGroup:IsGround() then
|
||||||
|
|
||||||
-- Add unit.
|
local IsPlayer = Event.IniDCSUnit:getPlayerName()
|
||||||
self:AddUnit( Event.IniDCSUnitName )
|
if IsPlayer then
|
||||||
|
|
||||||
-- Ini unit.
|
-- Debug info.
|
||||||
Event.IniUnit = self:FindUnit( Event.IniDCSUnitName )
|
self:I(string.format("Player '%s' joined GROUND unit '%s' of group '%s'", tostring(Event.IniPlayerName), tostring(Event.IniDCSUnitName), tostring(Event.IniDCSGroupName)))
|
||||||
|
|
||||||
-- Add group.
|
local client= self.CLIENTS[Event.IniDCSUnitName] --Wrapper.Client#CLIENT
|
||||||
self:AddGroup( Event.IniDCSGroupName )
|
|
||||||
|
|
||||||
-- Get player unit.
|
-- Add client in case it does not exist already.
|
||||||
local PlayerName = Event.IniDCSUnit:getPlayerName()
|
if not client then
|
||||||
|
client=self:AddClient(Event.IniDCSUnitName)
|
||||||
if PlayerName then
|
|
||||||
|
|
||||||
if not self.PLAYERS[PlayerName] then
|
|
||||||
self:AddPlayer( Event.IniDCSUnitName, PlayerName )
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local Settings = SETTINGS:Set( PlayerName )
|
-- Add player.
|
||||||
Settings:SetPlayerMenu( Event.IniUnit )
|
client:AddPlayer(Event.IniPlayerName)
|
||||||
|
|
||||||
|
-- Add player.
|
||||||
|
if not self.PLAYERS[Event.IniPlayerName] then
|
||||||
|
self:AddPlayer( Event.IniUnitName, Event.IniPlayerName )
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Player settings.
|
||||||
|
local Settings = SETTINGS:Set( Event.IniPlayerName )
|
||||||
|
Settings:SetPlayerMenu(Event.IniUnit)
|
||||||
|
|
||||||
else
|
|
||||||
self:E("ERROR: getPlayerName() returned nil for event PlayerEnterUnit")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1514,14 +1672,25 @@ end
|
|||||||
function DATABASE:_EventOnPlayerLeaveUnit( Event )
|
function DATABASE:_EventOnPlayerLeaveUnit( Event )
|
||||||
self:F2( { Event } )
|
self:F2( { Event } )
|
||||||
|
|
||||||
|
local function FindPlayerName(UnitName)
|
||||||
|
local playername = nil
|
||||||
|
for _name,_unitname in pairs(self.PLAYERS) do
|
||||||
|
if _unitname == UnitName then
|
||||||
|
playername = _name
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return playername
|
||||||
|
end
|
||||||
|
|
||||||
if Event.IniUnit then
|
if Event.IniUnit then
|
||||||
|
|
||||||
if Event.IniObjectCategory == 1 then
|
if Event.IniObjectCategory == 1 then
|
||||||
|
|
||||||
-- Try to get the player name. This can be buggy for multicrew aircraft!
|
-- Try to get the player name. This can be buggy for multicrew aircraft!
|
||||||
local PlayerName = Event.IniUnit:GetPlayerName()
|
local PlayerName = Event.IniPlayerName or Event.IniUnit:GetPlayerName() or FindPlayerName(Event.IniUnitName)
|
||||||
|
|
||||||
if PlayerName then --and self.PLAYERS[PlayerName] then
|
if PlayerName then
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:I(string.format("Player '%s' left unit %s", tostring(PlayerName), tostring(Event.IniUnitName)))
|
self:I(string.format("Player '%s' left unit %s", tostring(PlayerName), tostring(Event.IniUnitName)))
|
||||||
@@ -1834,7 +2003,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
|
||||||
@@ -1843,7 +2012,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
|
||||||
@@ -2005,8 +2174,6 @@ end
|
|||||||
TargetPlayerName = Event.IniPlayerName
|
TargetPlayerName = Event.IniPlayerName
|
||||||
|
|
||||||
TargetCoalition = Event.IniCoalition
|
TargetCoalition = Event.IniCoalition
|
||||||
--TargetCategory = TargetUnit:getCategory()
|
|
||||||
--TargetCategory = TargetUnit:getDesc().category -- Workaround
|
|
||||||
TargetCategory = Event.IniCategory
|
TargetCategory = Event.IniCategory
|
||||||
TargetType = Event.IniTypeName
|
TargetType = Event.IniTypeName
|
||||||
|
|
||||||
|
|||||||
@@ -173,7 +173,8 @@
|
|||||||
-- @image Core_Event.JPG
|
-- @image Core_Event.JPG
|
||||||
|
|
||||||
|
|
||||||
--- @type EVENT
|
---
|
||||||
|
-- @type EVENT
|
||||||
-- @field #EVENT.Events Events
|
-- @field #EVENT.Events Events
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
@@ -260,6 +261,15 @@ EVENTS = {
|
|||||||
SimulationStart = world.event.S_EVENT_SIMULATION_START or -1,
|
SimulationStart = world.event.S_EVENT_SIMULATION_START or -1,
|
||||||
WeaponRearm = world.event.S_EVENT_WEAPON_REARM or -1,
|
WeaponRearm = world.event.S_EVENT_WEAPON_REARM or -1,
|
||||||
WeaponDrop = world.event.S_EVENT_WEAPON_DROP or -1,
|
WeaponDrop = world.event.S_EVENT_WEAPON_DROP or -1,
|
||||||
|
-- Added with DCS 2.9.0
|
||||||
|
UnitTaskTimeout = world.event.S_EVENT_UNIT_TASK_TIMEOUT or -1,
|
||||||
|
UnitTaskStage = world.event.S_EVENT_UNIT_TASK_STAGE or -1,
|
||||||
|
MacSubtaskScore = world.event.S_EVENT_MAC_SUBTASK_SCORE or -1,
|
||||||
|
MacExtraScore = world.event.S_EVENT_MAC_EXTRA_SCORE or -1,
|
||||||
|
MissionRestart = world.event.S_EVENT_MISSION_RESTART or -1,
|
||||||
|
MissionWinner = world.event.S_EVENT_MISSION_WINNER or -1,
|
||||||
|
PostponedTakeoff = world.event.S_EVENT_POSTPONED_TAKEOFF or -1,
|
||||||
|
PostponedLand = world.event.S_EVENT_POSTPONED_LAND or -1,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- The Event structure
|
--- The Event structure
|
||||||
@@ -282,6 +292,7 @@ EVENTS = {
|
|||||||
-- @field Wrapper.Group#GROUP IniGroup (UNIT) The initiating MOOSE wrapper @{Wrapper.Group#GROUP} of the initiator Group object.
|
-- @field Wrapper.Group#GROUP IniGroup (UNIT) The initiating MOOSE wrapper @{Wrapper.Group#GROUP} of the initiator Group object.
|
||||||
-- @field #string IniGroupName UNIT) The initiating GROUP name (same as IniDCSGroupName).
|
-- @field #string IniGroupName UNIT) The initiating GROUP name (same as IniDCSGroupName).
|
||||||
-- @field #string IniPlayerName (UNIT) The name of the initiating player in case the Unit is a client or player slot.
|
-- @field #string IniPlayerName (UNIT) The name of the initiating player in case the Unit is a client or player slot.
|
||||||
|
-- @field #string IniPlayerUCID (UNIT) The UCID of the initiating player in case the Unit is a client or player slot and on a multi-player server.
|
||||||
-- @field DCS#coalition.side IniCoalition (UNIT) The coalition of the initiator.
|
-- @field DCS#coalition.side IniCoalition (UNIT) The coalition of the initiator.
|
||||||
-- @field DCS#Unit.Category IniCategory (UNIT) The category of the initiator.
|
-- @field DCS#Unit.Category IniCategory (UNIT) The category of the initiator.
|
||||||
-- @field #string IniTypeName (UNIT) The type name of the initiator.
|
-- @field #string IniTypeName (UNIT) The type name of the initiator.
|
||||||
@@ -297,6 +308,7 @@ EVENTS = {
|
|||||||
-- @field Wrapper.Group#GROUP TgtGroup (UNIT) The target MOOSE wrapper @{Wrapper.Group#GROUP} of the target Group object.
|
-- @field Wrapper.Group#GROUP TgtGroup (UNIT) The target MOOSE wrapper @{Wrapper.Group#GROUP} of the target Group object.
|
||||||
-- @field #string TgtGroupName (UNIT) The target GROUP name (same as TgtDCSGroupName).
|
-- @field #string TgtGroupName (UNIT) The target GROUP name (same as TgtDCSGroupName).
|
||||||
-- @field #string TgtPlayerName (UNIT) The name of the target player in case the Unit is a client or player slot.
|
-- @field #string TgtPlayerName (UNIT) The name of the target player in case the Unit is a client or player slot.
|
||||||
|
-- @field #string TgtPlayerUCID (UNIT) The UCID of the target player in case the Unit is a client or player slot and on a multi-player server.
|
||||||
-- @field DCS#coalition.side TgtCoalition (UNIT) The coalition of the target.
|
-- @field DCS#coalition.side TgtCoalition (UNIT) The coalition of the target.
|
||||||
-- @field DCS#Unit.Category TgtCategory (UNIT) The category of the target.
|
-- @field DCS#Unit.Category TgtCategory (UNIT) The category of the target.
|
||||||
-- @field #string TgtTypeName (UNIT) The type name of the target.
|
-- @field #string TgtTypeName (UNIT) The type name of the target.
|
||||||
@@ -313,7 +325,7 @@ EVENTS = {
|
|||||||
-- @field Cargo.Cargo#CARGO Cargo The cargo object.
|
-- @field Cargo.Cargo#CARGO Cargo The cargo object.
|
||||||
-- @field #string CargoName The name of the cargo object.
|
-- @field #string CargoName The name of the cargo object.
|
||||||
--
|
--
|
||||||
-- @field Core.ZONE#ZONE Zone The zone object.
|
-- @field Core.Zone#ZONE Zone The zone object.
|
||||||
-- @field #string ZoneName The name of the zone.
|
-- @field #string ZoneName The name of the zone.
|
||||||
|
|
||||||
|
|
||||||
@@ -633,6 +645,55 @@ 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.PostponedTakeoff] = {
|
||||||
|
Order = 1,
|
||||||
|
Side = "I",
|
||||||
|
Event = "OnEventPostponedTakeoff",
|
||||||
|
Text = "S_EVENT_POSTPONED_TAKEOFF"
|
||||||
|
},
|
||||||
|
[EVENTS.PostponedLand] = {
|
||||||
|
Order = 1,
|
||||||
|
Side = "I",
|
||||||
|
Event = "OnEventPostponedLand",
|
||||||
|
Text = "S_EVENT_POSTPONED_LAND"
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
--- The Events structure
|
--- The Events structure
|
||||||
@@ -988,7 +1049,7 @@ do -- Event Creation
|
|||||||
|
|
||||||
--- Creation of a New ZoneGoal Event.
|
--- Creation of a New ZoneGoal Event.
|
||||||
-- @param #EVENT self
|
-- @param #EVENT self
|
||||||
-- @param Core.Functional#ZONE_GOAL ZoneGoal The ZoneGoal created.
|
-- @param Functional.ZoneGoal#ZONE_GOAL ZoneGoal The ZoneGoal created.
|
||||||
function EVENT:CreateEventNewZoneGoal( ZoneGoal )
|
function EVENT:CreateEventNewZoneGoal( ZoneGoal )
|
||||||
self:F( { ZoneGoal } )
|
self:F( { ZoneGoal } )
|
||||||
|
|
||||||
@@ -1080,9 +1141,9 @@ function EVENT:onEvent( Event )
|
|||||||
|
|
||||||
if Event.initiator then
|
if Event.initiator then
|
||||||
|
|
||||||
Event.IniObjectCategory = Event.initiator:getCategory()
|
Event.IniObjectCategory = Object.getCategory(Event.initiator)
|
||||||
|
|
||||||
if Event.IniObjectCategory == Object.Category.STATIC then
|
if Event.IniObjectCategory == Object.Category.STATIC then
|
||||||
---
|
---
|
||||||
-- Static
|
-- Static
|
||||||
---
|
---
|
||||||
@@ -1119,9 +1180,8 @@ function EVENT:onEvent( Event )
|
|||||||
if Unit then
|
if Unit then
|
||||||
Event.IniObjectCategory = Object.Category.UNIT
|
Event.IniObjectCategory = Object.Category.UNIT
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if Event.IniObjectCategory == Object.Category.UNIT then
|
elseif Event.IniObjectCategory == Object.Category.UNIT then
|
||||||
---
|
---
|
||||||
-- Unit
|
-- Unit
|
||||||
---
|
---
|
||||||
@@ -1144,12 +1204,19 @@ function EVENT:onEvent( Event )
|
|||||||
end
|
end
|
||||||
|
|
||||||
Event.IniPlayerName = Event.IniDCSUnit:getPlayerName()
|
Event.IniPlayerName = Event.IniDCSUnit:getPlayerName()
|
||||||
|
if Event.IniPlayerName then
|
||||||
|
-- get UUCID
|
||||||
|
local PID = NET.GetPlayerIDByName(nil,Event.IniPlayerName)
|
||||||
|
if PID then
|
||||||
|
Event.IniPlayerUCID = net.get_player_info(tonumber(PID), 'ucid')
|
||||||
|
--env.info("Event.IniPlayerUCID="..tostring(Event.IniPlayerUCID),false)
|
||||||
|
end
|
||||||
|
end
|
||||||
Event.IniCoalition = Event.IniDCSUnit:getCoalition()
|
Event.IniCoalition = Event.IniDCSUnit:getCoalition()
|
||||||
Event.IniTypeName = Event.IniDCSUnit:getTypeName()
|
Event.IniTypeName = Event.IniDCSUnit:getTypeName()
|
||||||
Event.IniCategory = Event.IniDCSUnit:getDesc().category
|
Event.IniCategory = Event.IniDCSUnit:getDesc().category
|
||||||
end
|
|
||||||
|
|
||||||
if Event.IniObjectCategory == Object.Category.CARGO then
|
elseif Event.IniObjectCategory == Object.Category.CARGO then
|
||||||
---
|
---
|
||||||
-- Cargo
|
-- Cargo
|
||||||
---
|
---
|
||||||
@@ -1160,9 +1227,8 @@ function EVENT:onEvent( Event )
|
|||||||
Event.IniCoalition = Event.IniDCSUnit:getCoalition()
|
Event.IniCoalition = Event.IniDCSUnit:getCoalition()
|
||||||
Event.IniCategory = Event.IniDCSUnit:getDesc().category
|
Event.IniCategory = Event.IniDCSUnit:getDesc().category
|
||||||
Event.IniTypeName = Event.IniDCSUnit:getTypeName()
|
Event.IniTypeName = Event.IniDCSUnit:getTypeName()
|
||||||
end
|
|
||||||
|
|
||||||
if Event.IniObjectCategory == Object.Category.SCENERY then
|
elseif Event.IniObjectCategory == Object.Category.SCENERY then
|
||||||
---
|
---
|
||||||
-- Scenery
|
-- Scenery
|
||||||
---
|
---
|
||||||
@@ -1172,9 +1238,8 @@ function EVENT:onEvent( Event )
|
|||||||
Event.IniUnit = SCENERY:Register( Event.IniDCSUnitName, Event.initiator )
|
Event.IniUnit = SCENERY:Register( Event.IniDCSUnitName, Event.initiator )
|
||||||
Event.IniCategory = Event.IniDCSUnit:getDesc().category
|
Event.IniCategory = Event.IniDCSUnit:getDesc().category
|
||||||
Event.IniTypeName = Event.initiator:isExist() and Event.IniDCSUnit:getTypeName() or "SCENERY"
|
Event.IniTypeName = Event.initiator:isExist() and Event.IniDCSUnit:getTypeName() or "SCENERY"
|
||||||
end
|
|
||||||
|
|
||||||
if Event.IniObjectCategory == Object.Category.BASE then
|
elseif Event.IniObjectCategory == Object.Category.BASE then
|
||||||
---
|
---
|
||||||
-- Base Object
|
-- Base Object
|
||||||
---
|
---
|
||||||
@@ -1201,9 +1266,12 @@ function EVENT:onEvent( Event )
|
|||||||
---
|
---
|
||||||
|
|
||||||
-- Target category.
|
-- Target category.
|
||||||
Event.TgtObjectCategory = Event.target:getCategory()
|
Event.TgtObjectCategory = Object.getCategory(Event.target)
|
||||||
|
|
||||||
if Event.TgtObjectCategory == Object.Category.UNIT then
|
if Event.TgtObjectCategory == Object.Category.UNIT then
|
||||||
|
---
|
||||||
|
-- UNIT
|
||||||
|
---
|
||||||
Event.TgtDCSUnit = Event.target
|
Event.TgtDCSUnit = Event.target
|
||||||
Event.TgtDCSGroup = Event.TgtDCSUnit:getGroup()
|
Event.TgtDCSGroup = Event.TgtDCSUnit:getGroup()
|
||||||
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
|
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
|
||||||
@@ -1216,21 +1284,33 @@ function EVENT:onEvent( Event )
|
|||||||
Event.TgtGroupName = Event.TgtDCSGroupName
|
Event.TgtGroupName = Event.TgtDCSGroupName
|
||||||
end
|
end
|
||||||
Event.TgtPlayerName = Event.TgtDCSUnit:getPlayerName()
|
Event.TgtPlayerName = Event.TgtDCSUnit:getPlayerName()
|
||||||
|
if Event.TgtPlayerName then
|
||||||
|
-- get UUCID
|
||||||
|
local PID = NET.GetPlayerIDByName(nil,Event.TgtPlayerName)
|
||||||
|
if PID then
|
||||||
|
Event.TgtPlayerUCID = net.get_player_info(tonumber(PID), 'ucid')
|
||||||
|
--env.info("Event.TgtPlayerUCID="..tostring(Event.TgtPlayerUCID),false)
|
||||||
|
end
|
||||||
|
end
|
||||||
Event.TgtCoalition = Event.TgtDCSUnit:getCoalition()
|
Event.TgtCoalition = Event.TgtDCSUnit:getCoalition()
|
||||||
Event.TgtCategory = Event.TgtDCSUnit:getDesc().category
|
Event.TgtCategory = Event.TgtDCSUnit:getDesc().category
|
||||||
Event.TgtTypeName = Event.TgtDCSUnit:getTypeName()
|
Event.TgtTypeName = Event.TgtDCSUnit:getTypeName()
|
||||||
end
|
|
||||||
|
|
||||||
if Event.TgtObjectCategory == Object.Category.STATIC then
|
elseif Event.TgtObjectCategory == Object.Category.STATIC then
|
||||||
-- get base data
|
---
|
||||||
|
-- STATIC
|
||||||
|
---
|
||||||
Event.TgtDCSUnit = Event.target
|
Event.TgtDCSUnit = Event.target
|
||||||
if Event.target:isExist() and Event.id ~= 33 then -- leave out ejected seat object
|
if Event.target.isExist and Event.target:isExist() and Event.id ~= 33 then -- leave out ejected seat object, check that isExist exists (Kiowa Hellfire issue, Special K)
|
||||||
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
|
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
|
||||||
Event.TgtUnitName = Event.TgtDCSUnitName
|
-- Workaround for borked target info on cruise missiles
|
||||||
Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName, false )
|
if Event.TgtDCSUnitName and Event.TgtDCSUnitName ~= "" then
|
||||||
Event.TgtCoalition = Event.TgtDCSUnit:getCoalition()
|
Event.TgtUnitName = Event.TgtDCSUnitName
|
||||||
Event.TgtCategory = Event.TgtDCSUnit:getDesc().category
|
Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName, false )
|
||||||
Event.TgtTypeName = Event.TgtDCSUnit:getTypeName()
|
Event.TgtCoalition = Event.TgtDCSUnit:getCoalition()
|
||||||
|
Event.TgtCategory = Event.TgtDCSUnit:getDesc().category
|
||||||
|
Event.TgtTypeName = Event.TgtDCSUnit:getTypeName()
|
||||||
|
end
|
||||||
else
|
else
|
||||||
Event.TgtDCSUnitName = string.format("No target object for Event ID %s", tostring(Event.id))
|
Event.TgtDCSUnitName = string.format("No target object for Event ID %s", tostring(Event.id))
|
||||||
Event.TgtUnitName = Event.TgtDCSUnitName
|
Event.TgtUnitName = Event.TgtDCSUnitName
|
||||||
@@ -1249,9 +1329,11 @@ function EVENT:onEvent( Event )
|
|||||||
Event.TgtTypeName = "Static"
|
Event.TgtTypeName = "Static"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if Event.TgtObjectCategory == Object.Category.SCENERY then
|
elseif Event.TgtObjectCategory == Object.Category.SCENERY then
|
||||||
|
---
|
||||||
|
-- SCENERY
|
||||||
|
---
|
||||||
Event.TgtDCSUnit = Event.target
|
Event.TgtDCSUnit = Event.target
|
||||||
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
|
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
|
||||||
Event.TgtUnitName = Event.TgtDCSUnitName
|
Event.TgtUnitName = Event.TgtDCSUnitName
|
||||||
@@ -1266,7 +1348,8 @@ function EVENT:onEvent( Event )
|
|||||||
Event.Weapon = Event.weapon
|
Event.Weapon = Event.weapon
|
||||||
Event.WeaponName = Event.Weapon:getTypeName()
|
Event.WeaponName = Event.Weapon:getTypeName()
|
||||||
Event.WeaponUNIT = CLIENT:Find( Event.Weapon, '', true ) -- Sometimes, the weapon is a player unit!
|
Event.WeaponUNIT = CLIENT:Find( Event.Weapon, '', true ) -- Sometimes, the weapon is a player unit!
|
||||||
Event.WeaponPlayerName = Event.WeaponUNIT and Event.Weapon:getPlayerName()
|
Event.WeaponPlayerName = Event.WeaponUNIT and Event.Weapon.getPlayerName and Event.Weapon:getPlayerName()
|
||||||
|
--Event.WeaponPlayerName = Event.WeaponUNIT and Event.Weapon:getPlayerName()
|
||||||
Event.WeaponCoalition = Event.WeaponUNIT and Event.Weapon:getCoalition()
|
Event.WeaponCoalition = Event.WeaponUNIT and Event.Weapon:getCoalition()
|
||||||
Event.WeaponCategory = Event.WeaponUNIT and Event.Weapon:getDesc().category
|
Event.WeaponCategory = Event.WeaponUNIT and Event.Weapon:getDesc().category
|
||||||
Event.WeaponTypeName = Event.WeaponUNIT and Event.Weapon:getTypeName()
|
Event.WeaponTypeName = Event.WeaponUNIT and Event.Weapon:getTypeName()
|
||||||
@@ -1281,7 +1364,7 @@ function EVENT:onEvent( Event )
|
|||||||
-- However, this is not a big thing, as the aircraft the pilot ejected from is usually long crashed before the ejected pilot touches the ground.
|
-- However, this is not a big thing, as the aircraft the pilot ejected from is usually long crashed before the ejected pilot touches the ground.
|
||||||
--Event.Place=UNIT:Find(Event.place)
|
--Event.Place=UNIT:Find(Event.place)
|
||||||
else
|
else
|
||||||
if Event.place:isExist() and Event.place:getCategory() ~= Object.Category.SCENERY then
|
if Event.place:isExist() and Object.getCategory(Event.place) ~= Object.Category.SCENERY then
|
||||||
Event.Place=AIRBASE:Find(Event.place)
|
Event.Place=AIRBASE:Find(Event.place)
|
||||||
Event.PlaceName=Event.Place:GetName()
|
Event.PlaceName=Event.Place:GetName()
|
||||||
end
|
end
|
||||||
@@ -1295,6 +1378,7 @@ 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
|
||||||
|
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ do -- FSM
|
|||||||
--
|
--
|
||||||
-- ### Linear Transition Example
|
-- ### Linear Transition Example
|
||||||
--
|
--
|
||||||
-- This example is fully implemented in the MOOSE test mission on GITHUB: [FSM-100 - Transition Explanation](https://github.com/FlightControl-Master/MOOSE/blob/master/Moose%20Test%20Missions/FSM%20-%20Finite%20State%20Machine/FSM-100%20-%20Transition%20Explanation/FSM-100%20-%20Transition%20Explanation.lua)
|
-- This example is fully implemented in the MOOSE test mission on GitHub: [FSM-100 - Transition Explanation](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Core/FSM/FSM-100%20-%20Transition%20Explanation)
|
||||||
--
|
--
|
||||||
-- It models a unit standing still near Batumi, and flaring every 5 seconds while switching between a Green flare and a Red flare.
|
-- It models a unit standing still near Batumi, and flaring every 5 seconds while switching between a Green flare and a Red flare.
|
||||||
-- The purpose of this example is not to show how exciting flaring is, but it demonstrates how a Linear Transition FSM can be build.
|
-- The purpose of this example is not to show how exciting flaring is, but it demonstrates how a Linear Transition FSM can be build.
|
||||||
@@ -1260,7 +1260,7 @@ do -- FSM_PROCESS
|
|||||||
|
|
||||||
--- Assign the process to a @{Wrapper.Unit} and activate the process.
|
--- Assign the process to a @{Wrapper.Unit} and activate the process.
|
||||||
-- @param #FSM_PROCESS self
|
-- @param #FSM_PROCESS self
|
||||||
-- @param Task.Tasking#TASK Task
|
-- @param Tasking.Task#TASK Task
|
||||||
-- @param Wrapper.Unit#UNIT ProcessUnit
|
-- @param Wrapper.Unit#UNIT ProcessUnit
|
||||||
-- @return #FSM_PROCESS self
|
-- @return #FSM_PROCESS self
|
||||||
function FSM_PROCESS:Assign( ProcessUnit, Task )
|
function FSM_PROCESS:Assign( ProcessUnit, Task )
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
-- ### Author: **Applevangelist**
|
-- ### Author: **Applevangelist**
|
||||||
--
|
--
|
||||||
-- Date: 5 May 2021
|
-- Date: 5 May 2021
|
||||||
-- Last Update: Feb 2023
|
-- Last Update: Mar 2023
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
---
|
---
|
||||||
@@ -50,7 +50,7 @@ MARKEROPS_BASE = {
|
|||||||
ClassName = "MARKEROPS",
|
ClassName = "MARKEROPS",
|
||||||
Tag = "mytag",
|
Tag = "mytag",
|
||||||
Keywords = {},
|
Keywords = {},
|
||||||
version = "0.1.1",
|
version = "0.1.3",
|
||||||
debug = false,
|
debug = false,
|
||||||
Casesensitive = true,
|
Casesensitive = true,
|
||||||
}
|
}
|
||||||
@@ -114,6 +114,8 @@ function MARKEROPS_BASE:New(Tagname,Keywords,Casesensitive)
|
|||||||
-- @param #string Text The text on the marker
|
-- @param #string Text The text on the marker
|
||||||
-- @param #table Keywords Table of matching keywords found in the Event text
|
-- @param #table Keywords Table of matching keywords found in the Event text
|
||||||
-- @param Core.Point#COORDINATE Coord Coordinate of the marker.
|
-- @param Core.Point#COORDINATE Coord Coordinate of the marker.
|
||||||
|
-- @param #number MarkerID Id of this marker
|
||||||
|
-- @param #number CoalitionNumber Coalition of the marker creator
|
||||||
|
|
||||||
--- On after "MarkChanged" event. Triggered when a Marker is changed on the F10 map.
|
--- On after "MarkChanged" event. Triggered when a Marker is changed on the F10 map.
|
||||||
-- @function [parent=#MARKEROPS_BASE] OnAfterMarkChanged
|
-- @function [parent=#MARKEROPS_BASE] OnAfterMarkChanged
|
||||||
@@ -124,7 +126,8 @@ function MARKEROPS_BASE:New(Tagname,Keywords,Casesensitive)
|
|||||||
-- @param #string Text The text on the marker
|
-- @param #string Text The text on the marker
|
||||||
-- @param #table Keywords Table of matching keywords found in the Event text
|
-- @param #table Keywords Table of matching keywords found in the Event text
|
||||||
-- @param Core.Point#COORDINATE Coord Coordinate of the marker.
|
-- @param Core.Point#COORDINATE Coord Coordinate of the marker.
|
||||||
-- @param #number idx DCS Marker ID
|
-- @param #number MarkerID Id of this marker
|
||||||
|
-- @param #number CoalitionNumber Coalition of the marker creator
|
||||||
|
|
||||||
--- On after "MarkDeleted" event. Triggered when a Marker is deleted from the F10 map.
|
--- On after "MarkDeleted" event. Triggered when a Marker is deleted from the F10 map.
|
||||||
-- @function [parent=#MARKEROPS_BASE] OnAfterMarkDeleted
|
-- @function [parent=#MARKEROPS_BASE] OnAfterMarkDeleted
|
||||||
@@ -133,7 +136,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
|
||||||
@@ -155,29 +158,30 @@ function MARKEROPS_BASE:OnEventMark(Event)
|
|||||||
local text = tostring(Event.text)
|
local text = tostring(Event.text)
|
||||||
local m = MESSAGE:New(string.format("Mark added at %s with text: %s",coordtext,text),10,"Info",false):ToAll()
|
local m = MESSAGE:New(string.format("Mark added at %s with text: %s",coordtext,text),10,"Info",false):ToAll()
|
||||||
end
|
end
|
||||||
|
local coalition = Event.MarkCoalition
|
||||||
-- decision
|
-- decision
|
||||||
if Event.id==world.event.S_EVENT_MARK_ADDED then
|
if Event.id==world.event.S_EVENT_MARK_ADDED then
|
||||||
self:T({event="S_EVENT_MARK_ADDED", carrier=self.groupname, vec3=Event.pos})
|
self:T({event="S_EVENT_MARK_ADDED", carrier=Event.IniGroupName, vec3=Event.pos})
|
||||||
-- Handle event
|
-- 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 matchtable = self:_MatchKeywords(Eventtext)
|
local matchtable = self:_MatchKeywords(Eventtext)
|
||||||
self:MarkAdded(Eventtext,matchtable,coord)
|
self:MarkAdded(Eventtext,matchtable,coord,Event.idx,coalition)
|
||||||
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=self.groupname, vec3=Event.pos})
|
self:T({event="S_EVENT_MARK_CHANGE", carrier=Event.IniGroupName, 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 matchtable = self:_MatchKeywords(Eventtext)
|
local matchtable = self:_MatchKeywords(Eventtext)
|
||||||
self:MarkChanged(Eventtext,matchtable,coord,Event.idx)
|
self:MarkChanged(Eventtext,matchtable,coord,Event.idx,coalition)
|
||||||
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=self.groupname, vec3=Event.pos})
|
self:T({event="S_EVENT_MARK_REMOVED", carrier=Event.IniGroupName, 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
|
||||||
@@ -230,8 +234,10 @@ 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)
|
function MARKEROPS_BASE:onbeforeMarkAdded(From,Event,To,Text,Keywords,Coord,MarkerID,CoalitionNumber)
|
||||||
self:T({self.lid,From,Event,To,Text,Keywords,Coord:ToStringLLDDM()})
|
self:T({self.lid,From,Event,To,Text,Keywords,Coord:ToStringLLDDM()})
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -242,8 +248,10 @@ 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)
|
function MARKEROPS_BASE:onbeforeMarkChanged(From,Event,To,Text,Keywords,Coord,MarkerID,CoalitionNumber)
|
||||||
self:T({self.lid,From,Event,To,Text,Keywords,Coord:ToStringLLDDM()})
|
self:T({self.lid,From,Event,To,Text,Keywords,Coord:ToStringLLDDM()})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Features:
|
-- ## Features:
|
||||||
--
|
--
|
||||||
-- * Setup mission sub menus.
|
-- * Setup mission sub menus.
|
||||||
-- * Setup mission command menus.
|
-- * Setup mission command menus.
|
||||||
@@ -44,7 +44,11 @@
|
|||||||
-- * @{Core.Menu#MENU_GROUP_COMMAND}: Manages command menus for GROUPs.
|
-- * @{Core.Menu#MENU_GROUP_COMMAND}: Manages command menus for GROUPs.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
---
|
--
|
||||||
|
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_Demos/tree/master/Core/Menu)
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
|
--
|
||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
-- ### Contributions:
|
-- ### Contributions:
|
||||||
--
|
--
|
||||||
@@ -166,7 +170,8 @@ function MENU_INDEX:Refresh( Group )
|
|||||||
end
|
end
|
||||||
|
|
||||||
do -- MENU_BASE
|
do -- MENU_BASE
|
||||||
--- @type MENU_BASE
|
---
|
||||||
|
-- @type MENU_BASE
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
--- Defines the main MENU class where other MENU classes are derived from.
|
--- Defines the main MENU class where other MENU classes are derived from.
|
||||||
-- This is an abstract class, so don't use it.
|
-- This is an abstract class, so don't use it.
|
||||||
@@ -206,6 +211,7 @@ do -- MENU_BASE
|
|||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
function MENU_BASE:SetParentMenu( MenuText, Menu )
|
function MENU_BASE:SetParentMenu( MenuText, Menu )
|
||||||
if self.ParentMenu then
|
if self.ParentMenu then
|
||||||
self.ParentMenu.Menus = self.ParentMenu.Menus or {}
|
self.ParentMenu.Menus = self.ParentMenu.Menus or {}
|
||||||
@@ -277,8 +283,10 @@ do -- MENU_BASE
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
do -- MENU_COMMAND_BASE
|
do
|
||||||
--- @type MENU_COMMAND_BASE
|
---
|
||||||
|
-- MENU_COMMAND_BASE
|
||||||
|
-- @type MENU_COMMAND_BASE
|
||||||
-- @field #function MenuCallHandler
|
-- @field #function MenuCallHandler
|
||||||
-- @extends Core.Menu#MENU_BASE
|
-- @extends Core.Menu#MENU_BASE
|
||||||
|
|
||||||
@@ -343,8 +351,10 @@ do -- MENU_COMMAND_BASE
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
do -- MENU_MISSION
|
do
|
||||||
--- @type MENU_MISSION
|
---
|
||||||
|
-- MENU_MISSION
|
||||||
|
-- @type MENU_MISSION
|
||||||
-- @extends Core.Menu#MENU_BASE
|
-- @extends Core.Menu#MENU_BASE
|
||||||
--- Manages the main menus for a complete mission.
|
--- Manages the main menus for a complete mission.
|
||||||
--
|
--
|
||||||
@@ -509,11 +519,12 @@ do -- MENU_MISSION_COMMAND
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
do -- MENU_COALITION
|
do
|
||||||
--- @type MENU_COALITION
|
--- MENU_COALITION
|
||||||
|
-- @type MENU_COALITION
|
||||||
-- @extends Core.Menu#MENU_BASE
|
-- @extends Core.Menu#MENU_BASE
|
||||||
|
|
||||||
--- Manages the main menus for @{DCS.coalition}s.
|
--- Manages the main menus for DCS.coalition.
|
||||||
--
|
--
|
||||||
-- You can add menus with the @{#MENU_COALITION.New} method, which constructs a MENU_COALITION object and returns you the object reference.
|
-- You can add menus with the @{#MENU_COALITION.New} method, which constructs a MENU_COALITION object and returns you the object reference.
|
||||||
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_COALITION.Remove}.
|
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_COALITION.Remove}.
|
||||||
@@ -635,9 +646,10 @@ do -- MENU_COALITION
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
do -- MENU_COALITION_COMMAND
|
do
|
||||||
|
|
||||||
--- @type MENU_COALITION_COMMAND
|
--- MENU_COALITION_COMMAND
|
||||||
|
-- @type MENU_COALITION_COMMAND
|
||||||
-- @extends Core.Menu#MENU_COMMAND_BASE
|
-- @extends Core.Menu#MENU_COMMAND_BASE
|
||||||
|
|
||||||
--- Manages the command menus for coalitions, which allow players to execute functions during mission execution.
|
--- Manages the command menus for coalitions, which allow players to execute functions during mission execution.
|
||||||
@@ -725,8 +737,11 @@ do
|
|||||||
-- So every menu for a client created must be tracked so that program logic accidentally does not create.
|
-- So every menu for a client created must be tracked so that program logic accidentally does not create.
|
||||||
-- the same menus twice during initialization logic.
|
-- the same menus twice during initialization logic.
|
||||||
-- These menu classes are handling this logic with this variable.
|
-- These menu classes are handling this logic with this variable.
|
||||||
|
|
||||||
local _MENUGROUPS = {}
|
local _MENUGROUPS = {}
|
||||||
--- @type MENU_GROUP
|
|
||||||
|
---
|
||||||
|
-- @type MENU_GROUP
|
||||||
-- @extends Core.Menu#MENU_BASE
|
-- @extends Core.Menu#MENU_BASE
|
||||||
|
|
||||||
|
|
||||||
@@ -757,7 +772,7 @@ do
|
|||||||
-- MenuStatus[MenuGroupName]:Remove()
|
-- MenuStatus[MenuGroupName]:Remove()
|
||||||
-- end
|
-- end
|
||||||
--
|
--
|
||||||
-- --- @param Wrapper.Group#GROUP MenuGroup
|
-- -- @param Wrapper.Group#GROUP MenuGroup
|
||||||
-- local function AddStatusMenu( MenuGroup )
|
-- local function AddStatusMenu( MenuGroup )
|
||||||
-- local MenuGroupName = MenuGroup:GetName()
|
-- local MenuGroupName = MenuGroup:GetName()
|
||||||
-- -- This would create a menu for the red coalition under the MenuCoalitionRed menu object.
|
-- -- This would create a menu for the red coalition under the MenuCoalitionRed menu object.
|
||||||
@@ -899,8 +914,8 @@ do
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---
|
||||||
--- @type MENU_GROUP_COMMAND
|
-- @type MENU_GROUP_COMMAND
|
||||||
-- @extends Core.Menu#MENU_COMMAND_BASE
|
-- @extends Core.Menu#MENU_COMMAND_BASE
|
||||||
|
|
||||||
--- The @{Core.Menu#MENU_GROUP_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
|
--- The @{Core.Menu#MENU_GROUP_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
|
||||||
@@ -983,7 +998,8 @@ do
|
|||||||
end
|
end
|
||||||
--- MENU_GROUP_DELAYED
|
--- MENU_GROUP_DELAYED
|
||||||
do
|
do
|
||||||
--- @type MENU_GROUP_DELAYED
|
---
|
||||||
|
-- @type MENU_GROUP_DELAYED
|
||||||
-- @extends Core.Menu#MENU_BASE
|
-- @extends Core.Menu#MENU_BASE
|
||||||
|
|
||||||
|
|
||||||
@@ -1034,6 +1050,7 @@ do
|
|||||||
-- @param #MENU_GROUP_DELAYED self
|
-- @param #MENU_GROUP_DELAYED self
|
||||||
-- @return #MENU_GROUP_DELAYED
|
-- @return #MENU_GROUP_DELAYED
|
||||||
function MENU_GROUP_DELAYED:Set()
|
function MENU_GROUP_DELAYED:Set()
|
||||||
|
if not self.GroupID then return end
|
||||||
do
|
do
|
||||||
if not self.MenuSet then
|
if not self.MenuSet then
|
||||||
missionCommands.addSubMenuForGroup( self.GroupID, self.MenuText, self.MenuParentPath )
|
missionCommands.addSubMenuForGroup( self.GroupID, self.MenuText, self.MenuParentPath )
|
||||||
@@ -1106,8 +1123,8 @@ do
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---
|
||||||
--- @type MENU_GROUP_COMMAND_DELAYED
|
-- @type MENU_GROUP_COMMAND_DELAYED
|
||||||
-- @extends Core.Menu#MENU_COMMAND_BASE
|
-- @extends Core.Menu#MENU_COMMAND_BASE
|
||||||
|
|
||||||
--- Manages the command menus for coalitions, which allow players to execute functions during mission execution.
|
--- Manages the command menus for coalitions, which allow players to execute functions during mission execution.
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ MESSAGE.Type = {
|
|||||||
Detailed = "Detailed Report",
|
Detailed = "Detailed Report",
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Creates a new MESSAGE object. Note that these MESSAGE objects are not yet displayed on the display panel. You must use the functions @{ToClient} or @{ToCoalition} or @{ToAll} to send these Messages to the respective recipients.
|
--- Creates a new MESSAGE object. Note that these MESSAGE objects are not yet displayed on the display panel. You must use the functions @{#MESSAGE.ToClient} or @{#MESSAGE.ToCoalition} or @{#MESSAGE.ToAll} to send these Messages to the respective recipients.
|
||||||
-- @param self
|
-- @param self
|
||||||
-- @param #string MessageText is the text of the Message.
|
-- @param #string MessageText is the text of the Message.
|
||||||
-- @param #number MessageDuration is a number in seconds of how long the MESSAGE should be shown on the display panel.
|
-- @param #number MessageDuration is a number in seconds of how long the MESSAGE should be shown on the display panel.
|
||||||
@@ -127,7 +127,7 @@ end
|
|||||||
|
|
||||||
--- Creates a new MESSAGE object of a certain type.
|
--- Creates a new MESSAGE object of a certain type.
|
||||||
-- Note that these MESSAGE objects are not yet displayed on the display panel.
|
-- Note that these MESSAGE objects are not yet displayed on the display panel.
|
||||||
-- You must use the functions @{ToClient} or @{ToCoalition} or @{ToAll} to send these Messages to the respective recipients.
|
-- You must use the functions @{Core.Message#ToClient} or @{Core.Message#ToCoalition} or @{Core.Message#ToAll} to send these Messages to the respective recipients.
|
||||||
-- The message display times are automatically defined based on the timing settings in the @{Core.Settings} menu.
|
-- The message display times are automatically defined based on the timing settings in the @{Core.Settings} menu.
|
||||||
-- @param self
|
-- @param self
|
||||||
-- @param #string MessageText is the text of the Message.
|
-- @param #string MessageText is the text of the Message.
|
||||||
@@ -343,7 +343,7 @@ end
|
|||||||
|
|
||||||
--- Sends a MESSAGE to a Coalition.
|
--- Sends a MESSAGE to a Coalition.
|
||||||
-- @param #MESSAGE self
|
-- @param #MESSAGE self
|
||||||
-- @param #DCS.coalition.side CoalitionSide @{#DCS.coalition.side} to which the message is displayed.
|
-- @param DCS#coalition.side CoalitionSide @{#DCS.coalition.side} to which the message is displayed.
|
||||||
-- @param Core.Settings#SETTINGS Settings (Optional) Settings for message display.
|
-- @param Core.Settings#SETTINGS Settings (Optional) Settings for message display.
|
||||||
-- @return #MESSAGE Message object.
|
-- @return #MESSAGE Message object.
|
||||||
-- @usage
|
-- @usage
|
||||||
@@ -368,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.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ), self.MessageDuration, self.ClearScreen )
|
trigger.action.outTextForCoalition( CoalitionSide, self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ), self.MessageDuration, self.ClearScreen )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -379,7 +379,7 @@ end
|
|||||||
|
|
||||||
--- Sends a MESSAGE to a Coalition if the given Condition is true.
|
--- Sends a MESSAGE to a Coalition if the given Condition is true.
|
||||||
-- @param #MESSAGE self
|
-- @param #MESSAGE self
|
||||||
-- @param CoalitionSide needs to be filled out by the defined structure of the standard scripting engine @{coalition.side}.
|
-- @param CoalitionSide needs to be filled out by the defined structure of the standard scripting engine @{#DCS.coalition.side}.
|
||||||
-- @param #boolean Condition Sends the message only if the condition is true.
|
-- @param #boolean Condition Sends the message only if the condition is true.
|
||||||
-- @return #MESSAGE self
|
-- @return #MESSAGE self
|
||||||
function MESSAGE:ToCoalitionIf( CoalitionSide, Condition )
|
function MESSAGE:ToCoalitionIf( CoalitionSide, Condition )
|
||||||
@@ -395,29 +395,36 @@ end
|
|||||||
--- Sends a MESSAGE to all players.
|
--- Sends a MESSAGE to all players.
|
||||||
-- @param #MESSAGE self
|
-- @param #MESSAGE self
|
||||||
-- @param Core.Settings#Settings Settings (Optional) Settings for message display.
|
-- @param Core.Settings#Settings Settings (Optional) Settings for message display.
|
||||||
-- @return #MESSAGE
|
-- @param #number Delay (Optional) Delay in seconds before the message is send. Default instantly (`nil`).
|
||||||
|
-- @return #MESSAGE self
|
||||||
-- @usage
|
-- @usage
|
||||||
--
|
--
|
||||||
-- -- Send a message created to all players.
|
-- -- Send a message created to all players.
|
||||||
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25 ):ToAll()
|
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25 ):ToAll()
|
||||||
-- or
|
-- or
|
||||||
-- MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25 ):ToAll()
|
-- MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25 ):ToAll()
|
||||||
-- or
|
-- or
|
||||||
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25 )
|
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25 )
|
||||||
-- MessageAll:ToAll()
|
-- MessageAll:ToAll()
|
||||||
--
|
--
|
||||||
function MESSAGE:ToAll( Settings )
|
function MESSAGE:ToAll( Settings, Delay )
|
||||||
self:F()
|
self:F()
|
||||||
|
|
||||||
if self.MessageType then
|
if Delay and Delay>0 then
|
||||||
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
self:ScheduleOnce(Delay, MESSAGE.ToAll, self, Settings, 0)
|
||||||
self.MessageDuration = Settings:GetMessageTime( self.MessageType )
|
else
|
||||||
self.MessageCategory = "" -- self.MessageType .. ": "
|
|
||||||
end
|
if self.MessageType then
|
||||||
|
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
||||||
|
self.MessageDuration = Settings:GetMessageTime( self.MessageType )
|
||||||
|
self.MessageCategory = "" -- self.MessageType .. ": "
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.MessageDuration ~= 0 then
|
||||||
|
self:T( self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ) .. " / " .. self.MessageDuration )
|
||||||
|
trigger.action.outText( self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ), self.MessageDuration, self.ClearScreen )
|
||||||
|
end
|
||||||
|
|
||||||
if self.MessageDuration ~= 0 then
|
|
||||||
self:T( self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ) .. " / " .. self.MessageDuration )
|
|
||||||
trigger.action.outText( self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ), self.MessageDuration, self.ClearScreen )
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -459,14 +466,14 @@ end
|
|||||||
|
|
||||||
_MESSAGESRS = {}
|
_MESSAGESRS = {}
|
||||||
|
|
||||||
--- Set up MESSAGE generally to allow Text-To-Speech via SRS and TTS functions.
|
--- Set up MESSAGE generally to allow Text-To-Speech via SRS and TTS functions. `SetMSRS()` will try to use as many attributes configured with @{Sound.SRS#MSRS.LoadConfigFile}() as possible.
|
||||||
-- @param #string PathToSRS Path to SRS Folder, defaults to "C:\\\\Program Files\\\\DCS-SimpleRadio-Standalone".
|
-- @param #string PathToSRS (optional) Path to SRS Folder, defaults to "C:\\\\Program Files\\\\DCS-SimpleRadio-Standalone" or your configuration file setting.
|
||||||
-- @param #number Port Port number of SRS, defaults to 5002.
|
-- @param #number Port Port (optional) number of SRS, defaults to 5002 or your configuration file setting.
|
||||||
-- @param #string PathToCredentials (optional) Path to credentials file for e.g. Google.
|
-- @param #string PathToCredentials (optional) Path to credentials file for Google.
|
||||||
-- @param #number Frequency Frequency in MHz. Can also be given as a #table of frequencies.
|
-- @param #number Frequency Frequency in MHz. Can also be given as a #table of frequencies.
|
||||||
-- @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 "male".
|
-- @param #string Gender (optional) Gender, i.e. "male" or "female", defaults to "female" or your configuration file setting.
|
||||||
-- @param #string Culture (optional) Culture, e.g. "en-US", defaults to "en-GB"
|
-- @param #string Culture (optional) Culture, e.g. "en-US", defaults to "en-GB" or your configuration file setting.
|
||||||
-- @param #string Voice (optional) Voice. Will override gender and culture settings, e.g. MSRS.Voices.Microsoft.Hazel or MSRS.Voices.Google.Standard.de_DE_Standard_D. Hint on Microsoft voices - working voices are limited to Hedda, Hazel, David, Zira and Hortense. **Must** be installed on your Desktop or Server!
|
-- @param #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).
|
||||||
@@ -480,32 +487,56 @@ _MESSAGESRS = {}
|
|||||||
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRS()
|
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRS()
|
||||||
--
|
--
|
||||||
function MESSAGE.SetMSRS(PathToSRS,Port,PathToCredentials,Frequency,Modulation,Gender,Culture,Voice,Coalition,Volume,Label,Coordinate)
|
function MESSAGE.SetMSRS(PathToSRS,Port,PathToCredentials,Frequency,Modulation,Gender,Culture,Voice,Coalition,Volume,Label,Coordinate)
|
||||||
_MESSAGESRS.MSRS = MSRS:New(PathToSRS,Frequency,Modulation,Volume)
|
|
||||||
_MESSAGESRS.MSRS:SetCoalition(Coalition)
|
_MESSAGESRS.PathToSRS = PathToSRS or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
||||||
_MESSAGESRS.MSRS:SetCoordinate(Coordinate)
|
|
||||||
|
_MESSAGESRS.frequency = Frequency or MSRS.frequencies or 243
|
||||||
|
_MESSAGESRS.modulation = Modulation or MSRS.modulations or radio.modulation.AM
|
||||||
|
|
||||||
|
_MESSAGESRS.MSRS = MSRS:New(_MESSAGESRS.PathToSRS,_MESSAGESRS.frequency, _MESSAGESRS.modulation)
|
||||||
|
|
||||||
|
_MESSAGESRS.coalition = Coalition or MSRS.coalition or coalition.side.NEUTRAL
|
||||||
|
_MESSAGESRS.MSRS:SetCoalition(_MESSAGESRS.coalition)
|
||||||
|
|
||||||
|
_MESSAGESRS.coordinate = Coordinate
|
||||||
|
|
||||||
|
if Coordinate then
|
||||||
|
_MESSAGESRS.MSRS:SetCoordinate(Coordinate)
|
||||||
|
end
|
||||||
|
|
||||||
|
_MESSAGESRS.Culture = Culture or MSRS.culture or "en-GB"
|
||||||
_MESSAGESRS.MSRS:SetCulture(Culture)
|
_MESSAGESRS.MSRS:SetCulture(Culture)
|
||||||
_MESSAGESRS.Culture = Culture
|
|
||||||
--_MESSAGESRS.MSRS:SetFrequencies(Frequency)
|
_MESSAGESRS.Gender = Gender or MSRS.gender or "female"
|
||||||
_MESSAGESRS.MSRS:SetGender(Gender)
|
_MESSAGESRS.MSRS:SetGender(Gender)
|
||||||
_MESSAGESRS.Gender = Gender
|
|
||||||
_MESSAGESRS.MSRS:SetGoogle(PathToCredentials)
|
if PathToCredentials then
|
||||||
_MESSAGESRS.MSRS:SetLabel(Label or "MESSAGE")
|
_MESSAGESRS.MSRS:SetProviderOptionsGoogle(PathToCredentials)
|
||||||
--_MESSAGESRS.MSRS:SetModulations(Modulation)
|
_MESSAGESRS.MSRS:SetProvider(MSRS.Provider.GOOGLE)
|
||||||
--_MESSAGESRS.MSRS:SetPath(PathToSRS)
|
end
|
||||||
_MESSAGESRS.MSRS:SetPort(Port)
|
|
||||||
-- _MESSAGESRS.MSRS:SetVolume(Volume)
|
_MESSAGESRS.label = Label or MSRS.Label or "MESSAGE"
|
||||||
_MESSAGESRS.MSRS:SetVoice(Voice)
|
_MESSAGESRS.MSRS:SetLabel(_MESSAGESRS.label)
|
||||||
_MESSAGESRS.Voice = Voice
|
|
||||||
_MESSAGESRS.SRSQ = MSRSQUEUE:New(Label or "MESSAGE")
|
_MESSAGESRS.port = Port or MSRS.port or 5002
|
||||||
env.info(_MESSAGESRS.MSRS.provider,false)
|
_MESSAGESRS.MSRS:SetPort(_MESSAGESRS.port)
|
||||||
|
|
||||||
|
_MESSAGESRS.volume = Volume or MSRS.volume or 1
|
||||||
|
_MESSAGESRS.MSRS:SetVolume(_MESSAGESRS.volume)
|
||||||
|
|
||||||
|
if Voice then _MESSAGESRS.MSRS:SetVoice(Voice) end
|
||||||
|
|
||||||
|
_MESSAGESRS.voice = Voice or MSRS.voice --or MSRS.Voices.Microsoft.Hedda
|
||||||
|
|
||||||
|
_MESSAGESRS.SRSQ = MSRSQUEUE:New(_MESSAGESRS.label)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Sends a message via SRS.
|
--- Sends a message via SRS. `ToSRS()` will try to use as many attributes configured with @{Core.Message#MESSAGE.SetMSRS}() and @{Sound.SRS#MSRS.LoadConfigFile}() as possible.
|
||||||
-- @param #MESSAGE self
|
-- @param #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.
|
||||||
-- @param #string gender (optional) Gender, i.e. "male" or "female". Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
-- @param #string gender (optional) Gender, i.e. "male" or "female". Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
||||||
-- @param #string culture (optional) Culture, e.g. "en-US. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
-- @param #string culture (optional) Culture, e.g. "en-US". Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
||||||
-- @param #string voice (optional) Voice. Will override gender and culture settings. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
-- @param #string voice (optional) Voice. Will override gender and culture settings. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
||||||
-- @param #number coalition (optional) Coalition, can be coalition.side.RED, coalition.side.BLUE or coalition.side.NEUTRAL. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
-- @param #number coalition (optional) Coalition, can be coalition.side.RED, coalition.side.BLUE or coalition.side.NEUTRAL. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
||||||
-- @param #number volume (optional) Volume, can be between 0.0 and 1.0 (loudest). Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
-- @param #number volume (optional) Volume, can be between 0.0 and 1.0 (loudest). Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
|
||||||
@@ -519,9 +550,16 @@ end
|
|||||||
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRS()
|
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRS()
|
||||||
--
|
--
|
||||||
function MESSAGE:ToSRS(frequency,modulation,gender,culture,voice,coalition,volume,coordinate)
|
function MESSAGE:ToSRS(frequency,modulation,gender,culture,voice,coalition,volume,coordinate)
|
||||||
|
local tgender = gender or _MESSAGESRS.Gender
|
||||||
if _MESSAGESRS.SRSQ then
|
if _MESSAGESRS.SRSQ then
|
||||||
_MESSAGESRS.MSRS:SetVoice(voice or _MESSAGESRS.Voice)
|
if voice then
|
||||||
_MESSAGESRS.SRSQ:NewTransmission(self.MessageText,nil,_MESSAGESRS.MSRS,nil,nil,nil,nil,nil,frequency,modulation,gender or _MESSAGESRS.Gender,culture or _MESSAGESRS.Culture,voice or _MESSAGESRS.Voice,volume,self.MessageCategory)
|
_MESSAGESRS.MSRS:SetVoice(voice or _MESSAGESRS.voice)
|
||||||
|
end
|
||||||
|
if coordinate then
|
||||||
|
_MESSAGESRS.MSRS:SetCoordinate(coordinate)
|
||||||
|
end
|
||||||
|
local category = string.gsub(self.MessageCategory,":","")
|
||||||
|
_MESSAGESRS.SRSQ:NewTransmission(self.MessageText,nil,_MESSAGESRS.MSRS,0.5,1,nil,nil,nil,frequency or _MESSAGESRS.frequency,modulation or _MESSAGESRS.modulation, gender or _MESSAGESRS.Gender,culture or _MESSAGESRS.Culture,nil,volume or _MESSAGESRS.volume,category,coordinate or _MESSAGESRS.coordinate)
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ PATHLINE = {
|
|||||||
|
|
||||||
--- PATHLINE class version.
|
--- PATHLINE class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
PATHLINE.version="0.1.0"
|
PATHLINE.version="0.1.1"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
@@ -199,7 +199,7 @@ end
|
|||||||
|
|
||||||
--- Get points of pathline. Not that points are tables, that contain more information as just the 2D or 3D position but also the surface type etc.
|
--- Get points of pathline. Not that points are tables, that contain more information as just the 2D or 3D position but also the surface type etc.
|
||||||
-- @param #PATHLINE self
|
-- @param #PATHLINE self
|
||||||
-- @return <#PATHLINE.Point> List of points.
|
-- @return #list <#PATHLINE.Point> List of points.
|
||||||
function PATHLINE:GetPoints()
|
function PATHLINE:GetPoints()
|
||||||
return self.points
|
return self.points
|
||||||
end
|
end
|
||||||
@@ -237,13 +237,14 @@ end
|
|||||||
--- Get COORDINATES of pathline. Note that COORDINATE objects are created when calling this function. That does involve deep copy calls and can have an impact on performance if done too often.
|
--- 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:GetCoordinats()
|
function PATHLINE:GetCoordinates()
|
||||||
|
|
||||||
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
|
||||||
@@ -262,7 +263,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.point[n]
|
point=self.points[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
|
||||||
|
|||||||
@@ -8,22 +8,6 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # Demo Missions
|
|
||||||
--
|
|
||||||
-- ### [POINT_VEC Demo Missions source code]()
|
|
||||||
--
|
|
||||||
-- ### [POINT_VEC Demo Missions, only for beta testers]()
|
|
||||||
--
|
|
||||||
-- ### [ALL Demo Missions pack of the last release](https://github.com/FlightControl-Master/MOOSE_MISSIONS/releases)
|
|
||||||
--
|
|
||||||
-- ===
|
|
||||||
--
|
|
||||||
-- # YouTube Channel
|
|
||||||
--
|
|
||||||
-- ### [POINT_VEC YouTube Channel]()
|
|
||||||
--
|
|
||||||
-- ===
|
|
||||||
--
|
|
||||||
-- ### Authors:
|
-- ### Authors:
|
||||||
--
|
--
|
||||||
-- * FlightControl (Design & Programming)
|
-- * FlightControl (Design & Programming)
|
||||||
@@ -41,7 +25,8 @@
|
|||||||
|
|
||||||
do -- COORDINATE
|
do -- COORDINATE
|
||||||
|
|
||||||
--- @type COORDINATE
|
---
|
||||||
|
-- @type COORDINATE
|
||||||
-- @field #string ClassName Name of the class
|
-- @field #string ClassName Name of the class
|
||||||
-- @field #number x Component of the 3D vector.
|
-- @field #number x Component of the 3D vector.
|
||||||
-- @field #number y Component of the 3D vector.
|
-- @field #number y Component of the 3D vector.
|
||||||
@@ -196,7 +181,7 @@ do -- COORDINATE
|
|||||||
-- * @{#COORDINATE.ToStringBR}(): Generates a Bearing & Range text in the format of DDD for DI where DDD is degrees and DI is distance.
|
-- * @{#COORDINATE.ToStringBR}(): Generates a Bearing & Range text in the format of DDD for DI where DDD is degrees and DI is distance.
|
||||||
-- * @{#COORDINATE.ToStringBRA}(): Generates a Bearing, Range & Altitude text.
|
-- * @{#COORDINATE.ToStringBRA}(): Generates a Bearing, Range & Altitude text.
|
||||||
-- * @{#COORDINATE.ToStringBRAANATO}(): Generates a Generates a Bearing, Range, Aspect & Altitude text in NATOPS.
|
-- * @{#COORDINATE.ToStringBRAANATO}(): Generates a Generates a Bearing, Range, Aspect & Altitude text in NATOPS.
|
||||||
-- * @{#COORDINATE.ToStringLL}(): Generates a Latutide & Longitude text.
|
-- * @{#COORDINATE.ToStringLL}(): Generates a Latitude & Longitude text.
|
||||||
-- * @{#COORDINATE.ToStringLLDMS}(): Generates a Lat, Lon, Degree, Minute, Second text.
|
-- * @{#COORDINATE.ToStringLLDMS}(): Generates a Lat, Lon, Degree, Minute, Second text.
|
||||||
-- * @{#COORDINATE.ToStringLLDDM}(): Generates a Lat, Lon, Degree, decimal Minute text.
|
-- * @{#COORDINATE.ToStringLLDDM}(): Generates a Lat, Lon, Degree, decimal Minute text.
|
||||||
-- * @{#COORDINATE.ToStringMGRS}(): Generates a MGRS grid coordinate text.
|
-- * @{#COORDINATE.ToStringMGRS}(): Generates a MGRS grid coordinate text.
|
||||||
@@ -544,7 +529,7 @@ do -- COORDINATE
|
|||||||
if ZoneObject then
|
if ZoneObject then
|
||||||
|
|
||||||
-- Get category of scanned object.
|
-- Get category of scanned object.
|
||||||
local ObjectCategory = ZoneObject:getCategory()
|
local ObjectCategory = Object.getCategory(ZoneObject)
|
||||||
|
|
||||||
-- Check for unit or static objects
|
-- Check for unit or static objects
|
||||||
if ObjectCategory==Object.Category.UNIT and ZoneObject:isExist() then
|
if ObjectCategory==Object.Category.UNIT and ZoneObject:isExist() then
|
||||||
@@ -718,6 +703,7 @@ do -- COORDINATE
|
|||||||
-- @return DCS#Distance The distance from the reference @{#COORDINATE} in meters.
|
-- @return DCS#Distance The distance from the reference @{#COORDINATE} in meters.
|
||||||
function COORDINATE:DistanceFromPointVec2( PointVec2Reference )
|
function COORDINATE:DistanceFromPointVec2( PointVec2Reference )
|
||||||
self:F2( PointVec2Reference )
|
self:F2( PointVec2Reference )
|
||||||
|
if not PointVec2Reference then return math.huge end
|
||||||
|
|
||||||
local Distance = ( ( PointVec2Reference.x - self.x ) ^ 2 + ( PointVec2Reference.z - self.z ) ^2 ) ^ 0.5
|
local Distance = ( ( PointVec2Reference.x - self.x ) ^ 2 + ( PointVec2Reference.z - self.z ) ^2 ) ^ 0.5
|
||||||
|
|
||||||
@@ -920,7 +906,7 @@ do -- COORDINATE
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Return an angle in radians from the COORDINATE using a direction vector in Vec3 format.
|
--- Return an angle in radians from the COORDINATE using a **direction vector in Vec3 format**.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param DCS#Vec3 DirectionVec3 The direction vector in Vec3 format.
|
-- @param DCS#Vec3 DirectionVec3 The direction vector in Vec3 format.
|
||||||
-- @return #number DirectionRadians The angle in radians.
|
-- @return #number DirectionRadians The angle in radians.
|
||||||
@@ -933,10 +919,12 @@ do -- COORDINATE
|
|||||||
return DirectionRadians
|
return DirectionRadians
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Return an angle in degrees from the COORDINATE using a direction vector in Vec3 format.
|
--- Return an angle in degrees from the COORDINATE using a **direction vector in Vec3 format**.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param DCS#Vec3 DirectionVec3 The direction vector in Vec3 format.
|
-- @param DCS#Vec3 DirectionVec3 The direction vector in Vec3 format.
|
||||||
-- @return #number DirectionRadians The angle in degrees.
|
-- @return #number DirectionRadians The angle in degrees.
|
||||||
|
-- @usage
|
||||||
|
-- local directionAngle = currentCoordinate:GetAngleDegrees(currentCoordinate:GetDirectionVec3(sourceCoordinate:GetVec3()))
|
||||||
function COORDINATE:GetAngleDegrees( DirectionVec3 )
|
function COORDINATE:GetAngleDegrees( DirectionVec3 )
|
||||||
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
||||||
local Angle = UTILS.ToDegree( AngleRadians )
|
local Angle = UTILS.ToDegree( AngleRadians )
|
||||||
@@ -2469,15 +2457,18 @@ do -- COORDINATE
|
|||||||
-- Write command as string and execute that. Idea by Grimes https://forum.dcs.world/topic/324201-mark-to-all-function/#comment-5273793
|
-- Write command as string and execute that. Idea by Grimes https://forum.dcs.world/topic/324201-mark-to-all-function/#comment-5273793
|
||||||
local s=string.format("trigger.action.markupToAll(7, %d, %d,", Coalition, MarkID)
|
local s=string.format("trigger.action.markupToAll(7, %d, %d,", Coalition, MarkID)
|
||||||
for _,vec in pairs(vecs) do
|
for _,vec in pairs(vecs) do
|
||||||
s=s..string.format("%s,", UTILS._OneLineSerialize(vec))
|
--s=s..string.format("%s,", UTILS._OneLineSerialize(vec))
|
||||||
|
s=s..string.format("{x=%.1f, y=%.1f, z=%.1f},", vec.x, vec.y, vec.z)
|
||||||
end
|
end
|
||||||
s=s..string.format("%s, %s, %s, %s", UTILS._OneLineSerialize(Color), UTILS._OneLineSerialize(FillColor), tostring(LineType), tostring(ReadOnly))
|
s=s..string.format("{%.3f, %.3f, %.3f, %.3f},", Color[1], Color[2], Color[3], Color[4])
|
||||||
if Text and Text~="" then
|
s=s..string.format("{%.3f, %.3f, %.3f, %.3f},", FillColor[1], FillColor[2], FillColor[3], FillColor[4])
|
||||||
s=s..string.format(", \"%s\"", Text)
|
s=s..string.format("%d,", LineType or 1)
|
||||||
|
s=s..string.format("%s", tostring(ReadOnly))
|
||||||
|
if Text and type(Text)=="string" and string.len(Text)>0 then
|
||||||
|
s=s..string.format(", \"%s\"", tostring(Text))
|
||||||
end
|
end
|
||||||
s=s..")"
|
s=s..")"
|
||||||
|
|
||||||
|
|
||||||
-- Execute string command
|
-- Execute string command
|
||||||
local success=UTILS.DoString(s)
|
local success=UTILS.DoString(s)
|
||||||
|
|
||||||
@@ -2565,7 +2556,7 @@ do -- COORDINATE
|
|||||||
|
|
||||||
Offset=Offset or 2
|
Offset=Offset or 2
|
||||||
|
|
||||||
-- Measurement of visibility should not be from the ground, so Adding a hypotethical 2 meters to each Coordinate.
|
-- Measurement of visibility should not be from the ground, so Adding a hypothetical 2 meters to each Coordinate.
|
||||||
local FromVec3 = self:GetVec3()
|
local FromVec3 = self:GetVec3()
|
||||||
FromVec3.y = FromVec3.y + Offset
|
FromVec3.y = FromVec3.y + Offset
|
||||||
|
|
||||||
@@ -2966,10 +2957,10 @@ do -- COORDINATE
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- corrected Track to be direction of travel of bogey (self in this case)
|
-- corrected Track to be direction of travel of bogey (self in this case)
|
||||||
local track = "Maneuver"
|
local track = "Maneuver"
|
||||||
|
|
||||||
if self.Heading then
|
if self.Heading then
|
||||||
track = UTILS.BearingToCardinal(self.Heading) or "North"
|
track = UTILS.BearingToCardinal(self.Heading) or "North"
|
||||||
end
|
end
|
||||||
|
|
||||||
if rangeNM > 3 then
|
if rangeNM > 3 then
|
||||||
@@ -3021,6 +3012,16 @@ do -- COORDINATE
|
|||||||
return BRAANATO
|
return BRAANATO
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Return the BULLSEYE as COORDINATE Object
|
||||||
|
-- @param #number Coalition Coalition of the bulls eye to return, e.g. coalition.side.BLUE
|
||||||
|
-- @return #COORDINATE self
|
||||||
|
-- @usage
|
||||||
|
-- -- note the dot (.) here,not using the colon (:)
|
||||||
|
-- local redbulls = COORDINATE.GetBullseyeCoordinate(coalition.side.RED)
|
||||||
|
function COORDINATE.GetBullseyeCoordinate(Coalition)
|
||||||
|
return COORDINATE:NewFromVec3( coalition.getMainRefPoint( Coalition ) )
|
||||||
|
end
|
||||||
|
|
||||||
--- Return a BULLS string out of the BULLS of the coalition to the COORDINATE.
|
--- Return a BULLS string out of the BULLS of the coalition to the COORDINATE.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param DCS#coalition.side Coalition The coalition.
|
-- @param DCS#coalition.side Coalition The coalition.
|
||||||
@@ -3071,6 +3072,18 @@ do -- COORDINATE
|
|||||||
return coord.LOtoLL( self:GetVec3() )
|
return coord.LOtoLL( self:GetVec3() )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Get Latitude & Longitude text.
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
||||||
|
-- @return #string LLText
|
||||||
|
function COORDINATE:ToStringLL( Settings )
|
||||||
|
|
||||||
|
local LL_Accuracy = Settings and Settings.LL_Accuracy or _SETTINGS.LL_Accuracy
|
||||||
|
local lat, lon = coord.LOtoLL( self:GetVec3() )
|
||||||
|
return string.format('%f', lat) .. ' ' .. string.format('%f', lon)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Provides a Lat Lon string in Degree Minute Second format.
|
--- Provides a Lat Lon string in Degree Minute Second format.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
||||||
@@ -3105,6 +3118,50 @@ do -- COORDINATE
|
|||||||
return "MGRS " .. UTILS.tostringMGRS( MGRS, MGRS_Accuracy )
|
return "MGRS " .. UTILS.tostringMGRS( MGRS, MGRS_Accuracy )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Provides a COORDINATE from an MGRS String
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @param #string MGRSString MGRS String, e.g. "MGRS 37T DK 12345 12345"
|
||||||
|
-- @return #COORDINATE self
|
||||||
|
function COORDINATE:NewFromMGRSString( MGRSString )
|
||||||
|
local myparts = UTILS.Split(MGRSString," ")
|
||||||
|
local northing = tostring(myparts[5]) or ""
|
||||||
|
local easting = tostring(myparts[4]) or ""
|
||||||
|
if string.len(easting) < 5 then easting = easting..string.rep("0",5-string.len(easting)) end
|
||||||
|
if string.len(northing) < 5 then northing = northing..string.rep("0",5-string.len(northing)) end
|
||||||
|
local MGRS = {
|
||||||
|
UTMZone = myparts[2],
|
||||||
|
MGRSDigraph = myparts[3],
|
||||||
|
Easting = easting,
|
||||||
|
Northing = northing,
|
||||||
|
}
|
||||||
|
local lat, lon = coord.MGRStoLL(MGRS)
|
||||||
|
local point = coord.LLtoLO(lat, lon, 0)
|
||||||
|
local coord = COORDINATE:NewFromVec2({x=point.x,y=point.z})
|
||||||
|
return coord
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Provides a COORDINATE from an MGRS Coordinate
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @param #string UTMZone UTM Zone, e.g. "37T"
|
||||||
|
-- @param #string MGRSDigraph Digraph, e.g. "DK"
|
||||||
|
-- @param #string Easting Meters easting - string in order to allow for leading zeros, e.g. "01234". Should be 5 digits.
|
||||||
|
-- @param #string Northing Meters northing - string in order to allow for leading zeros, e.g. "12340". Should be 5 digits.
|
||||||
|
-- @return #COORDINATE self
|
||||||
|
function COORDINATE:NewFromMGRS( UTMZone, MGRSDigraph, Easting, Northing )
|
||||||
|
if string.len(Easting) < 5 then Easting = tostring(Easting..string.rep("0",5-string.len(Easting) )) end
|
||||||
|
if string.len(Northing) < 5 then Northing = tostring(Northing..string.rep("0",5-string.len(Northing) )) end
|
||||||
|
local MGRS = {
|
||||||
|
UTMZone = UTMZone,
|
||||||
|
MGRSDigraph = MGRSDigraph,
|
||||||
|
Easting = tostring(Easting),
|
||||||
|
Northing = tostring(Northing),
|
||||||
|
}
|
||||||
|
local lat, lon = coord.MGRStoLL(MGRS)
|
||||||
|
local point = coord.LLtoLO(lat, lon, 0)
|
||||||
|
local coord = COORDINATE:NewFromVec2({x=point.x,y=point.z})
|
||||||
|
return coord
|
||||||
|
end
|
||||||
|
|
||||||
--- Provides a coordinate string of the point, based on a coordinate format system:
|
--- Provides a coordinate string of the point, based on a coordinate format system:
|
||||||
-- * Uses default settings in COORDINATE.
|
-- * Uses default settings in COORDINATE.
|
||||||
-- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default.
|
-- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default.
|
||||||
@@ -3617,7 +3674,7 @@ end
|
|||||||
|
|
||||||
do -- POINT_VEC2
|
do -- POINT_VEC2
|
||||||
|
|
||||||
--- @type POINT_VEC2
|
-- @type POINT_VEC2
|
||||||
-- @field DCS#Distance x The x coordinate in meters.
|
-- @field DCS#Distance x The x coordinate in meters.
|
||||||
-- @field DCS#Distance y the y coordinate in meters.
|
-- @field DCS#Distance y the y coordinate in meters.
|
||||||
-- @extends Core.Point#COORDINATE
|
-- @extends Core.Point#COORDINATE
|
||||||
|
|||||||
@@ -14,17 +14,13 @@
|
|||||||
--
|
--
|
||||||
-- # Demo Missions
|
-- # Demo Missions
|
||||||
--
|
--
|
||||||
-- ### [SCHEDULER Demo Missions source code](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SCH%20-%20Scheduler)
|
-- ### [SCHEDULER Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Core/Scheduler)
|
||||||
--
|
|
||||||
-- ### [SCHEDULER Demo Missions, only for beta testers](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SCH%20-%20Scheduler)
|
|
||||||
--
|
|
||||||
-- ### [ALL Demo Missions pack of the last release](https://github.com/FlightControl-Master/MOOSE_MISSIONS/releases)
|
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # YouTube Channel
|
-- # YouTube Channel
|
||||||
--
|
--
|
||||||
-- ### [SCHEDULER YouTube Channel (none)]()
|
-- ### None
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -52,7 +48,7 @@
|
|||||||
--
|
--
|
||||||
-- A SCHEDULER can manage **multiple** (repeating) schedules. Each planned or executing schedule has a unique **ScheduleID**.
|
-- A SCHEDULER can manage **multiple** (repeating) schedules. Each planned or executing schedule has a unique **ScheduleID**.
|
||||||
-- The ScheduleID is returned when the method @{#SCHEDULER.Schedule}() is called.
|
-- The ScheduleID is returned when the method @{#SCHEDULER.Schedule}() is called.
|
||||||
-- It is recommended to store the ScheduleID in a variable, as it is used in the methods @{SCHEDULER.Start}() and @{SCHEDULER.Stop}(),
|
-- It is recommended to store the ScheduleID in a variable, as it is used in the methods @{#SCHEDULER.Start}() and @{#SCHEDULER.Stop}(),
|
||||||
-- which can start and stop specific repeating schedules respectively within a SCHEDULER object.
|
-- which can start and stop specific repeating schedules respectively within a SCHEDULER object.
|
||||||
--
|
--
|
||||||
-- ## SCHEDULER constructor
|
-- ## SCHEDULER constructor
|
||||||
|
|||||||
@@ -147,6 +147,44 @@ do -- SET_BASE
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- [Internal] Add a functional filter
|
||||||
|
-- @param #SET_BASE self
|
||||||
|
-- @param #function ConditionFunction If this function returns `true`, the object is added to the SET. The function needs to take a CONTROLLABLE object as first argument.
|
||||||
|
-- @param ... Condition function arguments, if any.
|
||||||
|
-- @return #boolean If true, at least one condition is true
|
||||||
|
function SET_BASE:FilterFunction(ConditionFunction, ...)
|
||||||
|
|
||||||
|
local condition={}
|
||||||
|
condition.func=ConditionFunction
|
||||||
|
condition.arg={}
|
||||||
|
|
||||||
|
if arg then
|
||||||
|
condition.arg=arg
|
||||||
|
end
|
||||||
|
|
||||||
|
if not self.Filter.Functions then self.Filter.Functions = {} end
|
||||||
|
table.insert(self.Filter.Functions, condition)
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [Internal] Check if the condition functions returns true.
|
||||||
|
-- @param #SET_BASE self
|
||||||
|
-- @param Wrapper.Controllable#CONTROLLABLE Object The object to filter for
|
||||||
|
-- @return #boolean If true, if **all** conditions are true
|
||||||
|
function SET_BASE:_EvalFilterFunctions(Object)
|
||||||
|
-- All conditions must be true.
|
||||||
|
for _,_condition in pairs(self.Filter.Functions or {}) do
|
||||||
|
local condition=_condition
|
||||||
|
-- Call function.
|
||||||
|
if condition.func(Object,unpack(condition.arg)) == false then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- No condition was true.
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
--- Clear the Objects in the Set.
|
--- Clear the Objects in the Set.
|
||||||
-- @param #SET_BASE self
|
-- @param #SET_BASE self
|
||||||
-- @param #boolean TriggerEvent If `true`, an event remove is triggered for each group that is removed from the set.
|
-- @param #boolean TriggerEvent If `true`, an event remove is triggered for each group that is removed from the set.
|
||||||
@@ -417,14 +455,35 @@ do -- SET_BASE
|
|||||||
|
|
||||||
--- Gets a random object from the @{Core.Set#SET_BASE} and derived classes.
|
--- Gets a random object from the @{Core.Set#SET_BASE} and derived classes.
|
||||||
-- @param #SET_BASE self
|
-- @param #SET_BASE self
|
||||||
-- @return Core.Base#BASE
|
-- @return Core.Base#BASE or nil if none found or the SET is empty!
|
||||||
function SET_BASE:GetRandom()
|
function SET_BASE:GetRandom()
|
||||||
local tablemax = table.maxn(self.Index)
|
local tablemax = 0
|
||||||
|
for _,_ind in pairs(self.Index) do
|
||||||
|
tablemax = tablemax + 1
|
||||||
|
end
|
||||||
|
--local tablemax = table.maxn(self.Index)
|
||||||
local RandomItem = self.Set[self.Index[math.random(1,tablemax)]]
|
local RandomItem = self.Set[self.Index[math.random(1,tablemax)]]
|
||||||
self:T3( { RandomItem } )
|
self:T3( { RandomItem } )
|
||||||
return RandomItem
|
return RandomItem
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Gets a random object from the @{Core.Set#SET_BASE} and derived classes. A bit slower than @{#SET_BASE.GetRandom}() but tries to ensure you get an object back if the SET is not empty.
|
||||||
|
-- @param #SET_BASE self
|
||||||
|
-- @return Core.Base#BASE or nil if the SET is empty!
|
||||||
|
function SET_BASE:GetRandomSurely()
|
||||||
|
local tablemax = 0
|
||||||
|
local sorted = {}
|
||||||
|
for _,_obj in pairs(self.Set) do
|
||||||
|
tablemax = tablemax + 1
|
||||||
|
sorted[tablemax] = _obj
|
||||||
|
end
|
||||||
|
--local tablemax = table.maxn(self.Index)
|
||||||
|
--local RandomItem = self.Set[self.Index[math.random(1,tablemax)]]
|
||||||
|
local RandomItem = sorted[math.random(1,tablemax)]
|
||||||
|
self:T3( { RandomItem } )
|
||||||
|
return RandomItem
|
||||||
|
end
|
||||||
|
|
||||||
--- Retrieves the amount of objects in the @{Core.Set#SET_BASE} and derived classes.
|
--- Retrieves the amount of objects in the @{Core.Set#SET_BASE} and derived classes.
|
||||||
-- @param #SET_BASE self
|
-- @param #SET_BASE self
|
||||||
-- @return #number Count
|
-- @return #number Count
|
||||||
@@ -561,10 +620,12 @@ do -- SET_BASE
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Iterate the SET_BASE while identifying the nearest object from a @{Core.Point#POINT_VEC2}.
|
--- Iterate the SET_BASE while identifying the nearest object in the set from a @{Core.Point#POINT_VEC2}.
|
||||||
-- @param #SET_BASE self
|
-- @param #SET_BASE self
|
||||||
-- @param Core.Point#POINT_VEC2 PointVec2 A @{Core.Point#POINT_VEC2} object from where to evaluate the closest object in the set.
|
-- @param Core.Point#POINT_VEC2 PointVec2 A @{Core.Point#COORDINATE} or @{Core.Point#POINT_VEC2} object (but **not** a simple DCS#Vec2!) from where to evaluate the closest object in the set.
|
||||||
-- @return Core.Base#BASE The closest object.
|
-- @return Core.Base#BASE The closest object.
|
||||||
|
-- @usage
|
||||||
|
-- myset:FindNearestObjectFromPointVec2( ZONE:New("Test Zone"):GetCoordinate() )
|
||||||
function SET_BASE:FindNearestObjectFromPointVec2( PointVec2 )
|
function SET_BASE:FindNearestObjectFromPointVec2( PointVec2 )
|
||||||
self:F2( PointVec2 )
|
self:F2( PointVec2 )
|
||||||
|
|
||||||
@@ -961,6 +1022,7 @@ do
|
|||||||
-- * @{#SET_GROUP.FilterCategoryShip}: Builds the SET_GROUP from ships.
|
-- * @{#SET_GROUP.FilterCategoryShip}: Builds the SET_GROUP from ships.
|
||||||
-- * @{#SET_GROUP.FilterCategoryStructure}: Builds the SET_GROUP from structures.
|
-- * @{#SET_GROUP.FilterCategoryStructure}: Builds the SET_GROUP from structures.
|
||||||
-- * @{#SET_GROUP.FilterZones}: Builds the SET_GROUP with the groups within a @{Core.Zone#ZONE}.
|
-- * @{#SET_GROUP.FilterZones}: Builds the SET_GROUP with the groups within a @{Core.Zone#ZONE}.
|
||||||
|
-- * @{#SET_GROUP.FilterFunction}: Builds the SET_GROUP with a custom condition.
|
||||||
--
|
--
|
||||||
-- Once the filter criteria have been set for the SET_GROUP, you can start filtering using:
|
-- Once the filter criteria have been set for the SET_GROUP, you can start filtering using:
|
||||||
--
|
--
|
||||||
@@ -1034,6 +1096,8 @@ do
|
|||||||
Countries = nil,
|
Countries = nil,
|
||||||
GroupPrefixes = nil,
|
GroupPrefixes = nil,
|
||||||
Zones = nil,
|
Zones = nil,
|
||||||
|
Functions = nil,
|
||||||
|
Alive = nil,
|
||||||
},
|
},
|
||||||
FilterMeta = {
|
FilterMeta = {
|
||||||
Coalitions = {
|
Coalitions = {
|
||||||
@@ -1065,6 +1129,13 @@ do
|
|||||||
self:FilterActive( false )
|
self:FilterActive( false )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
--- Filter the set once
|
||||||
|
-- @function [parent=#SET_GROUP] FilterOnce
|
||||||
|
-- @param #SET_GROUP self
|
||||||
|
-- @return #SET_GROUP self
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get a *new* set that only contains alive groups.
|
--- Get a *new* set that only contains alive groups.
|
||||||
@@ -1134,7 +1205,7 @@ do
|
|||||||
if not DontSetCargoBayLimit then
|
if not DontSetCargoBayLimit then
|
||||||
-- I set the default cargo bay weight limit each time a new group is added to the set.
|
-- I set the default cargo bay weight limit each time a new group is added to the set.
|
||||||
-- TODO Why is this here in the first place?
|
-- TODO Why is this here in the first place?
|
||||||
for UnitID, UnitData in pairs( group:GetUnits() ) do
|
for UnitID, UnitData in pairs( group:GetUnits() or {} ) do
|
||||||
if UnitData and UnitData:IsAlive() then
|
if UnitData and UnitData:IsAlive() then
|
||||||
UnitData:SetCargoBayWeightLimit()
|
UnitData:SetCargoBayWeightLimit()
|
||||||
end
|
end
|
||||||
@@ -1241,6 +1312,25 @@ do
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- [User] Add a custom condition function.
|
||||||
|
-- @function [parent=#SET_GROUP] FilterFunction
|
||||||
|
-- @param #SET_GROUP self
|
||||||
|
-- @param #function ConditionFunction If this function returns `true`, the object is added to the SET. The function needs to take a GROUP object as first argument.
|
||||||
|
-- @param ... Condition function arguments if any.
|
||||||
|
-- @return #SET_GROUP self
|
||||||
|
-- @usage
|
||||||
|
-- -- Image you want to exclude a specific GROUP from a SET:
|
||||||
|
-- local groundset = SET_GROUP:New():FilterCoalitions("blue"):FilterCategoryGround():FilterFunction(
|
||||||
|
-- -- The function needs to take a GROUP object as first - and in this case, only - argument.
|
||||||
|
-- function(grp)
|
||||||
|
-- local isinclude = true
|
||||||
|
-- if grp:GetName() == "Exclude Me" then isinclude = false end
|
||||||
|
-- return isinclude
|
||||||
|
-- end
|
||||||
|
-- ):FilterOnce()
|
||||||
|
-- BASE:I(groundset:Flush())
|
||||||
|
|
||||||
|
|
||||||
--- Builds a set of groups of coalitions.
|
--- Builds a set of groups of coalitions.
|
||||||
-- Possible current coalitions are red, blue and neutral.
|
-- Possible current coalitions are red, blue and neutral.
|
||||||
-- @param #SET_GROUP self
|
-- @param #SET_GROUP self
|
||||||
@@ -1381,7 +1471,7 @@ do
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Builds a set of groups that are only active.
|
--- Builds a set of groups that are active, ie in the mission but not yet activated (false) or actived (true).
|
||||||
-- Only the groups that are active will be included within the set.
|
-- Only the groups that are active will be included within the set.
|
||||||
-- @param #SET_GROUP self
|
-- @param #SET_GROUP self
|
||||||
-- @param #boolean Active (Optional) Include only active groups to the set.
|
-- @param #boolean Active (Optional) Include only active groups to the set.
|
||||||
@@ -1407,6 +1497,14 @@ do
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Build a set of groups that are alive.
|
||||||
|
-- @param #SET_GROUP self
|
||||||
|
-- @return #SET_GROUP self
|
||||||
|
function SET_GROUP:FilterAlive()
|
||||||
|
self.Filter.Alive = true
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Starts the filtering.
|
--- Starts the filtering.
|
||||||
-- @param #SET_GROUP self
|
-- @param #SET_GROUP self
|
||||||
-- @return #SET_GROUP self
|
-- @return #SET_GROUP self
|
||||||
@@ -1418,6 +1516,7 @@ do
|
|||||||
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.PlayerLeaveUnit, self._EventOnDeadOrCrash )
|
||||||
if self.Filter.Zones then
|
if self.Filter.Zones then
|
||||||
self.ZoneTimer = TIMER:New(self._ContinousZoneFilter,self)
|
self.ZoneTimer = TIMER:New(self._ContinousZoneFilter,self)
|
||||||
local timing = self.ZoneTimerInterval or 30
|
local timing = self.ZoneTimerInterval or 30
|
||||||
@@ -1489,7 +1588,7 @@ do
|
|||||||
function SET_GROUP:AddInDatabase( Event )
|
function SET_GROUP:AddInDatabase( Event )
|
||||||
self:F3( { Event } )
|
self:F3( { Event } )
|
||||||
|
|
||||||
if Event.IniObjectCategory == 1 then
|
if Event.IniObjectCategory == Object.Category.UNIT then
|
||||||
if not self.Database[Event.IniDCSGroupName] then
|
if not self.Database[Event.IniDCSGroupName] then
|
||||||
self.Database[Event.IniDCSGroupName] = GROUP:Register( Event.IniDCSGroupName )
|
self.Database[Event.IniDCSGroupName] = GROUP:Register( Event.IniDCSGroupName )
|
||||||
self:T3( self.Database[Event.IniDCSGroupName] )
|
self:T3( self.Database[Event.IniDCSGroupName] )
|
||||||
@@ -1905,6 +2004,15 @@ do
|
|||||||
self:F2( MGroup )
|
self:F2( MGroup )
|
||||||
local MGroupInclude = true
|
local MGroupInclude = true
|
||||||
|
|
||||||
|
if self.Filter.Alive == true then
|
||||||
|
local MGroupAlive = false
|
||||||
|
self:F( { Active = self.Filter.Active } )
|
||||||
|
if MGroup and MGroup:IsAlive() then
|
||||||
|
MGroupAlive = true
|
||||||
|
end
|
||||||
|
MGroupInclude = MGroupInclude and MGroupAlive
|
||||||
|
end
|
||||||
|
|
||||||
if self.Filter.Active ~= nil then
|
if self.Filter.Active ~= nil then
|
||||||
local MGroupActive = false
|
local MGroupActive = false
|
||||||
self:F( { Active = self.Filter.Active } )
|
self:F( { Active = self.Filter.Active } )
|
||||||
@@ -1914,7 +2022,7 @@ do
|
|||||||
MGroupInclude = MGroupInclude and MGroupActive
|
MGroupInclude = MGroupInclude and MGroupActive
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Coalitions then
|
if self.Filter.Coalitions and MGroupInclude then
|
||||||
local MGroupCoalition = false
|
local MGroupCoalition = false
|
||||||
for CoalitionID, CoalitionName in pairs( self.Filter.Coalitions ) do
|
for CoalitionID, CoalitionName in pairs( self.Filter.Coalitions ) do
|
||||||
self:T3( { "Coalition:", MGroup:GetCoalition(), self.FilterMeta.Coalitions[CoalitionName], CoalitionName } )
|
self:T3( { "Coalition:", MGroup:GetCoalition(), self.FilterMeta.Coalitions[CoalitionName], CoalitionName } )
|
||||||
@@ -1925,7 +2033,7 @@ do
|
|||||||
MGroupInclude = MGroupInclude and MGroupCoalition
|
MGroupInclude = MGroupInclude and MGroupCoalition
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Categories then
|
if self.Filter.Categories and MGroupInclude then
|
||||||
local MGroupCategory = false
|
local MGroupCategory = false
|
||||||
for CategoryID, CategoryName in pairs( self.Filter.Categories ) do
|
for CategoryID, CategoryName in pairs( self.Filter.Categories ) do
|
||||||
self:T3( { "Category:", MGroup:GetCategory(), self.FilterMeta.Categories[CategoryName], CategoryName } )
|
self:T3( { "Category:", MGroup:GetCategory(), self.FilterMeta.Categories[CategoryName], CategoryName } )
|
||||||
@@ -1936,7 +2044,7 @@ do
|
|||||||
MGroupInclude = MGroupInclude and MGroupCategory
|
MGroupInclude = MGroupInclude and MGroupCategory
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Countries then
|
if self.Filter.Countries and MGroupInclude then
|
||||||
local MGroupCountry = false
|
local MGroupCountry = false
|
||||||
for CountryID, CountryName in pairs( self.Filter.Countries ) do
|
for CountryID, CountryName in pairs( self.Filter.Countries ) do
|
||||||
self:T3( { "Country:", MGroup:GetCountry(), CountryName } )
|
self:T3( { "Country:", MGroup:GetCountry(), CountryName } )
|
||||||
@@ -1947,7 +2055,7 @@ do
|
|||||||
MGroupInclude = MGroupInclude and MGroupCountry
|
MGroupInclude = MGroupInclude and MGroupCountry
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.GroupPrefixes then
|
if self.Filter.GroupPrefixes and MGroupInclude then
|
||||||
local MGroupPrefix = false
|
local MGroupPrefix = false
|
||||||
for GroupPrefixId, GroupPrefix in pairs( self.Filter.GroupPrefixes ) do
|
for GroupPrefixId, GroupPrefix in pairs( self.Filter.GroupPrefixes ) do
|
||||||
self:T3( { "Prefix:", string.find( MGroup:GetName(), GroupPrefix, 1 ), GroupPrefix } )
|
self:T3( { "Prefix:", string.find( MGroup:GetName(), GroupPrefix, 1 ), GroupPrefix } )
|
||||||
@@ -1958,7 +2066,7 @@ do
|
|||||||
MGroupInclude = MGroupInclude and MGroupPrefix
|
MGroupInclude = MGroupInclude and MGroupPrefix
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Zones then
|
if self.Filter.Zones and MGroupInclude then
|
||||||
local MGroupZone = false
|
local MGroupZone = false
|
||||||
for ZoneName, Zone in pairs( self.Filter.Zones ) do
|
for ZoneName, Zone in pairs( self.Filter.Zones ) do
|
||||||
--self:T( "Zone:", ZoneName )
|
--self:T( "Zone:", ZoneName )
|
||||||
@@ -1969,6 +2077,12 @@ do
|
|||||||
MGroupInclude = MGroupInclude and MGroupZone
|
MGroupInclude = MGroupInclude and MGroupZone
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if self.Filter.Functions and MGroupInclude then
|
||||||
|
local MGroupFunc = false
|
||||||
|
MGroupFunc = self:_EvalFilterFunctions(MGroup)
|
||||||
|
MGroupInclude = MGroupInclude and MGroupFunc
|
||||||
|
end
|
||||||
|
|
||||||
self:T2( MGroupInclude )
|
self:T2( MGroupInclude )
|
||||||
return MGroupInclude
|
return MGroupInclude
|
||||||
end
|
end
|
||||||
@@ -1976,6 +2090,7 @@ do
|
|||||||
--- Get the closest group of the set with respect to a given reference coordinate. Optionally, only groups of given coalitions are considered in the search.
|
--- Get the closest group of the set with respect to a given reference coordinate. Optionally, only groups of given coalitions are considered in the search.
|
||||||
-- @param #SET_GROUP self
|
-- @param #SET_GROUP self
|
||||||
-- @param Core.Point#COORDINATE Coordinate Reference Coordinate from which the closest group is determined.
|
-- @param Core.Point#COORDINATE Coordinate Reference Coordinate from which the closest group is determined.
|
||||||
|
-- @param #table Coalitions (Optional) Table of coalition #number entries to filter for.
|
||||||
-- @return Wrapper.Group#GROUP The closest group (if any).
|
-- @return Wrapper.Group#GROUP The closest group (if any).
|
||||||
-- @return #number Distance in meters to the closest group.
|
-- @return #number Distance in meters to the closest group.
|
||||||
function SET_GROUP:GetClosestGroup(Coordinate, Coalitions)
|
function SET_GROUP:GetClosestGroup(Coordinate, Coalitions)
|
||||||
@@ -2066,6 +2181,7 @@ do -- SET_UNIT
|
|||||||
-- Have a read through here to understand the application of regular expressions: [LUA regular expressions](https://riptutorial.com/lua/example/20315/lua-pattern-matching)
|
-- Have a read through here to understand the application of regular expressions: [LUA regular expressions](https://riptutorial.com/lua/example/20315/lua-pattern-matching)
|
||||||
-- * @{#SET_UNIT.FilterActive}: Builds the SET_UNIT with the units that are only active. Units that are inactive (late activation) won't be included in the set!
|
-- * @{#SET_UNIT.FilterActive}: Builds the SET_UNIT with the units that are only active. Units that are inactive (late activation) won't be included in the set!
|
||||||
-- * @{#SET_UNIT.FilterZones}: Builds the SET_UNIT with the units within a @{Core.Zone#ZONE}.
|
-- * @{#SET_UNIT.FilterZones}: Builds the SET_UNIT with the units within a @{Core.Zone#ZONE}.
|
||||||
|
-- * @{#SET_UNIT.FilterFunction}: Builds the SET_UNIT with a custom condition.
|
||||||
--
|
--
|
||||||
-- Once the filter criteria have been set for the SET_UNIT, you can start filtering using:
|
-- Once the filter criteria have been set for the SET_UNIT, you can start filtering using:
|
||||||
--
|
--
|
||||||
@@ -2144,6 +2260,7 @@ do -- SET_UNIT
|
|||||||
Countries = nil,
|
Countries = nil,
|
||||||
UnitPrefixes = nil,
|
UnitPrefixes = nil,
|
||||||
Zones = nil,
|
Zones = nil,
|
||||||
|
Functions = nil,
|
||||||
},
|
},
|
||||||
FilterMeta = {
|
FilterMeta = {
|
||||||
Coalitions = {
|
Coalitions = {
|
||||||
@@ -2425,6 +2542,26 @@ do -- SET_UNIT
|
|||||||
return CountU
|
return CountU
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Gets the alive set.
|
||||||
|
-- @param #SET_UNIT self
|
||||||
|
-- @return #table Table of SET objects
|
||||||
|
-- @return #SET_UNIT AliveSet
|
||||||
|
function SET_UNIT:GetAliveSet()
|
||||||
|
|
||||||
|
local AliveSet = SET_UNIT:New()
|
||||||
|
|
||||||
|
-- Clean the Set before returning with only the alive Groups.
|
||||||
|
for GroupName, GroupObject in pairs(self.Set) do
|
||||||
|
local GroupObject=GroupObject --Wrapper.Client#CLIENT
|
||||||
|
|
||||||
|
if GroupObject and GroupObject:IsAlive() then
|
||||||
|
AliveSet:Add(GroupName, GroupObject)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return AliveSet.Set or {}, AliveSet
|
||||||
|
end
|
||||||
|
|
||||||
--- [Internal] Private function for use of continous zone filter
|
--- [Internal] Private function for use of continous zone filter
|
||||||
-- @param #SET_UNIT self
|
-- @param #SET_UNIT self
|
||||||
-- @return #SET_UNIT self
|
-- @return #SET_UNIT self
|
||||||
@@ -2495,6 +2632,25 @@ do -- SET_UNIT
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- [User] Add a custom condition function.
|
||||||
|
-- @function [parent=#SET_UNIT] FilterFunction
|
||||||
|
-- @param #SET_UNIT self
|
||||||
|
-- @param #function ConditionFunction If this function returns `true`, the object is added to the SET. The function needs to take a UNIT object as first argument.
|
||||||
|
-- @param ... Condition function arguments if any.
|
||||||
|
-- @return #SET_UNIT self
|
||||||
|
-- @usage
|
||||||
|
-- -- Image you want to exclude a specific UNIT from a SET:
|
||||||
|
-- local groundset = SET_UNIT:New():FilterCoalitions("blue"):FilterCategories("ground"):FilterFunction(
|
||||||
|
-- -- The function needs to take a UNIT object as first - and in this case, only - argument.
|
||||||
|
-- function(unit)
|
||||||
|
-- local isinclude = true
|
||||||
|
-- if unit:GetName() == "Exclude Me" then isinclude = false end
|
||||||
|
-- return isinclude
|
||||||
|
-- end
|
||||||
|
-- ):FilterOnce()
|
||||||
|
-- BASE:I(groundset:Flush())
|
||||||
|
|
||||||
|
|
||||||
--- Handles the Database to check on an event (birth) that the Object was added in the Database.
|
--- Handles the Database to check on an event (birth) that the Object was added in the Database.
|
||||||
-- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event!
|
-- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event!
|
||||||
-- @param #SET_UNIT self
|
-- @param #SET_UNIT self
|
||||||
@@ -2504,7 +2660,7 @@ do -- SET_UNIT
|
|||||||
function SET_UNIT:AddInDatabase( Event )
|
function SET_UNIT:AddInDatabase( Event )
|
||||||
self:F3( { Event } )
|
self:F3( { Event } )
|
||||||
|
|
||||||
if Event.IniObjectCategory == 1 then
|
if Event.IniObjectCategory == Object.Category.UNIT then
|
||||||
if not self.Database[Event.IniDCSUnitName] then
|
if not self.Database[Event.IniDCSUnitName] then
|
||||||
self.Database[Event.IniDCSUnitName] = UNIT:Register( Event.IniDCSUnitName )
|
self.Database[Event.IniDCSUnitName] = UNIT:Register( Event.IniDCSUnitName )
|
||||||
self:T3( self.Database[Event.IniDCSUnitName] )
|
self:T3( self.Database[Event.IniDCSUnitName] )
|
||||||
@@ -2820,52 +2976,50 @@ do -- SET_UNIT
|
|||||||
-- @return Core.Point#COORDINATE The center coordinate of all the units in the set, including heading in degrees and speed in mps in case of moving units.
|
-- @return Core.Point#COORDINATE The center coordinate of all the units in the set, including heading in degrees and speed in mps in case of moving units.
|
||||||
function SET_UNIT:GetCoordinate()
|
function SET_UNIT:GetCoordinate()
|
||||||
|
|
||||||
local Coordinate = self:GetRandom():GetCoordinate()
|
local function GetSetVec3(units)
|
||||||
--self:F({Coordinate:GetVec3()})
|
-- Init.
|
||||||
|
local x=0
|
||||||
|
local y=0
|
||||||
local x1 = Coordinate.x
|
local z=0
|
||||||
local x2 = Coordinate.x
|
local n=0
|
||||||
local y1 = Coordinate.y
|
-- Loop over all units.
|
||||||
local y2 = Coordinate.y
|
for _,unit in pairs(units) do
|
||||||
local z1 = Coordinate.z
|
local vec3=nil --DCS#Vec3
|
||||||
local z2 = Coordinate.z
|
if unit and unit:IsAlive() then
|
||||||
local MaxVelocity = 0
|
vec3 = unit:GetVec3()
|
||||||
local AvgHeading = nil
|
end
|
||||||
local MovingCount = 0
|
if vec3 then
|
||||||
|
-- Sum up posits.
|
||||||
for UnitName, UnitData in pairs( self:GetSet() ) do
|
x=x+vec3.x
|
||||||
|
y=y+vec3.y
|
||||||
local Unit = UnitData -- Wrapper.Unit#UNIT
|
z=z+vec3.z
|
||||||
local Coordinate = Unit:GetCoordinate()
|
-- Increase counter.
|
||||||
|
n=n+1
|
||||||
x1 = (Coordinate.x < x1) and Coordinate.x or x1
|
end
|
||||||
x2 = (Coordinate.x > x2) and Coordinate.x or x2
|
|
||||||
y1 = (Coordinate.y < y1) and Coordinate.y or y1
|
|
||||||
y2 = (Coordinate.y > y2) and Coordinate.y or y2
|
|
||||||
z1 = (Coordinate.y < z1) and Coordinate.z or z1
|
|
||||||
z2 = (Coordinate.y > z2) and Coordinate.z or z2
|
|
||||||
|
|
||||||
local Velocity = Coordinate:GetVelocity()
|
|
||||||
if Velocity ~= 0 then
|
|
||||||
MaxVelocity = (MaxVelocity < Velocity) and Velocity or MaxVelocity
|
|
||||||
local Heading = Coordinate:GetHeading()
|
|
||||||
AvgHeading = AvgHeading and (AvgHeading + Heading) or Heading
|
|
||||||
MovingCount = MovingCount + 1
|
|
||||||
end
|
end
|
||||||
|
if n>0 then
|
||||||
|
-- Average.
|
||||||
|
local Vec3={x=x/n, y=y/n, z=z/n} --DCS#Vec3
|
||||||
|
return Vec3
|
||||||
|
end
|
||||||
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
AvgHeading = AvgHeading and (AvgHeading / MovingCount)
|
local Coordinate = nil
|
||||||
|
local Vec3 = GetSetVec3(self.Set)
|
||||||
|
if Vec3 then
|
||||||
|
Coordinate = COORDINATE:NewFromVec3(Vec3)
|
||||||
|
end
|
||||||
|
|
||||||
Coordinate.x = (x2 - x1) / 2 + x1
|
if Coordinate then
|
||||||
Coordinate.y = (y2 - y1) / 2 + y1
|
local heading = self:GetHeading() or 0
|
||||||
Coordinate.z = (z2 - z1) / 2 + z1
|
local velocity = self:GetVelocity() or 0
|
||||||
Coordinate:SetHeading( AvgHeading )
|
Coordinate:SetHeading( heading )
|
||||||
Coordinate:SetVelocity( MaxVelocity )
|
Coordinate:SetVelocity( velocity )
|
||||||
|
self:T(UTILS.PrintTableToLog(Coordinate))
|
||||||
|
end
|
||||||
|
|
||||||
self:F( { Coordinate = Coordinate } )
|
|
||||||
return Coordinate
|
return Coordinate
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the maximum velocity of the SET_UNIT.
|
--- Get the maximum velocity of the SET_UNIT.
|
||||||
@@ -3074,7 +3228,7 @@ do -- SET_UNIT
|
|||||||
MUnitInclude = MUnitInclude and MUnitActive
|
MUnitInclude = MUnitInclude and MUnitActive
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Coalitions then
|
if self.Filter.Coalitions and MUnitInclude then
|
||||||
local MUnitCoalition = false
|
local MUnitCoalition = false
|
||||||
for CoalitionID, CoalitionName in pairs( self.Filter.Coalitions ) do
|
for CoalitionID, CoalitionName in pairs( self.Filter.Coalitions ) do
|
||||||
self:F( { "Coalition:", MUnit:GetCoalition(), self.FilterMeta.Coalitions[CoalitionName], CoalitionName } )
|
self:F( { "Coalition:", MUnit:GetCoalition(), self.FilterMeta.Coalitions[CoalitionName], CoalitionName } )
|
||||||
@@ -3085,7 +3239,7 @@ do -- SET_UNIT
|
|||||||
MUnitInclude = MUnitInclude and MUnitCoalition
|
MUnitInclude = MUnitInclude and MUnitCoalition
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Categories then
|
if self.Filter.Categories and MUnitInclude then
|
||||||
local MUnitCategory = false
|
local MUnitCategory = false
|
||||||
for CategoryID, CategoryName in pairs( self.Filter.Categories ) do
|
for CategoryID, CategoryName in pairs( self.Filter.Categories ) do
|
||||||
self:T3( { "Category:", MUnit:GetDesc().category, self.FilterMeta.Categories[CategoryName], CategoryName } )
|
self:T3( { "Category:", MUnit:GetDesc().category, self.FilterMeta.Categories[CategoryName], CategoryName } )
|
||||||
@@ -3096,7 +3250,7 @@ do -- SET_UNIT
|
|||||||
MUnitInclude = MUnitInclude and MUnitCategory
|
MUnitInclude = MUnitInclude and MUnitCategory
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Types then
|
if self.Filter.Types and MUnitInclude then
|
||||||
local MUnitType = false
|
local MUnitType = false
|
||||||
for TypeID, TypeName in pairs( self.Filter.Types ) do
|
for TypeID, TypeName in pairs( self.Filter.Types ) do
|
||||||
self:T3( { "Type:", MUnit:GetTypeName(), TypeName } )
|
self:T3( { "Type:", MUnit:GetTypeName(), TypeName } )
|
||||||
@@ -3107,7 +3261,7 @@ do -- SET_UNIT
|
|||||||
MUnitInclude = MUnitInclude and MUnitType
|
MUnitInclude = MUnitInclude and MUnitType
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Countries then
|
if self.Filter.Countries and MUnitInclude then
|
||||||
local MUnitCountry = false
|
local MUnitCountry = false
|
||||||
for CountryID, CountryName in pairs( self.Filter.Countries ) do
|
for CountryID, CountryName in pairs( self.Filter.Countries ) do
|
||||||
self:T3( { "Country:", MUnit:GetCountry(), CountryName } )
|
self:T3( { "Country:", MUnit:GetCountry(), CountryName } )
|
||||||
@@ -3118,7 +3272,7 @@ do -- SET_UNIT
|
|||||||
MUnitInclude = MUnitInclude and MUnitCountry
|
MUnitInclude = MUnitInclude and MUnitCountry
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.UnitPrefixes then
|
if self.Filter.UnitPrefixes and MUnitInclude then
|
||||||
local MUnitPrefix = false
|
local MUnitPrefix = false
|
||||||
for UnitPrefixId, UnitPrefix in pairs( self.Filter.UnitPrefixes ) do
|
for UnitPrefixId, UnitPrefix in pairs( self.Filter.UnitPrefixes ) do
|
||||||
self:T3( { "Prefix:", string.find( MUnit:GetName(), UnitPrefix, 1 ), UnitPrefix } )
|
self:T3( { "Prefix:", string.find( MUnit:GetName(), UnitPrefix, 1 ), UnitPrefix } )
|
||||||
@@ -3129,7 +3283,7 @@ do -- SET_UNIT
|
|||||||
MUnitInclude = MUnitInclude and MUnitPrefix
|
MUnitInclude = MUnitInclude and MUnitPrefix
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.RadarTypes then
|
if self.Filter.RadarTypes and MUnitInclude then
|
||||||
local MUnitRadar = false
|
local MUnitRadar = false
|
||||||
for RadarTypeID, RadarType in pairs( self.Filter.RadarTypes ) do
|
for RadarTypeID, RadarType in pairs( self.Filter.RadarTypes ) do
|
||||||
self:T3( { "Radar:", RadarType } )
|
self:T3( { "Radar:", RadarType } )
|
||||||
@@ -3143,7 +3297,7 @@ do -- SET_UNIT
|
|||||||
MUnitInclude = MUnitInclude and MUnitRadar
|
MUnitInclude = MUnitInclude and MUnitRadar
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.SEAD then
|
if self.Filter.SEAD and MUnitInclude then
|
||||||
local MUnitSEAD = false
|
local MUnitSEAD = false
|
||||||
if MUnit:HasSEAD() == true then
|
if MUnit:HasSEAD() == true then
|
||||||
self:T3( "SEAD Found" )
|
self:T3( "SEAD Found" )
|
||||||
@@ -3153,7 +3307,7 @@ do -- SET_UNIT
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Zones then
|
if self.Filter.Zones and MUnitInclude then
|
||||||
local MGroupZone = false
|
local MGroupZone = false
|
||||||
for ZoneName, Zone in pairs( self.Filter.Zones ) do
|
for ZoneName, Zone in pairs( self.Filter.Zones ) do
|
||||||
self:T3( "Zone:", ZoneName )
|
self:T3( "Zone:", ZoneName )
|
||||||
@@ -3164,6 +3318,11 @@ do -- SET_UNIT
|
|||||||
MUnitInclude = MUnitInclude and MGroupZone
|
MUnitInclude = MUnitInclude and MGroupZone
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if self.Filter.Functions and MUnitInclude then
|
||||||
|
local MUnitFunc = self:_EvalFilterFunctions(MUnit)
|
||||||
|
MUnitInclude = MUnitInclude and MUnitFunc
|
||||||
|
end
|
||||||
|
|
||||||
self:T2( MUnitInclude )
|
self:T2( MUnitInclude )
|
||||||
return MUnitInclude
|
return MUnitInclude
|
||||||
end
|
end
|
||||||
@@ -3245,6 +3404,7 @@ do -- SET_STATIC
|
|||||||
-- * @{#SET_STATIC.FilterPrefixes}: Builds the SET_STATIC with the units containing the same string(s) in their name. **Attention!** LUA regular expression apply here, so special characters in names like minus, dot, hash (#) etc might lead to unexpected results.
|
-- * @{#SET_STATIC.FilterPrefixes}: Builds the SET_STATIC with the units containing the same string(s) in their name. **Attention!** LUA regular expression apply here, so special characters in names like minus, dot, hash (#) etc might lead to unexpected results.
|
||||||
-- Have a read through here to understand the application of regular expressions: [LUA regular expressions](https://riptutorial.com/lua/example/20315/lua-pattern-matching)
|
-- Have a read through here to understand the application of regular expressions: [LUA regular expressions](https://riptutorial.com/lua/example/20315/lua-pattern-matching)
|
||||||
-- * @{#SET_STATIC.FilterZones}: Builds the SET_STATIC with the units within a @{Core.Zone#ZONE}.
|
-- * @{#SET_STATIC.FilterZones}: Builds the SET_STATIC with the units within a @{Core.Zone#ZONE}.
|
||||||
|
-- * @{#SET_STATIC.FilterFunction}: Builds the SET_STATIC with a custom condition.
|
||||||
--
|
--
|
||||||
-- Once the filter criteria have been set for the SET_STATIC, you can start filtering using:
|
-- Once the filter criteria have been set for the SET_STATIC, you can start filtering using:
|
||||||
--
|
--
|
||||||
@@ -3318,7 +3478,7 @@ do -- SET_STATIC
|
|||||||
|
|
||||||
--- Add STATIC(s) to SET_STATIC.
|
--- Add STATIC(s) to SET_STATIC.
|
||||||
-- @param #SET_STATIC self
|
-- @param #SET_STATIC self
|
||||||
-- @param #string AddStatic A single STATIC.
|
-- @param Wrapper.Static#STATIC AddStatic A single STATIC.
|
||||||
-- @return #SET_STATIC self
|
-- @return #SET_STATIC self
|
||||||
function SET_STATIC:AddStatic( AddStatic )
|
function SET_STATIC:AddStatic( AddStatic )
|
||||||
self:F2( AddStatic:GetName() )
|
self:F2( AddStatic:GetName() )
|
||||||
@@ -3448,6 +3608,24 @@ do -- SET_STATIC
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- [User] Add a custom condition function.
|
||||||
|
-- @function [parent=#SET_STATIC] FilterFunction
|
||||||
|
-- @param #SET_STATIC self
|
||||||
|
-- @param #function ConditionFunction If this function returns `true`, the object is added to the SET. The function needs to take a STATIC object as first argument.
|
||||||
|
-- @param ... Condition function arguments if any.
|
||||||
|
-- @return #SET_STATIC self
|
||||||
|
-- @usage
|
||||||
|
-- -- Image you want to exclude a specific CLIENT from a SET:
|
||||||
|
-- local groundset = SET_STATIC:New():FilterCoalitions("blue"):FilterActive(true):FilterFunction(
|
||||||
|
-- -- The function needs to take a STATIC object as first - and in this case, only - argument.
|
||||||
|
-- function(static)
|
||||||
|
-- local isinclude = true
|
||||||
|
-- if static:GetName() == "Exclude Me" then isinclude = false end
|
||||||
|
-- return isinclude
|
||||||
|
-- end
|
||||||
|
-- ):FilterOnce()
|
||||||
|
-- BASE:I(groundset:Flush())
|
||||||
|
|
||||||
--- Builds a set of units of defined countries.
|
--- Builds a set of units of defined countries.
|
||||||
-- Possible current countries are those known within DCS world.
|
-- Possible current countries are those known within DCS world.
|
||||||
-- @param #SET_STATIC self
|
-- @param #SET_STATIC self
|
||||||
@@ -4004,6 +4182,7 @@ do -- SET_CLIENT
|
|||||||
-- Have a read through here to understand the application of regular expressions: [LUA regular expressions](https://riptutorial.com/lua/example/20315/lua-pattern-matching)
|
-- Have a read through here to understand the application of regular expressions: [LUA regular expressions](https://riptutorial.com/lua/example/20315/lua-pattern-matching)
|
||||||
-- * @{#SET_CLIENT.FilterActive}: Builds the SET_CLIENT with the units that are only active. Units that are inactive (late activation) won't be included in the set!
|
-- * @{#SET_CLIENT.FilterActive}: Builds the SET_CLIENT with the units that are only active. Units that are inactive (late activation) won't be included in the set!
|
||||||
-- * @{#SET_CLIENT.FilterZones}: Builds the SET_CLIENT with the clients within a @{Core.Zone#ZONE}.
|
-- * @{#SET_CLIENT.FilterZones}: Builds the SET_CLIENT with the clients within a @{Core.Zone#ZONE}.
|
||||||
|
-- * @{#SET_CLIENT.FilterFunction}: Builds the SET_CLIENT with a custom condition.
|
||||||
--
|
--
|
||||||
-- Once the filter criteria have been set for the SET_CLIENT, you can start filtering using:
|
-- Once the filter criteria have been set for the SET_CLIENT, you can start filtering using:
|
||||||
--
|
--
|
||||||
@@ -4210,8 +4389,8 @@ do -- SET_CLIENT
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Builds a set of CLIENTs that contain the given string in their unit/pilot name.
|
--- Builds a set of CLIENTs that contain the given string in their **unit/pilot** name and **NOT** the group name!
|
||||||
-- **Attention!** Bad naming convention as this **does not** filter only **prefixes** but all clients that **contain** the string.
|
-- **Attention!** Bad naming convention as this **does not** filter only **prefixes** but all clients that **contain** the string. Pattern matching applies.
|
||||||
-- @param #SET_CLIENT self
|
-- @param #SET_CLIENT self
|
||||||
-- @param #string Prefixes The string pattern(s) that needs to be contained in the unit/pilot name. Can also be passed as a `#table` of strings.
|
-- @param #string Prefixes The string pattern(s) that needs to be contained in the unit/pilot name. Can also be passed as a `#table` of strings.
|
||||||
-- @return #SET_CLIENT self
|
-- @return #SET_CLIENT self
|
||||||
@@ -4317,6 +4496,8 @@ do -- SET_CLIENT
|
|||||||
self:UnHandleEvent(EVENTS.Birth)
|
self:UnHandleEvent(EVENTS.Birth)
|
||||||
self:UnHandleEvent(EVENTS.Dead)
|
self:UnHandleEvent(EVENTS.Dead)
|
||||||
self:UnHandleEvent(EVENTS.Crash)
|
self:UnHandleEvent(EVENTS.Crash)
|
||||||
|
--self:UnHandleEvent(EVENTS.PlayerEnterUnit)
|
||||||
|
--self:UnHandleEvent(EVENTS.PlayerLeaveUnit)
|
||||||
|
|
||||||
if self.Filter.Zones and self.ZoneTimer and self.ZoneTimer:IsRunning() then
|
if self.Filter.Zones and self.ZoneTimer and self.ZoneTimer:IsRunning() then
|
||||||
self.ZoneTimer:Stop()
|
self.ZoneTimer:Stop()
|
||||||
@@ -4335,6 +4516,9 @@ do -- SET_CLIENT
|
|||||||
self:HandleEvent( EVENTS.Birth, self._EventOnBirth )
|
self:HandleEvent( EVENTS.Birth, self._EventOnBirth )
|
||||||
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.PlayerEnterUnit, self._EventPlayerEnterUnit)
|
||||||
|
--self:HandleEvent( EVENTS.PlayerLeaveUnit, self._EventPlayerLeaveUnit)
|
||||||
|
--self:SetEventPriority(1)
|
||||||
if self.Filter.Zones then
|
if self.Filter.Zones then
|
||||||
self.ZoneTimer = TIMER:New(self._ContinousZoneFilter,self)
|
self.ZoneTimer = TIMER:New(self._ContinousZoneFilter,self)
|
||||||
local timing = self.ZoneTimerInterval or 30
|
local timing = self.ZoneTimerInterval or 30
|
||||||
@@ -4346,6 +4530,43 @@ do -- SET_CLIENT
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Handle CA slots addition
|
||||||
|
-- @param #SET_CLIENT self
|
||||||
|
-- @param Core.Event#EVENTDATA Event
|
||||||
|
-- @return #SET_CLIENT self
|
||||||
|
function SET_CLIENT:_EventPlayerEnterUnit(Event)
|
||||||
|
self:I( "_EventPlayerEnterUnit" )
|
||||||
|
if Event.IniDCSUnit then
|
||||||
|
if Event.IniObjectCategory == Object.Category.UNIT and Event.IniGroup and Event.IniGroup:IsGround() then
|
||||||
|
-- CA Slot entered
|
||||||
|
local ObjectName, Object = self:AddInDatabase( Event )
|
||||||
|
self:T( ObjectName, UTILS.PrintTableToLog(Object) )
|
||||||
|
if Object and self:IsIncludeObject( Object ) then
|
||||||
|
self:Add( ObjectName, Object )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Handle CA slots removal
|
||||||
|
-- @param #SET_CLIENT self
|
||||||
|
-- @param Core.Event#EVENTDATA Event
|
||||||
|
-- @return #SET_CLIENT self
|
||||||
|
function SET_CLIENT:_EventPlayerLeaveUnit(Event)
|
||||||
|
self:I( "_EventPlayerLeaveUnit" )
|
||||||
|
if Event.IniDCSUnit then
|
||||||
|
if Event.IniObjectCategory == Object.Category.UNIT and Event.IniGroup and Event.IniGroup:IsGround() then
|
||||||
|
-- CA Slot left
|
||||||
|
local ObjectName, Object = self:FindInDatabase( Event )
|
||||||
|
if ObjectName then
|
||||||
|
self:Remove( ObjectName )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Handles the Database to check on an event (birth) that the Object was added in the Database.
|
--- Handles the Database to check on an event (birth) that the Object was added in the Database.
|
||||||
-- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event!
|
-- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event!
|
||||||
-- @param #SET_CLIENT self
|
-- @param #SET_CLIENT self
|
||||||
@@ -4464,6 +4685,25 @@ do -- SET_CLIENT
|
|||||||
return AliveSet.Set or {}
|
return AliveSet.Set or {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- [User] Add a custom condition function.
|
||||||
|
-- @function [parent=#SET_CLIENT] FilterFunction
|
||||||
|
-- @param #SET_CLIENT self
|
||||||
|
-- @param #function ConditionFunction If this function returns `true`, the object is added to the SET. The function needs to take a CLIENT object as first argument.
|
||||||
|
-- @param ... Condition function arguments if any.
|
||||||
|
-- @return #SET_CLIENT self
|
||||||
|
-- @usage
|
||||||
|
-- -- Image you want to exclude a specific CLIENT from a SET:
|
||||||
|
-- local groundset = SET_CLIENT:New():FilterCoalitions("blue"):FilterActive(true):FilterFunction(
|
||||||
|
-- -- The function needs to take a UNIT object as first - and in this case, only - argument.
|
||||||
|
-- function(client)
|
||||||
|
-- local isinclude = true
|
||||||
|
-- if client:GetPlayerName() == "Exclude Me" then isinclude = false end
|
||||||
|
-- return isinclude
|
||||||
|
-- end
|
||||||
|
-- ):FilterOnce()
|
||||||
|
-- BASE:I(groundset:Flush())
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
-- @param #SET_CLIENT self
|
-- @param #SET_CLIENT self
|
||||||
-- @param Wrapper.Client#CLIENT MClient
|
-- @param Wrapper.Client#CLIENT MClient
|
||||||
@@ -4485,7 +4725,7 @@ do -- SET_CLIENT
|
|||||||
MClientInclude = MClientInclude and MClientActive
|
MClientInclude = MClientInclude and MClientActive
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Coalitions then
|
if self.Filter.Coalitions and MClientInclude then
|
||||||
local MClientCoalition = false
|
local MClientCoalition = false
|
||||||
for CoalitionID, CoalitionName in pairs( self.Filter.Coalitions ) do
|
for CoalitionID, CoalitionName in pairs( self.Filter.Coalitions ) do
|
||||||
local ClientCoalitionID = _DATABASE:GetCoalitionFromClientTemplate( MClientName )
|
local ClientCoalitionID = _DATABASE:GetCoalitionFromClientTemplate( MClientName )
|
||||||
@@ -4498,7 +4738,7 @@ do -- SET_CLIENT
|
|||||||
MClientInclude = MClientInclude and MClientCoalition
|
MClientInclude = MClientInclude and MClientCoalition
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Categories then
|
if self.Filter.Categories and MClientInclude then
|
||||||
local MClientCategory = false
|
local MClientCategory = false
|
||||||
for CategoryID, CategoryName in pairs( self.Filter.Categories ) do
|
for CategoryID, CategoryName in pairs( self.Filter.Categories ) do
|
||||||
local ClientCategoryID = _DATABASE:GetCategoryFromClientTemplate( MClientName )
|
local ClientCategoryID = _DATABASE:GetCategoryFromClientTemplate( MClientName )
|
||||||
@@ -4511,7 +4751,7 @@ do -- SET_CLIENT
|
|||||||
MClientInclude = MClientInclude and MClientCategory
|
MClientInclude = MClientInclude and MClientCategory
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Types then
|
if self.Filter.Types and MClientInclude then
|
||||||
local MClientType = false
|
local MClientType = false
|
||||||
for TypeID, TypeName in pairs( self.Filter.Types ) do
|
for TypeID, TypeName in pairs( self.Filter.Types ) do
|
||||||
self:T3( { "Type:", MClient:GetTypeName(), TypeName } )
|
self:T3( { "Type:", MClient:GetTypeName(), TypeName } )
|
||||||
@@ -4523,7 +4763,7 @@ do -- SET_CLIENT
|
|||||||
MClientInclude = MClientInclude and MClientType
|
MClientInclude = MClientInclude and MClientType
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Countries then
|
if self.Filter.Countries and MClientInclude then
|
||||||
local MClientCountry = false
|
local MClientCountry = false
|
||||||
for CountryID, CountryName in pairs( self.Filter.Countries ) do
|
for CountryID, CountryName in pairs( self.Filter.Countries ) do
|
||||||
local ClientCountryID = _DATABASE:GetCountryFromClientTemplate( MClientName )
|
local ClientCountryID = _DATABASE:GetCountryFromClientTemplate( MClientName )
|
||||||
@@ -4536,7 +4776,7 @@ do -- SET_CLIENT
|
|||||||
MClientInclude = MClientInclude and MClientCountry
|
MClientInclude = MClientInclude and MClientCountry
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.ClientPrefixes then
|
if self.Filter.ClientPrefixes and MClientInclude then
|
||||||
local MClientPrefix = false
|
local MClientPrefix = false
|
||||||
for ClientPrefixId, ClientPrefix in pairs( self.Filter.ClientPrefixes ) do
|
for ClientPrefixId, ClientPrefix in pairs( self.Filter.ClientPrefixes ) do
|
||||||
self:T3( { "Prefix:", string.find( MClient.UnitName, ClientPrefix, 1 ), ClientPrefix } )
|
self:T3( { "Prefix:", string.find( MClient.UnitName, ClientPrefix, 1 ), ClientPrefix } )
|
||||||
@@ -4548,7 +4788,7 @@ do -- SET_CLIENT
|
|||||||
MClientInclude = MClientInclude and MClientPrefix
|
MClientInclude = MClientInclude and MClientPrefix
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Zones then
|
if self.Filter.Zones and MClientInclude then
|
||||||
local MClientZone = false
|
local MClientZone = false
|
||||||
for ZoneName, Zone in pairs( self.Filter.Zones ) do
|
for ZoneName, Zone in pairs( self.Filter.Zones ) do
|
||||||
self:T3( "Zone:", ZoneName )
|
self:T3( "Zone:", ZoneName )
|
||||||
@@ -4560,7 +4800,7 @@ do -- SET_CLIENT
|
|||||||
MClientInclude = MClientInclude and MClientZone
|
MClientInclude = MClientInclude and MClientZone
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Playernames then
|
if self.Filter.Playernames and MClientInclude then
|
||||||
local MClientPlayername = false
|
local MClientPlayername = false
|
||||||
local playername = MClient:GetPlayerName() or "Unknown"
|
local playername = MClient:GetPlayerName() or "Unknown"
|
||||||
--self:T(playername)
|
--self:T(playername)
|
||||||
@@ -4573,7 +4813,7 @@ do -- SET_CLIENT
|
|||||||
MClientInclude = MClientInclude and MClientPlayername
|
MClientInclude = MClientInclude and MClientPlayername
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Callsigns then
|
if self.Filter.Callsigns and MClientInclude then
|
||||||
local MClientCallsigns = false
|
local MClientCallsigns = false
|
||||||
local callsign = MClient:GetCallsign()
|
local callsign = MClient:GetCallsign()
|
||||||
--self:I(callsign)
|
--self:I(callsign)
|
||||||
@@ -4586,6 +4826,11 @@ do -- SET_CLIENT
|
|||||||
MClientInclude = MClientInclude and MClientCallsigns
|
MClientInclude = MClientInclude and MClientCallsigns
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if self.Filter.Functions and MClientInclude then
|
||||||
|
local MClientFunc = self:_EvalFilterFunctions(MClient)
|
||||||
|
MClientInclude = MClientInclude and MClientFunc
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
self:T2( MClientInclude )
|
self:T2( MClientInclude )
|
||||||
return MClientInclude
|
return MClientInclude
|
||||||
@@ -5179,7 +5424,7 @@ do -- SET_AIRBASE
|
|||||||
function SET_AIRBASE:GetRandomAirbase()
|
function SET_AIRBASE:GetRandomAirbase()
|
||||||
|
|
||||||
local RandomAirbase = self:GetRandom()
|
local RandomAirbase = self:GetRandom()
|
||||||
self:F( { RandomAirbase = RandomAirbase:GetName() } )
|
--self:F( { RandomAirbase = RandomAirbase:GetName() } )
|
||||||
|
|
||||||
return RandomAirbase
|
return RandomAirbase
|
||||||
end
|
end
|
||||||
@@ -5345,7 +5590,7 @@ do -- SET_AIRBASE
|
|||||||
MAirbaseInclude = MAirbaseInclude and MAirbaseCoalition
|
MAirbaseInclude = MAirbaseInclude and MAirbaseCoalition
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Categories then
|
if self.Filter.Categories and MAirbaseInclude then
|
||||||
local MAirbaseCategory = false
|
local MAirbaseCategory = false
|
||||||
for CategoryID, CategoryName in pairs( self.Filter.Categories ) do
|
for CategoryID, CategoryName in pairs( self.Filter.Categories ) do
|
||||||
local AirbaseCategoryID = _DATABASE:GetCategoryFromAirbase( MAirbaseName )
|
local AirbaseCategoryID = _DATABASE:GetCategoryFromAirbase( MAirbaseName )
|
||||||
@@ -5471,7 +5716,7 @@ do -- SET_CARGO
|
|||||||
|
|
||||||
--- (R2.1) Remove CARGOs from SET_CARGO.
|
--- (R2.1) Remove CARGOs from SET_CARGO.
|
||||||
-- @param Core.Set#SET_CARGO self
|
-- @param Core.Set#SET_CARGO self
|
||||||
-- @param Wrapper.Cargo#CARGO RemoveCargoNames A single name or an array of CARGO names.
|
-- @param Cargo.Cargo#CARGO RemoveCargoNames A single name or an array of CARGO names.
|
||||||
-- @return Core.Set#SET_CARGO self
|
-- @return Core.Set#SET_CARGO self
|
||||||
function SET_CARGO:RemoveCargosByName( RemoveCargoNames ) -- R2.1
|
function SET_CARGO:RemoveCargosByName( RemoveCargoNames ) -- R2.1
|
||||||
|
|
||||||
@@ -5487,7 +5732,7 @@ do -- SET_CARGO
|
|||||||
--- (R2.1) Finds a Cargo based on the Cargo Name.
|
--- (R2.1) Finds a Cargo based on the Cargo Name.
|
||||||
-- @param #SET_CARGO self
|
-- @param #SET_CARGO self
|
||||||
-- @param #string CargoName
|
-- @param #string CargoName
|
||||||
-- @return Wrapper.Cargo#CARGO The found Cargo.
|
-- @return Cargo.Cargo#CARGO The found Cargo.
|
||||||
function SET_CARGO:FindCargo( CargoName ) -- R2.1
|
function SET_CARGO:FindCargo( CargoName ) -- R2.1
|
||||||
|
|
||||||
local CargoFound = self.Set[CargoName]
|
local CargoFound = self.Set[CargoName]
|
||||||
@@ -5630,7 +5875,7 @@ do -- SET_CARGO
|
|||||||
--- (R2.1) Iterate the SET_CARGO while identifying the nearest @{Cargo.Cargo#CARGO} from a @{Core.Point#POINT_VEC2}.
|
--- (R2.1) Iterate the SET_CARGO while identifying the nearest @{Cargo.Cargo#CARGO} from a @{Core.Point#POINT_VEC2}.
|
||||||
-- @param #SET_CARGO self
|
-- @param #SET_CARGO self
|
||||||
-- @param Core.Point#POINT_VEC2 PointVec2 A @{Core.Point#POINT_VEC2} object from where to evaluate the closest @{Cargo.Cargo#CARGO}.
|
-- @param Core.Point#POINT_VEC2 PointVec2 A @{Core.Point#POINT_VEC2} object from where to evaluate the closest @{Cargo.Cargo#CARGO}.
|
||||||
-- @return Wrapper.Cargo#CARGO The closest @{Cargo.Cargo#CARGO}.
|
-- @return Cargo.Cargo#CARGO The closest @{Cargo.Cargo#CARGO}.
|
||||||
function SET_CARGO:FindNearestCargoFromPointVec2( PointVec2 ) -- R2.1
|
function SET_CARGO:FindNearestCargoFromPointVec2( PointVec2 ) -- R2.1
|
||||||
self:F2( PointVec2 )
|
self:F2( PointVec2 )
|
||||||
|
|
||||||
@@ -6195,7 +6440,7 @@ do -- SET_ZONE
|
|||||||
|
|
||||||
--- Start watching if the Object or Objects move into or out of our set of zones.
|
--- Start watching if the Object or Objects move into or out of our set of zones.
|
||||||
-- @param #SET_ZONE self
|
-- @param #SET_ZONE self
|
||||||
-- @param Wrappe.Controllable#CONTROLLABLE Objects Object or Objects to watch, can be of type UNIT, GROUP, CLIENT, or SET\_UNIT, SET\_GROUP, SET\_CLIENT
|
-- @param Wrapper.Controllable#CONTROLLABLE Objects Object or Objects to watch, can be of type UNIT, GROUP, CLIENT, or SET\_UNIT, SET\_GROUP, SET\_CLIENT
|
||||||
-- @return #SET_ZONE self
|
-- @return #SET_ZONE self
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Create a SET_GROUP and a SET_ZONE for this:
|
-- -- Create a SET_GROUP and a SET_ZONE for this:
|
||||||
@@ -7611,6 +7856,28 @@ do -- SET_OPSGROUP
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Handles the OnBirth event for the Set.
|
||||||
|
-- @param #SET_OPSGROUP self
|
||||||
|
-- @param Core.Event#EVENTDATA Event Event data.
|
||||||
|
function SET_OPSGROUP:_EventOnBirth( Event )
|
||||||
|
self:F3( { Event } )
|
||||||
|
|
||||||
|
if Event.IniDCSUnit and Event.IniDCSGroup then
|
||||||
|
local DCSgroup=Event.IniDCSGroup --DCS#Group
|
||||||
|
|
||||||
|
if DCSgroup:getInitialSize() == DCSgroup:getSize() then -- This seems to be not a good check as even for the first birth event, getSize returns the total number of units in the group.
|
||||||
|
|
||||||
|
local groupname, group = self:AddInDatabase( Event )
|
||||||
|
|
||||||
|
if group and group:CountAliveUnits()==DCSgroup:getInitialSize() then
|
||||||
|
if group and self:IsIncludeObject( group ) then
|
||||||
|
self:Add( groupname, group )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--- Handles the OnDead or OnCrash event for alive groups set.
|
--- Handles the OnDead or OnCrash event for alive groups set.
|
||||||
-- Note: The GROUP object in the SET_OPSGROUP collection will only be removed if the last unit is destroyed of the GROUP.
|
-- Note: The GROUP object in the SET_OPSGROUP collection will only be removed if the last unit is destroyed of the GROUP.
|
||||||
-- @param #SET_OPSGROUP self
|
-- @param #SET_OPSGROUP self
|
||||||
@@ -7631,12 +7898,12 @@ do -- SET_OPSGROUP
|
|||||||
--- Handles the Database to check on an event (birth) that the Object was added in the Database.
|
--- Handles the Database to check on an event (birth) that the Object was added in the Database.
|
||||||
-- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event!
|
-- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event!
|
||||||
-- @param #SET_OPSGROUP self
|
-- @param #SET_OPSGROUP self
|
||||||
-- @param Core.Event#EVENTDATA Event
|
-- @param Core.Event#EVENTDATA Event Event data.
|
||||||
-- @return #string The name of the GROUP
|
-- @return #string The name of the GROUP.
|
||||||
-- @return #table The GROUP
|
-- @return Wrapper.Group#GROUP The GROUP object.
|
||||||
function SET_OPSGROUP:AddInDatabase( Event )
|
function SET_OPSGROUP:AddInDatabase( Event )
|
||||||
|
|
||||||
if Event.IniObjectCategory==1 then
|
if Event.IniObjectCategory==Object.Category.UNIT then
|
||||||
|
|
||||||
if not self.Database[Event.IniDCSGroupName] then
|
if not self.Database[Event.IniDCSGroupName] then
|
||||||
self.Database[Event.IniDCSGroupName] = GROUP:Register( Event.IniDCSGroupName )
|
self.Database[Event.IniDCSGroupName] = GROUP:Register( Event.IniDCSGroupName )
|
||||||
@@ -7651,8 +7918,8 @@ do -- SET_OPSGROUP
|
|||||||
-- This is required, because sometimes the _DATABASE event gets called later than the SET_BASE event or vise versa!
|
-- This is required, because sometimes the _DATABASE event gets called later than the SET_BASE event or vise versa!
|
||||||
-- @param #SET_OPSGROUP self
|
-- @param #SET_OPSGROUP self
|
||||||
-- @param Core.Event#EVENTDATA Event Event data table.
|
-- @param Core.Event#EVENTDATA Event Event data table.
|
||||||
-- @return #string The name of the GROUP
|
-- @return #string The name of the GROUP.
|
||||||
-- @return #table The GROUP
|
-- @return Wrapper.Group#GROUP The GROUP object.
|
||||||
function SET_OPSGROUP:FindInDatabase(Event)
|
function SET_OPSGROUP:FindInDatabase(Event)
|
||||||
return Event.IniDCSGroupName, self.Database[Event.IniDCSGroupName]
|
return Event.IniDCSGroupName, self.Database[Event.IniDCSGroupName]
|
||||||
end
|
end
|
||||||
@@ -7691,7 +7958,7 @@ do -- SET_OPSGROUP
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Filter coalitions.
|
-- Filter coalitions.
|
||||||
if self.Filter.Coalitions then
|
if self.Filter.Coalitions and MGroupInclude then
|
||||||
|
|
||||||
local MGroupCoalition = false
|
local MGroupCoalition = false
|
||||||
|
|
||||||
@@ -7705,7 +7972,7 @@ do -- SET_OPSGROUP
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Filter categories.
|
-- Filter categories.
|
||||||
if self.Filter.Categories then
|
if self.Filter.Categories and MGroupInclude then
|
||||||
|
|
||||||
local MGroupCategory = false
|
local MGroupCategory = false
|
||||||
|
|
||||||
@@ -7719,7 +7986,7 @@ do -- SET_OPSGROUP
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Filter countries.
|
-- Filter countries.
|
||||||
if self.Filter.Countries then
|
if self.Filter.Countries and MGroupInclude then
|
||||||
local MGroupCountry = false
|
local MGroupCountry = false
|
||||||
for CountryID, CountryName in pairs( self.Filter.Countries ) do
|
for CountryID, CountryName in pairs( self.Filter.Countries ) do
|
||||||
if country.id[CountryName] == MGroup:GetCountry() then
|
if country.id[CountryName] == MGroup:GetCountry() then
|
||||||
@@ -7730,12 +7997,12 @@ do -- SET_OPSGROUP
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Filter "prefixes".
|
-- Filter "prefixes".
|
||||||
if self.Filter.GroupPrefixes then
|
if self.Filter.GroupPrefixes and MGroupInclude then
|
||||||
|
|
||||||
local MGroupPrefix = false
|
local MGroupPrefix = false
|
||||||
|
|
||||||
for GroupPrefixId, GroupPrefix in pairs( self.Filter.GroupPrefixes ) do
|
for GroupPrefixId, GroupPrefix in pairs( self.Filter.GroupPrefixes ) do
|
||||||
if string.find( MGroup:GetName(), GroupPrefix:gsub ("-", "%%-"), 1 ) then --Not sure why "-" is replaced by "%-" ?!
|
if string.find( MGroup:GetName(), GroupPrefix:gsub ("-", "%%-"), 1 ) then --Not sure why "-" is replaced by "%-" ?! - So we can still match group names with a dash in them
|
||||||
MGroupPrefix = true
|
MGroupPrefix = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -7971,7 +8238,7 @@ do -- SET_SCENERY
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Get a table of alive objects.
|
--- Get a table of alive objects.
|
||||||
-- @param #SET_GROUP self
|
-- @param #SET_SCENERY self
|
||||||
-- @return #table Table of alive objects
|
-- @return #table Table of alive objects
|
||||||
-- @return Core.Set#SET_SCENERY SET of alive objects
|
-- @return Core.Set#SET_SCENERY SET of alive objects
|
||||||
function SET_SCENERY:GetAliveSet()
|
function SET_SCENERY:GetAliveSet()
|
||||||
@@ -8007,7 +8274,13 @@ do -- SET_SCENERY
|
|||||||
-- @return Core.Point#COORDINATE The center coordinate of all the objects in the set.
|
-- @return Core.Point#COORDINATE The center coordinate of all the objects in the set.
|
||||||
function SET_SCENERY:GetCoordinate()
|
function SET_SCENERY:GetCoordinate()
|
||||||
|
|
||||||
local Coordinate = self:GetRandom():GetCoordinate()
|
local Coordinate = COORDINATE:New({0,0,0})
|
||||||
|
|
||||||
|
local Item = self:GetRandomSurely()
|
||||||
|
|
||||||
|
if Item then
|
||||||
|
Coordinate:GetCoordinate()
|
||||||
|
end
|
||||||
|
|
||||||
local x1 = Coordinate.x
|
local x1 = Coordinate.x
|
||||||
local x2 = Coordinate.x
|
local x2 = Coordinate.x
|
||||||
@@ -8145,7 +8418,7 @@ do -- SET_SCENERY
|
|||||||
--- Calculate current relative lifepoints of the SET objects, i.e. Life divided by Life0 as percentage value, eg 75 meaning 75% alive.
|
--- Calculate current relative lifepoints of the SET objects, i.e. Life divided by Life0 as percentage value, eg 75 meaning 75% alive.
|
||||||
-- **CAVEAT**: Some objects change their life value or "hitpoints" **after** the first hit. Hence we will adjust the Life0 value to 120%
|
-- **CAVEAT**: Some objects change their life value or "hitpoints" **after** the first hit. Hence we will adjust the Life0 value to 120%
|
||||||
-- of the last life value if life exceeds life0 ata any point.
|
-- of the last life value if life exceeds life0 ata any point.
|
||||||
-- Thus will will get a smooth percentage decrease, if you use this e.g. as success criteria for a bombing task.
|
-- Thus we will get a smooth percentage decrease, if you use this e.g. as success criteria for a bombing task.
|
||||||
-- @param #SET_SCENERY self
|
-- @param #SET_SCENERY self
|
||||||
-- @return #number LifePoints
|
-- @return #number LifePoints
|
||||||
function SET_SCENERY:GetRelativeLife()
|
function SET_SCENERY:GetRelativeLife()
|
||||||
|
|||||||
@@ -91,7 +91,7 @@
|
|||||||
--
|
--
|
||||||
-- Will customize which display format is used to indicate A2G coordinates in text as part of the Command Center communications.
|
-- Will customize which display format is used to indicate A2G coordinates in text as part of the Command Center communications.
|
||||||
--
|
--
|
||||||
-- - A2G BR: [Bearing Range](https://en.wikipedia.org/wiki/Bearing_(navigation)).
|
-- - A2G BR: [Bearing Range](https://en.wikipedia.org/wiki/Bearing_\(navigation\)).
|
||||||
-- - A2G MGRS: The [Military Grid Reference System](https://en.wikipedia.org/wiki/Military_Grid_Reference_System). The accuracy can also be adapted.
|
-- - A2G MGRS: The [Military Grid Reference System](https://en.wikipedia.org/wiki/Military_Grid_Reference_System). The accuracy can also be adapted.
|
||||||
-- - A2G LL DMS: Latitude Longitude [Degrees Minutes Seconds](https://en.wikipedia.org/wiki/Geographic_coordinate_conversion). The accuracy can also be adapted.
|
-- - A2G LL DMS: Latitude Longitude [Degrees Minutes Seconds](https://en.wikipedia.org/wiki/Geographic_coordinate_conversion). The accuracy can also be adapted.
|
||||||
-- - A2G LL DDM: Latitude Longitude [Decimal Degrees Minutes](https://en.wikipedia.org/wiki/Decimal_degrees). The accuracy can also be adapted.
|
-- - A2G LL DDM: Latitude Longitude [Decimal Degrees Minutes](https://en.wikipedia.org/wiki/Decimal_degrees). The accuracy can also be adapted.
|
||||||
@@ -105,9 +105,9 @@
|
|||||||
-- There are different methods that can be used to change the **System settings** using the \_SETTINGS object.
|
-- There are different methods that can be used to change the **System settings** using the \_SETTINGS object.
|
||||||
--
|
--
|
||||||
-- - @{#SETTINGS.SetA2G_BR}(): Enable the BR display formatting by default.
|
-- - @{#SETTINGS.SetA2G_BR}(): Enable the BR display formatting by default.
|
||||||
-- - @{#SETTINGS.SetA2G_MGRS}(): Enable the MGRS display formatting by default. Use @{SETTINGS.SetMGRS_Accuracy}() to adapt the accuracy of the MGRS formatting.
|
-- - @{#SETTINGS.SetA2G_MGRS}(): Enable the MGRS display formatting by default. Use @{#SETTINGS.SetMGRS_Accuracy}() to adapt the accuracy of the MGRS formatting.
|
||||||
-- - @{#SETTINGS.SetA2G_LL_DMS}(): Enable the LL DMS display formatting by default. Use @{SETTINGS.SetLL_Accuracy}() to adapt the accuracy of the Seconds formatting.
|
-- - @{#SETTINGS.SetA2G_LL_DMS}(): Enable the LL DMS display formatting by default. Use @{#SETTINGS.SetLL_Accuracy}() to adapt the accuracy of the Seconds formatting.
|
||||||
-- - @{#SETTINGS.SetA2G_LL_DDM}(): Enable the LL DDM display formatting by default. Use @{SETTINGS.SetLL_Accuracy}() to adapt the accuracy of the Seconds formatting.
|
-- - @{#SETTINGS.SetA2G_LL_DDM}(): Enable the LL DDM display formatting by default. Use @{#SETTINGS.SetLL_Accuracy}() to adapt the accuracy of the Seconds formatting.
|
||||||
--
|
--
|
||||||
-- ### 3.1.4) A2G coordinates setting - additional notes
|
-- ### 3.1.4) A2G coordinates setting - additional notes
|
||||||
--
|
--
|
||||||
@@ -120,7 +120,7 @@
|
|||||||
--
|
--
|
||||||
-- Will customize which display format is used to indicate A2A coordinates in text as part of the Command Center communications.
|
-- Will customize which display format is used to indicate A2A coordinates in text as part of the Command Center communications.
|
||||||
--
|
--
|
||||||
-- - A2A BRAA: [Bearing Range Altitude Aspect](https://en.wikipedia.org/wiki/Bearing_(navigation)).
|
-- - A2A BRAA: [Bearing Range Altitude Aspect](https://en.wikipedia.org/wiki/Bearing_\(navigation\)).
|
||||||
-- - A2A MGRS: The [Military Grid Reference System](https://en.wikipedia.org/wiki/Military_Grid_Reference_System). The accuracy can also be adapted.
|
-- - A2A MGRS: The [Military Grid Reference System](https://en.wikipedia.org/wiki/Military_Grid_Reference_System). The accuracy can also be adapted.
|
||||||
-- - A2A LL DMS: Lattitude Longitude [Degrees Minutes Seconds](https://en.wikipedia.org/wiki/Geographic_coordinate_conversion). The accuracy can also be adapted.
|
-- - A2A LL DMS: Lattitude Longitude [Degrees Minutes Seconds](https://en.wikipedia.org/wiki/Geographic_coordinate_conversion). The accuracy can also be adapted.
|
||||||
-- - A2A LL DDM: Lattitude Longitude [Decimal Degrees and Minutes](https://en.wikipedia.org/wiki/Decimal_degrees). The accuracy can also be adapted.
|
-- - A2A LL DDM: Lattitude Longitude [Decimal Degrees and Minutes](https://en.wikipedia.org/wiki/Decimal_degrees). The accuracy can also be adapted.
|
||||||
@@ -135,9 +135,9 @@
|
|||||||
-- There are different methods that can be used to change the **System settings** using the \_SETTINGS object.
|
-- There are different methods that can be used to change the **System settings** using the \_SETTINGS object.
|
||||||
--
|
--
|
||||||
-- - @{#SETTINGS.SetA2A_BRAA}(): Enable the BR display formatting by default.
|
-- - @{#SETTINGS.SetA2A_BRAA}(): Enable the BR display formatting by default.
|
||||||
-- - @{#SETTINGS.SetA2A_MGRS}(): Enable the MGRS display formatting by default. Use @{SETTINGS.SetMGRS_Accuracy}() to adapt the accuracy of the MGRS formatting.
|
-- - @{#SETTINGS.SetA2A_MGRS}(): Enable the MGRS display formatting by default. Use @{#SETTINGS.SetMGRS_Accuracy}() to adapt the accuracy of the MGRS formatting.
|
||||||
-- - @{#SETTINGS.SetA2A_LL_DMS}(): Enable the LL DMS display formatting by default. Use @{SETTINGS.SetLL_Accuracy}() to adapt the accuracy of the Seconds formatting.
|
-- - @{#SETTINGS.SetA2A_LL_DMS}(): Enable the LL DMS display formatting by default. Use @{#SETTINGS.SetLL_Accuracy}() to adapt the accuracy of the Seconds formatting.
|
||||||
-- - @{#SETTINGS.SetA2A_LL_DDM}(): Enable the LL DDM display formatting by default. Use @{SETTINGS.SetLL_Accuracy}() to adapt the accuracy of the Seconds formatting.
|
-- - @{#SETTINGS.SetA2A_LL_DDM}(): Enable the LL DDM display formatting by default. Use @{#SETTINGS.SetLL_Accuracy}() to adapt the accuracy of the Seconds formatting.
|
||||||
-- - @{#SETTINGS.SetA2A_BULLS}(): Enable the BULLSeye display formatting by default.
|
-- - @{#SETTINGS.SetA2A_BULLS}(): Enable the BULLSeye display formatting by default.
|
||||||
--
|
--
|
||||||
-- ### 3.2.4) A2A coordinates settings - additional notes
|
-- ### 3.2.4) A2A coordinates settings - additional notes
|
||||||
@@ -190,8 +190,8 @@
|
|||||||
--
|
--
|
||||||
-- There are different methods that can be used to change the **System settings** using the \_SETTINGS object.
|
-- There are different methods that can be used to change the **System settings** using the \_SETTINGS object.
|
||||||
--
|
--
|
||||||
-- - @{#SETTINGS.SetMessageTime}(): Define for a specific @{Message.MESSAGE.MessageType} the duration to be displayed in seconds.
|
-- - @{#SETTINGS.SetMessageTime}(): Define for a specific @{Core.Message#MESSAGE.MessageType} the duration to be displayed in seconds.
|
||||||
-- - @{#SETTINGS.GetMessageTime}(): Retrieves for a specific @{Message.MESSAGE.MessageType} the duration to be displayed in seconds.
|
-- - @{#SETTINGS.GetMessageTime}(): Retrieves for a specific @{Core.Message#MESSAGE.MessageType} the duration to be displayed in seconds.
|
||||||
--
|
--
|
||||||
-- ## 3.5) **Era** of the battle
|
-- ## 3.5) **Era** of the battle
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SPA%20-%20Spawning)
|
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Core/Spawn)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
-- @field #SPAWN.SpawnZoneTable SpawnZoneTable
|
-- @field #SPAWN.SpawnZoneTable SpawnZoneTable
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
--- Allows to spawn dynamically new @{Core.Group}s.
|
--- Allows to spawn dynamically new @{Wrapper.Group}s.
|
||||||
--
|
--
|
||||||
-- Each SPAWN object needs to be have related **template groups** setup in the Mission Editor (ME),
|
-- Each SPAWN object needs to be have related **template groups** setup in the Mission Editor (ME),
|
||||||
-- which is a normal group with the **Late Activation** flag set.
|
-- which is a normal group with the **Late Activation** flag set.
|
||||||
@@ -200,6 +200,22 @@
|
|||||||
-- * @{#SPAWN.InitRepeat}() or @{#SPAWN.InitRepeatOnLanding}(): This method is used to re-spawn automatically the same group after it has landed.
|
-- * @{#SPAWN.InitRepeat}() or @{#SPAWN.InitRepeatOnLanding}(): This method is used to re-spawn automatically the same group after it has landed.
|
||||||
-- * @{#SPAWN.InitRepeatOnEngineShutDown}(): This method is used to re-spawn automatically the same group after it has landed and it shuts down the engines at the ramp.
|
-- * @{#SPAWN.InitRepeatOnEngineShutDown}(): This method is used to re-spawn automatically the same group after it has landed and it shuts down the engines at the ramp.
|
||||||
--
|
--
|
||||||
|
-- ### Link-16 Datalink STN and SADL IDs (limited at the moment to F15/16/18/AWACS/Tanker/B1B, but not the F15E for clients, SADL A10CII only)
|
||||||
|
--
|
||||||
|
-- * @{#SPAWN.InitSTN}(): Set the STN of the first unit in the group. All other units will have consecutive STNs, provided they have not been used yet.
|
||||||
|
-- * @{#SPAWN.InitSADL}(): Set the SADL of the first unit in the group. All other units will have consecutive SADLs, provided they have not been used yet.
|
||||||
|
--
|
||||||
|
-- ### Callsigns
|
||||||
|
--
|
||||||
|
-- * @{#SPAWN.InitRandomizeCallsign}(): Set a random callsign name per spawn.
|
||||||
|
-- * @{#SPAWN.SpawnInitCallSign}(): Set a specific callsign for a spawned group.
|
||||||
|
--
|
||||||
|
-- ### Speed
|
||||||
|
--
|
||||||
|
-- * @{#SPAWN.InitSpeedMps}(): Set the initial speed on spawning in meters per second.
|
||||||
|
-- * @{#SPAWN.InitSpeedKph}(): Set the initial speed on spawning in kilometers per hour.
|
||||||
|
-- * @{#SPAWN.InitSpeedKnots}(): Set the initial speed on spawning in knots.
|
||||||
|
--
|
||||||
-- ## SPAWN **Spawn** methods
|
-- ## SPAWN **Spawn** methods
|
||||||
--
|
--
|
||||||
-- Groups can be spawned at different times and methods:
|
-- Groups can be spawned at different times and methods:
|
||||||
@@ -276,9 +292,10 @@ SPAWN = {
|
|||||||
|
|
||||||
--- Enumerator for spawns at airbases
|
--- Enumerator for spawns at airbases
|
||||||
-- @type SPAWN.Takeoff
|
-- @type SPAWN.Takeoff
|
||||||
-- @extends Wrapper.Group#GROUP.Takeoff
|
-- @field #number Air Take off happens in air.
|
||||||
|
-- @field #number Runway Spawn on runway. Does not work in MP!
|
||||||
-- @field #SPAWN.Takeoff Takeoff
|
-- @field #number Hot Spawn at parking with engines on.
|
||||||
|
-- @field #number Cold Spawn at parking with engines off.
|
||||||
SPAWN.Takeoff = {
|
SPAWN.Takeoff = {
|
||||||
Air = 1,
|
Air = 1,
|
||||||
Runway = 2,
|
Runway = 2,
|
||||||
@@ -320,7 +337,7 @@ function SPAWN:New( SpawnTemplatePrefix )
|
|||||||
self.AIOnOff = true -- The AI is on by default when spawning a group.
|
self.AIOnOff = true -- The AI is on by default when spawning a group.
|
||||||
self.SpawnUnControlled = false
|
self.SpawnUnControlled = false
|
||||||
self.SpawnInitKeepUnitNames = false -- Overwrite unit names by default with group name.
|
self.SpawnInitKeepUnitNames = false -- Overwrite unit names by default with group name.
|
||||||
self.DelayOnOff = false -- No intial delay when spawning the first group.
|
self.DelayOnOff = false -- No initial delay when spawning the first group.
|
||||||
self.SpawnGrouping = nil -- No grouping.
|
self.SpawnGrouping = nil -- No grouping.
|
||||||
self.SpawnInitLivery = nil -- No special livery.
|
self.SpawnInitLivery = nil -- No special livery.
|
||||||
self.SpawnInitSkill = nil -- No special skill.
|
self.SpawnInitSkill = nil -- No special skill.
|
||||||
@@ -332,6 +349,7 @@ function SPAWN:New( SpawnTemplatePrefix )
|
|||||||
self.SpawnInitModexPostfix = nil
|
self.SpawnInitModexPostfix = nil
|
||||||
self.SpawnInitAirbase = nil
|
self.SpawnInitAirbase = nil
|
||||||
self.TweakedTemplate = false -- Check if the user is using self made template.
|
self.TweakedTemplate = false -- Check if the user is using self made template.
|
||||||
|
self.SpawnRandomCallsign = false
|
||||||
|
|
||||||
self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned.
|
self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned.
|
||||||
else
|
else
|
||||||
@@ -519,7 +537,7 @@ function SPAWN:NewFromTemplate( SpawnTemplate, SpawnTemplatePrefix, SpawnAliasPr
|
|||||||
end
|
end
|
||||||
|
|
||||||
if SpawnTemplate then
|
if SpawnTemplate then
|
||||||
self.SpawnTemplate = SpawnTemplate -- Contains the template structure for a Group Spawn from the Mission Editor. Note that this group must have lateActivation always on!!!
|
self.SpawnTemplate = UTILS.DeepCopy(SpawnTemplate) -- Contains the template structure for a Group Spawn from the Mission Editor. Note that this group must have lateActivation always on!!!
|
||||||
self.SpawnTemplatePrefix = SpawnTemplatePrefix
|
self.SpawnTemplatePrefix = SpawnTemplatePrefix
|
||||||
self.SpawnAliasPrefix = SpawnAliasPrefix or SpawnTemplatePrefix
|
self.SpawnAliasPrefix = SpawnAliasPrefix or SpawnTemplatePrefix
|
||||||
self.SpawnTemplate.name = SpawnTemplatePrefix
|
self.SpawnTemplate.name = SpawnTemplatePrefix
|
||||||
@@ -602,12 +620,14 @@ end
|
|||||||
-- and any spaces before and after the resulting name are removed.
|
-- and any spaces before and after the resulting name are removed.
|
||||||
-- IMPORTANT! This method MUST be the first used after :New !!!
|
-- IMPORTANT! This method MUST be the first used after :New !!!
|
||||||
-- @param #SPAWN self
|
-- @param #SPAWN self
|
||||||
-- @param #boolean KeepUnitNames (optional) If true, the unit names are kept, false or not provided to make new unit names.
|
-- @param #boolean KeepUnitNames (optional) If true, the unit names are kept, false or not provided create new unit names.
|
||||||
-- @return #SPAWN self
|
-- @return #SPAWN self
|
||||||
function SPAWN:InitKeepUnitNames( KeepUnitNames )
|
function SPAWN:InitKeepUnitNames( KeepUnitNames )
|
||||||
self:F()
|
self:F()
|
||||||
|
|
||||||
self.SpawnInitKeepUnitNames = KeepUnitNames or true
|
self.SpawnInitKeepUnitNames = false
|
||||||
|
|
||||||
|
if KeepUnitNames == true then self.SpawnInitKeepUnitNames = true end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -723,7 +743,7 @@ end
|
|||||||
-- @param #number Country Country id as number or enumerator:
|
-- @param #number Country Country id as number or enumerator:
|
||||||
--
|
--
|
||||||
-- * @{DCS#country.id.RUSSIA}
|
-- * @{DCS#country.id.RUSSIA}
|
||||||
-- * @{DCS#county.id.USA}
|
-- * @{DCS#country.id.USA}
|
||||||
--
|
--
|
||||||
-- @return #SPAWN self
|
-- @return #SPAWN self
|
||||||
function SPAWN:InitCountry( Country )
|
function SPAWN:InitCountry( Country )
|
||||||
@@ -779,6 +799,82 @@ function SPAWN:InitSkill( Skill )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- [Airplane - F15/16/18/AWACS/B1B/Tanker only] Set the STN Link16 starting number of the Group; each unit of the spawned group will have a consecutive STN set.
|
||||||
|
-- @param #SPAWN self
|
||||||
|
-- @param #number Octal The octal number (digits 1..7, max 5 digits, i.e. 1..77777) to set the STN to. Every STN needs to be unique!
|
||||||
|
-- @return #SPAWN self
|
||||||
|
function SPAWN:InitSTN(Octal)
|
||||||
|
self:F( { Octal = Octal } )
|
||||||
|
self.SpawnInitSTN = Octal or 77777
|
||||||
|
local num = UTILS.OctalToDecimal(Octal)
|
||||||
|
if num == nil or num < 1 then
|
||||||
|
self:E("WARNING - STN "..tostring(Octal).." is not valid!")
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
if _DATABASE.STNS[num] ~= nil then
|
||||||
|
self:E("WARNING - STN already assigned: "..tostring(Octal).." is used for ".._DATABASE.STNS[Octal])
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [Airplane - A10-C II only] Set the SADL TN starting number of the Group; each unit of the spawned group will have a consecutive SADL set.
|
||||||
|
-- @param #SPAWN self
|
||||||
|
-- @param #number Octal The octal number (digits 1..7, max 4 digits, i.e. 1..7777) to set the SADL to. Every SADL needs to be unique!
|
||||||
|
-- @return #SPAWN self
|
||||||
|
function SPAWN:InitSADL(Octal)
|
||||||
|
self:F( { Octal = Octal } )
|
||||||
|
self.SpawnInitSADL = Octal or 7777
|
||||||
|
local num = UTILS.OctalToDecimal(Octal)
|
||||||
|
if num == nil or num < 1 then
|
||||||
|
self:E("WARNING - SADL "..tostring(Octal).." is not valid!")
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
if _DATABASE.SADL[num] ~= nil then
|
||||||
|
self:E("WARNING - SADL already assigned: "..tostring(Octal).." is used for ".._DATABASE.SADL[Octal])
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [Airplane] Set the initial speed on spawning in meters per second. Useful when spawning in-air only.
|
||||||
|
-- @param #SPAWN self
|
||||||
|
-- @param #number MPS The speed in MPS to use.
|
||||||
|
-- @return #SPAWN self
|
||||||
|
function SPAWN:InitSpeedMps(MPS)
|
||||||
|
self:F( { MPS = MPS } )
|
||||||
|
if MPS == nil or tonumber(MPS)<0 then
|
||||||
|
MPS=125
|
||||||
|
end
|
||||||
|
self.InitSpeed = MPS
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [Airplane] Set the initial speed on spawning in knots. Useful when spawning in-air only.
|
||||||
|
-- @param #SPAWN self
|
||||||
|
-- @param #number Knots The speed in knots to use.
|
||||||
|
-- @return #SPAWN self
|
||||||
|
function SPAWN:InitSpeedKnots(Knots)
|
||||||
|
self:F( { Knots = Knots } )
|
||||||
|
if Knots == nil or tonumber(Knots)<0 then
|
||||||
|
Knots=300
|
||||||
|
end
|
||||||
|
self.InitSpeed = UTILS.KnotsToMps(Knots)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [Airplane] Set the initial speed on spawning in kilometers per hour. Useful when spawning in-air only.
|
||||||
|
-- @param #SPAWN self
|
||||||
|
-- @param #number KPH The speed in KPH to use.
|
||||||
|
-- @return #SPAWN self
|
||||||
|
function SPAWN:InitSpeedKph(KPH)
|
||||||
|
self:F( { KPH = KPH } )
|
||||||
|
if KPH == nil or tonumber(KPH)<0 then
|
||||||
|
KPH=UTILS.KnotsToKmph(300)
|
||||||
|
end
|
||||||
|
self.InitSpeed = UTILS.KmphToMps(KPH)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Sets the radio communication on or off. Same as checking/unchecking the COMM box in the mission editor.
|
--- Sets the radio communication on or off. Same as checking/unchecking the COMM box in the mission editor.
|
||||||
-- @param #SPAWN self
|
-- @param #SPAWN self
|
||||||
-- @param #number switch If true (or nil), enables the radio communication. If false, disables the radio for the spawned group.
|
-- @param #number switch If true (or nil), enables the radio communication. If false, disables the radio for the spawned group.
|
||||||
@@ -1099,6 +1195,31 @@ function SPAWN:InitRandomizeZones( SpawnZoneTable )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- [AIR/Fighter only!] This method randomizes the callsign for a new group.
|
||||||
|
-- @param #SPAWN self
|
||||||
|
-- @return #SPAWN self
|
||||||
|
function SPAWN:InitRandomizeCallsign()
|
||||||
|
self.SpawnRandomCallsign = true
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [BLUE AIR only!] This method sets a specific callsign for a spawned group. Use for a group with one unit only!
|
||||||
|
-- @param #SPAWN self
|
||||||
|
-- @param #number ID ID of the callsign enumerator, e.g. CALLSIGN.Tanker.Texaco - - resulting in e.g. Texaco-2-1
|
||||||
|
-- @param #string Name Name of this callsign as it cannot be determined from the ID because of the dependency on the task type of the plane, and the plane type. E.g. "Texaco"
|
||||||
|
-- @param #number Minor Minor number, i.e. the unit number within the group, e.g 2 - resulting in e.g. Texaco-2-1
|
||||||
|
-- @param #number Major Major number, i.e. the group number of this name, e.g. 1 - resulting in e.g. Texaco-2-1
|
||||||
|
-- @return #SPAWN self
|
||||||
|
function SPAWN:InitCallSign(ID,Name,Minor,Major)
|
||||||
|
local Name = Name or "Enfield"
|
||||||
|
self.SpawnInitCallSign = true
|
||||||
|
self.SpawnInitCallSignID = ID or 1
|
||||||
|
self.SpawnInitCallSignMinor = Minor or 1
|
||||||
|
self.SpawnInitCallSignMajor = Major or 1
|
||||||
|
self.SpawnInitCallSignName=string.lower(Name):gsub("^%l", string.upper)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- This method sets a spawn position for the group that is different from the location of the template.
|
--- This method sets a spawn position for the group that is different from the location of the template.
|
||||||
-- @param #SPAWN self
|
-- @param #SPAWN self
|
||||||
-- @param Core.Point#COORDINATE Coordinate The position to spawn from
|
-- @param Core.Point#COORDINATE Coordinate The position to spawn from
|
||||||
@@ -1331,7 +1452,7 @@ do -- Delay methods
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Turns the Delay On for the @{Wrapper.Group} when spawning with @{SpawnScheduled}(). In effect then the 1st group will only be spawned
|
--- Turns the Delay On for the @{Wrapper.Group} when spawning with @{#SpawnScheduled}(). In effect then the 1st group will only be spawned
|
||||||
-- after the number of seconds given in SpawnScheduled as arguments, and not immediately.
|
-- after the number of seconds given in SpawnScheduled as arguments, and not immediately.
|
||||||
-- @param #SPAWN self
|
-- @param #SPAWN self
|
||||||
-- @return #SPAWN The SPAWN object
|
-- @return #SPAWN The SPAWN object
|
||||||
@@ -1350,6 +1471,30 @@ do -- Delay methods
|
|||||||
|
|
||||||
end -- Delay methods
|
end -- Delay methods
|
||||||
|
|
||||||
|
--- Hide the group on the map view (visible to game master slots!).
|
||||||
|
-- @param #SPAWN self
|
||||||
|
-- @return #SPAWN The SPAWN object
|
||||||
|
function SPAWN:InitHiddenOnMap()
|
||||||
|
self.SpawnHiddenOnMap = true
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Hide the group on MFDs (visible to game master slots!).
|
||||||
|
-- @param #SPAWN self
|
||||||
|
-- @return #SPAWN The SPAWN object
|
||||||
|
function SPAWN:InitHiddenOnMFD()
|
||||||
|
self.SpawnHiddenOnMFD = true
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Hide the group on planner (visible to game master slots!).
|
||||||
|
-- @param #SPAWN self
|
||||||
|
-- @return #SPAWN The SPAWN object
|
||||||
|
function SPAWN:InitHiddenOnPlanner()
|
||||||
|
self.SpawnHiddenOnPlanner = true
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Will spawn a group based on the internal index.
|
--- Will spawn a group based on the internal index.
|
||||||
-- Note: This method uses the global _DATABASE object (an instance of @{Core.Database#DATABASE}), which contains ALL initial and new spawned objects in MOOSE.
|
-- Note: This method uses the global _DATABASE object (an instance of @{Core.Database#DATABASE}), which contains ALL initial and new spawned objects in MOOSE.
|
||||||
-- @param #SPAWN self
|
-- @param #SPAWN self
|
||||||
@@ -1433,6 +1578,7 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
|
|||||||
else
|
else
|
||||||
|
|
||||||
local SpawnTemplate = self.SpawnGroups[self.SpawnIndex].SpawnTemplate
|
local SpawnTemplate = self.SpawnGroups[self.SpawnIndex].SpawnTemplate
|
||||||
|
local SpawnZone = self.SpawnGroups[self.SpawnIndex].SpawnZone
|
||||||
self:T( SpawnTemplate.name )
|
self:T( SpawnTemplate.name )
|
||||||
|
|
||||||
if SpawnTemplate then
|
if SpawnTemplate then
|
||||||
@@ -1458,6 +1604,23 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
|
|||||||
if self.SpawnRandomizeUnits then
|
if self.SpawnRandomizeUnits then
|
||||||
for UnitID = 1, #SpawnTemplate.units do
|
for UnitID = 1, #SpawnTemplate.units do
|
||||||
local RandomVec2 = PointVec3:GetRandomVec2InRadius( self.SpawnOuterRadius, self.SpawnInnerRadius )
|
local RandomVec2 = PointVec3:GetRandomVec2InRadius( self.SpawnOuterRadius, self.SpawnInnerRadius )
|
||||||
|
if (SpawnZone) then
|
||||||
|
local inZone = SpawnZone:IsVec2InZone(RandomVec2)
|
||||||
|
local numTries = 1
|
||||||
|
while (not inZone) and (numTries < 20) do
|
||||||
|
if not inZone then
|
||||||
|
RandomVec2 = PointVec3:GetRandomVec2InRadius( self.SpawnOuterRadius, self.SpawnInnerRadius )
|
||||||
|
numTries = numTries + 1
|
||||||
|
inZone = SpawnZone:IsVec2InZone(RandomVec2)
|
||||||
|
--self:I("Retrying " .. numTries .. "spawn " .. SpawnTemplate.name .. " in Zone " .. SpawnZone:GetName() .. "!")
|
||||||
|
--self:I(SpawnZone)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if (not inZone) then
|
||||||
|
self:I("Could not place unit within zone and within radius!")
|
||||||
|
RandomVec2 = SpawnZone:GetRandomVec2()
|
||||||
|
end
|
||||||
|
end
|
||||||
SpawnTemplate.units[UnitID].x = RandomVec2.x
|
SpawnTemplate.units[UnitID].x = RandomVec2.x
|
||||||
SpawnTemplate.units[UnitID].y = RandomVec2.y
|
SpawnTemplate.units[UnitID].y = RandomVec2.y
|
||||||
self:T( 'SpawnTemplate.units[' .. UnitID .. '].x = ' .. SpawnTemplate.units[UnitID].x .. ', SpawnTemplate.units[' .. UnitID .. '].y = ' .. SpawnTemplate.units[UnitID].y )
|
self:T( 'SpawnTemplate.units[' .. UnitID .. '].x = ' .. SpawnTemplate.units[UnitID].x .. ', SpawnTemplate.units[' .. UnitID .. '].y = ' .. SpawnTemplate.units[UnitID].y )
|
||||||
@@ -1509,12 +1672,14 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
|
|||||||
|
|
||||||
for UnitID = 1, #SpawnTemplate.units do
|
for UnitID = 1, #SpawnTemplate.units do
|
||||||
|
|
||||||
if UnitID > 1 then -- don't rotate position of unit #1
|
if not self.SpawnRandomizeUnits then
|
||||||
local unitXOff = SpawnTemplate.units[UnitID].x - pivotX -- rotate position offset around unit #1
|
if UnitID > 1 then -- don't rotate position of unit #1
|
||||||
local unitYOff = SpawnTemplate.units[UnitID].y - pivotY
|
local unitXOff = SpawnTemplate.units[UnitID].x - pivotX -- rotate position offset around unit #1
|
||||||
|
local unitYOff = SpawnTemplate.units[UnitID].y - pivotY
|
||||||
|
|
||||||
SpawnTemplate.units[UnitID].x = pivotX + (unitXOff * cosHeading) - (unitYOff * sinHeading)
|
SpawnTemplate.units[UnitID].x = pivotX + (unitXOff * cosHeading) - (unitYOff * sinHeading)
|
||||||
SpawnTemplate.units[UnitID].y = pivotY + (unitYOff * cosHeading) + (unitXOff * sinHeading)
|
SpawnTemplate.units[UnitID].y = pivotY + (unitYOff * cosHeading) + (unitXOff * sinHeading)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- adjust heading of all units, including unit #1
|
-- adjust heading of all units, including unit #1
|
||||||
@@ -1604,6 +1769,19 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
|
|||||||
SpawnTemplate.modulation = self.SpawnInitModu
|
SpawnTemplate.modulation = self.SpawnInitModu
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- hiding options
|
||||||
|
if self.SpawnHiddenOnPlanner then
|
||||||
|
SpawnTemplate.hiddenOnPlanner=true
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.SpawnHiddenOnMFD then
|
||||||
|
SpawnTemplate.hiddenOnMFD=true
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.SpawnHiddenOnMap then
|
||||||
|
SpawnTemplate.hidden=true
|
||||||
|
end
|
||||||
|
|
||||||
-- Set country, coalition and category.
|
-- Set country, coalition and category.
|
||||||
SpawnTemplate.CategoryID = self.SpawnInitCategory or SpawnTemplate.CategoryID
|
SpawnTemplate.CategoryID = self.SpawnInitCategory or SpawnTemplate.CategoryID
|
||||||
SpawnTemplate.CountryID = self.SpawnInitCountry or SpawnTemplate.CountryID
|
SpawnTemplate.CountryID = self.SpawnInitCountry or SpawnTemplate.CountryID
|
||||||
@@ -1644,8 +1822,8 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
|
|||||||
|
|
||||||
-- If there is a SpawnFunction hook defined, call it.
|
-- If there is a SpawnFunction hook defined, call it.
|
||||||
if self.SpawnFunctionHook then
|
if self.SpawnFunctionHook then
|
||||||
-- delay calling this for .1 seconds so that it hopefully comes after the BIRTH event of the group.
|
-- delay calling this for .3 seconds so that it hopefully comes after the BIRTH event of the group.
|
||||||
self.SpawnHookScheduler:Schedule( nil, self.SpawnFunctionHook, { self.SpawnGroups[self.SpawnIndex].Group, unpack( self.SpawnFunctionArguments ) }, 0.1 )
|
self.SpawnHookScheduler:Schedule( nil, self.SpawnFunctionHook, { self.SpawnGroups[self.SpawnIndex].Group, unpack( self.SpawnFunctionArguments ) }, 0.3 )
|
||||||
end
|
end
|
||||||
-- TODO: Need to fix this by putting an "R" in the name of the group when the group repeats.
|
-- TODO: Need to fix this by putting an "R" in the name of the group when the group repeats.
|
||||||
-- if self.Repeat then
|
-- if self.Repeat then
|
||||||
@@ -1654,6 +1832,7 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
|
|||||||
end
|
end
|
||||||
|
|
||||||
self.SpawnGroups[self.SpawnIndex].Spawned = true
|
self.SpawnGroups[self.SpawnIndex].Spawned = true
|
||||||
|
self.SpawnGroups[self.SpawnIndex].Group.TemplateDonor = self.SpawnTemplatePrefix
|
||||||
return self.SpawnGroups[self.SpawnIndex].Group
|
return self.SpawnGroups[self.SpawnIndex].Group
|
||||||
else
|
else
|
||||||
-- self:E( { self.SpawnTemplatePrefix, "No more Groups to Spawn:", SpawnIndex, self.SpawnMaxGroups } )
|
-- self:E( { self.SpawnTemplatePrefix, "No more Groups to Spawn:", SpawnIndex, self.SpawnMaxGroups } )
|
||||||
@@ -1669,7 +1848,7 @@ end
|
|||||||
-- @param #number SpawnTimeVariation The variation to be applied on the defined time interval between each new spawn.
|
-- @param #number SpawnTimeVariation The variation to be applied on the defined time interval between each new spawn.
|
||||||
-- The variation is a number between 0 and 1, representing the % of variation to be applied on the time interval.
|
-- The variation is a number between 0 and 1, representing the % of variation to be applied on the time interval.
|
||||||
-- @param #boolean WithDelay Do not spawn the **first** group immediately, but delay the spawn as per the calculation below.
|
-- @param #boolean WithDelay Do not spawn the **first** group immediately, but delay the spawn as per the calculation below.
|
||||||
-- Effectively the same as @{InitDelayOn}().
|
-- Effectively the same as @{#InitDelayOn}().
|
||||||
-- @return #SPAWN self
|
-- @return #SPAWN self
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- NATO helicopters engaging in the battle field.
|
-- -- NATO helicopters engaging in the battle field.
|
||||||
@@ -3100,7 +3279,7 @@ end
|
|||||||
--- Get the index from a given group.
|
--- Get the index from a given group.
|
||||||
-- The function will search the name of the group for a #, and will return the number behind the #-mark.
|
-- The function will search the name of the group for a #, and will return the number behind the #-mark.
|
||||||
function SPAWN:GetSpawnIndexFromGroup( SpawnGroup )
|
function SPAWN:GetSpawnIndexFromGroup( SpawnGroup )
|
||||||
self:F2( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, SpawnGroup } )
|
self:F3( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, SpawnGroup } )
|
||||||
|
|
||||||
local IndexString = string.match( SpawnGroup:GetName(), "#(%d*)$" ):sub( 2 )
|
local IndexString = string.match( SpawnGroup:GetName(), "#(%d*)$" ):sub( 2 )
|
||||||
local Index = tonumber( IndexString )
|
local Index = tonumber( IndexString )
|
||||||
@@ -3112,7 +3291,7 @@ end
|
|||||||
|
|
||||||
--- Return the last maximum index that can be used.
|
--- Return the last maximum index that can be used.
|
||||||
function SPAWN:_GetLastIndex()
|
function SPAWN:_GetLastIndex()
|
||||||
self:F( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix } )
|
self:F3( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix } )
|
||||||
|
|
||||||
return self.SpawnMaxGroups
|
return self.SpawnMaxGroups
|
||||||
end
|
end
|
||||||
@@ -3261,36 +3440,206 @@ function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex ) -- R2.2
|
|||||||
|
|
||||||
if self.SpawnInitKeepUnitNames == false then
|
if self.SpawnInitKeepUnitNames == false then
|
||||||
for UnitID = 1, #SpawnTemplate.units do
|
for UnitID = 1, #SpawnTemplate.units do
|
||||||
SpawnTemplate.units[UnitID].name = string.format( SpawnTemplate.name .. '-%02d', UnitID )
|
if not string.find(SpawnTemplate.units[UnitID].name,"#IFF_",1,true) then --Razbam IFF hack for F15E etc
|
||||||
|
SpawnTemplate.units[UnitID].name = string.format( SpawnTemplate.name .. '-%02d', UnitID )
|
||||||
|
end
|
||||||
SpawnTemplate.units[UnitID].unitId = nil
|
SpawnTemplate.units[UnitID].unitId = nil
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
for UnitID = 1, #SpawnTemplate.units do
|
for UnitID = 1, #SpawnTemplate.units do
|
||||||
local UnitPrefix, Rest = string.match( SpawnTemplate.units[UnitID].name, "^([^#]+)#?" ):gsub( "^%s*(.-)%s*$", "%1" )
|
local SpawnInitKeepUnitIFF = false
|
||||||
self:T( { UnitPrefix, Rest } )
|
if string.find(SpawnTemplate.units[UnitID].name,"#IFF_",1,true) then --Razbam IFF hack for F15E etc
|
||||||
|
SpawnInitKeepUnitIFF = true
|
||||||
|
end
|
||||||
|
local UnitPrefix, Rest
|
||||||
|
if SpawnInitKeepUnitIFF == false then
|
||||||
|
UnitPrefix, Rest = string.match( SpawnTemplate.units[UnitID].name, "^([^#]+)#?" ):gsub( "^%s*(.-)%s*$", "%1" )
|
||||||
|
SpawnTemplate.units[UnitID].name = string.format( '%s#%03d-%02d', UnitPrefix, SpawnIndex, UnitID )
|
||||||
|
self:T( { UnitPrefix, Rest } )
|
||||||
|
--else
|
||||||
|
--UnitPrefix=SpawnTemplate.units[UnitID].name
|
||||||
|
end
|
||||||
|
--SpawnTemplate.units[UnitID].name = string.format( '%s#%03d-%02d', UnitPrefix, SpawnIndex, UnitID )
|
||||||
|
|
||||||
SpawnTemplate.units[UnitID].name = string.format( '%s#%03d-%02d', UnitPrefix, SpawnIndex, UnitID )
|
|
||||||
SpawnTemplate.units[UnitID].unitId = nil
|
SpawnTemplate.units[UnitID].unitId = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Callsign
|
-- Callsign
|
||||||
for UnitID = 1, #SpawnTemplate.units do
|
|
||||||
local Callsign = SpawnTemplate.units[UnitID].callsign
|
if self.SpawnRandomCallsign and SpawnTemplate.units[1].callsign then
|
||||||
if Callsign then
|
if type( SpawnTemplate.units[1].callsign ) ~= "number" then
|
||||||
if type( Callsign ) ~= "number" then -- blue callsign
|
-- change callsign
|
||||||
Callsign[2] = ((SpawnIndex - 1) % 10) + 1
|
local min = 1
|
||||||
local CallsignName = SpawnTemplate.units[UnitID].callsign["name"] -- #string
|
local max = 8
|
||||||
CallsignName = string.match(CallsignName,"^(%a+)") -- 2.8 - only the part w/o numbers
|
local ctable = CALLSIGN.Aircraft
|
||||||
local CallsignLen = CallsignName:len()
|
if string.find(SpawnTemplate.units[1].type, "A-10",1,true) then
|
||||||
SpawnTemplate.units[UnitID].callsign["name"] = CallsignName:sub( 1, CallsignLen ) .. SpawnTemplate.units[UnitID].callsign[2] .. SpawnTemplate.units[UnitID].callsign[3]
|
max = 12
|
||||||
else
|
end
|
||||||
SpawnTemplate.units[UnitID].callsign = Callsign + SpawnIndex
|
if string.find(SpawnTemplate.units[1].type, "18",1,true) then
|
||||||
|
min = 9
|
||||||
|
max = 20
|
||||||
|
ctable = CALLSIGN.F18
|
||||||
|
end
|
||||||
|
if string.find(SpawnTemplate.units[1].type, "16",1,true) then
|
||||||
|
min = 9
|
||||||
|
max = 20
|
||||||
|
ctable = CALLSIGN.F16
|
||||||
|
end
|
||||||
|
if SpawnTemplate.units[1].type == "F-15E" then
|
||||||
|
min = 9
|
||||||
|
max = 18
|
||||||
|
ctable = CALLSIGN.F15E
|
||||||
|
end
|
||||||
|
local callsignnr = math.random(min,max)
|
||||||
|
local callsignname = "Enfield"
|
||||||
|
for name, value in pairs(ctable) do
|
||||||
|
if value==callsignnr then
|
||||||
|
callsignname = name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for UnitID = 1, #SpawnTemplate.units do
|
||||||
|
SpawnTemplate.units[UnitID].callsign[1] = callsignnr
|
||||||
|
SpawnTemplate.units[UnitID].callsign[2] = UnitID
|
||||||
|
SpawnTemplate.units[UnitID].callsign[3] = "1"
|
||||||
|
SpawnTemplate.units[UnitID].callsign["name"] = tostring(callsignname)..tostring(UnitID).."1"
|
||||||
|
-- UTILS.PrintTableToLog(SpawnTemplate.units[UnitID].callsign,1)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- Russkis
|
||||||
|
for UnitID = 1, #SpawnTemplate.units do
|
||||||
|
SpawnTemplate.units[UnitID].callsign = math.random(1,999)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if self.SpawnInitCallSign then
|
||||||
|
for UnitID = 1, #SpawnTemplate.units do
|
||||||
|
local Callsign = SpawnTemplate.units[UnitID].callsign
|
||||||
|
if Callsign and type( Callsign ) ~= "number" then
|
||||||
|
SpawnTemplate.units[UnitID].callsign[1] = self.SpawnInitCallSignID
|
||||||
|
SpawnTemplate.units[UnitID].callsign[2] = self.SpawnInitCallSignMinor
|
||||||
|
SpawnTemplate.units[UnitID].callsign[3] = self.SpawnInitCallSignMajor
|
||||||
|
SpawnTemplate.units[UnitID].callsign["name"] = string.format("%s%d%d",self.SpawnInitCallSignName,self.SpawnInitCallSignMinor,self.SpawnInitCallSignMajor)
|
||||||
|
--UTILS.PrintTableToLog(SpawnTemplate.units[UnitID].callsign,1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for UnitID = 1, #SpawnTemplate.units do
|
||||||
|
local Callsign = SpawnTemplate.units[UnitID].callsign
|
||||||
|
if Callsign then
|
||||||
|
if type( Callsign ) ~= "number" and not self.SpawnInitCallSign then -- blue callsign
|
||||||
|
-- UTILS.PrintTableToLog(Callsign,1)
|
||||||
|
Callsign[2] = ((SpawnIndex - 1) % 10) + 1
|
||||||
|
local CallsignName = SpawnTemplate.units[UnitID].callsign["name"] -- #string
|
||||||
|
CallsignName = string.match(CallsignName,"^(%a+)") -- 2.8 - only the part w/o numbers
|
||||||
|
local CallsignLen = CallsignName:len()
|
||||||
|
SpawnTemplate.units[UnitID].callsign[2] = UnitID
|
||||||
|
SpawnTemplate.units[UnitID].callsign["name"] = CallsignName:sub( 1, CallsignLen ) .. SpawnTemplate.units[UnitID].callsign[2] .. SpawnTemplate.units[UnitID].callsign[3]
|
||||||
|
elseif type( Callsign ) == "number" then
|
||||||
|
SpawnTemplate.units[UnitID].callsign = Callsign + SpawnIndex
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- Speed
|
||||||
|
if self.InitSpeed then
|
||||||
|
SpawnTemplate.units[UnitID].speed = self.InitSpeed
|
||||||
|
end
|
||||||
|
-- Link16
|
||||||
|
local AddProps = SpawnTemplate.units[UnitID].AddPropAircraft
|
||||||
|
if AddProps then
|
||||||
|
if SpawnTemplate.units[UnitID].AddPropAircraft.STN_L16 then
|
||||||
|
if self.SpawnInitSTN then
|
||||||
|
local octal = self.SpawnInitSTN
|
||||||
|
if UnitID > 1 then
|
||||||
|
octal = _DATABASE:GetNextSTN(self.SpawnInitSTN,SpawnTemplate.units[UnitID].name)
|
||||||
|
end
|
||||||
|
SpawnTemplate.units[UnitID].AddPropAircraft.STN_L16 = string.format("%05d",octal)
|
||||||
|
else
|
||||||
|
-- 5 digit octal with leading 0
|
||||||
|
if tonumber(SpawnTemplate.units[UnitID].AddPropAircraft.STN_L16) ~= nil then
|
||||||
|
local octal = SpawnTemplate.units[UnitID].AddPropAircraft.STN_L16
|
||||||
|
local num = UTILS.OctalToDecimal(octal)
|
||||||
|
if _DATABASE.STNS[num] ~= nil or UnitID > 1 then -- STN taken or next unit
|
||||||
|
octal = _DATABASE:GetNextSTN(octal,SpawnTemplate.units[UnitID].name)
|
||||||
|
end
|
||||||
|
SpawnTemplate.units[UnitID].AddPropAircraft.STN_L16 = string.format("%05d",octal)
|
||||||
|
else -- ED bug - chars in here
|
||||||
|
local OSTN = _DATABASE:GetNextSTN(1,SpawnTemplate.units[UnitID].name)
|
||||||
|
SpawnTemplate.units[UnitID].AddPropAircraft.STN_L16 = string.format("%05d",OSTN)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- A10CII
|
||||||
|
if SpawnTemplate.units[UnitID].AddPropAircraft.SADL_TN then
|
||||||
|
-- 4 digit octal with leading 0
|
||||||
|
if self.SpawnInitSADL then
|
||||||
|
local octal = self.SpawnInitSADL
|
||||||
|
if UnitID > 1 then
|
||||||
|
octal = _DATABASE:GetNextSADL(self.SpawnInitSADL,SpawnTemplate.units[UnitID].name)
|
||||||
|
end
|
||||||
|
SpawnTemplate.units[UnitID].AddPropAircraft.SADL_TN = string.format("%04d",octal)
|
||||||
|
else
|
||||||
|
if tonumber(SpawnTemplate.units[UnitID].AddPropAircraft.SADL_TN) ~= nil then
|
||||||
|
local octal = SpawnTemplate.units[UnitID].AddPropAircraft.SADL_TN
|
||||||
|
local num = UTILS.OctalToDecimal(octal)
|
||||||
|
self.SpawnInitSADL = num -- we arrived here seeing that self.SpawnInitSADL == nil, but now that we have a SADL (num), we also need to set it to self.SpawnInitSADL in case
|
||||||
|
-- we need to get the next SADL from _DATABASE, or else UTILS.OctalToDecimal() will fail in GetNextSADL
|
||||||
|
if _DATABASE.SADL[num] ~= nil or UnitID > 1 then -- SADL taken or next unit
|
||||||
|
octal = _DATABASE:GetNextSADL(self.SpawnInitSADL,SpawnTemplate.units[UnitID].name)
|
||||||
|
end
|
||||||
|
SpawnTemplate.units[UnitID].AddPropAircraft.SADL_TN = string.format("%04d",octal)
|
||||||
|
else -- ED bug - chars in here
|
||||||
|
local OSTN = _DATABASE:GetNextSADL(1,SpawnTemplate.units[UnitID].name)
|
||||||
|
SpawnTemplate.units[UnitID].AddPropAircraft.SADL_TN = string.format("%04d",OSTN)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- VoiceCallsignNumber
|
||||||
|
if SpawnTemplate.units[UnitID].AddPropAircraft.VoiceCallsignNumber and type( Callsign ) ~= "number" then
|
||||||
|
SpawnTemplate.units[UnitID].AddPropAircraft.VoiceCallsignNumber = SpawnTemplate.units[UnitID].callsign[2] .. SpawnTemplate.units[UnitID].callsign[3]
|
||||||
|
end
|
||||||
|
-- VoiceCallsignLabel
|
||||||
|
if SpawnTemplate.units[UnitID].AddPropAircraft.VoiceCallsignLabel and type( Callsign ) ~= "number" then
|
||||||
|
local CallsignName = SpawnTemplate.units[UnitID].callsign["name"] -- #string
|
||||||
|
CallsignName = string.match(CallsignName,"^(%a+)") -- 2.8 - only the part w/o numbers
|
||||||
|
local label = "NY" -- Navy One exception
|
||||||
|
if not string.find(CallsignName," ") then
|
||||||
|
label = string.upper(string.match(CallsignName,"^%a")..string.match(CallsignName,"%a$"))
|
||||||
|
end
|
||||||
|
SpawnTemplate.units[UnitID].AddPropAircraft.VoiceCallsignLabel = label
|
||||||
|
end
|
||||||
|
-- UTILS.PrintTableToLog(SpawnTemplate.units[UnitID].AddPropAircraft,1)
|
||||||
|
-- FlightLead
|
||||||
|
if SpawnTemplate.units[UnitID].datalinks and SpawnTemplate.units[UnitID].datalinks.Link16 and SpawnTemplate.units[UnitID].datalinks.Link16.settings then
|
||||||
|
SpawnTemplate.units[UnitID].datalinks.Link16.settings.flightLead = UnitID == 1 and true or false
|
||||||
|
end
|
||||||
|
-- A10CII
|
||||||
|
if SpawnTemplate.units[UnitID].datalinks and SpawnTemplate.units[UnitID].datalinks.SADL and SpawnTemplate.units[UnitID].datalinks.SADL.settings then
|
||||||
|
SpawnTemplate.units[UnitID].datalinks.SADL.settings.flightLead = UnitID == 1 and true or false
|
||||||
|
end
|
||||||
|
-- UTILS.PrintTableToLog(SpawnTemplate.units[UnitID].datalinks,1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- Link16 team members
|
||||||
|
for UnitID = 1, #SpawnTemplate.units do
|
||||||
|
if SpawnTemplate.units[UnitID].datalinks and SpawnTemplate.units[UnitID].datalinks.Link16 and SpawnTemplate.units[UnitID].datalinks.Link16.network then
|
||||||
|
local team = {}
|
||||||
|
local isF16 = string.find(SpawnTemplate.units[UnitID].type,"F-16",1,true) and true or false
|
||||||
|
for ID = 1, #SpawnTemplate.units do
|
||||||
|
local member = {}
|
||||||
|
member.missionUnitId = ID
|
||||||
|
if isF16 then
|
||||||
|
member.TDOA = true
|
||||||
|
end
|
||||||
|
table.insert(team,member)
|
||||||
|
end
|
||||||
|
SpawnTemplate.units[UnitID].datalinks.Link16.network.teamMembers = team
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
self:T3( { "Template:", SpawnTemplate } )
|
self:T3( { "Template:", SpawnTemplate } )
|
||||||
|
--UTILS.PrintTableToLog(SpawnTemplate,1)
|
||||||
return SpawnTemplate
|
return SpawnTemplate
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -3432,6 +3781,7 @@ function SPAWN:_RandomizeZones( SpawnIndex )
|
|||||||
self:T( { SpawnVec2 = SpawnVec2 } )
|
self:T( { SpawnVec2 = SpawnVec2 } )
|
||||||
|
|
||||||
local SpawnTemplate = self.SpawnGroups[SpawnIndex].SpawnTemplate
|
local SpawnTemplate = self.SpawnGroups[SpawnIndex].SpawnTemplate
|
||||||
|
self.SpawnGroups[SpawnIndex].SpawnZone = SpawnZone
|
||||||
|
|
||||||
self:T( { Route = SpawnTemplate.route } )
|
self:T( { Route = SpawnTemplate.route } )
|
||||||
|
|
||||||
@@ -3622,7 +3972,7 @@ function SPAWN:_OnLand( EventData )
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Will detect AIR Units shutting down their engines ...
|
--- Will detect AIR Units shutting down their engines ...
|
||||||
-- When the event takes place, and the method @{RepeatOnEngineShutDown} was called, the spawned Group will Re-SPAWN.
|
-- When the event takes place, and the method @{#InitRepeatOnEngineShutDown} was called, the spawned Group will Re-SPAWN.
|
||||||
-- But only when the Unit was registered to have landed.
|
-- But only when the Unit was registered to have landed.
|
||||||
-- @param #SPAWN self
|
-- @param #SPAWN self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
|
|||||||
@@ -15,14 +15,14 @@
|
|||||||
--
|
--
|
||||||
-- # Demo Missions
|
-- # Demo Missions
|
||||||
--
|
--
|
||||||
-- ## [SPAWNSTATIC Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SPS%20-%20Spawning%20Statics)
|
-- ## [SPAWNSTATIC Demo Missions](https://github.com/FlightControl-Master/MOOSE_Demos/tree/master/Core/SpawnStatic)
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # YouTube Channel
|
-- # YouTube Channel
|
||||||
--
|
--
|
||||||
-- ## [SPAWNSTATIC YouTube Channel]() [No videos yet!]
|
-- ## No videos yet!
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -21,9 +21,9 @@
|
|||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
-- ### Contributions:
|
-- ### Contributions:
|
||||||
--
|
--
|
||||||
-- * [**Ciribob**](https://forums.eagle.ru/member.php?u=112175): Showing the way how to lase targets + how laser codes work!!! Explained the autolase script.
|
-- * **Ciribob**: Showing the way how to lase targets + how laser codes work!!! Explained the autolase script.
|
||||||
-- * [**EasyEB**](https://forums.eagle.ru/member.php?u=112055): Ideas and Beta Testing
|
-- * **EasyEB**: Ideas and Beta Testing
|
||||||
-- * [**Wingthor**](https://forums.eagle.ru/member.php?u=123698): Beta Testing
|
-- * **Wingthor**: Beta Testing
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -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)/100):AddX(math.random(-100,100)/100):GetVec3() )
|
self.SpotIR:setPoint( self.Target:GetPointVec3():AddY(1):AddY(math.random(-100,100)/200):AddX(math.random(-100,100)/200):GetVec3() )
|
||||||
self.SpotLaser:setPoint( self.Target:GetPointVec3():AddY(1):GetVec3() )
|
self.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)/100, y=self.TargetCoord.y+math.random(-100,100)/100, z=self.TargetCoord.z} --#DCS.Vec3
|
local irvec3={x=self.TargetCoord.x+math.random(-100,100)/200, y=self.TargetCoord.y+math.random(-100,100)/200, z=self.TargetCoord.z} --#DCS.Vec3
|
||||||
local lsvec3={x=self.TargetCoord.x, y=self.TargetCoord.y, z=self.TargetCoord.z} --#DCS.Vec3
|
local lsvec3={x=self.TargetCoord.x, y=self.TargetCoord.y, z=self.TargetCoord.z} --#DCS.Vec3
|
||||||
|
|
||||||
self.SpotIR:setPoint(irvec3)
|
self.SpotIR:setPoint(irvec3)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -17,7 +17,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Example Missions:
|
-- ## Example Missions:
|
||||||
--
|
--
|
||||||
-- Demo missions can be found on [github](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/CSR-001%20-%20Basics).
|
-- Demo missions can be found on [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/Functional/AICSAR).
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -527,7 +527,7 @@ end
|
|||||||
--- [User] Switch sound output on and use SRS output for sound files.
|
--- [User] Switch sound output on and use SRS output for sound files.
|
||||||
-- @param #AICSAR self
|
-- @param #AICSAR self
|
||||||
-- @param #boolean OnOff Switch on (true) or off (false).
|
-- @param #boolean OnOff Switch on (true) or off (false).
|
||||||
-- @param #string Path Path to your SRS Server Component, e.g. "E:\\\\Program Files\\\\DCS-SimpleRadio-Standalone"
|
-- @param #string Path Path to your SRS Server Component, e.g. "C:\\\\Program Files\\\\DCS-SimpleRadio-Standalone"
|
||||||
-- @param #number Frequency Defaults to 243 (guard)
|
-- @param #number Frequency Defaults to 243 (guard)
|
||||||
-- @param #number Modulation Radio modulation. Defaults to radio.modulation.AM
|
-- @param #number Modulation Radio modulation. Defaults to radio.modulation.AM
|
||||||
-- @param #string SoundPath Where to find the audio files. Defaults to nil, i.e. add messages via "Sound to..." in the Mission Editor.
|
-- @param #string SoundPath Where to find the audio files. Defaults to nil, i.e. add messages via "Sound to..." in the Mission Editor.
|
||||||
@@ -538,13 +538,13 @@ function AICSAR:SetSRSRadio(OnOff,Path,Frequency,Modulation,SoundPath,Port)
|
|||||||
self.SRSRadio = OnOff and true
|
self.SRSRadio = OnOff and true
|
||||||
self.SRSTTSRadio = false
|
self.SRSTTSRadio = false
|
||||||
self.SRSFrequency = Frequency or 243
|
self.SRSFrequency = Frequency or 243
|
||||||
self.SRSPath = Path or "c:\\"
|
self.SRSPath = Path or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
||||||
self.SRS:SetLabel("ACSR")
|
self.SRS:SetLabel("ACSR")
|
||||||
self.SRS:SetCoalition(self.coalition)
|
self.SRS:SetCoalition(self.coalition)
|
||||||
self.SRSModulation = Modulation or radio.modulation.AM
|
self.SRSModulation = Modulation or radio.modulation.AM
|
||||||
local soundpath = os.getenv('TMP') .. "\\DCS\\Mission\\l10n\\DEFAULT" -- defaults to "l10n/DEFAULT/", i.e. add messages by "Sound to..." in the ME
|
local soundpath = os.getenv('TMP') .. "\\DCS\\Mission\\l10n\\DEFAULT" -- defaults to "l10n/DEFAULT/", i.e. add messages by "Sound to..." in the ME
|
||||||
self.SRSSoundPath = SoundPath or soundpath
|
self.SRSSoundPath = SoundPath or soundpath
|
||||||
self.SRSPort = Port or 5002
|
self.SRSPort = Port or MSRS.port or 5002
|
||||||
if OnOff then
|
if OnOff then
|
||||||
self.SRS = MSRS:New(Path,Frequency,Modulation)
|
self.SRS = MSRS:New(Path,Frequency,Modulation)
|
||||||
self.SRS:SetPort(self.SRSPort)
|
self.SRS:SetPort(self.SRSPort)
|
||||||
@@ -570,11 +570,11 @@ function AICSAR:SetSRSTTSRadio(OnOff,Path,Frequency,Modulation,Port,Voice,Cultur
|
|||||||
self.SRSTTSRadio = OnOff and true
|
self.SRSTTSRadio = OnOff and true
|
||||||
self.SRSRadio = false
|
self.SRSRadio = false
|
||||||
self.SRSFrequency = Frequency or 243
|
self.SRSFrequency = Frequency or 243
|
||||||
self.SRSPath = Path or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
self.SRSPath = Path or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
||||||
self.SRSModulation = Modulation or radio.modulation.AM
|
self.SRSModulation = Modulation or radio.modulation.AM
|
||||||
self.SRSPort = Port or 5002
|
self.SRSPort = Port or MSRS.port or 5002
|
||||||
if OnOff then
|
if OnOff then
|
||||||
self.SRS = MSRS:New(Path,Frequency,Modulation,1)
|
self.SRS = MSRS:New(self.SRSPath,Frequency,Modulation)
|
||||||
self.SRS:SetPort(self.SRSPort)
|
self.SRS:SetPort(self.SRSPort)
|
||||||
self.SRS:SetCoalition(self.coalition)
|
self.SRS:SetCoalition(self.coalition)
|
||||||
self.SRS:SetLabel("ACSR")
|
self.SRS:SetLabel("ACSR")
|
||||||
@@ -582,7 +582,8 @@ function AICSAR:SetSRSTTSRadio(OnOff,Path,Frequency,Modulation,Port,Voice,Cultur
|
|||||||
self.SRS:SetCulture(Culture)
|
self.SRS:SetCulture(Culture)
|
||||||
self.SRS:SetGender(Gender)
|
self.SRS:SetGender(Gender)
|
||||||
if GoogleCredentials then
|
if GoogleCredentials then
|
||||||
self.SRS:SetGoogle(GoogleCredentials)
|
self.SRS:SetProviderOptionsGoogle(GoogleCredentials,GoogleCredentials)
|
||||||
|
self.SRS:SetProvider(MSRS.Provider.GOOGLE)
|
||||||
self.SRSGoogle = true
|
self.SRSGoogle = true
|
||||||
end
|
end
|
||||||
self.SRSQ = MSRSQUEUE:New(self.alias)
|
self.SRSQ = MSRSQUEUE:New(self.alias)
|
||||||
@@ -600,14 +601,16 @@ end
|
|||||||
function AICSAR:SetPilotTTSVoice(Voice,Culture,Gender)
|
function AICSAR:SetPilotTTSVoice(Voice,Culture,Gender)
|
||||||
self:T(self.lid .. "SetPilotTTSVoice")
|
self:T(self.lid .. "SetPilotTTSVoice")
|
||||||
self.SRSPilotVoice = true
|
self.SRSPilotVoice = true
|
||||||
self.SRSPilot = MSRS:New(self.SRSPath,self.SRSFrequency,self.SRSModulation,1)
|
self.SRSPilot = MSRS:New(self.SRSPath,self.SRSFrequency,self.SRSModulation)
|
||||||
self.SRSPilot:SetCoalition(self.coalition)
|
self.SRSPilot:SetCoalition(self.coalition)
|
||||||
self.SRSPilot:SetVoice(Voice)
|
self.SRSPilot:SetVoice(Voice)
|
||||||
self.SRSPilot:SetCulture(Culture or "en-US")
|
self.SRSPilot:SetCulture(Culture or "en-US")
|
||||||
self.SRSPilot:SetGender(Gender or "male")
|
self.SRSPilot:SetGender(Gender or "male")
|
||||||
self.SRSPilot:SetLabel("PILOT")
|
self.SRSPilot:SetLabel("PILOT")
|
||||||
if self.SRS.google then
|
if self.SRSGoogle then
|
||||||
self.SRSPilot:SetGoogle(self.SRS.google)
|
local poptions = self.SRS:GetProviderOptions(MSRS.Provider.GOOGLE) -- Sound.SRS#MSRS.ProviderOptions
|
||||||
|
self.SRSPilot:SetProviderOptionsGoogle(poptions.credentials,poptions.key)
|
||||||
|
self.SRSPilot:SetProvider(MSRS.Provider.GOOGLE)
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -622,14 +625,16 @@ end
|
|||||||
function AICSAR:SetOperatorTTSVoice(Voice,Culture,Gender)
|
function AICSAR:SetOperatorTTSVoice(Voice,Culture,Gender)
|
||||||
self:T(self.lid .. "SetOperatorTTSVoice")
|
self:T(self.lid .. "SetOperatorTTSVoice")
|
||||||
self.SRSOperatorVoice = true
|
self.SRSOperatorVoice = true
|
||||||
self.SRSOperator = MSRS:New(self.SRSPath,self.SRSFrequency,self.SRSModulation,1)
|
self.SRSOperator = MSRS:New(self.SRSPath,self.SRSFrequency,self.SRSModulation)
|
||||||
self.SRSOperator:SetCoalition(self.coalition)
|
self.SRSOperator:SetCoalition(self.coalition)
|
||||||
self.SRSOperator:SetVoice(Voice)
|
self.SRSOperator:SetVoice(Voice)
|
||||||
self.SRSOperator:SetCulture(Culture or "en-GB")
|
self.SRSOperator:SetCulture(Culture or "en-GB")
|
||||||
self.SRSOperator:SetGender(Gender or "female")
|
self.SRSOperator:SetGender(Gender or "female")
|
||||||
self.SRSPilot:SetLabel("RESCUE")
|
self.SRSOperator:SetLabel("RESCUE")
|
||||||
if self.SRS.google then
|
if self.SRSGoogle then
|
||||||
self.SRSOperator:SetGoogle(self.SRS.google)
|
local poptions = self.SRS:GetProviderOptions(MSRS.Provider.GOOGLE) -- Sound.SRS#MSRS.ProviderOptions
|
||||||
|
self.SRSOperator:SetProviderOptionsGoogle(poptions.credentials,poptions.key)
|
||||||
|
self.SRSOperator:SetProvider(MSRS.Provider.GOOGLE)
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,9 +10,7 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions: None
|
||||||
--
|
|
||||||
-- [ABP - Airbase Police](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/ABP%20-%20Airbase%20Police)
|
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -20,13 +18,15 @@
|
|||||||
-- ### Author: FlightControl - Framework Design & Programming
|
-- ### Author: FlightControl - Framework Design & Programming
|
||||||
-- ### Refactoring to use the Runway auto-detection: Applevangelist
|
-- ### Refactoring to use the Runway auto-detection: Applevangelist
|
||||||
-- @date August 2022
|
-- @date August 2022
|
||||||
|
-- Last Update Nov 2023
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @module Functional.ATC_Ground
|
-- @module Functional.ATC_Ground
|
||||||
-- @image Air_Traffic_Control_Ground_Operations.JPG
|
-- @image Air_Traffic_Control_Ground_Operations.JPG
|
||||||
|
|
||||||
--- @type ATC_GROUND
|
---
|
||||||
|
-- @type ATC_GROUND
|
||||||
-- @field Core.Set#SET_CLIENT SetClient
|
-- @field Core.Set#SET_CLIENT SetClient
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
@@ -39,7 +39,8 @@ ATC_GROUND = {
|
|||||||
AirbaseNames = nil,
|
AirbaseNames = nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- @type ATC_GROUND.AirbaseNames
|
---
|
||||||
|
-- @type ATC_GROUND.AirbaseNames
|
||||||
-- @list <#string>
|
-- @list <#string>
|
||||||
|
|
||||||
|
|
||||||
@@ -51,7 +52,7 @@ function ATC_GROUND:New( Airbases, AirbaseList )
|
|||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, BASE:New() ) -- #ATC_GROUND
|
local self = BASE:Inherit( self, BASE:New() ) -- #ATC_GROUND
|
||||||
self:E( { self.ClassName, Airbases } )
|
self:T( { self.ClassName, Airbases } )
|
||||||
|
|
||||||
self.Airbases = Airbases
|
self.Airbases = Airbases
|
||||||
self.AirbaseList = AirbaseList
|
self.AirbaseList = AirbaseList
|
||||||
@@ -82,7 +83,7 @@ function ATC_GROUND:New( Airbases, AirbaseList )
|
|||||||
end
|
end
|
||||||
|
|
||||||
self.SetClient:ForEachClient(
|
self.SetClient:ForEachClient(
|
||||||
--- @param Wrapper.Client#CLIENT Client
|
-- @param Wrapper.Client#CLIENT Client
|
||||||
function( Client )
|
function( Client )
|
||||||
Client:SetState( self, "Speeding", false )
|
Client:SetState( self, "Speeding", false )
|
||||||
Client:SetState( self, "Warnings", 0)
|
Client:SetState( self, "Warnings", 0)
|
||||||
@@ -246,11 +247,11 @@ function ATC_GROUND:SetMaximumKickSpeedMiph( MaximumKickSpeedMiph, Airbase )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #ATC_GROUND self
|
-- @param #ATC_GROUND self
|
||||||
function ATC_GROUND:_AirbaseMonitor()
|
function ATC_GROUND:_AirbaseMonitor()
|
||||||
|
|
||||||
self.SetClient:ForEachClient(
|
self.SetClient:ForEachClient(
|
||||||
--- @param Wrapper.Client#CLIENT Client
|
-- @param Wrapper.Client#CLIENT Client
|
||||||
function( Client )
|
function( Client )
|
||||||
|
|
||||||
if Client:IsAlive() then
|
if Client:IsAlive() then
|
||||||
@@ -258,7 +259,7 @@ function ATC_GROUND:_AirbaseMonitor()
|
|||||||
local IsOnGround = Client:InAir() == false
|
local IsOnGround = Client:InAir() == false
|
||||||
|
|
||||||
for AirbaseID, AirbaseMeta in pairs( self.Airbases ) do
|
for AirbaseID, AirbaseMeta in pairs( self.Airbases ) do
|
||||||
self:E( AirbaseID, AirbaseMeta.KickSpeed )
|
self:T( AirbaseID, AirbaseMeta.KickSpeed )
|
||||||
|
|
||||||
if AirbaseMeta.Monitor == true and Client:IsInZone( AirbaseMeta.ZoneBoundary ) then
|
if AirbaseMeta.Monitor == true and Client:IsInZone( AirbaseMeta.ZoneBoundary ) then
|
||||||
|
|
||||||
@@ -271,7 +272,7 @@ function ATC_GROUND:_AirbaseMonitor()
|
|||||||
|
|
||||||
if IsOnGround then
|
if IsOnGround then
|
||||||
local Taxi = Client:GetState( self, "Taxi" )
|
local Taxi = Client:GetState( self, "Taxi" )
|
||||||
self:E( Taxi )
|
self:T( Taxi )
|
||||||
if Taxi == false then
|
if Taxi == false then
|
||||||
local Velocity = VELOCITY:New( AirbaseMeta.KickSpeed or self.KickSpeed )
|
local Velocity = VELOCITY:New( AirbaseMeta.KickSpeed or self.KickSpeed )
|
||||||
Client:Message( "Welcome to " .. AirbaseID .. ". The maximum taxiing speed is " ..
|
Client:Message( "Welcome to " .. AirbaseID .. ". The maximum taxiing speed is " ..
|
||||||
@@ -331,7 +332,7 @@ function ATC_GROUND:_AirbaseMonitor()
|
|||||||
Client:SetState( self, "Warnings", SpeedingWarnings + 1 )
|
Client:SetState( self, "Warnings", SpeedingWarnings + 1 )
|
||||||
else
|
else
|
||||||
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
||||||
--- @param Wrapper.Client#CLIENT Client
|
-- @param Wrapper.Client#CLIENT Client
|
||||||
Client:Destroy()
|
Client:Destroy()
|
||||||
Client:SetState( self, "Speeding", false )
|
Client:SetState( self, "Speeding", false )
|
||||||
Client:SetState( self, "Warnings", 0 )
|
Client:SetState( self, "Warnings", 0 )
|
||||||
@@ -363,7 +364,7 @@ function ATC_GROUND:_AirbaseMonitor()
|
|||||||
Client:SetState( self, "OffRunwayWarnings", OffRunwayWarnings + 1 )
|
Client:SetState( self, "OffRunwayWarnings", OffRunwayWarnings + 1 )
|
||||||
else
|
else
|
||||||
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
||||||
--- @param Wrapper.Client#CLIENT Client
|
-- @param Wrapper.Client#CLIENT Client
|
||||||
Client:Destroy()
|
Client:Destroy()
|
||||||
Client:SetState( self, "IsOffRunway", false )
|
Client:SetState( self, "IsOffRunway", false )
|
||||||
Client:SetState( self, "OffRunwayWarnings", 0 )
|
Client:SetState( self, "OffRunwayWarnings", 0 )
|
||||||
@@ -424,13 +425,20 @@ ATC_GROUND_UNIVERSAL = {
|
|||||||
|
|
||||||
--- Creates a new ATC\_GROUND\_UNIVERSAL object. This works on any map.
|
--- Creates a new ATC\_GROUND\_UNIVERSAL object. This works on any map.
|
||||||
-- @param #ATC_GROUND_UNIVERSAL self
|
-- @param #ATC_GROUND_UNIVERSAL self
|
||||||
-- @param AirbaseList (Optional) A table of Airbase Names.
|
-- @param AirbaseList A table of Airbase Names. Leave empty to cover **all** airbases of the map.
|
||||||
-- @return #ATC_GROUND_UNIVERSAL self
|
-- @return #ATC_GROUND_UNIVERSAL self
|
||||||
|
-- @usage
|
||||||
|
-- -- define monitoring for one airbase
|
||||||
|
-- local atc=ATC_GROUND_UNIVERSAL:New({AIRBASE.Syria.Gecitkale})
|
||||||
|
-- -- set kick speed
|
||||||
|
-- atc:SetKickSpeed(UTILS.KnotsToMps(20))
|
||||||
|
-- -- start monitoring evey 10 secs
|
||||||
|
-- atc:Start(10)
|
||||||
function ATC_GROUND_UNIVERSAL:New(AirbaseList)
|
function ATC_GROUND_UNIVERSAL:New(AirbaseList)
|
||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, BASE:New() ) -- #ATC_GROUND
|
local self = BASE:Inherit( self, BASE:New() ) -- #ATC_GROUND
|
||||||
self:E( { self.ClassName } )
|
self:T( { self.ClassName } )
|
||||||
|
|
||||||
self.Airbases = {}
|
self.Airbases = {}
|
||||||
|
|
||||||
@@ -440,6 +448,13 @@ function ATC_GROUND_UNIVERSAL:New(AirbaseList)
|
|||||||
|
|
||||||
self.AirbaseList = AirbaseList
|
self.AirbaseList = AirbaseList
|
||||||
|
|
||||||
|
if not self.AirbaseList then
|
||||||
|
self.AirbaseList = {}
|
||||||
|
for _name,_ in pairs(_DATABASE.AIRBASES) do
|
||||||
|
self.AirbaseList[_name]=_name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
self.SetClient = SET_CLIENT:New():FilterCategories( "plane" ):FilterStart()
|
self.SetClient = SET_CLIENT:New():FilterCategories( "plane" ):FilterStart()
|
||||||
|
|
||||||
|
|
||||||
@@ -460,8 +475,9 @@ function ATC_GROUND_UNIVERSAL:New(AirbaseList)
|
|||||||
self.Airbases[AirbaseName].Monitor = true
|
self.Airbases[AirbaseName].Monitor = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
self.SetClient:ForEachClient(
|
self.SetClient:ForEachClient(
|
||||||
--- @param Wrapper.Client#CLIENT Client
|
-- @param Wrapper.Client#CLIENT Client
|
||||||
function( Client )
|
function( Client )
|
||||||
Client:SetState( self, "Speeding", false )
|
Client:SetState( self, "Speeding", false )
|
||||||
Client:SetState( self, "Warnings", 0)
|
Client:SetState( self, "Warnings", 0)
|
||||||
@@ -679,9 +695,10 @@ end
|
|||||||
-- @param #ATC_GROUND_UNIVERSAL self
|
-- @param #ATC_GROUND_UNIVERSAL self
|
||||||
-- @return #ATC_GROUND_UNIVERSAL self
|
-- @return #ATC_GROUND_UNIVERSAL self
|
||||||
function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
|
function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
|
||||||
|
self:I("_AirbaseMonitor")
|
||||||
self.SetClient:ForEachClient(
|
self.SetClient:ForEachClient(
|
||||||
--- @param Wrapper.Client#CLIENT Client
|
--- Nameless function
|
||||||
|
-- @param Wrapper.Client#CLIENT Client
|
||||||
function( Client )
|
function( Client )
|
||||||
|
|
||||||
if Client:IsAlive() then
|
if Client:IsAlive() then
|
||||||
@@ -689,7 +706,7 @@ function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
|
|||||||
local IsOnGround = Client:InAir() == false
|
local IsOnGround = Client:InAir() == false
|
||||||
|
|
||||||
for AirbaseID, AirbaseMeta in pairs( self.Airbases ) do
|
for AirbaseID, AirbaseMeta in pairs( self.Airbases ) do
|
||||||
self:E( AirbaseID, AirbaseMeta.KickSpeed )
|
self:T( AirbaseID, AirbaseMeta.KickSpeed )
|
||||||
|
|
||||||
if AirbaseMeta.Monitor == true and Client:IsInZone( AirbaseMeta.ZoneBoundary ) then
|
if AirbaseMeta.Monitor == true and Client:IsInZone( AirbaseMeta.ZoneBoundary ) then
|
||||||
|
|
||||||
@@ -706,7 +723,7 @@ function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
|
|||||||
|
|
||||||
if IsOnGround then
|
if IsOnGround then
|
||||||
local Taxi = Client:GetState( self, "Taxi" )
|
local Taxi = Client:GetState( self, "Taxi" )
|
||||||
self:E( Taxi )
|
self:T( Taxi )
|
||||||
if Taxi == false then
|
if Taxi == false then
|
||||||
local Velocity = VELOCITY:New( AirbaseMeta.KickSpeed or self.KickSpeed )
|
local Velocity = VELOCITY:New( AirbaseMeta.KickSpeed or self.KickSpeed )
|
||||||
Client:Message( "Welcome to " .. AirbaseID .. ". The maximum taxiing speed is " ..
|
Client:Message( "Welcome to " .. AirbaseID .. ". The maximum taxiing speed is " ..
|
||||||
@@ -766,7 +783,7 @@ function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
|
|||||||
Client:SetState( self, "Warnings", SpeedingWarnings + 1 )
|
Client:SetState( self, "Warnings", SpeedingWarnings + 1 )
|
||||||
else
|
else
|
||||||
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
||||||
--- @param Wrapper.Client#CLIENT Client
|
-- @param Wrapper.Client#CLIENT Client
|
||||||
Client:Destroy()
|
Client:Destroy()
|
||||||
Client:SetState( self, "Speeding", false )
|
Client:SetState( self, "Speeding", false )
|
||||||
Client:SetState( self, "Warnings", 0 )
|
Client:SetState( self, "Warnings", 0 )
|
||||||
@@ -798,7 +815,7 @@ function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
|
|||||||
Client:SetState( self, "OffRunwayWarnings", OffRunwayWarnings + 1 )
|
Client:SetState( self, "OffRunwayWarnings", OffRunwayWarnings + 1 )
|
||||||
else
|
else
|
||||||
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
|
||||||
--- @param Wrapper.Client#CLIENT Client
|
-- @param Wrapper.Client#CLIENT Client
|
||||||
Client:Destroy()
|
Client:Destroy()
|
||||||
Client:SetState( self, "IsOffRunway", false )
|
Client:SetState( self, "IsOffRunway", false )
|
||||||
Client:SetState( self, "OffRunwayWarnings", 0 )
|
Client:SetState( self, "OffRunwayWarnings", 0 )
|
||||||
@@ -838,15 +855,16 @@ end
|
|||||||
|
|
||||||
--- Start SCHEDULER for ATC_GROUND_UNIVERSAL object.
|
--- Start SCHEDULER for ATC_GROUND_UNIVERSAL object.
|
||||||
-- @param #ATC_GROUND_UNIVERSAL self
|
-- @param #ATC_GROUND_UNIVERSAL self
|
||||||
-- @param RepeatScanSeconds Time in second for defining occurency of alerts.
|
-- @param RepeatScanSeconds Time in second for defining schedule of alerts.
|
||||||
-- @return #ATC_GROUND_UNIVERSAL self
|
-- @return #ATC_GROUND_UNIVERSAL self
|
||||||
function ATC_GROUND_UNIVERSAL:Start( RepeatScanSeconds )
|
function ATC_GROUND_UNIVERSAL:Start( RepeatScanSeconds )
|
||||||
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
||||||
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds )
|
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, RepeatScanSeconds )
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @type ATC_GROUND_CAUCASUS
|
---
|
||||||
|
-- @type ATC_GROUND_CAUCASUS
|
||||||
-- @extends #ATC_GROUND
|
-- @extends #ATC_GROUND
|
||||||
|
|
||||||
--- # ATC\_GROUND\_CAUCASUS, extends @{#ATC_GROUND_UNIVERSAL}
|
--- # ATC\_GROUND\_CAUCASUS, extends @{#ATC_GROUND_UNIVERSAL}
|
||||||
@@ -981,12 +999,12 @@ end
|
|||||||
-- @return nothing
|
-- @return nothing
|
||||||
function ATC_GROUND_CAUCASUS:Start( RepeatScanSeconds )
|
function ATC_GROUND_CAUCASUS:Start( RepeatScanSeconds )
|
||||||
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
||||||
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds )
|
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, RepeatScanSeconds )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
--- @type ATC_GROUND_NEVADA
|
-- @type ATC_GROUND_NEVADA
|
||||||
-- @extends #ATC_GROUND
|
-- @extends #ATC_GROUND
|
||||||
|
|
||||||
|
|
||||||
@@ -1120,11 +1138,11 @@ end
|
|||||||
-- @return nothing
|
-- @return nothing
|
||||||
function ATC_GROUND_NEVADA:Start( RepeatScanSeconds )
|
function ATC_GROUND_NEVADA:Start( RepeatScanSeconds )
|
||||||
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
||||||
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds )
|
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, RepeatScanSeconds )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---
|
||||||
--- @type ATC_GROUND_NORMANDY
|
-- @type ATC_GROUND_NORMANDY
|
||||||
-- @extends #ATC_GROUND
|
-- @extends #ATC_GROUND
|
||||||
|
|
||||||
|
|
||||||
@@ -1277,10 +1295,11 @@ end
|
|||||||
-- @return nothing
|
-- @return nothing
|
||||||
function ATC_GROUND_NORMANDY:Start( RepeatScanSeconds )
|
function ATC_GROUND_NORMANDY:Start( RepeatScanSeconds )
|
||||||
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
||||||
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds )
|
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, RepeatScanSeconds )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @type ATC_GROUND_PERSIANGULF
|
---
|
||||||
|
-- @type ATC_GROUND_PERSIANGULF
|
||||||
-- @extends #ATC_GROUND
|
-- @extends #ATC_GROUND
|
||||||
|
|
||||||
|
|
||||||
@@ -1419,11 +1438,11 @@ end
|
|||||||
-- @return nothing
|
-- @return nothing
|
||||||
function ATC_GROUND_PERSIANGULF:Start( RepeatScanSeconds )
|
function ATC_GROUND_PERSIANGULF:Start( RepeatScanSeconds )
|
||||||
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
||||||
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds )
|
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, RepeatScanSeconds )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @type ATC_GROUND_MARIANAISLANDS
|
-- @type ATC_GROUND_MARIANAISLANDS
|
||||||
-- @extends #ATC_GROUND
|
-- @extends #ATC_GROUND
|
||||||
|
|
||||||
|
|
||||||
@@ -1517,7 +1536,7 @@ end
|
|||||||
-- * @{#ATC_GROUND.SetMaximumKickSpeedKmph}(): Set the maximum speed allowed at an airbase in kilometers per hour.
|
-- * @{#ATC_GROUND.SetMaximumKickSpeedKmph}(): Set the maximum speed allowed at an airbase in kilometers per hour.
|
||||||
-- * @{#ATC_GROUND.SetMaximumKickSpeedMiph}(): Set the maximum speed allowed at an airbase in miles per hour.
|
-- * @{#ATC_GROUND.SetMaximumKickSpeedMiph}(): Set the maximum speed allowed at an airbase in miles per hour.
|
||||||
--
|
--
|
||||||
---- @field #ATC_GROUND_MARIANAISLANDS
|
-- @field #ATC_GROUND_MARIANAISLANDS
|
||||||
ATC_GROUND_MARIANAISLANDS = {
|
ATC_GROUND_MARIANAISLANDS = {
|
||||||
ClassName = "ATC_GROUND_MARIANAISLANDS",
|
ClassName = "ATC_GROUND_MARIANAISLANDS",
|
||||||
}
|
}
|
||||||
@@ -1529,7 +1548,7 @@ ATC_GROUND_MARIANAISLANDS = {
|
|||||||
function ATC_GROUND_MARIANAISLANDS:New( AirbaseNames )
|
function ATC_GROUND_MARIANAISLANDS:New( AirbaseNames )
|
||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, ATC_GROUND_UNIVERSAL:New( self.Airbases, AirbaseNames ) )
|
local self = BASE:Inherit( self, ATC_GROUND_UNIVERSAL:New( AirbaseNames ) )
|
||||||
|
|
||||||
self:SetKickSpeedKmph( 50 )
|
self:SetKickSpeedKmph( 50 )
|
||||||
self:SetMaximumKickSpeedKmph( 150 )
|
self:SetMaximumKickSpeedKmph( 150 )
|
||||||
@@ -1543,5 +1562,5 @@ end
|
|||||||
-- @return nothing
|
-- @return nothing
|
||||||
function ATC_GROUND_MARIANAISLANDS:Start( RepeatScanSeconds )
|
function ATC_GROUND_MARIANAISLANDS:Start( RepeatScanSeconds )
|
||||||
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
RepeatScanSeconds = RepeatScanSeconds or 0.05
|
||||||
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds )
|
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, RepeatScanSeconds )
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- ### [AmmoTruck](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/AMT%20-%20AmmoTruck/AmmoTruck%20100%20-%20NTTR%20-%20Basic)
|
-- Demo missions can be found on [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/Functional/AmmoTruck)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
-- Last update: July 2023
|
-- Last update: July 2023
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
--- **AMMOTRUCK** class, extends Core.FSM#FSM
|
--- **AMMOTRUCK** class, extends Core.Fsm#FSM
|
||||||
-- @type AMMOTRUCK
|
-- @type AMMOTRUCK
|
||||||
-- @field #string ClassName Class Name
|
-- @field #string ClassName Class Name
|
||||||
-- @field #string lid Lid for log entries
|
-- @field #string lid Lid for log entries
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
-- @field #number waitingtime Max waiting time in seconds
|
-- @field #number waitingtime Max waiting time in seconds
|
||||||
-- @field #boolean routeonroad Route truck on road if true (default)
|
-- @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
|
-- @field #number reloads Number of reloads a single truck can do before he must return home
|
||||||
-- @extends Core.FSM#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
--- *Amateurs talk about tactics, but professionals study logistics.* - General Robert H Barrow, USMC
|
--- *Amateurs talk about tactics, but professionals study logistics.* - General Robert H Barrow, USMC
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -25,9 +25,9 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **[funkyfranky](https://forums.eagle.ru/member.php?u=115026)**
|
-- ### Author: **funkyfranky**
|
||||||
--
|
--
|
||||||
-- ### Contributions: [FlightControl](https://forums.eagle.ru/member.php?u=89536)
|
-- ### Contributions: FlightControl
|
||||||
--
|
--
|
||||||
-- ====
|
-- ====
|
||||||
-- @module Functional.Artillery
|
-- @module Functional.Artillery
|
||||||
@@ -291,14 +291,14 @@
|
|||||||
-- ### Illumination Shells
|
-- ### Illumination Shells
|
||||||
--
|
--
|
||||||
-- ARTY groups that possess shells can fire shells with illumination bombs. First, the group needs to be equipped with this weapon. This is done by the
|
-- ARTY groups that possess shells can fire shells with illumination bombs. First, the group needs to be equipped with this weapon. This is done by the
|
||||||
-- function @{ARTY.SetIlluminationShells}(*n*, *power*), where *n* is the number of shells the group has available and *power* the illumination power in mega candela (mcd).
|
-- function @{#ARTY.SetIlluminationShells}(*n*, *power*), where *n* is the number of shells the group has available and *power* the illumination power in mega candela (mcd).
|
||||||
--
|
--
|
||||||
-- In order to execute an engagement with illumination shells one has to use the weapon type *ARTY.WeaponType.IlluminationShells* in the
|
-- In order to execute an engagement with illumination shells one has to use the weapon type *ARTY.WeaponType.IlluminationShells* in the
|
||||||
-- @{#ARTY.AssignTargetCoord}() function.
|
-- @{#ARTY.AssignTargetCoord}() function.
|
||||||
--
|
--
|
||||||
-- In the simulation, the explosive shell that is fired is destroyed once it gets close to the target point but before it can actually impact.
|
-- In the simulation, the explosive shell that is fired is destroyed once it gets close to the target point but before it can actually impact.
|
||||||
-- At this position an illumination bomb is triggered at a random altitude between 500 and 1000 meters. This interval can be set by the function
|
-- At this position an illumination bomb is triggered at a random altitude between 500 and 1000 meters. This interval can be set by the function
|
||||||
-- @{ARTY.SetIlluminationMinMaxAlt}(*minalt*, *maxalt*).
|
-- @{#ARTY.SetIlluminationMinMaxAlt}(*minalt*, *maxalt*).
|
||||||
--
|
--
|
||||||
-- ### Smoke Shells
|
-- ### Smoke Shells
|
||||||
--
|
--
|
||||||
@@ -3546,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.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- ### [Autolase](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/)
|
-- None yet.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
-- @image Designation.JPG
|
-- @image Designation.JPG
|
||||||
--
|
--
|
||||||
-- Date: 24 Oct 2021
|
-- Date: 24 Oct 2021
|
||||||
-- Last Update: Aug 2022
|
-- Last Update: May 2024
|
||||||
--
|
--
|
||||||
--- Class AUTOLASE
|
--- Class AUTOLASE
|
||||||
-- @type AUTOLASE
|
-- @type AUTOLASE
|
||||||
@@ -84,6 +84,11 @@
|
|||||||
-- @field #string alias
|
-- @field #string alias
|
||||||
-- @field #boolean debug
|
-- @field #boolean debug
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
|
-- @field Core.Set#SET_GROUP RecceSet
|
||||||
|
-- @field #table LaserCodes
|
||||||
|
-- @field #table playermenus
|
||||||
|
-- @field #boolean smokemenu
|
||||||
|
-- @field #boolean threatmenu
|
||||||
-- @extends Ops.Intel#INTEL
|
-- @extends Ops.Intel#INTEL
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -94,6 +99,7 @@ AUTOLASE = {
|
|||||||
verbose = 0,
|
verbose = 0,
|
||||||
alias = "",
|
alias = "",
|
||||||
debug = false,
|
debug = false,
|
||||||
|
smokemenu = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Laser spot info
|
--- Laser spot info
|
||||||
@@ -109,9 +115,10 @@ AUTOLASE = {
|
|||||||
-- @field #string unittype
|
-- @field #string unittype
|
||||||
-- @field Core.Point#COORDINATE coordinate
|
-- @field Core.Point#COORDINATE coordinate
|
||||||
|
|
||||||
|
|
||||||
--- AUTOLASE class version.
|
--- AUTOLASE class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
AUTOLASE.version = "0.1.21"
|
AUTOLASE.version = "0.1.25"
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
-- Begin Functional.Autolase.lua
|
-- Begin Functional.Autolase.lua
|
||||||
@@ -196,6 +203,10 @@ function AUTOLASE:New(RecceSet, Coalition, Alias, PilotSet)
|
|||||||
self.NoMenus = false
|
self.NoMenus = false
|
||||||
self.minthreatlevel = 0
|
self.minthreatlevel = 0
|
||||||
self.blacklistattributes = {}
|
self.blacklistattributes = {}
|
||||||
|
self:SetLaserCodes( { 1688, 1130, 4785, 6547, 1465, 4578 } ) -- set self.LaserCodes
|
||||||
|
self.playermenus = {}
|
||||||
|
self.smokemenu = true
|
||||||
|
self.threatmenu = true
|
||||||
|
|
||||||
-- Set some string id for output to DCS.log file.
|
-- Set some string id for output to DCS.log file.
|
||||||
self.lid=string.format("AUTOLASE %s (%s) | ", self.alias, self.coalition and UTILS.GetCoalitionName(self.coalition) or "unknown")
|
self.lid=string.format("AUTOLASE %s (%s) | ", self.alias, self.coalition and UTILS.GetCoalitionName(self.coalition) or "unknown")
|
||||||
@@ -214,7 +225,7 @@ function AUTOLASE:New(RecceSet, Coalition, Alias, PilotSet)
|
|||||||
if PilotSet then
|
if PilotSet then
|
||||||
self.usepilotset = true
|
self.usepilotset = true
|
||||||
self.pilotset = PilotSet
|
self.pilotset = PilotSet
|
||||||
self:HandleEvent(EVENTS.PlayerEnterAircraft)
|
self:HandleEvent(EVENTS.PlayerEnterAircraft,self._EventHandler)
|
||||||
--self:SetPilotMenu()
|
--self:SetPilotMenu()
|
||||||
end
|
end
|
||||||
--self.SetPilotMenu()
|
--self.SetPilotMenu()
|
||||||
@@ -298,20 +309,67 @@ end
|
|||||||
-- Helper Functions
|
-- Helper Functions
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
|
|
||||||
|
--- [User] Set a table of possible laser codes.
|
||||||
|
-- Each new RECCE can select a code from this table, default is { 1688, 1130, 4785, 6547, 1465, 4578 } .
|
||||||
|
-- @param #AUTOLASE self
|
||||||
|
-- @param #list<#number> LaserCodes
|
||||||
|
-- @return #AUTOLASE
|
||||||
|
function AUTOLASE:SetLaserCodes( LaserCodes )
|
||||||
|
self.LaserCodes = ( type( LaserCodes ) == "table" ) and LaserCodes or { LaserCodes }
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- (Internal) Function to set pilot menu.
|
--- (Internal) Function to set pilot menu.
|
||||||
-- @param #AUTOLASE self
|
-- @param #AUTOLASE self
|
||||||
-- @return #AUTOLASE self
|
-- @return #AUTOLASE self
|
||||||
function AUTOLASE:SetPilotMenu()
|
function AUTOLASE:SetPilotMenu()
|
||||||
if self.usepilotset then
|
if self.usepilotset then
|
||||||
local pilottable = self.pilotset:GetSetObjects() or {}
|
local pilottable = self.pilotset:GetSetObjects() or {}
|
||||||
|
local grouptable = {}
|
||||||
for _,_unit in pairs (pilottable) do
|
for _,_unit in pairs (pilottable) do
|
||||||
local Unit = _unit -- Wrapper.Unit#UNIT
|
local Unit = _unit -- Wrapper.Unit#UNIT
|
||||||
if Unit and Unit:IsAlive() then
|
if Unit and Unit:IsAlive() then
|
||||||
local Group = Unit:GetGroup()
|
local Group = Unit:GetGroup()
|
||||||
local lasemenu = MENU_GROUP_COMMAND:New(Group,"Autolase Status",nil,self.ShowStatus,self,Group,Unit)
|
local GroupName = Group:GetName() or "none"
|
||||||
lasemenu:Refresh()
|
local unitname = Unit:GetName()
|
||||||
end
|
if not grouptable[GroupName] == true then
|
||||||
end
|
if self.playermenus[unitname] then self.playermenus[unitname]:Remove() end -- menus
|
||||||
|
local lasetopm = MENU_GROUP:New(Group,"Autolase",nil)
|
||||||
|
self.playermenus[unitname] = lasetopm
|
||||||
|
local lasemenu = MENU_GROUP_COMMAND:New(Group,"Status",lasetopm,self.ShowStatus,self,Group,Unit)
|
||||||
|
if self.smokemenu then
|
||||||
|
local smoke = (self.smoketargets == true) and "off" or "on"
|
||||||
|
local smoketext = string.format("Switch smoke targets to %s",smoke)
|
||||||
|
local smokemenu = MENU_GROUP_COMMAND:New(Group,smoketext,lasetopm,self.SetSmokeTargets,self,(not self.smoketargets))
|
||||||
|
end -- smokement
|
||||||
|
if self.threatmenu then
|
||||||
|
local threatmenutop = MENU_GROUP:New(Group,"Set min lasing threat",lasetopm)
|
||||||
|
for i=0,10,2 do
|
||||||
|
local text = "Threatlevel "..tostring(i)
|
||||||
|
local threatmenu = MENU_GROUP_COMMAND:New(Group,text,threatmenutop,self.SetMinThreatLevel,self,i)
|
||||||
|
end -- threatlevel
|
||||||
|
end -- threatmenu
|
||||||
|
for _,_grp in pairs(self.RecceSet.Set) do
|
||||||
|
local grp = _grp -- Wrapper.Group#GROUP
|
||||||
|
local unit = grp:GetUnit(1)
|
||||||
|
--local name = grp:GetName()
|
||||||
|
if unit and unit:IsAlive() then
|
||||||
|
local name = unit:GetName()
|
||||||
|
local mname = string.gsub(name,".%d+.%d+$","")
|
||||||
|
local code = self:GetLaserCode(name)
|
||||||
|
local unittop = MENU_GROUP:New(Group,"Change laser code for "..mname,lasetopm)
|
||||||
|
for _,_code in pairs(self.LaserCodes) do
|
||||||
|
local text = tostring(_code)
|
||||||
|
if _code == code then text = text.."(*)" end
|
||||||
|
local changemenu = MENU_GROUP_COMMAND:New(Group,text,unittop,self.SetRecceLaserCode,self,name,_code,true)
|
||||||
|
end -- Codes
|
||||||
|
end -- unit alive
|
||||||
|
end -- Recceset
|
||||||
|
grouptable[GroupName] = true
|
||||||
|
end -- grouptable[GroupName]
|
||||||
|
--lasemenu:Refresh()
|
||||||
|
end -- unit alive
|
||||||
|
end -- pilot loop
|
||||||
else
|
else
|
||||||
if not self.NoMenus then
|
if not self.NoMenus then
|
||||||
self.Menu = MENU_COALITION_COMMAND:New(self.coalition,"Autolase",nil,self.ShowStatus,self)
|
self.Menu = MENU_COALITION_COMMAND:New(self.coalition,"Autolase",nil,self.ShowStatus,self)
|
||||||
@@ -324,7 +382,7 @@ end
|
|||||||
-- @param #AUTOLASE self
|
-- @param #AUTOLASE self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
-- @return #AUTOLASE self
|
-- @return #AUTOLASE self
|
||||||
function AUTOLASE:OnEventPlayerEnterAircraft(EventData)
|
function AUTOLASE:_EventHandler(EventData)
|
||||||
self:SetPilotMenu()
|
self:SetPilotMenu()
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -397,14 +455,14 @@ end
|
|||||||
--- (User) Function enable sending messages via SRS.
|
--- (User) Function enable sending messages via SRS.
|
||||||
-- @param #AUTOLASE self
|
-- @param #AUTOLASE self
|
||||||
-- @param #boolean OnOff Switch usage on and off
|
-- @param #boolean OnOff Switch usage on and off
|
||||||
-- @param #string Path Path to SRS directory, e.g. C:\\Program Files\\DCS-SimpleRadio-Standalon
|
-- @param #string Path Path to SRS directory, e.g. C:\\Program Files\\DCS-SimpleRadio-Standalone
|
||||||
-- @param #number Frequency Frequency to send, e.g. 243
|
-- @param #number Frequency Frequency to send, e.g. 243
|
||||||
-- @param #number Modulation Modulation i.e. radio.modulation.AM or radio.modulation.FM
|
-- @param #number Modulation Modulation i.e. radio.modulation.AM or radio.modulation.FM
|
||||||
-- @param #string Label (Optional) Short label to be used on the SRS Client Overlay
|
-- @param #string Label (Optional) Short label to be used on the SRS Client Overlay
|
||||||
-- @param #string Gender (Optional) Defaults to "male"
|
-- @param #string Gender (Optional) Defaults to "male"
|
||||||
-- @param #string Culture (Optional) Defaults to "en-US"
|
-- @param #string Culture (Optional) Defaults to "en-US"
|
||||||
-- @param #number Port (Optional) Defaults to 5002
|
-- @param #number Port (Optional) Defaults to 5002
|
||||||
-- @param #string Voice (Optional) Use a specifc voice with the @{Sound.SRS.SetVoice} function, e.g, `:SetVoice("Microsoft Hedda Desktop")`.
|
-- @param #string Voice (Optional) Use a specifc voice with the @{Sound.SRS#SetVoice} function, e.g, `:SetVoice("Microsoft Hedda Desktop")`.
|
||||||
-- Note that this must be installed on your windows system. Can also be Google voice types, if you are using Google TTS.
|
-- Note that this must be installed on your windows system. Can also be Google voice types, if you are using Google TTS.
|
||||||
-- @param #number Volume (Optional) Volume - between 0.0 (silent) and 1.0 (loudest)
|
-- @param #number Volume (Optional) Volume - between 0.0 (silent) and 1.0 (loudest)
|
||||||
-- @param #string PathToGoogleKey (Optional) Path to your google key if you want to use google TTS
|
-- @param #string PathToGoogleKey (Optional) Path to your google key if you want to use google TTS
|
||||||
@@ -412,18 +470,18 @@ end
|
|||||||
function AUTOLASE:SetUsingSRS(OnOff,Path,Frequency,Modulation,Label,Gender,Culture,Port,Voice,Volume,PathToGoogleKey)
|
function AUTOLASE:SetUsingSRS(OnOff,Path,Frequency,Modulation,Label,Gender,Culture,Port,Voice,Volume,PathToGoogleKey)
|
||||||
if OnOff then
|
if OnOff then
|
||||||
self.useSRS = true
|
self.useSRS = true
|
||||||
self.SRSPath = Path or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
self.SRSPath = Path or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
||||||
self.SRSFreq = Frequency or 271
|
self.SRSFreq = Frequency or 271
|
||||||
self.SRSMod = Modulation or radio.modulation.AM
|
self.SRSMod = Modulation or radio.modulation.AM
|
||||||
self.Gender = Gender or "male"
|
self.Gender = Gender or MSRS.gender or "male"
|
||||||
self.Culture = Culture or "en-US"
|
self.Culture = Culture or MSRS.culture or "en-US"
|
||||||
self.Port = Port or 5002
|
self.Port = Port or MSRS.port or 5002
|
||||||
self.Voice = Voice
|
self.Voice = Voice
|
||||||
self.PathToGoogleKey = PathToGoogleKey
|
self.PathToGoogleKey = PathToGoogleKey
|
||||||
self.Volume = Volume or 1.0
|
self.Volume = Volume or 1.0
|
||||||
self.Label = Label
|
self.Label = Label
|
||||||
-- set up SRS
|
-- set up SRS
|
||||||
self.SRS = MSRS:New(self.SRSPath,self.SRSFreq,self.SRSMod,self.Volume)
|
self.SRS = MSRS:New(self.SRSPath,self.SRSFreq,self.SRSMod)
|
||||||
self.SRS:SetCoalition(self.coalition)
|
self.SRS:SetCoalition(self.coalition)
|
||||||
self.SRS:SetLabel(self.MenuName or self.Name)
|
self.SRS:SetLabel(self.MenuName or self.Name)
|
||||||
self.SRS:SetGender(self.Gender)
|
self.SRS:SetGender(self.Gender)
|
||||||
@@ -431,8 +489,10 @@ function AUTOLASE:SetUsingSRS(OnOff,Path,Frequency,Modulation,Label,Gender,Cultu
|
|||||||
self.SRS:SetPort(self.Port)
|
self.SRS:SetPort(self.Port)
|
||||||
self.SRS:SetVoice(self.Voice)
|
self.SRS:SetVoice(self.Voice)
|
||||||
self.SRS:SetCoalition(self.coalition)
|
self.SRS:SetCoalition(self.coalition)
|
||||||
|
self.SRS:SetVolume(self.Volume)
|
||||||
if self.PathToGoogleKey then
|
if self.PathToGoogleKey then
|
||||||
self.SRS:SetGoogle(self.PathToGoogleKey)
|
self.SRS:SetProviderOptionsGoogle(PathToGoogleKey,PathToGoogleKey)
|
||||||
|
self.SRS:SetProvider(MSRS.Provider.GOOGLE)
|
||||||
end
|
end
|
||||||
self.SRSQueue = MSRSQUEUE:New(self.alias)
|
self.SRSQueue = MSRSQUEUE:New(self.alias)
|
||||||
else
|
else
|
||||||
@@ -465,10 +525,20 @@ end
|
|||||||
-- @param #AUTOLASE self
|
-- @param #AUTOLASE self
|
||||||
-- @param #string RecceName (Unit!) Name of the Recce
|
-- @param #string RecceName (Unit!) Name of the Recce
|
||||||
-- @param #number Code The lase code
|
-- @param #number Code The lase code
|
||||||
|
-- @param #boolean Refresh If true, refresh menu entries
|
||||||
-- @return #AUTOLASE self
|
-- @return #AUTOLASE self
|
||||||
function AUTOLASE:SetRecceLaserCode(RecceName, Code)
|
function AUTOLASE:SetRecceLaserCode(RecceName, Code, Refresh)
|
||||||
local code = Code or 1688
|
local code = Code or 1688
|
||||||
self.RecceLaserCode[RecceName] = code
|
self.RecceLaserCode[RecceName] = code
|
||||||
|
if Refresh then
|
||||||
|
self:SetPilotMenu()
|
||||||
|
if self.notifypilots then
|
||||||
|
if string.find(RecceName,"#") then
|
||||||
|
RecceName = string.match(RecceName,"^(.*)#")
|
||||||
|
end
|
||||||
|
self:NotifyPilots(string.format("Code for %s set to: %d",RecceName,Code),15)
|
||||||
|
end
|
||||||
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -524,6 +594,41 @@ end
|
|||||||
function AUTOLASE:SetSmokeTargets(OnOff,Color)
|
function AUTOLASE:SetSmokeTargets(OnOff,Color)
|
||||||
self.smoketargets = OnOff
|
self.smoketargets = OnOff
|
||||||
self.smokecolor = Color or SMOKECOLOR.Red
|
self.smokecolor = Color or SMOKECOLOR.Red
|
||||||
|
local smktxt = OnOff == true and "on" or "off"
|
||||||
|
local Message = "Smoking targets is now "..smktxt.."!"
|
||||||
|
self:NotifyPilots(Message,10)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- (User) Show the "Switch smoke target..." menu entry for pilots. On by default.
|
||||||
|
-- @param #AUTOLASE self
|
||||||
|
-- @return #AUTOLASE self
|
||||||
|
function AUTOLASE:EnableSmokeMenu()
|
||||||
|
self.smokemenu = true
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- (User) Do not show the "Switch smoke target..." menu entry for pilots.
|
||||||
|
-- @param #AUTOLASE self
|
||||||
|
-- @return #AUTOLASE self
|
||||||
|
function AUTOLASE:DisableSmokeMenu()
|
||||||
|
self.smokemenu = false
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- (User) Show the "Switch min threat lasing..." menu entry for pilots. On by default.
|
||||||
|
-- @param #AUTOLASE self
|
||||||
|
-- @return #AUTOLASE self
|
||||||
|
function AUTOLASE:EnableThreatLevelMenu()
|
||||||
|
self.threatmenu = true
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- (User) Do not show the "Switch min threat lasing..." menu entry for pilots.
|
||||||
|
-- @param #AUTOLASE self
|
||||||
|
-- @return #AUTOLASE self
|
||||||
|
function AUTOLASE:DisableThreatLevelMenu()
|
||||||
|
self.threatmenu = false
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -654,6 +759,7 @@ function AUTOLASE:ShowStatus(Group,Unit)
|
|||||||
report:Add(string.format("Recce %s has code %d",name,code))
|
report:Add(string.format("Recce %s has code %d",name,code))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
report:Add(string.format("Lasing min threat level %d",self.minthreatlevel))
|
||||||
local lines = 0
|
local lines = 0
|
||||||
for _ind,_entry in pairs(self.CurrentLasing) do
|
for _ind,_entry in pairs(self.CurrentLasing) do
|
||||||
local entry = _entry -- #AUTOLASE.LaserSpot
|
local entry = _entry -- #AUTOLASE.LaserSpot
|
||||||
@@ -673,7 +779,7 @@ function AUTOLASE:ShowStatus(Group,Unit)
|
|||||||
if playername then
|
if playername then
|
||||||
local settings = _DATABASE:GetPlayerSettings(playername)
|
local settings = _DATABASE:GetPlayerSettings(playername)
|
||||||
if settings then
|
if settings then
|
||||||
--self:I("Get Settings ok!")
|
self:I("Get Settings ok!")
|
||||||
if settings:IsA2G_MGRS() then
|
if settings:IsA2G_MGRS() then
|
||||||
locationstring = entry.coordinate:ToStringMGRS(settings)
|
locationstring = entry.coordinate:ToStringMGRS(settings)
|
||||||
elseif settings:IsA2G_LL_DMS() then
|
elseif settings:IsA2G_LL_DMS() then
|
||||||
@@ -838,12 +944,12 @@ function AUTOLASE:onafterMonitor(From, Event, To)
|
|||||||
|
|
||||||
self:SetPilotMenu()
|
self:SetPilotMenu()
|
||||||
|
|
||||||
local detecteditems = self.Contacts or {} -- #table of Ops.Intelligence#INTEL.Contact
|
local detecteditems = self.Contacts or {} -- #table of Ops.Intel#INTEL.Contact
|
||||||
local groupsbythreat = {}
|
local groupsbythreat = {}
|
||||||
local report = REPORT:New("Detections")
|
local report = REPORT:New("Detections")
|
||||||
local lines = 0
|
local lines = 0
|
||||||
for _,_contact in pairs(detecteditems) do
|
for _,_contact in pairs(detecteditems) do
|
||||||
local contact = _contact -- Ops.Intelligence#INTEL.Contact
|
local contact = _contact -- Ops.Intel#INTEL.Contact
|
||||||
local grp = contact.group
|
local grp = contact.group
|
||||||
local coord = contact.position
|
local coord = contact.position
|
||||||
local reccename = contact.recce or "none"
|
local reccename = contact.recce or "none"
|
||||||
@@ -995,6 +1101,9 @@ end
|
|||||||
function AUTOLASE:onbeforeRecceKIA(From,Event,To,RecceName)
|
function AUTOLASE:onbeforeRecceKIA(From,Event,To,RecceName)
|
||||||
self:T({From, Event, To, RecceName})
|
self:T({From, Event, To, RecceName})
|
||||||
if self.notifypilots or self.debug then
|
if self.notifypilots or self.debug then
|
||||||
|
if string.find(RecceName,"#") then
|
||||||
|
RecceName = string.match(RecceName,"^(.*)#")
|
||||||
|
end
|
||||||
local text = string.format("Recce %s KIA!",RecceName)
|
local text = string.format("Recce %s KIA!",RecceName)
|
||||||
self:NotifyPilots(text,self.reporttimeshort)
|
self:NotifyPilots(text,self.reporttimeshort)
|
||||||
end
|
end
|
||||||
@@ -1029,6 +1138,9 @@ end
|
|||||||
function AUTOLASE:onbeforeTargetLost(From,Event,To,UnitName,RecceName)
|
function AUTOLASE:onbeforeTargetLost(From,Event,To,UnitName,RecceName)
|
||||||
self:T({From, Event, To, UnitName,RecceName})
|
self:T({From, Event, To, UnitName,RecceName})
|
||||||
if self.notifypilots or self.debug then
|
if self.notifypilots or self.debug then
|
||||||
|
if string.find(RecceName,"#") then
|
||||||
|
RecceName = string.match(RecceName,"^(.*)#")
|
||||||
|
end
|
||||||
local text = string.format("%s lost sight of unit %s.",RecceName,UnitName)
|
local text = string.format("%s lost sight of unit %s.",RecceName,UnitName)
|
||||||
self:NotifyPilots(text,self.reporttimeshort)
|
self:NotifyPilots(text,self.reporttimeshort)
|
||||||
end
|
end
|
||||||
@@ -1046,6 +1158,9 @@ end
|
|||||||
function AUTOLASE:onbeforeLaserTimeout(From,Event,To,UnitName,RecceName)
|
function AUTOLASE:onbeforeLaserTimeout(From,Event,To,UnitName,RecceName)
|
||||||
self:T({From, Event, To, UnitName,RecceName})
|
self:T({From, Event, To, UnitName,RecceName})
|
||||||
if self.notifypilots or self.debug then
|
if self.notifypilots or self.debug then
|
||||||
|
if string.find(RecceName,"#") then
|
||||||
|
RecceName = string.match(RecceName,"^(.*)#")
|
||||||
|
end
|
||||||
local text = string.format("%s laser timeout on unit %s.",RecceName,UnitName)
|
local text = string.format("%s laser timeout on unit %s.",RecceName,UnitName)
|
||||||
self:NotifyPilots(text,self.reporttimeshort)
|
self:NotifyPilots(text,self.reporttimeshort)
|
||||||
end
|
end
|
||||||
@@ -1063,10 +1178,9 @@ function AUTOLASE:onbeforeLasing(From,Event,To,LaserSpot)
|
|||||||
self:T({From, Event, To, LaserSpot.unittype})
|
self:T({From, Event, To, LaserSpot.unittype})
|
||||||
if self.notifypilots or self.debug then
|
if self.notifypilots or self.debug then
|
||||||
local laserspot = LaserSpot -- #AUTOLASE.LaserSpot
|
local laserspot = LaserSpot -- #AUTOLASE.LaserSpot
|
||||||
local name = laserspot.reccename
|
local name = laserspot.reccename if string.find(name,"#") then
|
||||||
if string.find(name,"#") then
|
|
||||||
name = string.match(name,"^(.*)#")
|
name = string.match(name,"^(.*)#")
|
||||||
end
|
end
|
||||||
local text = string.format("%s is lasing %s code %d\nat %s",name,laserspot.unittype,laserspot.lasercode,laserspot.location)
|
local text = string.format("%s is lasing %s code %d\nat %s",name,laserspot.unittype,laserspot.lasercode,laserspot.location)
|
||||||
self:NotifyPilots(text,self.reporttimeshort+5)
|
self:NotifyPilots(text,self.reporttimeshort+5)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [CLA - CleanUp Airbase](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CLA%20-%20CleanUp%20Airbase)
|
-- [CLA - CleanUp Airbase](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/CleanUp)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -15,9 +15,11 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Additional Material:
|
||||||
--
|
--
|
||||||
-- [DES - Designation](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/DES%20-%20Designation)
|
-- * **Demo Missions:** [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Designate)
|
||||||
|
-- * **YouTube videos:** None
|
||||||
|
-- * **Guides:** None
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -167,9 +169,9 @@
|
|||||||
--
|
--
|
||||||
-- ### Contributions:
|
-- ### Contributions:
|
||||||
--
|
--
|
||||||
-- * [**Ciribob**](https://forums.eagle.ru/member.php?u=112175): Showing the way how to lase targets + how laser codes work!!! Explained the autolase script.
|
-- * **Ciribob**: Showing the way how to lase targets + how laser codes work!!! Explained the autolase script.
|
||||||
-- * [**EasyEB**](https://forums.eagle.ru/member.php?u=112055): Ideas and Beta Testing
|
-- * **EasyEB**: Ideas and Beta Testing
|
||||||
-- * [**Wingthor**](https://forums.eagle.ru/member.php?u=123698): Beta Testing
|
-- * **Wingthor**: Beta Testing
|
||||||
--
|
--
|
||||||
-- ### Authors:
|
-- ### Authors:
|
||||||
--
|
--
|
||||||
@@ -182,7 +184,7 @@
|
|||||||
|
|
||||||
do -- DESIGNATE
|
do -- DESIGNATE
|
||||||
|
|
||||||
--- @type DESIGNATE
|
-- @type DESIGNATE
|
||||||
-- @extends Core.Fsm#FSM_PROCESS
|
-- @extends Core.Fsm#FSM_PROCESS
|
||||||
|
|
||||||
--- Manage the designation of detected targets.
|
--- Manage the designation of detected targets.
|
||||||
@@ -523,7 +525,7 @@ do -- DESIGNATE
|
|||||||
|
|
||||||
self.AttackSet:ForEachGroupAlive(
|
self.AttackSet:ForEachGroupAlive(
|
||||||
|
|
||||||
--- @param Wrapper.Group#GROUP AttackGroup
|
-- @param Wrapper.Group#GROUP AttackGroup
|
||||||
function( AttackGroup )
|
function( AttackGroup )
|
||||||
self.FlashStatusMenu[AttackGroup] = FlashMenu
|
self.FlashStatusMenu[AttackGroup] = FlashMenu
|
||||||
end
|
end
|
||||||
@@ -552,7 +554,7 @@ do -- DESIGNATE
|
|||||||
|
|
||||||
self.AttackSet:ForEachGroupAlive(
|
self.AttackSet:ForEachGroupAlive(
|
||||||
|
|
||||||
--- @param Wrapper.Group#GROUP AttackGroup
|
-- @param Wrapper.Group#GROUP AttackGroup
|
||||||
function( AttackGroup )
|
function( AttackGroup )
|
||||||
self.FlashDetectionMessage[AttackGroup] = FlashDetectionMessage
|
self.FlashDetectionMessage[AttackGroup] = FlashDetectionMessage
|
||||||
end
|
end
|
||||||
@@ -824,7 +826,7 @@ do -- DESIGNATE
|
|||||||
-- This Detection is obsolete, remove from the designate scope
|
-- This Detection is obsolete, remove from the designate scope
|
||||||
self.Designating[DesignateIndex] = nil
|
self.Designating[DesignateIndex] = nil
|
||||||
self.AttackSet:ForEachGroupAlive(
|
self.AttackSet:ForEachGroupAlive(
|
||||||
--- @param Wrapper.Group#GROUP AttackGroup
|
-- @param Wrapper.Group#GROUP AttackGroup
|
||||||
function( AttackGroup )
|
function( AttackGroup )
|
||||||
if AttackGroup:IsAlive() == true then
|
if AttackGroup:IsAlive() == true then
|
||||||
local DetectionText = self.Detection:DetectedItemReportSummary( DetectedItem, AttackGroup ):Text( ", " )
|
local DetectionText = self.Detection:DetectedItemReportSummary( DetectedItem, AttackGroup ):Text( ", " )
|
||||||
@@ -901,7 +903,7 @@ do -- DESIGNATE
|
|||||||
|
|
||||||
self.AttackSet:ForEachGroupAlive(
|
self.AttackSet:ForEachGroupAlive(
|
||||||
|
|
||||||
--- @param Wrapper.Group#GROUP GroupReport
|
-- @param Wrapper.Group#GROUP GroupReport
|
||||||
function( AttackGroup )
|
function( AttackGroup )
|
||||||
|
|
||||||
if self.FlashStatusMenu[AttackGroup] or ( MenuAttackGroup and ( AttackGroup:GetName() == MenuAttackGroup:GetName() ) ) then
|
if self.FlashStatusMenu[AttackGroup] or ( MenuAttackGroup and ( AttackGroup:GetName() == MenuAttackGroup:GetName() ) ) then
|
||||||
@@ -1058,7 +1060,7 @@ do -- DESIGNATE
|
|||||||
|
|
||||||
self.AttackSet:ForEachGroupAlive(
|
self.AttackSet:ForEachGroupAlive(
|
||||||
|
|
||||||
--- @param Wrapper.Group#GROUP GroupReport
|
-- @param Wrapper.Group#GROUP GroupReport
|
||||||
function( AttackGroup )
|
function( AttackGroup )
|
||||||
|
|
||||||
self:ScheduleOnce( Delay, self.SetMenu, self, AttackGroup )
|
self:ScheduleOnce( Delay, self.SetMenu, self, AttackGroup )
|
||||||
@@ -1196,7 +1198,7 @@ do -- DESIGNATE
|
|||||||
--local ReportTypes = REPORT:New()
|
--local ReportTypes = REPORT:New()
|
||||||
--local ReportLaserCodes = REPORT:New()
|
--local ReportLaserCodes = REPORT:New()
|
||||||
|
|
||||||
TargetSetUnit:Flush( self )
|
--TargetSetUnit:Flush( self )
|
||||||
|
|
||||||
--self:F( { Recces = self.Recces } )
|
--self:F( { Recces = self.Recces } )
|
||||||
for TargetUnit, RecceData in pairs( self.Recces ) do
|
for TargetUnit, RecceData in pairs( self.Recces ) do
|
||||||
@@ -1227,10 +1229,12 @@ do -- DESIGNATE
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if TargetSetUnit == nil then return end
|
||||||
|
|
||||||
if self.AutoLase or ( not self.AutoLase and ( self.LaseStart + Duration >= timer.getTime() ) ) then
|
if self.AutoLase or ( not self.AutoLase and ( self.LaseStart + Duration >= timer.getTime() ) ) then
|
||||||
|
|
||||||
TargetSetUnit:ForEachUnitPerThreatLevel( 10, 0,
|
TargetSetUnit:ForEachUnitPerThreatLevel( 10, 0,
|
||||||
--- @param Wrapper.Unit#UNIT SmokeUnit
|
-- @param Wrapper.Unit#UNIT SmokeUnit
|
||||||
function( TargetUnit )
|
function( TargetUnit )
|
||||||
|
|
||||||
self:F( { TargetUnit = TargetUnit:GetName() } )
|
self:F( { TargetUnit = TargetUnit:GetName() } )
|
||||||
@@ -1251,7 +1255,7 @@ do -- DESIGNATE
|
|||||||
|
|
||||||
local RecceUnit = UnitData -- Wrapper.Unit#UNIT
|
local RecceUnit = UnitData -- Wrapper.Unit#UNIT
|
||||||
local RecceUnitDesc = RecceUnit:GetDesc()
|
local RecceUnitDesc = RecceUnit:GetDesc()
|
||||||
--self:F( { RecceUnit = RecceUnit:GetName(), RecceDescription = RecceUnitDesc } )
|
--self:F( { RecceUnit = RecceUnit:GetName(), RecceDescription = RecceUnitDesc } )x
|
||||||
|
|
||||||
if RecceUnit:IsLasing() == false then
|
if RecceUnit:IsLasing() == false then
|
||||||
--self:F( { IsDetected = RecceUnit:IsDetected( TargetUnit ), IsLOS = RecceUnit:IsLOS( TargetUnit ) } )
|
--self:F( { IsDetected = RecceUnit:IsDetected( TargetUnit ), IsLOS = RecceUnit:IsLOS( TargetUnit ) } )
|
||||||
@@ -1273,9 +1277,10 @@ do -- DESIGNATE
|
|||||||
local Spot = RecceUnit:LaseUnit( TargetUnit, LaserCode, Duration )
|
local Spot = RecceUnit:LaseUnit( TargetUnit, LaserCode, Duration )
|
||||||
local AttackSet = self.AttackSet
|
local AttackSet = self.AttackSet
|
||||||
local DesignateName = self.DesignateName
|
local DesignateName = self.DesignateName
|
||||||
|
local typename = TargetUnit:GetTypeName()
|
||||||
|
|
||||||
function Spot:OnAfterDestroyed( From, Event, To )
|
function Spot:OnAfterDestroyed( From, Event, To )
|
||||||
self.Recce:MessageToSetGroup( "Target " .. TargetUnit:GetTypeName() .. " destroyed. " .. TargetSetUnit:Count() .. " targets left.",
|
self.Recce:MessageToSetGroup( "Target " ..typename .. " destroyed. " .. TargetSetUnit:CountAlive() .. " targets left.",
|
||||||
5, AttackSet, self.DesignateName )
|
5, AttackSet, self.DesignateName )
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1283,7 +1288,7 @@ do -- DESIGNATE
|
|||||||
-- OK. We have assigned for the Recce a TargetUnit. We can exit the function.
|
-- OK. We have assigned for the Recce a TargetUnit. We can exit the function.
|
||||||
MarkingCount = MarkingCount + 1
|
MarkingCount = MarkingCount + 1
|
||||||
local TargetUnitType = TargetUnit:GetTypeName()
|
local TargetUnitType = TargetUnit:GetTypeName()
|
||||||
RecceUnit:MessageToSetGroup( "Marking " .. TargetUnit:GetTypeName() .. " with laser " .. RecceUnit:GetSpot().LaserCode .. " for " .. Duration .. "s.",
|
RecceUnit:MessageToSetGroup( "Marking " .. TargetUnitType .. " with laser " .. RecceUnit:GetSpot().LaserCode .. " for " .. Duration .. "s.",
|
||||||
10, self.AttackSet, DesignateName )
|
10, self.AttackSet, DesignateName )
|
||||||
if not MarkedTypes[TargetUnitType] then
|
if not MarkedTypes[TargetUnitType] then
|
||||||
MarkedTypes[TargetUnitType] = true
|
MarkedTypes[TargetUnitType] = true
|
||||||
@@ -1390,7 +1395,7 @@ do -- DESIGNATE
|
|||||||
local MarkedCount = 0
|
local MarkedCount = 0
|
||||||
|
|
||||||
TargetSetUnit:ForEachUnitPerThreatLevel( 10, 0,
|
TargetSetUnit:ForEachUnitPerThreatLevel( 10, 0,
|
||||||
--- @param Wrapper.Unit#UNIT SmokeUnit
|
-- @param Wrapper.Unit#UNIT SmokeUnit
|
||||||
function( SmokeUnit )
|
function( SmokeUnit )
|
||||||
|
|
||||||
if MarkedCount < self.MaximumMarkings then
|
if MarkedCount < self.MaximumMarkings then
|
||||||
@@ -1455,9 +1460,10 @@ do -- DESIGNATE
|
|||||||
-- @param #DESIGNATE self
|
-- @param #DESIGNATE self
|
||||||
-- @return #DESIGNATE
|
-- @return #DESIGNATE
|
||||||
function DESIGNATE:onafterDoneSmoking( From, Event, To, Index )
|
function DESIGNATE:onafterDoneSmoking( From, Event, To, Index )
|
||||||
|
if self.Designating[Index] ~= nil then
|
||||||
self.Designating[Index] = string.gsub( self.Designating[Index], "S", "" )
|
self.Designating[Index] = string.gsub( self.Designating[Index], "S", "" )
|
||||||
self:SetDesignateMenu()
|
self:SetDesignateMenu()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- DoneIlluminating
|
--- DoneIlluminating
|
||||||
@@ -1470,5 +1476,3 @@ do -- DESIGNATE
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [DET - Detection](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/DET%20-%20Detection)
|
-- [DET - Detection](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/Functional/Detection)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -39,7 +39,8 @@
|
|||||||
|
|
||||||
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.
|
||||||
@@ -91,6 +92,11 @@ do -- DETECTION_BASE
|
|||||||
--
|
--
|
||||||
-- DetectionObject:FilterCategories( { Unit.Category.AIRPLANE, Unit.Category.HELICOPTER } )
|
-- DetectionObject:FilterCategories( { Unit.Category.AIRPLANE, Unit.Category.HELICOPTER } )
|
||||||
--
|
--
|
||||||
|
--
|
||||||
|
-- ## Radar Blur - use to make the radar less exact, e.g. for WWII scenarios
|
||||||
|
--
|
||||||
|
-- * @{#DETECTION_BASE.SetRadarBlur}(): Set the radar blur to be used.
|
||||||
|
--
|
||||||
-- ## **DETECTION_ derived classes** group the detected units into a **DetectedItems[]** list
|
-- ## **DETECTION_ derived classes** group the detected units into a **DetectedItems[]** list
|
||||||
--
|
--
|
||||||
-- DETECTION_BASE derived classes build a list called DetectedItems[], which is essentially a first later
|
-- DETECTION_BASE derived classes build a list called DetectedItems[], which is essentially a first later
|
||||||
@@ -269,10 +275,12 @@ do -- DETECTION_BASE
|
|||||||
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
|
||||||
@@ -284,7 +292,8 @@ do -- DETECTION_BASE
|
|||||||
-- @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.
|
||||||
@@ -522,7 +531,7 @@ do -- DETECTION_BASE
|
|||||||
|
|
||||||
do -- State Transition Handling
|
do -- State Transition Handling
|
||||||
|
|
||||||
--- @param #DETECTION_BASE self
|
-- @param #DETECTION_BASE self
|
||||||
-- @param #string From The From State string.
|
-- @param #string From The From State string.
|
||||||
-- @param #string Event The Event string.
|
-- @param #string Event The Event string.
|
||||||
-- @param #string To The To State string.
|
-- @param #string To The To State string.
|
||||||
@@ -530,13 +539,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.1
|
local DetectDelay = 0.15
|
||||||
self.DetectionCount = 0
|
self.DetectionCount = 0
|
||||||
self.DetectionRun = 0
|
self.DetectionRun = 0
|
||||||
self:UnIdentifyAllDetectedObjects() -- Resets the DetectedObjectsIdentified table
|
self:UnIdentifyAllDetectedObjects() -- Resets the DetectedObjectsIdentified table
|
||||||
@@ -570,7 +579,7 @@ do -- DETECTION_BASE
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #DETECTION_BASE self
|
-- @param #DETECTION_BASE self
|
||||||
-- @param #number The amount of alive recce.
|
-- @param #number The amount of alive recce.
|
||||||
function DETECTION_BASE:CountAliveRecce()
|
function DETECTION_BASE:CountAliveRecce()
|
||||||
|
|
||||||
@@ -578,7 +587,7 @@ do -- DETECTION_BASE
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #DETECTION_BASE self
|
-- @param #DETECTION_BASE self
|
||||||
function DETECTION_BASE:ForEachAliveRecce( IteratorFunction, ... )
|
function DETECTION_BASE:ForEachAliveRecce( IteratorFunction, ... )
|
||||||
self:F2( arg )
|
self:F2( arg )
|
||||||
|
|
||||||
@@ -587,7 +596,7 @@ do -- DETECTION_BASE
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #DETECTION_BASE self
|
-- @param #DETECTION_BASE self
|
||||||
-- @param #string From The From State string.
|
-- @param #string From The From State string.
|
||||||
-- @param #string Event The Event string.
|
-- @param #string Event The Event string.
|
||||||
-- @param #string To The To State string.
|
-- @param #string To The To State string.
|
||||||
@@ -595,7 +604,7 @@ do -- DETECTION_BASE
|
|||||||
-- @param #number DetectionTimeStamp Time stamp of detection event.
|
-- @param #number DetectionTimeStamp Time stamp of detection event.
|
||||||
function DETECTION_BASE:onafterDetection( From, Event, To, Detection, DetectionTimeStamp )
|
function DETECTION_BASE:onafterDetection( From, Event, To, Detection, DetectionTimeStamp )
|
||||||
|
|
||||||
-- self:F( { DetectedObjects = self.DetectedObjects } )
|
self:I( { DetectedObjects = self.DetectedObjects } )
|
||||||
|
|
||||||
self.DetectionRun = self.DetectionRun + 1
|
self.DetectionRun = self.DetectionRun + 1
|
||||||
|
|
||||||
@@ -603,14 +612,14 @@ do -- DETECTION_BASE
|
|||||||
|
|
||||||
if Detection and Detection:IsAlive() then
|
if Detection and Detection:IsAlive() then
|
||||||
|
|
||||||
-- self:T( { "DetectionGroup is Alive", DetectionGroup:GetName() } )
|
self:I( { "DetectionGroup is Alive", Detection:GetName() } )
|
||||||
|
|
||||||
local DetectionGroupName = Detection:GetName()
|
local DetectionGroupName = Detection:GetName()
|
||||||
local DetectionUnit = Detection:GetUnit( 1 )
|
local DetectionUnit = Detection:GetUnit( 1 )
|
||||||
|
|
||||||
local DetectedUnits = {}
|
local DetectedUnits = {}
|
||||||
|
|
||||||
local DetectedTargets = Detection:GetDetectedTargets(
|
local DetectedTargets = DetectionUnit:GetDetectedTargets(
|
||||||
self.DetectVisual,
|
self.DetectVisual,
|
||||||
self.DetectOptical,
|
self.DetectOptical,
|
||||||
self.DetectRadar,
|
self.DetectRadar,
|
||||||
@@ -619,7 +628,9 @@ do -- DETECTION_BASE
|
|||||||
self.DetectDLINK
|
self.DetectDLINK
|
||||||
)
|
)
|
||||||
|
|
||||||
self:F( { DetectedTargets = DetectedTargets } )
|
--self:I( { DetectedTargets = DetectedTargets } )
|
||||||
|
--self:I(UTILS.PrintTableToLog(DetectedTargets))
|
||||||
|
|
||||||
|
|
||||||
for DetectionObjectID, Detection in pairs( DetectedTargets ) do
|
for DetectionObjectID, Detection in pairs( DetectedTargets ) do
|
||||||
local DetectedObject = Detection.object -- DCS#Object
|
local DetectedObject = Detection.object -- DCS#Object
|
||||||
@@ -712,6 +723,31 @@ do -- DETECTION_BASE
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Calculate radar blur probability
|
||||||
|
|
||||||
|
if self.RadarBlur then
|
||||||
|
MESSAGE:New("Radar Blur",10):ToLogIf(self.debug):ToAllIf(self.verbose)
|
||||||
|
local minheight = self.RadarBlurMinHeight or 250 -- meters
|
||||||
|
local thresheight = self.RadarBlurThresHeight or 90 -- 10% chance to find a low flying group
|
||||||
|
local thresblur = self.RadarBlurThresBlur or 85 -- 25% chance to escape the radar overall
|
||||||
|
local dist = math.floor(Distance)
|
||||||
|
if dist <= self.RadarBlurClosing then
|
||||||
|
thresheight = (((dist*dist)/self.RadarBlurClosingSquare)*thresheight)
|
||||||
|
thresblur = (((dist*dist)/self.RadarBlurClosingSquare)*thresblur)
|
||||||
|
end
|
||||||
|
local fheight = math.floor(math.random(1,10000)/100)
|
||||||
|
local fblur = math.floor(math.random(1,10000)/100)
|
||||||
|
local unit = UNIT:FindByName(DetectedObjectName)
|
||||||
|
if unit and unit:IsAlive() then
|
||||||
|
local AGL = unit:GetAltitude(true)
|
||||||
|
MESSAGE:New("Unit "..DetectedObjectName.." is at "..math.floor(AGL).."m. Distance "..math.floor(Distance).."km.",10):ToLogIf(self.debug):ToAllIf(self.verbose)
|
||||||
|
MESSAGE:New(string.format("fheight = %d/%d | fblur = %d/%d",fheight,thresheight,fblur,thresblur),10):ToLogIf(self.debug):ToAllIf(self.verbose)
|
||||||
|
if fblur > thresblur then DetectionAccepted = false end
|
||||||
|
if AGL <= minheight and fheight < thresheight then DetectionAccepted = false end
|
||||||
|
MESSAGE:New("Detection Accepted = "..tostring(DetectionAccepted),10):ToLogIf(self.debug):ToAllIf(self.verbose)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Calculate additional probabilities
|
-- Calculate additional probabilities
|
||||||
|
|
||||||
if not self.DetectedObjects[DetectedObjectName] and TargetIsVisible and self.DistanceProbability then
|
if not self.DetectedObjects[DetectedObjectName] and TargetIsVisible and self.DistanceProbability then
|
||||||
@@ -1012,6 +1048,23 @@ do -- DETECTION_BASE
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Method to make the radar detection less accurate, e.g. for WWII scenarios.
|
||||||
|
-- @param #DETECTION_BASE self
|
||||||
|
-- @param #number minheight Minimum flight height to be detected, in meters AGL (above ground)
|
||||||
|
-- @param #number thresheight Threshold to escape the radar if flying below minheight, defaults to 90 (90% escape chance)
|
||||||
|
-- @param #number thresblur Threshold to be detected by the radar overall, defaults to 85 (85% chance to be found)
|
||||||
|
-- @param #number closing Closing-in in km - the limit of km from which on it becomes increasingly difficult to escape radar detection if flying towards the radar position. Should be about 1/3 of the radar detection radius in kilometers, defaults to 20.
|
||||||
|
-- @return #DETECTION_BASE self
|
||||||
|
function DETECTION_BASE:SetRadarBlur(minheight,thresheight,thresblur,closing)
|
||||||
|
self.RadarBlur = true
|
||||||
|
self.RadarBlurMinHeight = minheight or 250 -- meters
|
||||||
|
self.RadarBlurThresHeight = thresheight or 90 -- 10% chance to find a low flying group
|
||||||
|
self.RadarBlurThresBlur = thresblur or 85 -- 25% chance to escape the radar overall
|
||||||
|
self.RadarBlurClosing = closing or 20 -- 20km
|
||||||
|
self.RadarBlurClosingSquare = self.RadarBlurClosing * self.RadarBlurClosing
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
do
|
do
|
||||||
@@ -1354,7 +1407,7 @@ do -- DETECTION_BASE
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
--- @param DCS#Unit FoundDCSUnit
|
-- @param DCS#Unit FoundDCSUnit
|
||||||
-- @param Wrapper.Group#GROUP ReportGroup
|
-- @param Wrapper.Group#GROUP ReportGroup
|
||||||
-- @param Core.Set#SET_GROUP ReportSetGroup
|
-- @param Core.Set#SET_GROUP ReportSetGroup
|
||||||
local FindNearByFriendlies = function( FoundDCSUnit, ReportGroupData )
|
local FindNearByFriendlies = function( FoundDCSUnit, ReportGroupData )
|
||||||
@@ -1419,7 +1472,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 )
|
||||||
|
|
||||||
@@ -1976,7 +2029,8 @@ 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
|
||||||
|
|
||||||
@@ -2232,7 +2286,8 @@ 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.
|
||||||
@@ -2435,7 +2490,8 @@ 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
|
||||||
@@ -2452,7 +2508,7 @@ do -- DETECTION_AREAS
|
|||||||
--
|
--
|
||||||
-- Retrieve the DetectedItems[].Set with the method @{Functional.Detection#DETECTION_BASE.GetDetectedSet}(). A @{Core.Set#SET_UNIT} object will be returned.
|
-- Retrieve the DetectedItems[].Set with the method @{Functional.Detection#DETECTION_BASE.GetDetectedSet}(). A @{Core.Set#SET_UNIT} object will be returned.
|
||||||
--
|
--
|
||||||
-- Retrieve the formed @{Zone@ZONE_UNIT}s as a result of the grouping the detected units within the DetectionZoneRange, use the method @{Functional.Detection#DETECTION_AREAS.GetDetectionZones}().
|
-- Retrieve the formed @{Core.Zone@ZONE_UNIT}s as a result of the grouping the detected units within the DetectionZoneRange, use the method @{Functional.Detection#DETECTION_AREAS.GetDetectionZones}().
|
||||||
-- To understand the amount of zones created, use the method @{Functional.Detection#DETECTION_AREAS.GetDetectionZoneCount}().
|
-- To understand the amount of zones created, use the method @{Functional.Detection#DETECTION_AREAS.GetDetectionZoneCount}().
|
||||||
-- If you want to obtain a specific zone from the DetectedZones, use the method @{Functional.Detection#DETECTION_AREAS.GetDetectionZoneByID}() with a given index.
|
-- If you want to obtain a specific zone from the DetectedZones, use the method @{Functional.Detection#DETECTION_AREAS.GetDetectionZoneByID}() with a given index.
|
||||||
--
|
--
|
||||||
@@ -2961,7 +3017,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() )
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ do -- DETECTION_ZONES
|
|||||||
--
|
--
|
||||||
-- Retrieve the DetectedItems[].Set with the method @{Functional.Detection#DETECTION_BASE.GetDetectedSet}(). A @{Core.Set#SET_UNIT} object will be returned.
|
-- Retrieve the DetectedItems[].Set with the method @{Functional.Detection#DETECTION_BASE.GetDetectedSet}(). A @{Core.Set#SET_UNIT} object will be returned.
|
||||||
--
|
--
|
||||||
-- Retrieve the formed @{Zone@ZONE_UNIT}s as a result of the grouping the detected units within the DetectionZoneRange, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZones}().
|
-- Retrieve the formed @{Core.Zone#ZONE_UNIT}s as a result of the grouping the detected units within the DetectionZoneRange, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZones}().
|
||||||
-- To understand the amount of zones created, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZoneCount}().
|
-- To understand the amount of zones created, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZoneCount}().
|
||||||
-- If you want to obtain a specific zone from the DetectedZones, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZone}() with a given index.
|
-- If you want to obtain a specific zone from the DetectedZones, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZone}() with a given index.
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -17,9 +17,11 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Additional Material:
|
||||||
--
|
--
|
||||||
-- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/ESC%20-%20Escorting)
|
-- * **Demo Missions:** [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Escort)
|
||||||
|
-- * **YouTube videos:** None
|
||||||
|
-- * **Guides:** None
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -252,7 +254,7 @@ end
|
|||||||
--- Set a Detection method for the EscortClient to be reported upon.
|
--- Set a Detection method for the EscortClient to be reported upon.
|
||||||
-- Detection methods are based on the derived classes from DETECTION_BASE.
|
-- Detection methods are based on the derived classes from DETECTION_BASE.
|
||||||
-- @param #ESCORT self
|
-- @param #ESCORT self
|
||||||
-- @param Function.Detection#DETECTION_BASE Detection
|
-- @param Functional.Detection#DETECTION_BASE Detection
|
||||||
function ESCORT:SetDetection( Detection )
|
function ESCORT:SetDetection( Detection )
|
||||||
|
|
||||||
self.Detection = Detection
|
self.Detection = Detection
|
||||||
|
|||||||
@@ -19,6 +19,10 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
|
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_Demos/tree/master/Functional/FOX)
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
|
--
|
||||||
-- ### Author: **funkyfranky**
|
-- ### Author: **funkyfranky**
|
||||||
-- @module Functional.Fox
|
-- @module Functional.Fox
|
||||||
-- @image Functional_FOX.png
|
-- @image Functional_FOX.png
|
||||||
@@ -58,7 +62,7 @@
|
|||||||
--
|
--
|
||||||
-- # The FOX Concept
|
-- # The FOX Concept
|
||||||
--
|
--
|
||||||
-- As you probably know [Fox](https://en.wikipedia.org/wiki/Fox_(code_word)) is a NATO brevity code for launching air-to-air munition. Therefore, the class name is not 100% accurate as this
|
-- As you probably know [Fox](https://en.wikipedia.org/wiki/Fox_\(code_word\)) is a NATO brevity code for launching air-to-air munition. Therefore, the class name is not 100% accurate as this
|
||||||
-- script handles air-to-air but also surface-to-air missiles.
|
-- script handles air-to-air but also surface-to-air missiles.
|
||||||
--
|
--
|
||||||
-- # Basic Script
|
-- # Basic Script
|
||||||
@@ -437,7 +441,7 @@ function FOX:SetProtectedGroupSet(groupset)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Add a group to the protected set.
|
--- Add a group to the protected set. Works only with AI!
|
||||||
-- @param #FOX self
|
-- @param #FOX self
|
||||||
-- @param Wrapper.Group#GROUP group Protected group.
|
-- @param Wrapper.Group#GROUP group Protected group.
|
||||||
-- @return #FOX self
|
-- @return #FOX self
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- ### [MANTIS - Modular, Automatic and Network capable Targeting and Interception System](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/MTS%20-%20Mantis/MTS-010%20-%20Basic%20Mantis%20Demo)
|
-- ### [MANTIS - Modular, Automatic and Network capable Targeting and Interception System](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Mantis)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
-- @module Functional.Mantis
|
-- @module Functional.Mantis
|
||||||
-- @image Functional.Mantis.jpg
|
-- @image Functional.Mantis.jpg
|
||||||
--
|
--
|
||||||
-- Last Update: Sept 2023
|
-- Last Update: May 2024
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
--- **MANTIS** class, extends Core.Base#BASE
|
--- **MANTIS** class, extends Core.Base#BASE
|
||||||
@@ -58,6 +58,7 @@
|
|||||||
-- @field #boolean ShoradLink If true, #MANTIS has #SHORAD enabled
|
-- @field #boolean ShoradLink If true, #MANTIS has #SHORAD enabled
|
||||||
-- @field #number ShoradTime Timer in seconds, how long #SHORAD will be active after a detection inside of the defense range
|
-- @field #number ShoradTime Timer in seconds, how long #SHORAD will be active after a detection inside of the defense range
|
||||||
-- @field #number ShoradActDistance Distance of an attacker in meters from a Mantis SAM site, on which Shorad will be switched on. Useful to not give away Shorad sites too early. Default 15km. Should be smaller than checkradius.
|
-- @field #number ShoradActDistance Distance of an attacker in meters from a Mantis SAM site, on which Shorad will be switched on. Useful to not give away Shorad sites too early. Default 15km. Should be smaller than checkradius.
|
||||||
|
-- @field #boolean checkforfriendlies If true, do not activate a SAM installation if a friendly aircraft is in firing range.
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
|
|
||||||
@@ -94,7 +95,7 @@
|
|||||||
-- Known SAM types at the time of writing are:
|
-- Known SAM types at the time of writing are:
|
||||||
--
|
--
|
||||||
-- * Avenger
|
-- * Avenger
|
||||||
-- * Chaparrel
|
-- * Chaparral
|
||||||
-- * Hawk
|
-- * Hawk
|
||||||
-- * Linebacker
|
-- * Linebacker
|
||||||
-- * NASAMS
|
-- * NASAMS
|
||||||
@@ -103,6 +104,7 @@
|
|||||||
-- * Roland
|
-- * Roland
|
||||||
-- * Silkworm (though strictly speaking this is a surface to ship missile)
|
-- * Silkworm (though strictly speaking this is a surface to ship missile)
|
||||||
-- * SA-2, SA-3, SA-5, SA-6, SA-7, SA-8, SA-9, SA-10, SA-11, SA-13, SA-15, SA-19
|
-- * SA-2, SA-3, SA-5, SA-6, SA-7, SA-8, SA-9, SA-10, SA-11, SA-13, SA-15, SA-19
|
||||||
|
-- * From IDF mod: STUNNER IDFA, TAMIR IDFA (Note all caps!)
|
||||||
-- * From HDS (see note on HDS below): SA-2, SA-3, SA-10B, SA-10C, SA-12, SA-17, SA-20A, SA-20B, SA-23, HQ-2
|
-- * From HDS (see note on HDS below): SA-2, SA-3, SA-10B, SA-10C, SA-12, SA-17, SA-20A, SA-20B, SA-23, HQ-2
|
||||||
--
|
--
|
||||||
-- * From SMA: RBS98M, RBS70, RBS90, RBS90M, RBS103A, RBS103B, RBS103AM, RBS103BM, Lvkv9040M
|
-- * From SMA: RBS98M, RBS70, RBS90, RBS90M, RBS103A, RBS103B, RBS103AM, RBS103BM, Lvkv9040M
|
||||||
@@ -186,29 +188,34 @@
|
|||||||
-- -- This is effectively a 3-stage filter allowing for zone overlap. A coordinate is accepted first when
|
-- -- This is effectively a 3-stage filter allowing for zone overlap. A coordinate is accepted first when
|
||||||
-- -- it is inside any AcceptZone. Then RejectZones are checked, which enforces both borders, but also overlaps of
|
-- -- it is inside any AcceptZone. Then RejectZones are checked, which enforces both borders, but also overlaps of
|
||||||
-- -- Accept- and RejectZones. Last, if it is inside a conflict zone, it is accepted.
|
-- -- Accept- and RejectZones. Last, if it is inside a conflict zone, it is accepted.
|
||||||
-- `mybluemantis:AddZones(AcceptZones,RejectZones,ConflictZones)`
|
-- mybluemantis:AddZones(AcceptZones,RejectZones,ConflictZones)
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
-- ### 2.1.2 Change the number of long-, mid- and short-range systems going live on a detected target:
|
-- ### 2.1.2 Change the number of long-, mid- and short-range systems going live on a detected target:
|
||||||
--
|
--
|
||||||
-- -- parameters are numbers. Defaults are 1,2,2,6 respectively
|
-- -- parameters are numbers. Defaults are 1,2,2,6 respectively
|
||||||
-- `mybluemantis:SetMaxActiveSAMs(Short,Mid,Long,Classic)`
|
-- mybluemantis:SetMaxActiveSAMs(Short,Mid,Long,Classic)
|
||||||
--
|
--
|
||||||
-- ### 2.1.3 SHORAD will automatically be added from SAM sites of type "short-range"
|
-- ### 2.1.3 SHORAD will automatically be added from SAM sites of type "short-range"
|
||||||
--
|
--
|
||||||
-- ### 2.1.4 Advanced features
|
-- ### 2.1.4 Advanced features
|
||||||
--
|
--
|
||||||
-- -- switch off auto mode **before** you start MANTIS.
|
-- -- switch off auto mode **before** you start MANTIS.
|
||||||
-- `mybluemantis.automode = false`
|
-- mybluemantis.automode = false
|
||||||
--
|
--
|
||||||
-- -- switch off auto shorad **before** you start MANTIS.
|
-- -- switch off auto shorad **before** you start MANTIS.
|
||||||
-- `mybluemantis.autoshorad = false`
|
-- mybluemantis.autoshorad = false
|
||||||
--
|
--
|
||||||
-- -- scale of the activation range, i.e. don't activate at the fringes of max range, defaults below.
|
-- -- scale of the activation range, i.e. don't activate at the fringes of max range, defaults below.
|
||||||
-- -- also see engagerange below.
|
-- -- also see engagerange below.
|
||||||
-- ` self.radiusscale[MANTIS.SamType.LONG] = 1.1`
|
-- self.radiusscale[MANTIS.SamType.LONG] = 1.1
|
||||||
-- ` self.radiusscale[MANTIS.SamType.MEDIUM] = 1.2`
|
-- self.radiusscale[MANTIS.SamType.MEDIUM] = 1.2
|
||||||
-- ` self.radiusscale[MANTIS.SamType.SHORT] = 1.3`
|
-- self.radiusscale[MANTIS.SamType.SHORT] = 1.3
|
||||||
|
--
|
||||||
|
-- ### 2.1.5 Friendlies check in firing range
|
||||||
|
--
|
||||||
|
-- -- For some scenarios, like Cold War, it might be useful not to activate SAMs if friendly aircraft are around to avoid death by friendly fire.
|
||||||
|
-- mybluemantis.checkforfriendlies = true
|
||||||
--
|
--
|
||||||
-- # 3. Default settings [both modes unless stated otherwise]
|
-- # 3. Default settings [both modes unless stated otherwise]
|
||||||
--
|
--
|
||||||
@@ -320,6 +327,7 @@ MANTIS = {
|
|||||||
automode = true,
|
automode = true,
|
||||||
autoshorad = true,
|
autoshorad = true,
|
||||||
ShoradGroupSet = nil,
|
ShoradGroupSet = nil,
|
||||||
|
checkforfriendlies = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Advanced state enumerator
|
--- Advanced state enumerator
|
||||||
@@ -346,17 +354,17 @@ MANTIS.SamType = {
|
|||||||
-- @field #string Type #MANTIS.SamType of SAM, i.e. SHORT, MEDIUM or LONG (range)
|
-- @field #string Type #MANTIS.SamType of SAM, i.e. SHORT, MEDIUM or LONG (range)
|
||||||
-- @field #string Radar Radar typename on unit level (used as key)
|
-- @field #string Radar Radar typename on unit level (used as key)
|
||||||
MANTIS.SamData = {
|
MANTIS.SamData = {
|
||||||
["Hawk"] = { Range=44, Blindspot=0, Height=9, Type="Medium", Radar="Hawk" }, -- measures in km
|
["Hawk"] = { Range=35, Blindspot=0, Height=12, Type="Medium", Radar="Hawk" }, -- measures in km
|
||||||
["NASAMS"] = { Range=14, Blindspot=0, Height=3, Type="Short", Radar="NSAMS" },
|
["NASAMS"] = { Range=14, Blindspot=0, Height=7, Type="Short", Radar="NSAMS" }, -- AIM 120B
|
||||||
["Patriot"] = { Range=99, Blindspot=0, Height=9, Type="Long", Radar="Patriot" },
|
["Patriot"] = { Range=99, Blindspot=0, Height=25, Type="Long", Radar="Patriot" },
|
||||||
["Rapier"] = { Range=6, Blindspot=0, Height=3, Type="Short", Radar="rapier" },
|
["Rapier"] = { Range=10, Blindspot=0, Height=3, Type="Short", Radar="rapier" },
|
||||||
["SA-2"] = { Range=40, Blindspot=7, Height=25, Type="Medium", Radar="S_75M_Volhov" },
|
["SA-2"] = { Range=40, Blindspot=7, Height=25, Type="Medium", Radar="S_75M_Volhov" },
|
||||||
["SA-3"] = { Range=18, Blindspot=6, Height=18, Type="Short", Radar="5p73 s-125 ln" },
|
["SA-3"] = { Range=18, Blindspot=6, Height=18, Type="Short", Radar="5p73 s-125 ln" },
|
||||||
["SA-5"] = { Range=250, Blindspot=7, Height=40, Type="Long", Radar="5N62V" },
|
["SA-5"] = { Range=250, Blindspot=7, Height=40, Type="Long", Radar="5N62V" },
|
||||||
["SA-6"] = { Range=25, Blindspot=0, Height=8, Type="Medium", Radar="1S91" },
|
["SA-6"] = { Range=25, Blindspot=0, Height=8, Type="Medium", Radar="1S91" },
|
||||||
["SA-10"] = { Range=119, Blindspot=0, Height=18, Type="Long" , Radar="S-300PS 4"},
|
["SA-10"] = { Range=119, Blindspot=0, Height=18, Type="Long" , Radar="S-300PS 4"},
|
||||||
["SA-11"] = { Range=35, Blindspot=0, Height=20, Type="Medium", Radar="SA-11" },
|
["SA-11"] = { Range=35, Blindspot=0, Height=20, Type="Medium", Radar="SA-11" },
|
||||||
["Roland"] = { Range=8, Blindspot=0, Height=3, Type="Short", Radar="Roland" },
|
["Roland"] = { Range=5, Blindspot=0, Height=5, Type="Short", Radar="Roland" },
|
||||||
["HQ-7"] = { Range=12, Blindspot=0, Height=3, Type="Short", Radar="HQ-7" },
|
["HQ-7"] = { Range=12, Blindspot=0, Height=3, Type="Short", Radar="HQ-7" },
|
||||||
["SA-9"] = { Range=4, Blindspot=0, Height=3, Type="Short", Radar="Strela" },
|
["SA-9"] = { Range=4, Blindspot=0, Height=3, Type="Short", Radar="Strela" },
|
||||||
["SA-8"] = { Range=10, Blindspot=0, Height=5, Type="Short", Radar="Osa 9A33" },
|
["SA-8"] = { Range=10, Blindspot=0, Height=5, Type="Short", Radar="Osa 9A33" },
|
||||||
@@ -364,7 +372,7 @@ MANTIS.SamData = {
|
|||||||
["SA-15"] = { Range=11, Blindspot=0, Height=6, Type="Short", Radar="Tor 9A331" },
|
["SA-15"] = { Range=11, Blindspot=0, Height=6, Type="Short", Radar="Tor 9A331" },
|
||||||
["SA-13"] = { Range=5, Blindspot=0, Height=3, Type="Short", Radar="Strela" },
|
["SA-13"] = { Range=5, Blindspot=0, Height=3, Type="Short", Radar="Strela" },
|
||||||
["Avenger"] = { Range=4, Blindspot=0, Height=3, Type="Short", Radar="Avenger" },
|
["Avenger"] = { Range=4, Blindspot=0, Height=3, Type="Short", Radar="Avenger" },
|
||||||
["Chaparrel"] = { Range=8, Blindspot=0, Height=3, Type="Short", Radar="Chaparral" },
|
["Chaparral"] = { Range=8, Blindspot=0, Height=3, Type="Short", Radar="Chaparral" },
|
||||||
["Linebacker"] = { Range=4, Blindspot=0, Height=3, Type="Short", Radar="Linebacker" },
|
["Linebacker"] = { Range=4, Blindspot=0, Height=3, Type="Short", Radar="Linebacker" },
|
||||||
["Silkworm"] = { Range=90, Blindspot=1, Height=0.2, Type="Long", Radar="Silkworm" },
|
["Silkworm"] = { Range=90, Blindspot=1, Height=0.2, Type="Long", Radar="Silkworm" },
|
||||||
-- units from HDS Mod, multi launcher options is tricky
|
-- units from HDS Mod, multi launcher options is tricky
|
||||||
@@ -373,7 +381,9 @@ MANTIS.SamData = {
|
|||||||
["SA-20A"] = { Range=150, Blindspot=5, Height=27, Type="Long" , Radar="S-300PMU1"},
|
["SA-20A"] = { Range=150, Blindspot=5, Height=27, Type="Long" , Radar="S-300PMU1"},
|
||||||
["SA-20B"] = { Range=200, Blindspot=4, Height=27, Type="Long" , Radar="S-300PMU2"},
|
["SA-20B"] = { Range=200, Blindspot=4, Height=27, Type="Long" , Radar="S-300PMU2"},
|
||||||
["HQ-2"] = { Range=50, Blindspot=6, Height=35, Type="Medium", Radar="HQ_2_Guideline_LN" },
|
["HQ-2"] = { Range=50, Blindspot=6, Height=35, Type="Medium", Radar="HQ_2_Guideline_LN" },
|
||||||
["SHORAD"] = { Range=3, Blindspot=0, Height=3, Type="Short", Radar="Igla" }
|
["SHORAD"] = { Range=3, Blindspot=0, Height=3, Type="Short", Radar="Igla" },
|
||||||
|
["TAMIR IDFA"] = { Range=20, Blindspot=0.6, Height=12.3, Type="Short", Radar="IRON_DOME_LN" },
|
||||||
|
["STUNNER IDFA"] = { Range=250, Blindspot=1, Height=45, Type="Long", Radar="DAVID_SLING_LN" },
|
||||||
}
|
}
|
||||||
|
|
||||||
--- SAM data HDS
|
--- SAM data HDS
|
||||||
@@ -488,6 +498,10 @@ do
|
|||||||
--
|
--
|
||||||
function MANTIS:New(name,samprefix,ewrprefix,hq,coalition,dynamic,awacs, EmOnOff, Padding, Zones)
|
function MANTIS:New(name,samprefix,ewrprefix,hq,coalition,dynamic,awacs, EmOnOff, Padding, Zones)
|
||||||
|
|
||||||
|
|
||||||
|
-- Inherit everything from BASE class.
|
||||||
|
local self = BASE:Inherit(self, FSM:New()) -- #MANTIS
|
||||||
|
|
||||||
-- DONE: Create some user functions for these
|
-- DONE: Create some user functions for these
|
||||||
-- DONE: Make HQ useful
|
-- DONE: Make HQ useful
|
||||||
-- DONE: Set SAMs to auto if EWR dies
|
-- DONE: Set SAMs to auto if EWR dies
|
||||||
@@ -496,6 +510,7 @@ do
|
|||||||
-- DONE: Allow tables of prefixes for the setup
|
-- DONE: Allow tables of prefixes for the setup
|
||||||
-- DONE: Auto-Mode with range setups for various known SAM types.
|
-- DONE: Auto-Mode with range setups for various known SAM types.
|
||||||
|
|
||||||
|
self.name = name or "mymantis"
|
||||||
self.SAM_Templates_Prefix = samprefix or "Red SAM"
|
self.SAM_Templates_Prefix = samprefix or "Red SAM"
|
||||||
self.EWR_Templates_Prefix = ewrprefix or "Red EWR"
|
self.EWR_Templates_Prefix = ewrprefix or "Red EWR"
|
||||||
self.HQ_Template_CC = hq or nil
|
self.HQ_Template_CC = hq or nil
|
||||||
@@ -549,6 +564,10 @@ do
|
|||||||
self.ShoradGroupSet = SET_GROUP:New() -- Core.Set#SET_GROUP
|
self.ShoradGroupSet = SET_GROUP:New() -- Core.Set#SET_GROUP
|
||||||
self.FilterZones = Zones
|
self.FilterZones = Zones
|
||||||
|
|
||||||
|
self.SkateZones = nil
|
||||||
|
self.SkateNumber = 3
|
||||||
|
self.shootandscoot = false
|
||||||
|
|
||||||
self.UseEmOnOff = true
|
self.UseEmOnOff = true
|
||||||
if EmOnOff == false then
|
if EmOnOff == false then
|
||||||
self.UseEmOnOff = false
|
self.UseEmOnOff = false
|
||||||
@@ -560,9 +579,6 @@ do
|
|||||||
self.advAwacs = false
|
self.advAwacs = false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Inherit everything from BASE class.
|
|
||||||
local self = BASE:Inherit(self, FSM:New()) -- #MANTIS
|
|
||||||
|
|
||||||
-- Set the string id for output to DCS.log file.
|
-- Set the string id for output to DCS.log file.
|
||||||
self.lid=string.format("MANTIS %s | ", self.name)
|
self.lid=string.format("MANTIS %s | ", self.name)
|
||||||
|
|
||||||
@@ -623,7 +639,7 @@ do
|
|||||||
|
|
||||||
-- TODO Version
|
-- TODO Version
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
self.version="0.8.14"
|
self.version="0.8.18"
|
||||||
self:I(string.format("***** Starting MANTIS Version %s *****", self.version))
|
self:I(string.format("***** Starting MANTIS Version %s *****", self.version))
|
||||||
|
|
||||||
--- FSM Functions ---
|
--- FSM Functions ---
|
||||||
@@ -787,6 +803,23 @@ do
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Add a SET_ZONE of zones for Shoot&Scoot - SHORAD units will move around
|
||||||
|
-- @param #MANTIS self
|
||||||
|
-- @param Core.Set#SET_ZONE ZoneSet Set of zones to be used. Units will move around to the next (random) zone between 100m and 3000m away.
|
||||||
|
-- @param #number Number Number of closest zones to be considered, defaults to 3.
|
||||||
|
-- @param #boolean Random If true, use a random coordinate inside the next zone to scoot to.
|
||||||
|
-- @param #string Formation Formation to use, defaults to "Cone". See mission editor dropdown for options.
|
||||||
|
-- @return #MANTIS self
|
||||||
|
function MANTIS:AddScootZones(ZoneSet, Number, Random, Formation)
|
||||||
|
self:T(self.lid .. " AddScootZones")
|
||||||
|
self.SkateZones = ZoneSet
|
||||||
|
self.SkateNumber = Number or 3
|
||||||
|
self.shootandscoot = true
|
||||||
|
self.ScootRandom = Random
|
||||||
|
self.ScootFormation = Formation or "Cone"
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Function to set accept and reject zones.
|
--- Function to set accept and reject zones.
|
||||||
-- @param #MANTIS self
|
-- @param #MANTIS self
|
||||||
-- @param #table AcceptZones Table of @{Core.Zone#ZONE} objects
|
-- @param #table AcceptZones Table of @{Core.Zone#ZONE} objects
|
||||||
@@ -893,7 +926,7 @@ do
|
|||||||
|
|
||||||
--- Function to get the HQ object for further use
|
--- Function to get the HQ object for further use
|
||||||
-- @param #MANTIS self
|
-- @param #MANTIS self
|
||||||
-- @return Wrapper.GROUP#GROUP The HQ #GROUP object or *nil* if it doesn't exist
|
-- @return Wrapper.Group#GROUP The HQ #GROUP object or *nil* if it doesn't exist
|
||||||
function MANTIS:GetCommandCenter()
|
function MANTIS:GetCommandCenter()
|
||||||
self:T(self.lid .. "GetCommandCenter")
|
self:T(self.lid .. "GetCommandCenter")
|
||||||
if self.HQ_CC then
|
if self.HQ_CC then
|
||||||
@@ -929,7 +962,7 @@ do
|
|||||||
|
|
||||||
--- Function to set the HQ object for further use
|
--- Function to set the HQ object for further use
|
||||||
-- @param #MANTIS self
|
-- @param #MANTIS self
|
||||||
-- @param Wrapper.GROUP#GROUP group The #GROUP object to be set as HQ
|
-- @param Wrapper.Group#GROUP group The #GROUP object to be set as HQ
|
||||||
function MANTIS:SetCommandCenter(group)
|
function MANTIS:SetCommandCenter(group)
|
||||||
self:T(self.lid .. "SetCommandCenter")
|
self:T(self.lid .. "SetCommandCenter")
|
||||||
local group = group or nil
|
local group = group or nil
|
||||||
@@ -991,7 +1024,7 @@ do
|
|||||||
|
|
||||||
--- Set using your own #INTEL_DLINK object instead of #DETECTION
|
--- Set using your own #INTEL_DLINK object instead of #DETECTION
|
||||||
-- @param #MANTIS self
|
-- @param #MANTIS self
|
||||||
-- @param Ops.Intelligence#INTEL_DLINK DLink The data link object to be used.
|
-- @param Ops.Intel#INTEL_DLINK DLink The data link object to be used.
|
||||||
function MANTIS:SetUsingDLink(DLink)
|
function MANTIS:SetUsingDLink(DLink)
|
||||||
self:T(self.lid .. "SetUsingDLink")
|
self:T(self.lid .. "SetUsingDLink")
|
||||||
self.DLink = true
|
self.DLink = true
|
||||||
@@ -1124,7 +1157,7 @@ do
|
|||||||
--self:T(self.lid.." Relocating HQ")
|
--self:T(self.lid.." Relocating HQ")
|
||||||
local text = self.lid.." Relocating HQ"
|
local text = self.lid.." Relocating HQ"
|
||||||
--local m= MESSAGE:New(text,10,"MANTIS"):ToAll()
|
--local m= MESSAGE:New(text,10,"MANTIS"):ToAll()
|
||||||
_hqgrp:RelocateGroundRandomInRadius(20,500,true,true)
|
_hqgrp:RelocateGroundRandomInRadius(20,500,true,true,nil,true)
|
||||||
end
|
end
|
||||||
--relocate EWR
|
--relocate EWR
|
||||||
-- TODO: maybe dependent on AlarmState? Observed: SA11 SR only relocates if no objects in reach
|
-- TODO: maybe dependent on AlarmState? Observed: SA11 SR only relocates if no objects in reach
|
||||||
@@ -1138,7 +1171,7 @@ do
|
|||||||
local text = self.lid.." Relocating EWR ".._grp:GetName()
|
local text = self.lid.." Relocating EWR ".._grp:GetName()
|
||||||
local m= MESSAGE:New(text,10,"MANTIS"):ToAllIf(self.debug)
|
local m= MESSAGE:New(text,10,"MANTIS"):ToAllIf(self.debug)
|
||||||
if self.verbose then self:I(text) end
|
if self.verbose then self:I(text) end
|
||||||
_grp:RelocateGroundRandomInRadius(20,500,true,true)
|
_grp:RelocateGroundRandomInRadius(20,500,true,true,nil,true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1197,10 +1230,10 @@ do
|
|||||||
function MANTIS:_PreFilterHeight(height)
|
function MANTIS:_PreFilterHeight(height)
|
||||||
self:T(self.lid.."_PreFilterHeight")
|
self:T(self.lid.."_PreFilterHeight")
|
||||||
local set = {}
|
local set = {}
|
||||||
local dlink = self.Detection -- Ops.Intelligence#INTEL_DLINK
|
local dlink = self.Detection -- Ops.Intel#INTEL_DLINK
|
||||||
local detectedgroups = dlink:GetContactTable()
|
local detectedgroups = dlink:GetContactTable()
|
||||||
for _,_contact in pairs(detectedgroups) do
|
for _,_contact in pairs(detectedgroups) do
|
||||||
local contact = _contact -- Ops.Intelligence#INTEL.Contact
|
local contact = _contact -- Ops.Intel#INTEL.Contact
|
||||||
local grp = contact.group -- Wrapper.Group#GROUP
|
local grp = contact.group -- Wrapper.Group#GROUP
|
||||||
if grp:IsAlive() then
|
if grp:IsAlive() then
|
||||||
if grp:GetHeight(true) < height then
|
if grp:GetHeight(true) < height then
|
||||||
@@ -1230,6 +1263,10 @@ do
|
|||||||
-- DEBUG
|
-- DEBUG
|
||||||
set = self:_PreFilterHeight(height)
|
set = self:_PreFilterHeight(height)
|
||||||
end
|
end
|
||||||
|
local friendlyset -- Core.Set#SET_GROUP
|
||||||
|
if self.checkforfriendlies == true then
|
||||||
|
friendlyset = SET_GROUP:New():FilterCoalitions(self.Coalition):FilterCategories({"plane","helicopter"}):FilterFunction(function(grp) if grp and grp:InAir() then return true else return false end end):FilterOnce()
|
||||||
|
end
|
||||||
for _,_coord in pairs (set) do
|
for _,_coord in pairs (set) do
|
||||||
local coord = _coord -- get current coord to check
|
local coord = _coord -- get current coord to check
|
||||||
-- output for cross-check
|
-- output for cross-check
|
||||||
@@ -1254,8 +1291,16 @@ do
|
|||||||
local m = MESSAGE:New(text,10,"Check"):ToAllIf(self.debug)
|
local m = MESSAGE:New(text,10,"Check"):ToAllIf(self.debug)
|
||||||
self:T(self.lid..text)
|
self:T(self.lid..text)
|
||||||
end
|
end
|
||||||
|
-- friendlies around?
|
||||||
|
local nofriendlies = true
|
||||||
|
if self.checkforfriendlies == true then
|
||||||
|
local closestfriend, distance = friendlyset:GetClosestGroup(samcoordinate)
|
||||||
|
if closestfriend and distance and distance < rad then
|
||||||
|
nofriendlies = false
|
||||||
|
end
|
||||||
|
end
|
||||||
-- end output to cross-check
|
-- end output to cross-check
|
||||||
if targetdistance <= rad and zonecheck then
|
if targetdistance <= rad and zonecheck == true and nofriendlies == true then
|
||||||
return true, targetdistance
|
return true, targetdistance
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1752,7 +1797,7 @@ do
|
|||||||
-- @return #MANTIS self
|
-- @return #MANTIS self
|
||||||
function MANTIS:_CheckDLinkState()
|
function MANTIS:_CheckDLinkState()
|
||||||
self:T(self.lid .. "_CheckDLinkState")
|
self:T(self.lid .. "_CheckDLinkState")
|
||||||
local dlink = self.Detection -- Ops.Intelligence#INTEL_DLINK
|
local dlink = self.Detection -- Ops.Intel#INTEL_DLINK
|
||||||
local TS = timer.getAbsTime()
|
local TS = timer.getAbsTime()
|
||||||
if not dlink:Is("Running") and (TS - self.DLTimeStamp > 29) then
|
if not dlink:Is("Running") and (TS - self.DLTimeStamp > 29) then
|
||||||
self.DLink = false
|
self.DLink = false
|
||||||
@@ -1786,6 +1831,10 @@ do
|
|||||||
self.Shorad:SetDefenseLimits(80,95)
|
self.Shorad:SetDefenseLimits(80,95)
|
||||||
self.ShoradLink = true
|
self.ShoradLink = true
|
||||||
self.Shorad.Groupset=self.ShoradGroupSet
|
self.Shorad.Groupset=self.ShoradGroupSet
|
||||||
|
self.Shorad.debug = self.debug
|
||||||
|
end
|
||||||
|
if self.shootandscoot and self.SkateZones and self.Shorad then
|
||||||
|
self.Shorad:AddScootZones(self.SkateZones,self.SkateNumber or 3,self.ScootRandom,self.ScootFormation)
|
||||||
end
|
end
|
||||||
self:__Status(-math.random(1,10))
|
self:__Status(-math.random(1,10))
|
||||||
return self
|
return self
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [MIT - Missile Trainer](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/MIT%20-%20Missile%20Trainer)
|
-- [MIT - Missile Trainer](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/MissileTrainer)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
|
|||||||
+1390
-1283
File diff suppressed because it is too large
Load Diff
@@ -4,10 +4,10 @@
|
|||||||
--
|
--
|
||||||
-- The RANGE class enables easy set up of bombing and strafing ranges within DCS World.
|
-- The RANGE class enables easy set up of bombing and strafing ranges within DCS World.
|
||||||
--
|
--
|
||||||
-- Implementation is based on the [Simple Range Script](https://forums.eagle.ru/showthread.php?t=157991) by [Ciribob](https://forums.eagle.ru/member.php?u=112175), which itself was motivated
|
-- Implementation is based on the [Simple Range Script](https://forums.eagle.ru/showthread.php?t=157991) by Ciribob, which itself was motivated
|
||||||
-- by a script by SNAFU [see here](https://forums.eagle.ru/showthread.php?t=109174).
|
-- by a script by SNAFU [see here](https://forums.eagle.ru/showthread.php?t=109174).
|
||||||
--
|
--
|
||||||
-- [476th - Air Weapons Range Objects mod](http://www.476vfightergroup.com/downloads.php?do=file&id=287) is highly recommended for this class.
|
-- [476th - Air Weapons Range Objects mod](https://www.476vfightergroup.com/downloads.php?do=download&downloadid=482) is highly recommended for this class.
|
||||||
--
|
--
|
||||||
-- **Main Features:**
|
-- **Main Features:**
|
||||||
--
|
--
|
||||||
@@ -42,9 +42,9 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **[funkyfranky](https://forums.eagle.ru/member.php?u=115026)**
|
-- ### Author: **funkyfranky**
|
||||||
--
|
--
|
||||||
-- ### Contributions: [FlightControl](https://forums.eagle.ru/member.php?u=89536), [Ciribob](https://forums.eagle.ru/member.php?u=112175)
|
-- ### Contributions: FlightControl, Ciribob
|
||||||
-- ### SRS Additions: Applevangelist
|
-- ### SRS Additions: Applevangelist
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
@@ -105,6 +105,7 @@
|
|||||||
-- @field Sound.SRS#MSRSQUEUE controlsrsQ SRS queue for range controller.
|
-- @field Sound.SRS#MSRSQUEUE controlsrsQ SRS queue for range controller.
|
||||||
-- @field Sound.SRS#MSRS instructmsrs SRS wrapper for range instructor.
|
-- @field Sound.SRS#MSRS instructmsrs SRS wrapper for range instructor.
|
||||||
-- @field Sound.SRS#MSRSQUEUE instructsrsQ SRS queue for range instructor.
|
-- @field Sound.SRS#MSRSQUEUE instructsrsQ SRS queue for range instructor.
|
||||||
|
-- @field #number Coalition Coalition side for the menu, if any.
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
--- *Don't only practice your art, but force your way into its secrets; art deserves that, for it and knowledge can raise man to the Divine.* - Ludwig van Beethoven
|
--- *Don't only practice your art, but force your way into its secrets; art deserves that, for it and knowledge can raise man to the Divine.* - Ludwig van Beethoven
|
||||||
@@ -355,7 +356,8 @@ RANGE = {
|
|||||||
targetsheet = nil,
|
targetsheet = nil,
|
||||||
targetpath = nil,
|
targetpath = nil,
|
||||||
targetprefix = nil,
|
targetprefix = nil,
|
||||||
}
|
Coalition = nil,
|
||||||
|
}
|
||||||
|
|
||||||
--- Default range parameters.
|
--- Default range parameters.
|
||||||
-- @type RANGE.Defaults
|
-- @type RANGE.Defaults
|
||||||
@@ -591,7 +593,7 @@ RANGE.MenuF10Root = nil
|
|||||||
|
|
||||||
--- Range script version.
|
--- Range script version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
RANGE.version = "2.7.1"
|
RANGE.version = "2.7.3"
|
||||||
|
|
||||||
-- TODO list:
|
-- TODO list:
|
||||||
-- TODO: Verbosity level for messages.
|
-- TODO: Verbosity level for messages.
|
||||||
@@ -613,8 +615,9 @@ RANGE.version = "2.7.1"
|
|||||||
--- RANGE contructor. Creates a new RANGE object.
|
--- RANGE contructor. Creates a new RANGE object.
|
||||||
-- @param #RANGE self
|
-- @param #RANGE self
|
||||||
-- @param #string RangeName Name of the range. Has to be unique. Will we used to create F10 menu items etc.
|
-- @param #string RangeName Name of the range. Has to be unique. Will we used to create F10 menu items etc.
|
||||||
|
-- @param #number Coalition (optional) Coalition of the range, if any, e.g. coalition.side.BLUE.
|
||||||
-- @return #RANGE RANGE object.
|
-- @return #RANGE RANGE object.
|
||||||
function RANGE:New( RangeName )
|
function RANGE:New( RangeName, Coalition )
|
||||||
|
|
||||||
-- Inherit BASE.
|
-- Inherit BASE.
|
||||||
local self = BASE:Inherit( self, FSM:New() ) -- #RANGE
|
local self = BASE:Inherit( self, FSM:New() ) -- #RANGE
|
||||||
@@ -623,6 +626,8 @@ function RANGE:New( RangeName )
|
|||||||
-- TODO: make sure that the range name is not given twice. This would lead to problems in the F10 radio menu.
|
-- TODO: make sure that the range name is not given twice. This would lead to problems in the F10 radio menu.
|
||||||
self.rangename = RangeName or "Practice Range"
|
self.rangename = RangeName or "Practice Range"
|
||||||
|
|
||||||
|
self.Coalition = Coalition
|
||||||
|
|
||||||
-- Log id.
|
-- Log id.
|
||||||
self.lid = string.format( "RANGE %s | ", self.rangename )
|
self.lid = string.format( "RANGE %s | ", self.rangename )
|
||||||
|
|
||||||
@@ -1202,20 +1207,22 @@ end
|
|||||||
-- @return #RANGE self
|
-- @return #RANGE self
|
||||||
function RANGE:SetSRS(PathToSRS, Port, Coalition, Frequency, Modulation, Volume, PathToGoogleKey)
|
function RANGE:SetSRS(PathToSRS, Port, Coalition, Frequency, Modulation, Volume, PathToGoogleKey)
|
||||||
|
|
||||||
if PathToSRS then
|
if PathToSRS or MSRS.path then
|
||||||
|
|
||||||
self.useSRS=true
|
self.useSRS=true
|
||||||
|
|
||||||
self.controlmsrs=MSRS:New(PathToSRS, Frequency or 256, Modulation or radio.modulation.AM, Volume or 1.0)
|
self.controlmsrs=MSRS:New(PathToSRS or MSRS.path, Frequency or 256, Modulation or radio.modulation.AM)
|
||||||
self.controlmsrs:SetPort(Port)
|
self.controlmsrs:SetPort(Port or MSRS.port)
|
||||||
self.controlmsrs:SetCoalition(Coalition or coalition.side.BLUE)
|
self.controlmsrs:SetCoalition(Coalition or coalition.side.BLUE)
|
||||||
self.controlmsrs:SetLabel("RANGEC")
|
self.controlmsrs:SetLabel("RANGEC")
|
||||||
|
self.controlmsrs:SetVolume(Volume or 1.0)
|
||||||
self.controlsrsQ = MSRSQUEUE:New("CONTROL")
|
self.controlsrsQ = MSRSQUEUE:New("CONTROL")
|
||||||
|
|
||||||
self.instructmsrs=MSRS:New(PathToSRS, Frequency or 305, Modulation or radio.modulation.AM, Volume or 1.0)
|
self.instructmsrs=MSRS:New(PathToSRS or MSRS.path, Frequency or 305, Modulation or radio.modulation.AM)
|
||||||
self.instructmsrs:SetPort(Port)
|
self.instructmsrs:SetPort(Port or MSRS.port)
|
||||||
self.instructmsrs:SetCoalition(Coalition or coalition.side.BLUE)
|
self.instructmsrs:SetCoalition(Coalition or coalition.side.BLUE)
|
||||||
self.instructmsrs:SetLabel("RANGEI")
|
self.instructmsrs:SetLabel("RANGEI")
|
||||||
|
self.instructmsrs:SetVolume(Volume or 1.0)
|
||||||
self.instructsrsQ = MSRSQUEUE:New("INSTRUCT")
|
self.instructsrsQ = MSRSQUEUE:New("INSTRUCT")
|
||||||
|
|
||||||
if PathToGoogleKey then
|
if PathToGoogleKey then
|
||||||
@@ -1229,7 +1236,7 @@ function RANGE:SetSRS(PathToSRS, Port, Coalition, Frequency, Modulation, Volume,
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- (SRS) Set range control frequency and voice.
|
--- (SRS) Set range control frequency and voice. Use `RANGE:SetSRS()` once first before using this function.
|
||||||
-- @param #RANGE self
|
-- @param #RANGE self
|
||||||
-- @param #number frequency Frequency in MHz. Default 256 MHz.
|
-- @param #number frequency Frequency in MHz. Default 256 MHz.
|
||||||
-- @param #number modulation Modulation, defaults to radio.modulation.AM.
|
-- @param #number modulation Modulation, defaults to radio.modulation.AM.
|
||||||
@@ -1239,6 +1246,10 @@ end
|
|||||||
-- @param #string relayunitname Name of the unit used for transmission location.
|
-- @param #string relayunitname Name of the unit used for transmission location.
|
||||||
-- @return #RANGE self
|
-- @return #RANGE self
|
||||||
function RANGE:SetSRSRangeControl( frequency, modulation, voice, culture, gender, relayunitname )
|
function RANGE:SetSRSRangeControl( frequency, modulation, voice, culture, gender, relayunitname )
|
||||||
|
if not self.instructmsrs then
|
||||||
|
self:E(self.lid.."Use myrange:SetSRS() once first before using myrange:SetSRSRangeControl!")
|
||||||
|
return self
|
||||||
|
end
|
||||||
self.rangecontrolfreq = frequency or 256
|
self.rangecontrolfreq = frequency or 256
|
||||||
self.controlmsrs:SetFrequencies(self.rangecontrolfreq)
|
self.controlmsrs:SetFrequencies(self.rangecontrolfreq)
|
||||||
self.controlmsrs:SetModulations(modulation or radio.modulation.AM)
|
self.controlmsrs:SetModulations(modulation or radio.modulation.AM)
|
||||||
@@ -1254,7 +1265,7 @@ function RANGE:SetSRSRangeControl( frequency, modulation, voice, culture, gender
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- (SRS) Set range instructor frequency and voice.
|
--- (SRS) Set range instructor frequency and voice. Use `RANGE:SetSRS()` once first before using this function.
|
||||||
-- @param #RANGE self
|
-- @param #RANGE self
|
||||||
-- @param #number frequency Frequency in MHz. Default 305 MHz.
|
-- @param #number frequency Frequency in MHz. Default 305 MHz.
|
||||||
-- @param #number modulation Modulation, defaults to radio.modulation.AM.
|
-- @param #number modulation Modulation, defaults to radio.modulation.AM.
|
||||||
@@ -1264,6 +1275,10 @@ end
|
|||||||
-- @param #string relayunitname Name of the unit used for transmission location.
|
-- @param #string relayunitname Name of the unit used for transmission location.
|
||||||
-- @return #RANGE self
|
-- @return #RANGE self
|
||||||
function RANGE:SetSRSRangeInstructor( frequency, modulation, voice, culture, gender, relayunitname )
|
function RANGE:SetSRSRangeInstructor( frequency, modulation, voice, culture, gender, relayunitname )
|
||||||
|
if not self.instructmsrs then
|
||||||
|
self:E(self.lid.."Use myrange:SetSRS() once first before using myrange:SetSRSRangeInstructor!")
|
||||||
|
return self
|
||||||
|
end
|
||||||
self.instructorfreq = frequency or 305
|
self.instructorfreq = frequency or 305
|
||||||
self.instructmsrs:SetFrequencies(self.instructorfreq)
|
self.instructmsrs:SetFrequencies(self.instructorfreq)
|
||||||
self.instructmsrs:SetModulations(modulation or radio.modulation.AM)
|
self.instructmsrs:SetModulations(modulation or radio.modulation.AM)
|
||||||
@@ -1725,6 +1740,8 @@ end
|
|||||||
function RANGE:OnEventBirth( EventData )
|
function RANGE:OnEventBirth( EventData )
|
||||||
self:F( { eventbirth = EventData } )
|
self:F( { eventbirth = EventData } )
|
||||||
|
|
||||||
|
if not EventData.IniPlayerName then return end
|
||||||
|
|
||||||
local _unitName = EventData.IniUnitName
|
local _unitName = EventData.IniUnitName
|
||||||
local _unit, _playername = self:_GetPlayerUnitAndName( _unitName )
|
local _unit, _playername = self:_GetPlayerUnitAndName( _unitName )
|
||||||
|
|
||||||
@@ -1746,8 +1763,14 @@ function RANGE:OnEventBirth( EventData )
|
|||||||
-- Reset current strafe status.
|
-- Reset current strafe status.
|
||||||
self.strafeStatus[_uid] = nil
|
self.strafeStatus[_uid] = nil
|
||||||
|
|
||||||
-- Add Menu commands after a delay of 0.1 seconds.
|
if self.Coalition then
|
||||||
self:ScheduleOnce( 0.1, self._AddF10Commands, self, _unitName )
|
if EventData.IniCoalition == self.Coalition then
|
||||||
|
self:ScheduleOnce( 0.1, self._AddF10Commands, self, _unitName )
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- Add Menu commands after a delay of 0.1 seconds.
|
||||||
|
self:ScheduleOnce( 0.1, self._AddF10Commands, self, _unitName )
|
||||||
|
end
|
||||||
|
|
||||||
-- By default, some bomb impact points and do not flare each hit on target.
|
-- By default, some bomb impact points and do not flare each hit on target.
|
||||||
self.PlayerSettings[_playername] = {} -- #RANGE.PlayerData
|
self.PlayerSettings[_playername] = {} -- #RANGE.PlayerData
|
||||||
@@ -2168,7 +2191,7 @@ function RANGE:onafterExitRange( From, Event, To, player )
|
|||||||
|
|
||||||
local text = "You left the bombing range zone. "
|
local text = "You left the bombing range zone. "
|
||||||
|
|
||||||
local r=math.random(2)
|
local r=math.random(5)
|
||||||
|
|
||||||
if r==1 then
|
if r==1 then
|
||||||
text=text.."Have a nice day!"
|
text=text.."Have a nice day!"
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [SCO - Scoring](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SCO%20-%20Scoring)
|
-- [SCO - Scoring](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Scoring)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
-- and creates a CSV file logging the scoring events and results for use at team or squadron websites.
|
-- and creates a CSV file logging the scoring events and results for use at team or squadron websites.
|
||||||
--
|
--
|
||||||
-- SCORING automatically calculates the threat level of the objects hit and destroyed by players,
|
-- SCORING automatically calculates the threat level of the objects hit and destroyed by players,
|
||||||
-- which can be @{Wrapper.Unit}, @{Static) and @{Scenery} objects.
|
-- which can be @{Wrapper.Unit}, @{Wrapper.Static) and @{Scenery} objects.
|
||||||
--
|
--
|
||||||
-- Positive score points are granted when enemy or neutral targets are destroyed.
|
-- Positive score points are granted when enemy or neutral targets are destroyed.
|
||||||
-- Negative score points or penalties are given when a friendly target is hit or destroyed.
|
-- Negative score points or penalties are given when a friendly target is hit or destroyed.
|
||||||
@@ -79,9 +79,10 @@
|
|||||||
--
|
--
|
||||||
-- ### 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](http://forums.eagle.ru/member.php?u=3829): Testing and Advice.
|
-- * **Whisper**: Testing and Advice.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -116,11 +117,13 @@
|
|||||||
-- Special targets can be set that will give extra scores to the players when these are destroyed.
|
-- 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.SetGroupGroup}() to specify a special additional score for a specific @{Wrapper.Group}s.
|
-- Use the method @{#SCORING.AddScoreSetGroup}() to specify a special additional score for a specific @{Wrapper.Group}s gathered in a @{Core.Set#SET_GROUP}.
|
||||||
--
|
--
|
||||||
-- local Scoring = SCORING:New( "Scoring File" )
|
-- 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.
|
||||||
@@ -226,7 +229,7 @@ SCORING = {
|
|||||||
ClassID = 0,
|
ClassID = 0,
|
||||||
Players = {},
|
Players = {},
|
||||||
AutoSave = true,
|
AutoSave = true,
|
||||||
version = "1.17.1"
|
version = "1.18.4"
|
||||||
}
|
}
|
||||||
|
|
||||||
local _SCORINGCoalition = {
|
local _SCORINGCoalition = {
|
||||||
@@ -245,13 +248,15 @@ 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 )
|
function SCORING:New( GameName, SavePath, AutoSave )
|
||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, BASE:New() ) -- #SCORING
|
local self = BASE:Inherit( self, BASE:New() ) -- #SCORING
|
||||||
@@ -276,9 +281,15 @@ function SCORING:New( GameName )
|
|||||||
self:SetMessagesZone( true )
|
self:SetMessagesZone( true )
|
||||||
|
|
||||||
-- Scales
|
-- Scales
|
||||||
|
|
||||||
self:SetScaleDestroyScore( 10 )
|
self:SetScaleDestroyScore( 10 )
|
||||||
self:SetScaleDestroyPenalty( 30 )
|
self:SetScaleDestroyPenalty( 30 )
|
||||||
|
|
||||||
|
-- Hitting a target multiple times before destoying it should not result in a higger score
|
||||||
|
-- Multiple hits is typically a results of bombs/missles missing their target but still inflict some spash damage
|
||||||
|
-- Making this configurable to anyone can enable this anyway if they want
|
||||||
|
self:SetScoreIncrementOnHit(0)
|
||||||
|
|
||||||
-- Default fratricide penalty level (maximum penalty that can be assigned to a player before he gets kicked).
|
-- Default fratricide penalty level (maximum penalty that can be assigned to a player before he gets kicked).
|
||||||
self:SetFratricide( self.ScaleDestroyPenalty * 3 )
|
self:SetFratricide( self.ScaleDestroyPenalty * 3 )
|
||||||
self.penaltyonfratricide = true
|
self.penaltyonfratricide = true
|
||||||
@@ -308,7 +319,8 @@ function SCORING:New( GameName )
|
|||||||
end )
|
end )
|
||||||
|
|
||||||
-- Create the CSV file.
|
-- Create the CSV file.
|
||||||
self.AutoSave = true
|
self.AutoSavePath = SavePath
|
||||||
|
self.AutoSave = AutoSave or true
|
||||||
self:OpenCSV( GameName )
|
self:OpenCSV( GameName )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -422,6 +434,31 @@ 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.
|
||||||
@@ -467,6 +504,16 @@ function SCORING:SetMessagesHit( OnOff )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Configure to increment score after a target has been hit.
|
||||||
|
-- @param #SCORING self
|
||||||
|
-- @param #number score amount of point to inclement score on each hit
|
||||||
|
-- @return #SCORING
|
||||||
|
function SCORING:SetScoreIncrementOnHit( score )
|
||||||
|
|
||||||
|
self.ScoreIncrementOnHit = score
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- If to send messages after a target has been hit.
|
--- If to send messages after a target has been hit.
|
||||||
-- @param #SCORING self
|
-- @param #SCORING self
|
||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
@@ -885,6 +932,7 @@ 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
|
||||||
@@ -1013,11 +1061,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 thread level anymore. To fix this we compute at OnEventBirth
|
-- After an instant kill we can't compute the threat level anymore. To fix this we compute at OnEventBirth
|
||||||
if PlayerHit.UNIT.ThreatType == nil then
|
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 or PlayerHit.ThreatType == "" then
|
||||||
PlayerHit.ThreatLevel = 1
|
PlayerHit.ThreatLevel = 1
|
||||||
PlayerHit.ThreatType = "Unknown"
|
PlayerHit.ThreatType = "Unknown"
|
||||||
end
|
end
|
||||||
@@ -1060,10 +1108,8 @@ 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
|
||||||
-- Hitting a target multiple times before destoying it should not result in a higger score
|
Player.Score = Player.Score + self.ScoreIncrementOnHit
|
||||||
-- Multiple hits is typically a results of bombs/missles missing their target but still inflict some spash damage
|
PlayerHit.Score = PlayerHit.Score + self.ScoreIncrementOnHit
|
||||||
-- 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. " ..
|
||||||
@@ -1126,9 +1172,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 thread level anymore. To fix this we compute at OnEventBirth
|
-- After an instant kill we can't compute the threat level anymore. To fix this we compute at OnEventBirth
|
||||||
if PlayerHit.UNIT.ThreatType == nil then
|
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
|
||||||
@@ -1163,10 +1209,8 @@ 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
|
||||||
-- Hitting a target multiple times before destoying it should not result in a higger score
|
Player.Score = Player.Score + self.ScoreIncrementOnHit
|
||||||
-- Multiple hits is typically a results of bombs/missles missing their target but still inflict some spash damage
|
PlayerHit.Score = PlayerHit.Score + self.ScoreIncrementOnHit
|
||||||
-- 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,
|
||||||
@@ -1274,13 +1318,18 @@ 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 )
|
||||||
@@ -1303,12 +1352,19 @@ 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 )
|
||||||
@@ -1786,10 +1842,11 @@ end
|
|||||||
function SCORING:OpenCSV( ScoringCSV )
|
function SCORING:OpenCSV( ScoringCSV )
|
||||||
self:F( ScoringCSV )
|
self:F( ScoringCSV )
|
||||||
|
|
||||||
if lfs and io and os and self.AutoSave then
|
if lfs and io and os and self.AutoSave == true then
|
||||||
if ScoringCSV then
|
if ScoringCSV then
|
||||||
self.ScoringCSV = ScoringCSV
|
self.ScoringCSV = ScoringCSV
|
||||||
local fdir = lfs.writedir() .. [[Logs\]] .. self.ScoringCSV .. " " .. os.date( "%Y-%m-%d %H-%M-%S" ) .. ".csv"
|
local path = self.AutoSavePath or lfs.writedir() .. [[Logs\]]
|
||||||
|
local fdir = path .. self.ScoringCSV .. " " .. os.date( "%Y-%m-%d %H-%M-%S" ) .. ".csv"
|
||||||
|
|
||||||
self.CSVFile, self.err = io.open( fdir, "w+" )
|
self.CSVFile, self.err = io.open( fdir, "w+" )
|
||||||
if not self.CSVFile then
|
if not self.CSVFile then
|
||||||
@@ -1907,3 +1964,26 @@ 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/SEV%20-%20SEAD%20Evasion)
|
-- [SEV - SEAD Evasion](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Sead)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Authors: **FlightControl**, **applevangelist**
|
-- ### Authors: **applevangelist**, **FlightControl**
|
||||||
--
|
--
|
||||||
-- Last Update: September 2023
|
-- Last Update: Dec 2023
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
--
|
--
|
||||||
-- This class is very easy to use. Just setup a SEAD object by using @{#SEAD.New}() and SAMs will evade and take defensive action when being fired upon.
|
-- This class is very easy to use. Just setup a SEAD object by using @{#SEAD.New}() and SAMs will evade and take defensive action when being fired upon.
|
||||||
-- Once a HARM attack is detected, SEAD will shut down the radars of the attacked SAM site and take evasive action by moving the SAM
|
-- Once a HARM attack is detected, SEAD will shut down the radars of the attacked SAM site and take evasive action by moving the SAM
|
||||||
-- vehicles around (*if* they are drivable, that is). There's a component of randomness in detection and evasion, which is based on the
|
-- vehicles around (*if* they are driveable, that is). There's a component of randomness in detection and evasion, which is based on the
|
||||||
-- skill set of the SAM set (the higher the skill, the more likely). When a missile is fired from far away, the SAM will stay active for a
|
-- skill set of the SAM set (the higher the skill, the more likely). When a missile is fired from far away, the SAM will stay active for a
|
||||||
-- period of time to stay defensive, before it takes evasive actions.
|
-- period of time to stay defensive, before it takes evasive actions.
|
||||||
--
|
--
|
||||||
@@ -66,7 +66,6 @@ SEAD = {
|
|||||||
-- @field Harms
|
-- @field Harms
|
||||||
SEAD.Harms = {
|
SEAD.Harms = {
|
||||||
["AGM_88"] = "AGM_88",
|
["AGM_88"] = "AGM_88",
|
||||||
--["AGM_45"] = "AGM_45",
|
|
||||||
["AGM_122"] = "AGM_122",
|
["AGM_122"] = "AGM_122",
|
||||||
["AGM_84"] = "AGM_84",
|
["AGM_84"] = "AGM_84",
|
||||||
["AGM_45"] = "AGM_45",
|
["AGM_45"] = "AGM_45",
|
||||||
@@ -80,6 +79,7 @@ SEAD = {
|
|||||||
["BGM_109"] = "BGM_109",
|
["BGM_109"] = "BGM_109",
|
||||||
["AGM_154"] = "AGM_154",
|
["AGM_154"] = "AGM_154",
|
||||||
["HY-2"] = "HY-2",
|
["HY-2"] = "HY-2",
|
||||||
|
["ADM_141A"] = "ADM_141A",
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Missile enumerators - from DCS ME and Wikipedia
|
--- Missile enumerators - from DCS ME and Wikipedia
|
||||||
@@ -100,6 +100,7 @@ SEAD = {
|
|||||||
["BGM_109"] = {460, 0.705}, --in-game ~465kn
|
["BGM_109"] = {460, 0.705}, --in-game ~465kn
|
||||||
["AGM_154"] = {130, 0.61},
|
["AGM_154"] = {130, 0.61},
|
||||||
["HY-2"] = {90,1},
|
["HY-2"] = {90,1},
|
||||||
|
["ADM_141A"] = {126,0.6},
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Creates the main object which is handling defensive actions for SA sites or moving SA vehicles.
|
--- Creates the main object which is handling defensive actions for SA sites or moving SA vehicles.
|
||||||
@@ -143,7 +144,7 @@ function SEAD:New( SEADGroupPrefixes, Padding )
|
|||||||
self:AddTransition("*", "ManageEvasion", "*")
|
self:AddTransition("*", "ManageEvasion", "*")
|
||||||
self:AddTransition("*", "CalculateHitZone", "*")
|
self:AddTransition("*", "CalculateHitZone", "*")
|
||||||
|
|
||||||
self:I("*** SEAD - Started Version 0.4.4")
|
self:I("*** SEAD - Started Version 0.4.6")
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -319,9 +320,6 @@ 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"
|
||||||
@@ -348,8 +346,9 @@ end
|
|||||||
-- @param #string SEADWeaponName
|
-- @param #string SEADWeaponName
|
||||||
-- @param Wrapper.Group#GROUP SEADGroup Attacker Group
|
-- @param Wrapper.Group#GROUP SEADGroup Attacker Group
|
||||||
-- @param #number timeoffset Offset for tti calc
|
-- @param #number timeoffset Offset for tti calc
|
||||||
|
-- @param Wrapper.Weapon#WEAPON Weapon
|
||||||
-- @return #SEAD self
|
-- @return #SEAD self
|
||||||
function SEAD:onafterManageEvasion(From,Event,To,_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,timeoffset)
|
function SEAD:onafterManageEvasion(From,Event,To,_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,timeoffset,Weapon)
|
||||||
local timeoffset = timeoffset or 0
|
local timeoffset = timeoffset or 0
|
||||||
if _targetskill == "Random" then -- when skill is random, choose a skill
|
if _targetskill == "Random" then -- when skill is random, choose a skill
|
||||||
local Skills = { "Average", "Good", "High", "Excellent" }
|
local Skills = { "Average", "Good", "High", "Excellent" }
|
||||||
@@ -372,6 +371,10 @@ function SEAD:onafterManageEvasion(From,Event,To,_targetskill,_targetgroup,SEADP
|
|||||||
reach = wpndata[1] * 1.1
|
reach = wpndata[1] * 1.1
|
||||||
local mach = wpndata[2]
|
local mach = wpndata[2]
|
||||||
wpnspeed = math.floor(mach * 340.29)
|
wpnspeed = math.floor(mach * 340.29)
|
||||||
|
if Weapon then
|
||||||
|
wpnspeed = Weapon:GetSpeed()
|
||||||
|
self:T(string.format("*** SEAD - Weapon Speed from WEAPON: %f m/s",wpnspeed))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
-- time to impact
|
-- time to impact
|
||||||
local _tti = math.floor(_distance / wpnspeed) - timeoffset -- estimated impact time
|
local _tti = math.floor(_distance / wpnspeed) - timeoffset -- estimated impact time
|
||||||
@@ -395,7 +398,7 @@ function SEAD:onafterManageEvasion(From,Event,To,_targetskill,_targetgroup,SEADP
|
|||||||
grp:EnableEmission(false)
|
grp:EnableEmission(false)
|
||||||
end
|
end
|
||||||
grp:OptionAlarmStateGreen() -- needed else we cannot move around
|
grp:OptionAlarmStateGreen() -- needed else we cannot move around
|
||||||
grp:RelocateGroundRandomInRadius(20,300,false,false,"Diamond")
|
grp:RelocateGroundRandomInRadius(20,300,false,false,"Diamond",true)
|
||||||
if self.UseCallBack then
|
if self.UseCallBack then
|
||||||
local object = self.CallBack
|
local object = self.CallBack
|
||||||
object:SeadSuppressionStart(grp,name,attacker)
|
object:SeadSuppressionStart(grp,name,attacker)
|
||||||
@@ -457,6 +460,9 @@ function SEAD:HandleEventShot( EventData )
|
|||||||
local SEADWeapon = EventData.Weapon -- Identify the weapon fired
|
local SEADWeapon = EventData.Weapon -- Identify the weapon fired
|
||||||
local SEADWeaponName = EventData.WeaponName -- return weapon type
|
local SEADWeaponName = EventData.WeaponName -- return weapon type
|
||||||
|
|
||||||
|
local WeaponWrapper = WEAPON:New(EventData.Weapon)
|
||||||
|
--local SEADWeaponSpeed = WeaponWrapper:GetSpeed() -- mps
|
||||||
|
|
||||||
self:T( "*** SEAD - Missile Launched = " .. SEADWeaponName)
|
self:T( "*** SEAD - Missile Launched = " .. SEADWeaponName)
|
||||||
--self:T({ SEADWeapon })
|
--self:T({ SEADWeapon })
|
||||||
|
|
||||||
@@ -475,7 +481,7 @@ function SEAD:HandleEventShot( EventData )
|
|||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
local targetcat = _target:getCategory() -- Identify category
|
local targetcat = Object.getCategory(_target) -- Identify category
|
||||||
local _targetUnit = nil -- Wrapper.Unit#UNIT
|
local _targetUnit = nil -- Wrapper.Unit#UNIT
|
||||||
local _targetgroup = nil -- Wrapper.Group#GROUP
|
local _targetgroup = nil -- Wrapper.Group#GROUP
|
||||||
self:T(string.format("*** Targetcat = %d",targetcat))
|
self:T(string.format("*** Targetcat = %d",targetcat))
|
||||||
@@ -513,7 +519,11 @@ function SEAD:HandleEventShot( EventData )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if SEADGroupFound == true then -- yes we are being attacked
|
if SEADGroupFound == true then -- yes we are being attacked
|
||||||
self:ManageEvasion(_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup)
|
if string.find(SEADWeaponName,"ADM_141",1,true) then
|
||||||
|
self:__ManageEvasion(2,_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,0,WeaponWrapper)
|
||||||
|
else
|
||||||
|
self:ManageEvasion(_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,0,WeaponWrapper)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- ### [SHORAD - Short Range Air Defense](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SRD%20-%20SHORAD%20Defense)
|
-- ### [SHORAD - Short Range Air Defense](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Shorad)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
-- @image Functional.Shorad.jpg
|
-- @image Functional.Shorad.jpg
|
||||||
--
|
--
|
||||||
-- Date: Nov 2021
|
-- Date: Nov 2021
|
||||||
|
-- Last Update: Nov 2023
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
--- **SHORAD** class, extends Core.Base#BASE
|
--- **SHORAD** class, extends Core.Base#BASE
|
||||||
@@ -39,8 +40,15 @@
|
|||||||
-- @field #boolean DefendHarms Default true, intercept incoming HARMS
|
-- @field #boolean DefendHarms Default true, intercept incoming HARMS
|
||||||
-- @field #boolean DefendMavs Default true, intercept incoming AG-Missiles
|
-- @field #boolean DefendMavs Default true, intercept incoming AG-Missiles
|
||||||
-- @field #number DefenseLowProb Default 70, minimum detection limit
|
-- @field #number DefenseLowProb Default 70, minimum detection limit
|
||||||
-- @field #number DefenseHighProb Default 90, maximim detection limit
|
-- @field #number DefenseHighProb Default 90, maximum detection limit
|
||||||
-- @field #boolean UseEmOnOff Decide if we are using Emission on/off (default) or AlarmState red/green.
|
-- @field #boolean UseEmOnOff Decide if we are using Emission on/off (default) or AlarmState red/green
|
||||||
|
-- @field #boolean shootandscoot If true, shoot and scoot between zones
|
||||||
|
-- @field #number SkateNumber Number of zones to consider
|
||||||
|
-- @field Core.Set#SET_ZONE SkateZones Zones in this set are considered
|
||||||
|
-- @field #number minscootdist Min distance of the next zone
|
||||||
|
-- @field #number maxscootdist Max distance of the next zone
|
||||||
|
-- @field #boolean scootrandomcoord If true, use a random coordinate in the zone and not the center
|
||||||
|
-- @field #string scootformation Formation to take for scooting, e.g. "Vee" or "Cone"
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
|
|
||||||
@@ -73,14 +81,15 @@
|
|||||||
--
|
--
|
||||||
-- `myshorad = SHORAD:New("RedShorad", "Red SHORAD", SamSet, 25000, 600, "red")`
|
-- `myshorad = SHORAD:New("RedShorad", "Red SHORAD", SamSet, 25000, 600, "red")`
|
||||||
--
|
--
|
||||||
-- ## Customize options
|
-- ## Customization options
|
||||||
--
|
--
|
||||||
-- * SHORAD:SwitchDebug(debug)
|
-- * myshorad:SwitchDebug(debug)
|
||||||
-- * SHORAD:SwitchHARMDefense(onoff)
|
-- * myshorad:SwitchHARMDefense(onoff)
|
||||||
-- * SHORAD:SwitchAGMDefense(onoff)
|
-- * myshorad:SwitchAGMDefense(onoff)
|
||||||
-- * SHORAD:SetDefenseLimits(low,high)
|
-- * myshorad:SetDefenseLimits(low,high)
|
||||||
-- * SHORAD:SetActiveTimer(seconds)
|
-- * myshorad:SetActiveTimer(seconds)
|
||||||
-- * SHORAD:SetDefenseRadius(meters)
|
-- * myshorad:SetDefenseRadius(meters)
|
||||||
|
-- * myshorad:AddScootZones(ZoneSet,Number,Random,Formation)
|
||||||
--
|
--
|
||||||
-- @field #SHORAD
|
-- @field #SHORAD
|
||||||
SHORAD = {
|
SHORAD = {
|
||||||
@@ -99,7 +108,13 @@ SHORAD = {
|
|||||||
DefendMavs = true,
|
DefendMavs = true,
|
||||||
DefenseLowProb = 70,
|
DefenseLowProb = 70,
|
||||||
DefenseHighProb = 90,
|
DefenseHighProb = 90,
|
||||||
UseEmOnOff = false,
|
UseEmOnOff = true,
|
||||||
|
shootandscoot = false,
|
||||||
|
SkateNumber = 3,
|
||||||
|
SkateZones = nil,
|
||||||
|
minscootdist = 100,
|
||||||
|
minscootdist = 3000,
|
||||||
|
scootrandomcoord = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@@ -112,7 +127,6 @@ do
|
|||||||
-- @field Harms
|
-- @field Harms
|
||||||
SHORAD.Harms = {
|
SHORAD.Harms = {
|
||||||
["AGM_88"] = "AGM_88",
|
["AGM_88"] = "AGM_88",
|
||||||
["AGM_45"] = "AGM_45",
|
|
||||||
["AGM_122"] = "AGM_122",
|
["AGM_122"] = "AGM_122",
|
||||||
["AGM_84"] = "AGM_84",
|
["AGM_84"] = "AGM_84",
|
||||||
["AGM_45"] = "AGM_45",
|
["AGM_45"] = "AGM_45",
|
||||||
@@ -123,6 +137,8 @@ do
|
|||||||
["X_25"] = "X_25",
|
["X_25"] = "X_25",
|
||||||
["X_31"] = "X_31",
|
["X_31"] = "X_31",
|
||||||
["Kh25"] = "Kh25",
|
["Kh25"] = "Kh25",
|
||||||
|
["HY-2"] = "HY-2",
|
||||||
|
["ADM_141A"] = "ADM_141A",
|
||||||
}
|
}
|
||||||
|
|
||||||
--- TODO complete list?
|
--- TODO complete list?
|
||||||
@@ -134,7 +150,6 @@ do
|
|||||||
["Kh29"] = "Kh29",
|
["Kh29"] = "Kh29",
|
||||||
["Kh31"] = "Kh31",
|
["Kh31"] = "Kh31",
|
||||||
["Kh66"] = "Kh66",
|
["Kh66"] = "Kh66",
|
||||||
--["BGM_109"] = "BGM_109",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Instantiates a new SHORAD object
|
--- Instantiates a new SHORAD object
|
||||||
@@ -146,7 +161,7 @@ do
|
|||||||
-- @param #number ActiveTimer Determines how many seconds the systems stay on red alert after wake-up call
|
-- @param #number ActiveTimer Determines how many seconds the systems stay on red alert after wake-up call
|
||||||
-- @param #string Coalition Coalition, i.e. "blue", "red", or "neutral"
|
-- @param #string Coalition Coalition, i.e. "blue", "red", or "neutral"
|
||||||
-- @param #boolean UseEmOnOff Use Emissions On/Off rather than Alarm State Red/Green (default: use Emissions switch)
|
-- @param #boolean UseEmOnOff Use Emissions On/Off rather than Alarm State Red/Green (default: use Emissions switch)
|
||||||
-- @retunr #SHORAD self
|
-- @return #SHORAD self
|
||||||
function SHORAD:New(Name, ShoradPrefix, Samset, Radius, ActiveTimer, Coalition, UseEmOnOff)
|
function SHORAD:New(Name, ShoradPrefix, Samset, Radius, ActiveTimer, Coalition, UseEmOnOff)
|
||||||
local self = BASE:Inherit( self, FSM:New() )
|
local self = BASE:Inherit( self, FSM:New() )
|
||||||
self:T({Name, ShoradPrefix, Samset, Radius, ActiveTimer, Coalition})
|
self:T({Name, ShoradPrefix, Samset, Radius, ActiveTimer, Coalition})
|
||||||
@@ -165,8 +180,9 @@ do
|
|||||||
self.DefendMavs = true
|
self.DefendMavs = true
|
||||||
self.DefenseLowProb = 70 -- probability to detect a missile shot, low margin
|
self.DefenseLowProb = 70 -- probability to detect a missile shot, low margin
|
||||||
self.DefenseHighProb = 90 -- probability to detect a missile shot, high margin
|
self.DefenseHighProb = 90 -- probability to detect a missile shot, high margin
|
||||||
self.UseEmOnOff = UseEmOnOff or false -- Decide if we are using Emission on/off (default) or AlarmState red/green
|
self.UseEmOnOff = true -- Decide if we are using Emission on/off (default) or AlarmState red/green
|
||||||
self:I("*** SHORAD - Started Version 0.3.1")
|
if UseEmOnOff == false then self.UseEmOnOff = UseEmOnOff end
|
||||||
|
self:I("*** SHORAD - Started Version 0.3.4")
|
||||||
-- Set the string id for output to DCS.log file.
|
-- Set the string id for output to DCS.log file.
|
||||||
self.lid=string.format("SHORAD %s | ", self.name)
|
self.lid=string.format("SHORAD %s | ", self.name)
|
||||||
self:_InitState()
|
self:_InitState()
|
||||||
@@ -176,12 +192,14 @@ do
|
|||||||
self:SetStartState("Running")
|
self:SetStartState("Running")
|
||||||
self:AddTransition("*", "WakeUpShorad", "*")
|
self:AddTransition("*", "WakeUpShorad", "*")
|
||||||
self:AddTransition("*", "CalculateHitZone", "*")
|
self:AddTransition("*", "CalculateHitZone", "*")
|
||||||
|
self:AddTransition("*", "ShootAndScoot", "*")
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Initially set all groups to alarm state GREEN
|
--- Initially set all groups to alarm state GREEN
|
||||||
-- @param #SHORAD self
|
-- @param #SHORAD self
|
||||||
|
-- @return #SHORAD self
|
||||||
function SHORAD:_InitState()
|
function SHORAD:_InitState()
|
||||||
self:T(self.lid .. " _InitState")
|
self:T(self.lid .. " _InitState")
|
||||||
local table = {}
|
local table = {}
|
||||||
@@ -205,21 +223,40 @@ do
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Add a SET_ZONE of zones for Shoot&Scoot
|
||||||
|
-- @param #SHORAD self
|
||||||
|
-- @param Core.Set#SET_ZONE ZoneSet Set of zones to be used. Units will move around to the next (random) zone between 100m and 3000m away.
|
||||||
|
-- @param #number Number Number of closest zones to be considered, defaults to 3.
|
||||||
|
-- @param #boolean Random If true, use a random coordinate inside the next zone to scoot to.
|
||||||
|
-- @param #string Formation Formation to use, defaults to "Cone". See mission editor dropdown for options.
|
||||||
|
-- @return #SHORAD self
|
||||||
|
function SHORAD:AddScootZones(ZoneSet, Number, Random, Formation)
|
||||||
|
self:T(self.lid .. " AddScootZones")
|
||||||
|
self.SkateZones = ZoneSet
|
||||||
|
self.SkateNumber = Number or 3
|
||||||
|
self.shootandscoot = true
|
||||||
|
self.scootrandomcoord = Random
|
||||||
|
self.scootformation = Formation or "Cone"
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Switch debug state on
|
--- Switch debug state on
|
||||||
-- @param #SHORAD self
|
-- @param #SHORAD self
|
||||||
-- @param #boolean debug Switch debug on (true) or off (false)
|
-- @param #boolean debug Switch debug on (true) or off (false)
|
||||||
|
-- @return #SHORAD self
|
||||||
function SHORAD:SwitchDebug(onoff)
|
function SHORAD:SwitchDebug(onoff)
|
||||||
self:T( { onoff } )
|
self:T( { onoff } )
|
||||||
if onoff then
|
if onoff then
|
||||||
self:SwitchDebugOn()
|
self:SwitchDebugOn()
|
||||||
else
|
else
|
||||||
self.SwitchDebugOff()
|
self:SwitchDebugOff()
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Switch debug state on
|
--- Switch debug state on
|
||||||
-- @param #SHORAD self
|
-- @param #SHORAD self
|
||||||
|
-- @return #SHORAD self
|
||||||
function SHORAD:SwitchDebugOn()
|
function SHORAD:SwitchDebugOn()
|
||||||
self.debug = true
|
self.debug = true
|
||||||
--tracing
|
--tracing
|
||||||
@@ -230,6 +267,7 @@ do
|
|||||||
|
|
||||||
--- Switch debug state off
|
--- Switch debug state off
|
||||||
-- @param #SHORAD self
|
-- @param #SHORAD self
|
||||||
|
-- @return #SHORAD self
|
||||||
function SHORAD:SwitchDebugOff()
|
function SHORAD:SwitchDebugOff()
|
||||||
self.debug = false
|
self.debug = false
|
||||||
BASE:TraceOff()
|
BASE:TraceOff()
|
||||||
@@ -239,6 +277,7 @@ do
|
|||||||
--- Switch defense for HARMs
|
--- Switch defense for HARMs
|
||||||
-- @param #SHORAD self
|
-- @param #SHORAD self
|
||||||
-- @param #boolean onoff
|
-- @param #boolean onoff
|
||||||
|
-- @return #SHORAD self
|
||||||
function SHORAD:SwitchHARMDefense(onoff)
|
function SHORAD:SwitchHARMDefense(onoff)
|
||||||
self:T( { onoff } )
|
self:T( { onoff } )
|
||||||
local onoff = onoff or true
|
local onoff = onoff or true
|
||||||
@@ -249,6 +288,7 @@ do
|
|||||||
--- Switch defense for AGMs
|
--- Switch defense for AGMs
|
||||||
-- @param #SHORAD self
|
-- @param #SHORAD self
|
||||||
-- @param #boolean onoff
|
-- @param #boolean onoff
|
||||||
|
-- @return #SHORAD self
|
||||||
function SHORAD:SwitchAGMDefense(onoff)
|
function SHORAD:SwitchAGMDefense(onoff)
|
||||||
self:T( { onoff } )
|
self:T( { onoff } )
|
||||||
local onoff = onoff or true
|
local onoff = onoff or true
|
||||||
@@ -260,6 +300,7 @@ do
|
|||||||
-- @param #SHORAD self
|
-- @param #SHORAD self
|
||||||
-- @param #number low Minimum detection limit, integer 1-100
|
-- @param #number low Minimum detection limit, integer 1-100
|
||||||
-- @param #number high Maximum detection limit integer 1-100
|
-- @param #number high Maximum detection limit integer 1-100
|
||||||
|
-- @return #SHORAD self
|
||||||
function SHORAD:SetDefenseLimits(low,high)
|
function SHORAD:SetDefenseLimits(low,high)
|
||||||
self:T( { low, high } )
|
self:T( { low, high } )
|
||||||
local low = low or 70
|
local low = low or 70
|
||||||
@@ -278,6 +319,7 @@ do
|
|||||||
--- Set the number of seconds a SHORAD site will stay active
|
--- Set the number of seconds a SHORAD site will stay active
|
||||||
-- @param #SHORAD self
|
-- @param #SHORAD self
|
||||||
-- @param #number seconds Number of seconds systems stay active
|
-- @param #number seconds Number of seconds systems stay active
|
||||||
|
-- @return #SHORAD self
|
||||||
function SHORAD:SetActiveTimer(seconds)
|
function SHORAD:SetActiveTimer(seconds)
|
||||||
self:T(self.lid .. " SetActiveTimer")
|
self:T(self.lid .. " SetActiveTimer")
|
||||||
local timer = seconds or 600
|
local timer = seconds or 600
|
||||||
@@ -291,6 +333,7 @@ do
|
|||||||
--- Set the number of meters for the SHORAD defense zone
|
--- Set the number of meters for the SHORAD defense zone
|
||||||
-- @param #SHORAD self
|
-- @param #SHORAD self
|
||||||
-- @param #number meters Radius of the defense search zone in meters. #SHORADs in this range around a targeted group will go active
|
-- @param #number meters Radius of the defense search zone in meters. #SHORADs in this range around a targeted group will go active
|
||||||
|
-- @return #SHORAD self
|
||||||
function SHORAD:SetDefenseRadius(meters)
|
function SHORAD:SetDefenseRadius(meters)
|
||||||
self:T(self.lid .. " SetDefenseRadius")
|
self:T(self.lid .. " SetDefenseRadius")
|
||||||
local radius = meters or 20000
|
local radius = meters or 20000
|
||||||
@@ -304,6 +347,7 @@ do
|
|||||||
--- Set using Emission on/off instead of changing alarm state
|
--- Set using Emission on/off instead of changing alarm state
|
||||||
-- @param #SHORAD self
|
-- @param #SHORAD self
|
||||||
-- @param #boolean switch Decide if we are changing alarm state or AI state
|
-- @param #boolean switch Decide if we are changing alarm state or AI state
|
||||||
|
-- @return #SHORAD self
|
||||||
function SHORAD:SetUsingEmOnOff(switch)
|
function SHORAD:SetUsingEmOnOff(switch)
|
||||||
self:T(self.lid .. " SetUsingEmOnOff")
|
self:T(self.lid .. " SetUsingEmOnOff")
|
||||||
self.UseEmOnOff = switch or false
|
self.UseEmOnOff = switch or false
|
||||||
@@ -375,11 +419,11 @@ do
|
|||||||
local shorad = self.Groupset
|
local shorad = self.Groupset
|
||||||
local shoradset = shorad:GetAliveSet() --#table
|
local shoradset = shorad:GetAliveSet() --#table
|
||||||
local returnname = false
|
local returnname = false
|
||||||
|
--local TDiff = 1
|
||||||
for _,_groups in pairs (shoradset) do
|
for _,_groups in pairs (shoradset) do
|
||||||
local groupname = _groups:GetName()
|
local groupname = _groups:GetName()
|
||||||
if string.find(groupname, tgtgrp, 1, true) then
|
if string.find(groupname, tgtgrp, 1, true) then
|
||||||
returnname = true
|
returnname = true
|
||||||
--_groups:RelocateGroundRandomInRadius(7,100,false,false) -- be a bit evasive
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return returnname
|
return returnname
|
||||||
@@ -426,6 +470,7 @@ do
|
|||||||
-- @param #number Radius Radius of the #ZONE
|
-- @param #number Radius Radius of the #ZONE
|
||||||
-- @param #number ActiveTimer Number of seconds to stay active
|
-- @param #number ActiveTimer Number of seconds to stay active
|
||||||
-- @param #number TargetCat (optional) Category, i.e. Object.Category.UNIT or Object.Category.STATIC
|
-- @param #number TargetCat (optional) Category, i.e. Object.Category.UNIT or Object.Category.STATIC
|
||||||
|
-- @return #SHORAD self
|
||||||
-- @usage Use this function to integrate with other systems, example
|
-- @usage Use this function to integrate with other systems, example
|
||||||
--
|
--
|
||||||
-- local SamSet = SET_GROUP:New():FilterPrefixes("Blue SAM"):FilterCoalitions("blue"):FilterStart()
|
-- local SamSet = SET_GROUP:New():FilterPrefixes("Blue SAM"):FilterCoalitions("blue"):FilterStart()
|
||||||
@@ -452,28 +497,35 @@ do
|
|||||||
local targetzone = ZONE_RADIUS:New("Shorad",targetvec2,Radius) -- create a defense zone to check
|
local targetzone = ZONE_RADIUS:New("Shorad",targetvec2,Radius) -- create a defense zone to check
|
||||||
local groupset = self.Groupset --Core.Set#SET_GROUP
|
local groupset = self.Groupset --Core.Set#SET_GROUP
|
||||||
local shoradset = groupset:GetAliveSet() --#table
|
local shoradset = groupset:GetAliveSet() --#table
|
||||||
|
|
||||||
-- local function to switch off shorad again
|
-- local function to switch off shorad again
|
||||||
local function SleepShorad(group)
|
local function SleepShorad(group)
|
||||||
local groupname = group:GetName()
|
if group and group:IsAlive() then
|
||||||
self.ActiveGroups[groupname] = nil
|
local groupname = group:GetName()
|
||||||
if self.UseEmOnOff then
|
self.ActiveGroups[groupname] = nil
|
||||||
group:EnableEmission(false)
|
if self.UseEmOnOff then
|
||||||
--group:SetAIOff()
|
group:EnableEmission(false)
|
||||||
else
|
else
|
||||||
group:OptionAlarmStateGreen()
|
group:OptionAlarmStateGreen()
|
||||||
|
end
|
||||||
|
local text = string.format("Sleeping SHORAD %s", group:GetName())
|
||||||
|
self:T(text)
|
||||||
|
local m = MESSAGE:New(text,10,"SHORAD"):ToAllIf(self.debug)
|
||||||
|
--Shoot and Scoot
|
||||||
|
if self.shootandscoot then
|
||||||
|
self:__ShootAndScoot(1,group)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
local text = string.format("Sleeping SHORAD %s", group:GetName())
|
|
||||||
self:T(text)
|
|
||||||
local m = MESSAGE:New(text,10,"SHORAD"):ToAllIf(self.debug)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- go through set and find the one(s) to activate
|
-- go through set and find the one(s) to activate
|
||||||
|
local TDiff = 4
|
||||||
for _,_group in pairs (shoradset) do
|
for _,_group in pairs (shoradset) do
|
||||||
if _group:IsAnyInZone(targetzone) then
|
if _group:IsAnyInZone(targetzone) then
|
||||||
local text = string.format("Waking up SHORAD %s", _group:GetName())
|
local text = string.format("Waking up SHORAD %s", _group:GetName())
|
||||||
self:T(text)
|
self:T(text)
|
||||||
local m = MESSAGE:New(text,10,"SHORAD"):ToAllIf(self.debug)
|
local m = MESSAGE:New(text,10,"SHORAD"):ToAllIf(self.debug)
|
||||||
if self.UseEmOnOff then
|
if self.UseEmOnOff then
|
||||||
--_group:SetAIOn()
|
|
||||||
_group:EnableEmission(true)
|
_group:EnableEmission(true)
|
||||||
end
|
end
|
||||||
_group:OptionAlarmStateRed()
|
_group:OptionAlarmStateRed()
|
||||||
@@ -481,91 +533,132 @@ do
|
|||||||
if self.ActiveGroups[groupname] == nil then -- no timer yet for this group
|
if self.ActiveGroups[groupname] == nil then -- no timer yet for this group
|
||||||
self.ActiveGroups[groupname] = { Timing = ActiveTimer }
|
self.ActiveGroups[groupname] = { Timing = ActiveTimer }
|
||||||
local endtime = timer.getTime() + (ActiveTimer * math.random(75,100) / 100 ) -- randomize wakeup a bit
|
local endtime = timer.getTime() + (ActiveTimer * math.random(75,100) / 100 ) -- randomize wakeup a bit
|
||||||
timer.scheduleFunction(SleepShorad, _group, endtime)
|
self.ActiveGroups[groupname].Timer = TIMER:New(SleepShorad,_group):Start(endtime)
|
||||||
|
--Shoot and Scoot
|
||||||
|
if self.shootandscoot then
|
||||||
|
self:__ShootAndScoot(TDiff,_group)
|
||||||
|
TDiff=TDiff+1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- (Internal) Calculate hit zone of an AGM-88
|
--- (Internal) Calculate hit zone of an AGM-88
|
||||||
-- @param #SHORAD self
|
-- @param #SHORAD self
|
||||||
-- @param #table SEADWeapon DCS.Weapon object
|
-- @param #table SEADWeapon DCS.Weapon object
|
||||||
-- @param Core.Point#COORDINATE pos0 Position of the plane when it fired
|
-- @param Core.Point#COORDINATE pos0 Position of the plane when it fired
|
||||||
-- @param #number height Height when the missile was fired
|
-- @param #number height Height when the missile was fired
|
||||||
-- @param Wrapper.Group#GROUP SEADGroup Attacker group
|
-- @param Wrapper.Group#GROUP SEADGroup Attacker group
|
||||||
-- @return #SHORAD self
|
-- @return #SHORAD self
|
||||||
function SHORAD:onafterCalculateHitZone(From,Event,To,SEADWeapon,pos0,height,SEADGroup)
|
function SHORAD:onafterCalculateHitZone(From,Event,To,SEADWeapon,pos0,height,SEADGroup)
|
||||||
self:T("**** Calculating hit zone")
|
self:T("**** Calculating hit zone")
|
||||||
if SEADWeapon and SEADWeapon:isExist() then
|
if SEADWeapon and SEADWeapon:isExist() then
|
||||||
--local pos = SEADWeapon:getPoint()
|
--local pos = SEADWeapon:getPoint()
|
||||||
|
|
||||||
-- postion and height
|
-- postion and height
|
||||||
local position = SEADWeapon:getPosition()
|
local position = SEADWeapon:getPosition()
|
||||||
local mheight = height
|
local mheight = height
|
||||||
-- heading
|
-- heading
|
||||||
local wph = math.atan2(position.x.z, position.x.x)
|
local wph = math.atan2(position.x.z, position.x.x)
|
||||||
if wph < 0 then
|
if wph < 0 then
|
||||||
wph=wph+2*math.pi
|
wph=wph+2*math.pi
|
||||||
end
|
end
|
||||||
wph=math.deg(wph)
|
wph=math.deg(wph)
|
||||||
|
|
||||||
-- velocity
|
-- velocity
|
||||||
local wpndata = SEAD.HarmData["AGM_88"]
|
local wpndata = SEAD.HarmData["AGM_88"]
|
||||||
local mveloc = math.floor(wpndata[2] * 340.29)
|
local mveloc = math.floor(wpndata[2] * 340.29)
|
||||||
local c1 = (2*mheight*9.81)/(mveloc^2)
|
local c1 = (2*mheight*9.81)/(mveloc^2)
|
||||||
local c2 = (mveloc^2) / 9.81
|
local c2 = (mveloc^2) / 9.81
|
||||||
local Ropt = c2 * math.sqrt(c1+1)
|
local Ropt = c2 * math.sqrt(c1+1)
|
||||||
if height <= 5000 then
|
if height <= 5000 then
|
||||||
Ropt = Ropt * 0.72
|
Ropt = Ropt * 0.72
|
||||||
elseif height <= 7500 then
|
elseif height <= 7500 then
|
||||||
Ropt = Ropt * 0.82
|
Ropt = Ropt * 0.82
|
||||||
elseif height <= 10000 then
|
elseif height <= 10000 then
|
||||||
Ropt = Ropt * 0.87
|
Ropt = Ropt * 0.87
|
||||||
elseif height <= 12500 then
|
elseif height <= 12500 then
|
||||||
Ropt = Ropt * 0.98
|
Ropt = Ropt * 0.98
|
||||||
end
|
end
|
||||||
|
|
||||||
-- look at a couple of zones across the trajectory
|
-- look at a couple of zones across the trajectory
|
||||||
for n=1,3 do
|
for n=1,3 do
|
||||||
local dist = Ropt - ((n-1)*20000)
|
local dist = Ropt - ((n-1)*20000)
|
||||||
local predpos= pos0:Translate(dist,wph)
|
local predpos= pos0:Translate(dist,wph)
|
||||||
if predpos then
|
if predpos then
|
||||||
|
|
||||||
local targetzone = ZONE_RADIUS:New("Target Zone",predpos:GetVec2(),20000)
|
local targetzone = ZONE_RADIUS:New("Target Zone",predpos:GetVec2(),20000)
|
||||||
|
|
||||||
if self.debug then
|
if self.debug then
|
||||||
predpos:MarkToAll(string.format("height=%dm | heading=%d | velocity=%ddeg | Ropt=%dm",mheight,wph,mveloc,Ropt),false)
|
predpos:MarkToAll(string.format("height=%dm | heading=%d | velocity=%ddeg | Ropt=%dm",mheight,wph,mveloc,Ropt),false)
|
||||||
targetzone:DrawZone(coalition.side.BLUE,{0,0,1},0.2,nil,nil,3,true)
|
targetzone:DrawZone(coalition.side.BLUE,{0,0,1},0.2,nil,nil,3,true)
|
||||||
end
|
end
|
||||||
|
|
||||||
local seadset = self.Groupset
|
local seadset = self.Groupset
|
||||||
local tgtcoord = targetzone:GetRandomPointVec2()
|
local tgtcoord = targetzone:GetRandomPointVec2()
|
||||||
local tgtgrp = seadset:FindNearestGroupFromPointVec2(tgtcoord)
|
local tgtgrp = seadset:FindNearestGroupFromPointVec2(tgtcoord)
|
||||||
local _targetgroup = nil
|
local _targetgroup = nil
|
||||||
local _targetgroupname = "none"
|
local _targetgroupname = "none"
|
||||||
local _targetskill = "Random"
|
local _targetskill = "Random"
|
||||||
if tgtgrp and tgtgrp:IsAlive() then
|
if tgtgrp and tgtgrp:IsAlive() then
|
||||||
_targetgroup = tgtgrp
|
_targetgroup = tgtgrp
|
||||||
_targetgroupname = tgtgrp:GetName() -- group name
|
_targetgroupname = tgtgrp:GetName() -- group name
|
||||||
_targetskill = tgtgrp:GetUnit(1):GetSkill()
|
_targetskill = tgtgrp:GetUnit(1):GetSkill()
|
||||||
self:T("*** Found Target = ".. _targetgroupname)
|
self:T("*** Found Target = ".. _targetgroupname)
|
||||||
self:WakeUpShorad(_targetgroupname, self.Radius, self.ActiveTimer, Object.Category.UNIT)
|
self:WakeUpShorad(_targetgroupname, self.Radius, self.ActiveTimer, Object.Category.UNIT)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- (Internal) Shoot and Scoot
|
||||||
|
-- @param #SHORAD self
|
||||||
|
-- @param #string From
|
||||||
|
-- @param #string Event
|
||||||
|
-- @param #string To
|
||||||
|
-- @param Wrapper.Group#GROUP Shorad Shorad group
|
||||||
|
-- @return #SHORAD self
|
||||||
|
function SHORAD:onafterShootAndScoot(From,Event,To,Shorad)
|
||||||
|
self:T( { From,Event,To } )
|
||||||
|
local possibleZones = {}
|
||||||
|
local mindist = self.minscootdist or 100
|
||||||
|
local maxdist = self.maxscootdist or 3000
|
||||||
|
if Shorad and Shorad:IsAlive() then
|
||||||
|
local NowCoord = Shorad:GetCoordinate()
|
||||||
|
for _,_zone in pairs(self.SkateZones.Set) do
|
||||||
|
local zone = _zone -- Core.Zone#ZONE_RADIUS
|
||||||
|
local dist = NowCoord:Get2DDistance(zone:GetCoordinate())
|
||||||
|
if dist >= mindist and dist <= maxdist then
|
||||||
|
possibleZones[#possibleZones+1] = zone
|
||||||
|
if #possibleZones == self.SkateNumber then break end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if #possibleZones > 0 and Shorad:GetVelocityKMH() < 2 then
|
||||||
|
local rand = math.floor(math.random(1,#possibleZones*1000)/1000+0.5)
|
||||||
|
if rand == 0 then rand = 1 end
|
||||||
|
self:T(self.lid .. " ShootAndScoot to zone "..rand)
|
||||||
|
local ToCoordinate = possibleZones[rand]:GetCoordinate()
|
||||||
|
if self.scootrandomcoord then
|
||||||
|
ToCoordinate = possibleZones[rand]:GetRandomCoordinate(nil,nil,{land.SurfaceType.LAND,land.SurfaceType.ROAD})
|
||||||
|
end
|
||||||
|
local formation = self.scootformation or "Cone"
|
||||||
|
Shorad:RouteGroundTo(ToCoordinate,20,formation,1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return self
|
||||||
end
|
end
|
||||||
return self
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Main function - work on the EventData
|
--- Main function - work on the EventData
|
||||||
-- @param #SHORAD self
|
-- @param #SHORAD self
|
||||||
-- @param Core.Event#EVENTDATA EventData The event details table data set
|
-- @param Core.Event#EVENTDATA EventData The event details table data set
|
||||||
|
-- @return #SHORAD self
|
||||||
function SHORAD:HandleEventShot( EventData )
|
function SHORAD:HandleEventShot( EventData )
|
||||||
self:T( { EventData } )
|
self:T( { EventData } )
|
||||||
self:T(self.lid .. " HandleEventShot")
|
self:T(self.lid .. " HandleEventShot")
|
||||||
--local ShootingUnit = EventData.IniDCSUnit
|
|
||||||
--local ShootingUnitName = EventData.IniDCSUnitName
|
|
||||||
local ShootingWeapon = EventData.Weapon -- Identify the weapon fired
|
local ShootingWeapon = EventData.Weapon -- Identify the weapon fired
|
||||||
local ShootingWeaponName = EventData.WeaponName -- return weapon type
|
local ShootingWeaponName = EventData.WeaponName -- return weapon type
|
||||||
-- get firing coalition
|
-- get firing coalition
|
||||||
@@ -596,27 +689,18 @@ end
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
local targetcat = targetdata:getCategory() -- Identify category
|
local targetcat = Object.getCategory(targetdata) -- Identify category
|
||||||
self:T(string.format("Target Category (3=STATIC, 1=UNIT)= %s",tostring(targetcat)))
|
self:T(string.format("Target Category (3=STATIC, 1=UNIT)= %s",tostring(targetcat)))
|
||||||
self:T({targetdata})
|
self:T({targetdata})
|
||||||
local targetunit = nil
|
local targetunit = nil
|
||||||
if targetcat == Object.Category.UNIT then -- UNIT
|
if targetcat == Object.Category.UNIT then -- UNIT
|
||||||
targetunit = UNIT:Find(targetdata)
|
targetunit = UNIT:Find(targetdata)
|
||||||
elseif targetcat == Object.Category.STATIC then -- STATIC
|
elseif targetcat == Object.Category.STATIC then -- STATIC
|
||||||
--self:T("Static Target Data")
|
|
||||||
--self:T({targetdata:isExist()})
|
|
||||||
--self:T({targetdata:getPoint()})
|
|
||||||
local tgtcoord = COORDINATE:NewFromVec3(targetdata:getPoint())
|
local tgtcoord = COORDINATE:NewFromVec3(targetdata:getPoint())
|
||||||
--tgtcoord:MarkToAll("Missile Target",true)
|
local tgtgrp1 = self.Samset:FindNearestGroupFromPointVec2(tgtcoord)
|
||||||
|
|
||||||
local tgtgrp1 = self.Samset:FindNearestGroupFromPointVec2(tgtcoord)
|
|
||||||
local tgtcoord1 = tgtgrp1:GetCoordinate()
|
local tgtcoord1 = tgtgrp1:GetCoordinate()
|
||||||
--tgtcoord1:MarkToAll("Close target SAM",true)
|
|
||||||
|
|
||||||
local tgtgrp2 = self.Groupset:FindNearestGroupFromPointVec2(tgtcoord)
|
local tgtgrp2 = self.Groupset:FindNearestGroupFromPointVec2(tgtcoord)
|
||||||
local tgtcoord2 = tgtgrp2:GetCoordinate()
|
local tgtcoord2 = tgtgrp2:GetCoordinate()
|
||||||
--tgtcoord2:MarkToAll("Close target SHORAD",true)
|
|
||||||
|
|
||||||
local dist1 = tgtcoord:Get2DDistance(tgtcoord1)
|
local dist1 = tgtcoord:Get2DDistance(tgtcoord1)
|
||||||
local dist2 = tgtcoord:Get2DDistance(tgtcoord2)
|
local dist2 = tgtcoord:Get2DDistance(tgtcoord2)
|
||||||
|
|
||||||
@@ -628,10 +712,8 @@ end
|
|||||||
targetcat = Object.Category.UNIT
|
targetcat = Object.Category.UNIT
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--local targetunitname = Unit.getName(targetdata) -- Unit name
|
|
||||||
if targetunit and targetunit:IsAlive() then
|
if targetunit and targetunit:IsAlive() then
|
||||||
local targetunitname = targetunit:GetName()
|
local targetunitname = targetunit:GetName()
|
||||||
--local targetgroup = Unit.getGroup(Weapon.getTarget(ShootingWeapon)) --targeted group
|
|
||||||
local targetgroup = nil
|
local targetgroup = nil
|
||||||
local targetgroupname = "none"
|
local targetgroupname = "none"
|
||||||
if targetcat == Object.Category.UNIT then
|
if targetcat == Object.Category.UNIT then
|
||||||
@@ -649,7 +731,6 @@ end
|
|||||||
self:T( text )
|
self:T( text )
|
||||||
local m = MESSAGE:New(text,10,"Info"):ToAllIf(self.debug)
|
local m = MESSAGE:New(text,10,"Info"):ToAllIf(self.debug)
|
||||||
-- check if we or a SAM site are the target
|
-- check if we or a SAM site are the target
|
||||||
--local TargetGroup = EventData.TgtGroup -- Wrapper.Group#GROUP
|
|
||||||
local shotatus = self:_CheckShotAtShorad(targetgroupname) --#boolean
|
local shotatus = self:_CheckShotAtShorad(targetgroupname) --#boolean
|
||||||
local shotatsams = self:_CheckShotAtSams(targetgroupname) --#boolean
|
local shotatsams = self:_CheckShotAtSams(targetgroupname) --#boolean
|
||||||
-- if being shot at, find closest SHORADs to activate
|
-- if being shot at, find closest SHORADs to activate
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -33,9 +33,9 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **[funkyfranky](https://forums.eagle.ru/member.php?u=115026)**
|
-- ### Author: **funkyfranky**
|
||||||
--
|
--
|
||||||
-- ### Contributions: [FlightControl](https://forums.eagle.ru/member.php?u=89536)
|
-- ### Contributions: FlightControl
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -0,0 +1,590 @@
|
|||||||
|
--- **Functional** - TIRESIAS - manages AI behaviour.
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
|
--
|
||||||
|
-- The @{#TIRESIAS} class is working in the back to keep your large-scale ground units in check.
|
||||||
|
--
|
||||||
|
-- ## Features:
|
||||||
|
--
|
||||||
|
-- * Designed to keep CPU and Network usage lower on missions with a lot of ground units.
|
||||||
|
-- * Does not affect ships to keep the Navy guys happy.
|
||||||
|
-- * Does not affect OpsGroup type groups.
|
||||||
|
-- * Distinguishes between SAM groups, AAA groups and other ground groups.
|
||||||
|
-- * Exceptions can be defined to keep certain actions going.
|
||||||
|
-- * Works coalition-independent in the back
|
||||||
|
-- * Easy setup.
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
|
--
|
||||||
|
-- ## Missions:
|
||||||
|
--
|
||||||
|
-- ### [TIRESIAS](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master)
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
|
--
|
||||||
|
-- ### Author : **applevangelist **
|
||||||
|
--
|
||||||
|
-- @module Functional.Tiresias
|
||||||
|
-- @image Functional.Tiresias.jpg
|
||||||
|
--
|
||||||
|
-- Last Update: Dec 2023
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------
|
||||||
|
--- **TIRESIAS** class, extends Core.Base#BASE
|
||||||
|
-- @type TIRESIAS
|
||||||
|
-- @field #string ClassName
|
||||||
|
-- @field #booelan debug
|
||||||
|
-- @field #string version
|
||||||
|
-- @field #number Interval
|
||||||
|
-- @field Core.Set#SET_GROUP GroundSet
|
||||||
|
-- @field #number Coalition
|
||||||
|
-- @field Core.Set#SET_GROUP VehicleSet
|
||||||
|
-- @field Core.Set#SET_GROUP AAASet
|
||||||
|
-- @field Core.Set#SET_GROUP SAMSet
|
||||||
|
-- @field Core.Set#SET_GROUP ExceptionSet
|
||||||
|
-- @field Core.Set#SET_OPSGROUP OpsGroupSet
|
||||||
|
-- @field #number AAARange
|
||||||
|
-- @field #number HeloSwitchRange
|
||||||
|
-- @field #number PlaneSwitchRange
|
||||||
|
-- @field Core.Set#SET_GROUP FlightSet
|
||||||
|
-- @field #boolean SwitchAAA
|
||||||
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
|
---
|
||||||
|
-- @type TIRESIAS.Data
|
||||||
|
-- @field #string type
|
||||||
|
-- @field #number range
|
||||||
|
-- @field #boolean invisible
|
||||||
|
-- @field #boolean AIOff
|
||||||
|
-- @field #boolean exception
|
||||||
|
|
||||||
|
|
||||||
|
--- *Tiresias, Greek demi-god and shapeshifter, blinded by the Gods, works as oracle for you.* (Wiki)
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
|
--
|
||||||
|
-- ## TIRESIAS Concept
|
||||||
|
--
|
||||||
|
-- * Designed to keep CPU and Network usage lower on missions with a lot of ground units.
|
||||||
|
-- * Does not affect ships to keep the Navy guys happy.
|
||||||
|
-- * Does not affect OpsGroup type groups.
|
||||||
|
-- * Distinguishes between SAM groups, AAA groups and other ground groups.
|
||||||
|
-- * Exceptions can be defined in SET_GROUP objects to keep certain actions going.
|
||||||
|
-- * Works coalition-independent in the back
|
||||||
|
-- * Easy setup.
|
||||||
|
--
|
||||||
|
-- ## Setup
|
||||||
|
--
|
||||||
|
-- Setup is a one-liner:
|
||||||
|
--
|
||||||
|
-- local blinder = TIRESIAS:New()
|
||||||
|
--
|
||||||
|
-- Optionally you can set up exceptions, e.g. for convoys driving around
|
||||||
|
--
|
||||||
|
-- local exceptionset = SET_GROUP:New():FilterCoalitions("red"):FilterPrefixes("Convoy"):FilterStart()
|
||||||
|
-- local blinder = TIRESIAS:New()
|
||||||
|
-- blinder:AddExceptionSet(exceptionset)
|
||||||
|
--
|
||||||
|
-- Options
|
||||||
|
--
|
||||||
|
-- -- Setup different radius for activation around helo and airplane groups (applies to AI and humans)
|
||||||
|
-- blinder:SetActivationRanges(10,25) -- defaults are 10, and 25
|
||||||
|
--
|
||||||
|
-- -- Setup engagement ranges for AAA (non-advanced SAM units like Flaks etc) and if you want them to be AIOff
|
||||||
|
-- blinder:SetAAARanges(60,true) -- defaults are 60, and true
|
||||||
|
--
|
||||||
|
-- @field #TIRESIAS
|
||||||
|
TIRESIAS = {
|
||||||
|
ClassName = "TIRESIAS",
|
||||||
|
debug = false,
|
||||||
|
version = "0.0.4",
|
||||||
|
Interval = 20,
|
||||||
|
GroundSet = nil,
|
||||||
|
VehicleSet = nil,
|
||||||
|
AAASet = nil,
|
||||||
|
SAMSet = nil,
|
||||||
|
ExceptionSet = nil,
|
||||||
|
AAARange = 60, -- 60%
|
||||||
|
HeloSwitchRange = 10, -- NM
|
||||||
|
PlaneSwitchRange = 25, -- NM
|
||||||
|
SwitchAAA = true,
|
||||||
|
}
|
||||||
|
|
||||||
|
--- [USER] Create a new Tiresias object and start it up.
|
||||||
|
-- @param #TIRESIAS self
|
||||||
|
-- @return #TIRESIAS self
|
||||||
|
function TIRESIAS:New()
|
||||||
|
|
||||||
|
-- Inherit everything from FSM class.
|
||||||
|
local self = BASE:Inherit(self, FSM:New()) -- #TIRESIAS
|
||||||
|
|
||||||
|
--- FSM Functions ---
|
||||||
|
|
||||||
|
-- Start State.
|
||||||
|
self:SetStartState("Stopped")
|
||||||
|
|
||||||
|
-- Add FSM transitions.
|
||||||
|
-- From State --> Event --> To State
|
||||||
|
self:AddTransition("Stopped", "Start", "Running") -- Start FSM.
|
||||||
|
self:AddTransition("*", "Status", "*") -- TIRESIAS status update.
|
||||||
|
self:AddTransition("*", "Stop", "Stopped") -- Stop FSM.
|
||||||
|
|
||||||
|
self.ExceptionSet = SET_GROUP:New():Clear(false)
|
||||||
|
|
||||||
|
self:HandleEvent(EVENTS.PlayerEnterAircraft,self._EventHandler)
|
||||||
|
|
||||||
|
self.lid = string.format("TIRESIAS %s | ",self.version)
|
||||||
|
|
||||||
|
self:I(self.lid.."Managing ground groups!")
|
||||||
|
|
||||||
|
--- Triggers the FSM event "Stop". Stops TIRESIAS and all its event handlers.
|
||||||
|
-- @function [parent=#TIRESIAS] Stop
|
||||||
|
-- @param #TIRESIAS self
|
||||||
|
|
||||||
|
--- Triggers the FSM event "Stop" after a delay. Stops TIRESIAS and all its event handlers.
|
||||||
|
-- @function [parent=#TIRESIAS] __Stop
|
||||||
|
-- @param #TIRESIAS self
|
||||||
|
-- @param #number delay Delay in seconds.
|
||||||
|
|
||||||
|
--- Triggers the FSM event "Start". Starts TIRESIAS and all its event handlers. Note - `:New()` already starts the instance.
|
||||||
|
-- @function [parent=#TIRESIAS] Start
|
||||||
|
-- @param #TIRESIAS self
|
||||||
|
|
||||||
|
--- Triggers the FSM event "Start" after a delay. Starts TIRESIAS and all its event handlers. Note - `:New()` already starts the instance.
|
||||||
|
-- @function [parent=#TIRESIAS] __Start
|
||||||
|
-- @param #TIRESIAS self
|
||||||
|
-- @param #number delay Delay in seconds.
|
||||||
|
|
||||||
|
self:__Start(1)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- Helper Functions
|
||||||
|
--
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
---[USER] Set activation radius for Helos and Planes in Nautical Miles.
|
||||||
|
-- @param #TIRESIAS self
|
||||||
|
-- @param #number HeloMiles Radius around a Helicopter in which AI ground units will be activated. Defaults to 10NM.
|
||||||
|
-- @param #number PlaneMiles Radius around an Airplane in which AI ground units will be activated. Defaults to 25NM.
|
||||||
|
-- @return #TIRESIAS self
|
||||||
|
function TIRESIAS:SetActivationRanges(HeloMiles,PlaneMiles)
|
||||||
|
self.HeloSwitchRange = HeloMiles or 10
|
||||||
|
self.PlaneSwitchRange = PlaneMiles or 25
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
---[USER] Set AAA Ranges - AAA equals non-SAM systems which qualify as AAA in DCS world.
|
||||||
|
-- @param #TIRESIAS self
|
||||||
|
-- @param #number FiringRange The engagement range that AAA units will be set to. Can be 0 to 100 (percent). Defaults to 60.
|
||||||
|
-- @param #boolean SwitchAAA Decide if these system will have their AI switched off, too. Defaults to true.
|
||||||
|
-- @return #TIRESIAS self
|
||||||
|
function TIRESIAS:SetAAARanges(FiringRange,SwitchAAA)
|
||||||
|
self.AAARange = FiringRange or 60
|
||||||
|
self.SwitchAAA = (SwitchAAA == false) and false or true
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [USER] Add a SET_GROUP of GROUP objects as exceptions. Can be done multiple times.
|
||||||
|
-- @param #TIRESIAS self
|
||||||
|
-- @param Core.Set#SET_GROUP Set to add to the exception list.
|
||||||
|
-- @return #TIRESIAS self
|
||||||
|
function TIRESIAS:AddExceptionSet(Set)
|
||||||
|
self:T(self.lid.."AddExceptionSet")
|
||||||
|
local exceptions = self.ExceptionSet
|
||||||
|
Set:ForEachGroupAlive(
|
||||||
|
function(grp)
|
||||||
|
if not grp.Tiresias then
|
||||||
|
grp.Tiresias = { -- #TIRESIAS.Data
|
||||||
|
type = "Exception",
|
||||||
|
exception = true,
|
||||||
|
}
|
||||||
|
exceptions:AddGroup(grp,true)
|
||||||
|
end
|
||||||
|
BASE:I("TIRESIAS: Added exception group: "..grp:GetName())
|
||||||
|
end
|
||||||
|
)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [INTERNAL] Filter Function
|
||||||
|
-- @param Wrapper.Group#GROUP Group
|
||||||
|
-- @return #boolean isin
|
||||||
|
function TIRESIAS._FilterNotAAA(Group)
|
||||||
|
local grp = Group -- Wrapper.Group#GROUP
|
||||||
|
local isaaa = grp:IsAAA()
|
||||||
|
if isaaa == true and grp:IsGround() and not grp:IsShip() then
|
||||||
|
return false -- remove from SET
|
||||||
|
else
|
||||||
|
return true -- keep in SET
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [INTERNAL] Filter Function
|
||||||
|
-- @param Wrapper.Group#GROUP Group
|
||||||
|
-- @return #boolean isin
|
||||||
|
function TIRESIAS._FilterNotSAM(Group)
|
||||||
|
local grp = Group -- Wrapper.Group#GROUP
|
||||||
|
local issam = grp:IsSAM()
|
||||||
|
if issam == true and grp:IsGround() and not grp:IsShip() then
|
||||||
|
return false -- remove from SET
|
||||||
|
else
|
||||||
|
return true -- keep in SET
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [INTERNAL] Filter Function
|
||||||
|
-- @param Wrapper.Group#GROUP Group
|
||||||
|
-- @return #boolean isin
|
||||||
|
function TIRESIAS._FilterAAA(Group)
|
||||||
|
local grp = Group -- Wrapper.Group#GROUP
|
||||||
|
local isaaa = grp:IsAAA()
|
||||||
|
if isaaa == true and grp:IsGround() and not grp:IsShip() then
|
||||||
|
return true -- remove from SET
|
||||||
|
else
|
||||||
|
return false -- keep in SET
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [INTERNAL] Filter Function
|
||||||
|
-- @param Wrapper.Group#GROUP Group
|
||||||
|
-- @return #boolean isin
|
||||||
|
function TIRESIAS._FilterSAM(Group)
|
||||||
|
local grp = Group -- Wrapper.Group#GROUP
|
||||||
|
local issam = grp:IsSAM()
|
||||||
|
if issam == true and grp:IsGround() and not grp:IsShip() then
|
||||||
|
return true -- remove from SET
|
||||||
|
else
|
||||||
|
return false -- keep in SET
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [INTERNAL] Init Groups
|
||||||
|
-- @param #TIRESIAS self
|
||||||
|
-- @return #TIRESIAS self
|
||||||
|
function TIRESIAS:_InitGroups()
|
||||||
|
self:T(self.lid.."_InitGroups")
|
||||||
|
-- Set all groups invisible/motionless
|
||||||
|
local EngageRange = self.AAARange
|
||||||
|
local SwitchAAA = self.SwitchAAA
|
||||||
|
--- AAA
|
||||||
|
self.AAASet:ForEachGroupAlive(
|
||||||
|
function(grp)
|
||||||
|
if not grp.Tiresias then
|
||||||
|
grp:OptionEngageRange(EngageRange)
|
||||||
|
grp:SetCommandInvisible(true)
|
||||||
|
if SwitchAAA then
|
||||||
|
grp:SetAIOff()
|
||||||
|
grp:EnableEmission(false)
|
||||||
|
end
|
||||||
|
grp.Tiresias = { -- #TIRESIAS.Data
|
||||||
|
type = "AAA",
|
||||||
|
invisible = true,
|
||||||
|
range = EngageRange,
|
||||||
|
exception = false,
|
||||||
|
AIOff = SwitchAAA,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
if grp.Tiresias and (not grp.Tiresias.exception == true) then
|
||||||
|
if grp.Tiresias.invisible and grp.Tiresias.invisible == false then
|
||||||
|
grp:SetCommandInvisible(true)
|
||||||
|
grp.Tiresias.invisible = true
|
||||||
|
if SwitchAAA then
|
||||||
|
grp:SetAIOff()
|
||||||
|
grp:EnableEmission(false)
|
||||||
|
grp.Tiresias.AIOff = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
--BASE:I(string.format("Init/Switch off AAA %s (Exception %s)",grp:GetName(),tostring(grp.Tiresias.exception)))
|
||||||
|
end
|
||||||
|
)
|
||||||
|
--- Vehicles
|
||||||
|
self.VehicleSet:ForEachGroupAlive(
|
||||||
|
function(grp)
|
||||||
|
if not grp.Tiresias then
|
||||||
|
grp:SetAIOff()
|
||||||
|
grp:SetCommandInvisible(true)
|
||||||
|
grp.Tiresias = { -- #TIRESIAS.Data
|
||||||
|
type = "Vehicle",
|
||||||
|
invisible = true,
|
||||||
|
AIOff = true,
|
||||||
|
exception = false,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
if grp.Tiresias and (not grp.Tiresias.exception == true) then
|
||||||
|
if grp.Tiresias and grp.Tiresias.invisible and grp.Tiresias.invisible == false then
|
||||||
|
grp:SetCommandInvisible(true)
|
||||||
|
grp:SetAIOff()
|
||||||
|
grp.Tiresias.invisible = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
--BASE:I(string.format("Init/Switch off Vehicle %s (Exception %s)",grp:GetName(),tostring(grp.Tiresias.exception)))
|
||||||
|
end
|
||||||
|
)
|
||||||
|
--- SAM
|
||||||
|
self.SAMSet:ForEachGroupAlive(
|
||||||
|
function(grp)
|
||||||
|
if not grp.Tiresias then
|
||||||
|
grp:SetCommandInvisible(true)
|
||||||
|
grp.Tiresias = { -- #TIRESIAS.Data
|
||||||
|
type = "SAM",
|
||||||
|
invisible = true,
|
||||||
|
exception = false,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
if grp.Tiresias and (not grp.Tiresias.exception == true) then
|
||||||
|
if grp.Tiresias and grp.Tiresias.invisible and grp.Tiresias.invisible == false then
|
||||||
|
grp:SetCommandInvisible(true)
|
||||||
|
grp.Tiresias.invisible = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
--BASE:I(string.format("Init/Switch off SAM %s (Exception %s)",grp:GetName(),tostring(grp.Tiresias.exception)))
|
||||||
|
end
|
||||||
|
)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [INTERNAL] Event handler function
|
||||||
|
-- @param #TIRESIAS self
|
||||||
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
|
-- @return #TIRESIAS self
|
||||||
|
function TIRESIAS:_EventHandler(EventData)
|
||||||
|
self:T(string.format("%s Event = %d",self.lid, EventData.id))
|
||||||
|
local event = EventData -- Core.Event#EVENTDATA
|
||||||
|
if event.id == EVENTS.PlayerEnterAircraft or event.id == EVENTS.PlayerEnterUnit then
|
||||||
|
--local _coalition = event.IniCoalition
|
||||||
|
--if _coalition ~= self.Coalition then
|
||||||
|
-- return --ignore!
|
||||||
|
--end
|
||||||
|
local unitname = event.IniUnitName or "none"
|
||||||
|
local _unit = event.IniUnit
|
||||||
|
local _group = event.IniGroup
|
||||||
|
if _group and _group:IsAlive() then
|
||||||
|
local radius = self.PlaneSwitchRange
|
||||||
|
if _group:IsHelicopter() then
|
||||||
|
radius = self.HeloSwitchRange
|
||||||
|
end
|
||||||
|
self:_SwitchOnGroups(_group,radius)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [INTERNAL] Switch Groups Behaviour
|
||||||
|
-- @param #TIRESIAS self
|
||||||
|
-- @param Wrapper.Group#GROUP group
|
||||||
|
-- @param #number radius Radius in NM
|
||||||
|
-- @return #TIRESIAS self
|
||||||
|
function TIRESIAS:_SwitchOnGroups(group,radius)
|
||||||
|
self:T(self.lid.."_SwitchOnGroups "..group:GetName().." Radius "..radius.." NM")
|
||||||
|
local zone = ZONE_GROUP:New("Zone-"..group:GetName(),group,UTILS.NMToMeters(radius))
|
||||||
|
local ground = SET_GROUP:New():FilterCategoryGround():FilterZones({zone}):FilterOnce()
|
||||||
|
local count = ground:CountAlive()
|
||||||
|
if self.debug then
|
||||||
|
local text = string.format("There are %d groups around this plane or helo!",count)
|
||||||
|
self:I(text)
|
||||||
|
end
|
||||||
|
local SwitchAAA = self.SwitchAAA
|
||||||
|
if ground:CountAlive() > 0 then
|
||||||
|
ground:ForEachGroupAlive(
|
||||||
|
function(grp)
|
||||||
|
if grp.Tiresias and grp.Tiresias.type and (not grp.Tiresias.exception == true ) then
|
||||||
|
if grp.Tiresias.invisible == true then
|
||||||
|
grp:SetCommandInvisible(false)
|
||||||
|
grp.Tiresias.invisible = false
|
||||||
|
end
|
||||||
|
if grp.Tiresias.type == "Vehicle" and grp.Tiresias.AIOff and grp.Tiresias.AIOff == true then
|
||||||
|
grp:SetAIOn()
|
||||||
|
grp.Tiresias.AIOff = false
|
||||||
|
end
|
||||||
|
if SwitchAAA and grp.Tiresias.type == "AAA" and grp.Tiresias.AIOff and grp.Tiresias.AIOff == true then
|
||||||
|
grp:SetAIOn()
|
||||||
|
grp:EnableEmission(true)
|
||||||
|
grp.Tiresias.AIOff = false
|
||||||
|
end
|
||||||
|
--BASE:I(string.format("TIRESIAS - Switch on %s %s (Exception %s)",tostring(grp.Tiresias.type),grp:GetName(),tostring(grp.Tiresias.exception)))
|
||||||
|
else
|
||||||
|
BASE:E("TIRESIAS - This group has not been initialized or is an exception!")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- FSM Functions
|
||||||
|
--
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
--- [INTERNAL] FSM Function
|
||||||
|
-- @param #TIRESIAS self
|
||||||
|
-- @param #string From
|
||||||
|
-- @param #string Event
|
||||||
|
-- @param #string To
|
||||||
|
-- @return #TIRESIAS self
|
||||||
|
function TIRESIAS:onafterStart(From, Event, To)
|
||||||
|
self:T({From, Event, To})
|
||||||
|
|
||||||
|
local VehicleSet = SET_GROUP:New():FilterCategoryGround():FilterFunction(TIRESIAS._FilterNotAAA):FilterFunction(TIRESIAS._FilterNotSAM):FilterStart()
|
||||||
|
local AAASet = SET_GROUP:New():FilterCategoryGround():FilterFunction(TIRESIAS._FilterAAA):FilterStart()
|
||||||
|
local SAMSet = SET_GROUP:New():FilterCategoryGround():FilterFunction(TIRESIAS._FilterSAM):FilterStart()
|
||||||
|
local OpsGroupSet = SET_OPSGROUP:New():FilterActive(true):FilterStart()
|
||||||
|
self.FlightSet = SET_GROUP:New():FilterCategories({"plane","helicopter"}):FilterStart()
|
||||||
|
|
||||||
|
local EngageRange = self.AAARange
|
||||||
|
|
||||||
|
local ExceptionSet = self.ExceptionSet
|
||||||
|
if self.ExceptionSet then
|
||||||
|
function ExceptionSet:OnAfterAdded(From,Event,To,ObjectName,Object)
|
||||||
|
BASE:I("TIRESIAS: EXCEPTION Object Added: "..Object:GetName())
|
||||||
|
if Object and Object:IsAlive() then
|
||||||
|
Object.Tiresias = { -- #TIRESIAS.Data
|
||||||
|
type = "Exception",
|
||||||
|
exception = true,
|
||||||
|
}
|
||||||
|
Object:SetAIOn()
|
||||||
|
Object:SetCommandInvisible(false)
|
||||||
|
Object:EnableEmission(true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local OGS = OpsGroupSet:GetAliveSet()
|
||||||
|
for _,_OG in pairs(OGS or {}) do
|
||||||
|
local OG = _OG -- Ops.OpsGroup#OPSGROUP
|
||||||
|
local grp = OG:GetGroup()
|
||||||
|
ExceptionSet:AddGroup(grp,true)
|
||||||
|
end
|
||||||
|
|
||||||
|
function OpsGroupSet:OnAfterAdded(From,Event,To,ObjectName,Object)
|
||||||
|
local grp = Object:GetGroup()
|
||||||
|
ExceptionSet:AddGroup(grp,true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function VehicleSet:OnAfterAdded(From,Event,To,ObjectName,Object)
|
||||||
|
BASE:I("TIRESIAS: VEHCILE Object Added: "..Object:GetName())
|
||||||
|
if Object and Object:IsAlive() then
|
||||||
|
Object:SetAIOff()
|
||||||
|
Object:SetCommandInvisible(true)
|
||||||
|
Object.Tiresias = { -- #TIRESIAS.Data
|
||||||
|
type = "Vehicle",
|
||||||
|
invisible = true,
|
||||||
|
AIOff = true,
|
||||||
|
exception = false,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local SwitchAAA = self.SwitchAAA
|
||||||
|
|
||||||
|
function AAASet:OnAfterAdded(From,Event,To,ObjectName,Object)
|
||||||
|
if Object and Object:IsAlive() then
|
||||||
|
BASE:I("TIRESIAS: AAA Object Added: "..Object:GetName())
|
||||||
|
Object:OptionEngageRange(EngageRange)
|
||||||
|
Object:SetCommandInvisible(true)
|
||||||
|
if SwitchAAA then
|
||||||
|
Object:SetAIOff()
|
||||||
|
Object:EnableEmission(false)
|
||||||
|
end
|
||||||
|
Object.Tiresias = { -- #TIRESIAS.Data
|
||||||
|
type = "AAA",
|
||||||
|
invisible = true,
|
||||||
|
range = EngageRange,
|
||||||
|
exception = false,
|
||||||
|
AIOff = SwitchAAA,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function SAMSet:OnAfterAdded(From,Event,To,ObjectName,Object)
|
||||||
|
if Object and Object:IsAlive() then
|
||||||
|
BASE:I("TIRESIAS: SAM Object Added: "..Object:GetName())
|
||||||
|
Object:SetCommandInvisible(true)
|
||||||
|
Object.Tiresias = { -- #TIRESIAS.Data
|
||||||
|
type = "SAM",
|
||||||
|
invisible = true,
|
||||||
|
exception = false,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
self.VehicleSet = VehicleSet
|
||||||
|
self.AAASet = AAASet
|
||||||
|
self.SAMSet = SAMSet
|
||||||
|
self.OpsGroupSet = OpsGroupSet
|
||||||
|
|
||||||
|
self:_InitGroups()
|
||||||
|
|
||||||
|
self:__Status(1)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [INTERNAL] FSM Function
|
||||||
|
-- @param #TIRESIAS self
|
||||||
|
-- @param #string From
|
||||||
|
-- @param #string Event
|
||||||
|
-- @param #string To
|
||||||
|
-- @return #TIRESIAS self
|
||||||
|
function TIRESIAS:onbeforeStatus(From, Event, To)
|
||||||
|
self:T({From, Event, To})
|
||||||
|
if self:GetState() == "Stopped" then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [INTERNAL] FSM Function
|
||||||
|
-- @param #TIRESIAS self
|
||||||
|
-- @param #string From
|
||||||
|
-- @param #string Event
|
||||||
|
-- @param #string To
|
||||||
|
-- @return #TIRESIAS self
|
||||||
|
function TIRESIAS:onafterStatus(From, Event, To)
|
||||||
|
self:T({From, Event, To})
|
||||||
|
if self.debug then
|
||||||
|
local count = self.VehicleSet:CountAlive()
|
||||||
|
local AAAcount = self.AAASet:CountAlive()
|
||||||
|
local SAMcount = self.SAMSet:CountAlive()
|
||||||
|
local text = string.format("Overall: %d | Vehicles: %d | AAA: %d | SAM: %d",count+AAAcount+SAMcount,count,AAAcount,SAMcount)
|
||||||
|
self:I(text)
|
||||||
|
end
|
||||||
|
self:_InitGroups()
|
||||||
|
if self.FlightSet:CountAlive() > 0 then
|
||||||
|
local Set = self.FlightSet:GetAliveSet()
|
||||||
|
for _,_plane in pairs(Set) do
|
||||||
|
local plane = _plane -- Wrapper.Group#GROUP
|
||||||
|
local radius = self.PlaneSwitchRange
|
||||||
|
if plane:IsHelicopter() then
|
||||||
|
radius = self.HeloSwitchRange
|
||||||
|
end
|
||||||
|
self:_SwitchOnGroups(_plane,radius)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if self:GetState() ~= "Stopped" then
|
||||||
|
self:__Status(self.Interval)
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [INTERNAL] FSM Function
|
||||||
|
-- @param #TIRESIAS self
|
||||||
|
-- @param #string From
|
||||||
|
-- @param #string Event
|
||||||
|
-- @param #string To
|
||||||
|
-- @return #TIRESIAS self
|
||||||
|
function TIRESIAS:onafterStop(From, Event, To)
|
||||||
|
self:T({From, Event, To})
|
||||||
|
self:UnHandleEvent(EVENTS.PlayerEnterAircraft)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- End
|
||||||
|
--
|
||||||
|
-------------------------------------------------------------------------------------------------------------
|
||||||
@@ -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!
|
||||||
@@ -742,7 +742,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Save Assets
|
-- ## Save Assets
|
||||||
--
|
--
|
||||||
-- Saving asset data to file is achieved by the @{WAREHOUSE.Save}(*path*, *filename*) function. The parameter *path* specifies the path on the file system where the
|
-- Saving asset data to file is achieved by the @{#WAREHOUSE.Save}(*path*, *filename*) function. The parameter *path* specifies the path on the file system where the
|
||||||
-- warehouse data is saved. If you do not specify a path, the file is saved your the DCS installation root directory.
|
-- warehouse data is saved. If you do not specify a path, the file is saved your the DCS installation root directory.
|
||||||
-- The parameter *filename* is optional and defines the name of the saved file. By default this is automatically created from the warehouse id and name, for example
|
-- The parameter *filename* is optional and defines the name of the saved file. By default this is automatically created from the warehouse id and name, for example
|
||||||
-- "Warehouse-1234_Batumi.txt".
|
-- "Warehouse-1234_Batumi.txt".
|
||||||
@@ -753,13 +753,13 @@
|
|||||||
--
|
--
|
||||||
-- ### Automatic Save at Mission End
|
-- ### Automatic Save at Mission End
|
||||||
--
|
--
|
||||||
-- The assets can be saved automatically when the mission is ended via the @{WAREHOUSE.SetSaveOnMissionEnd}(*path*, *filename*) function, i.e.
|
-- The assets can be saved automatically when the mission is ended via the @{#WAREHOUSE.SetSaveOnMissionEnd}(*path*, *filename*) function, i.e.
|
||||||
--
|
--
|
||||||
-- warehouseBatumi:SetSaveOnMissionEnd("D:\\My Warehouse Data\\")
|
-- warehouseBatumi:SetSaveOnMissionEnd("D:\\My Warehouse Data\\")
|
||||||
--
|
--
|
||||||
-- ## Load Assets
|
-- ## Load Assets
|
||||||
--
|
--
|
||||||
-- Loading assets data from file is achieved by the @{WAREHOUSE.Load}(*path*, *filename*) function. The parameter *path* specifies the path on the file system where the
|
-- Loading assets data from file is achieved by the @{#WAREHOUSE.Load}(*path*, *filename*) function. The parameter *path* specifies the path on the file system where the
|
||||||
-- warehouse data is loaded from. If you do not specify a path, the file is loaded from your the DCS installation root directory.
|
-- warehouse data is loaded from. If you do not specify a path, the file is loaded from your the DCS installation root directory.
|
||||||
-- The parameter *filename* is optional and defines the name of the file to load. By default this is automatically generated from the warehouse id and name, for example
|
-- The parameter *filename* is optional and defines the name of the file to load. By default this is automatically generated from the warehouse id and name, for example
|
||||||
-- "Warehouse-1234_Batumi.txt".
|
-- "Warehouse-1234_Batumi.txt".
|
||||||
@@ -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.
|
||||||
@@ -3414,7 +3414,7 @@ end
|
|||||||
-- FSM states
|
-- FSM states
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
--- On after Start event. Starts the warehouse. Addes event handlers and schedules status updates of reqests and queue.
|
--- On after Start event. Starts the warehouse. Adds event handlers and schedules status updates of reqests and queue.
|
||||||
-- @param #WAREHOUSE self
|
-- @param #WAREHOUSE self
|
||||||
-- @param #string From From state.
|
-- @param #string From From state.
|
||||||
-- @param #string Event Event.
|
-- @param #string Event Event.
|
||||||
@@ -3595,6 +3595,7 @@ 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,6 +5394,7 @@ function WAREHOUSE:onafterRunwayDestroyed(From, Event, To)
|
|||||||
|
|
||||||
self.runwaydestroyed=timer.getAbsTime()
|
self.runwaydestroyed=timer.getAbsTime()
|
||||||
|
|
||||||
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- On after "RunwayRepaired" event.
|
--- On after "RunwayRepaired" event.
|
||||||
@@ -5408,6 +5410,7 @@ function WAREHOUSE:onafterRunwayRepaired(From, Event, To)
|
|||||||
|
|
||||||
self.runwaydestroyed=nil
|
self.runwaydestroyed=nil
|
||||||
|
|
||||||
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -7405,6 +7408,8 @@ 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
|
||||||
_assetcategory=_assets[1].category
|
_assetcategory=_assets[1].category
|
||||||
@@ -7415,6 +7420,19 @@ function WAREHOUSE:_CheckRequestNow(request)
|
|||||||
|
|
||||||
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
|
||||||
@@ -7531,6 +7549,9 @@ function WAREHOUSE:_CheckRequestNow(request)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
elseif _assetcategory==Group.Category.AIRPLANE or _assetcategory==Group.Category.HELICOPTER then
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -7870,7 +7891,7 @@ function WAREHOUSE:_GetTerminal(_attribute, _category)
|
|||||||
-- Default terminal is "large".
|
-- Default terminal is "large".
|
||||||
local _terminal=AIRBASE.TerminalType.OpenBig
|
local _terminal=AIRBASE.TerminalType.OpenBig
|
||||||
|
|
||||||
if _attribute==WAREHOUSE.Attribute.AIR_FIGHTER then
|
if _attribute==WAREHOUSE.Attribute.AIR_FIGHTER or _attribute==WAREHOUSE.Attribute.AIR_UAV then
|
||||||
-- Fighter ==> small.
|
-- Fighter ==> small.
|
||||||
_terminal=AIRBASE.TerminalType.FighterAircraft
|
_terminal=AIRBASE.TerminalType.FighterAircraft
|
||||||
elseif _attribute==WAREHOUSE.Attribute.AIR_BOMBER or _attribute==WAREHOUSE.Attribute.AIR_TRANSPORTPLANE or _attribute==WAREHOUSE.Attribute.AIR_TANKER or _attribute==WAREHOUSE.Attribute.AIR_AWACS then
|
elseif _attribute==WAREHOUSE.Attribute.AIR_BOMBER or _attribute==WAREHOUSE.Attribute.AIR_TRANSPORTPLANE or _attribute==WAREHOUSE.Attribute.AIR_TANKER or _attribute==WAREHOUSE.Attribute.AIR_AWACS then
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Missions:
|
||||||
--
|
--
|
||||||
-- [CAZ - Capture Zones](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CAZ%20-%20Capture%20Zones)
|
-- [CAZ - Capture Zones](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/ZoneCaptureCoalition)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -363,8 +363,8 @@ do -- ZONE_CAPTURE_COALITION
|
|||||||
|
|
||||||
--- ZONE_CAPTURE_COALITION Constructor.
|
--- ZONE_CAPTURE_COALITION Constructor.
|
||||||
-- @param #ZONE_CAPTURE_COALITION self
|
-- @param #ZONE_CAPTURE_COALITION self
|
||||||
-- @param Core.Zone#ZONE Zone A @{Core.Zone} object with the goal to be achieved. Alternatively, can be handed as the name of late activated group describing a @{ZONE_POLYGON} with its waypoints.
|
-- @param Core.Zone#ZONE Zone A @{Core.Zone} object with the goal to be achieved. Alternatively, can be handed as the name of late activated group describing a @{Core.Zone#ZONE_POLYGON} with its waypoints.
|
||||||
-- @param DCSCoalition.DCSCoalition#coalition Coalition The initial coalition owning the zone.
|
-- @param #number Coalition The initial coalition owning the zone.
|
||||||
-- @param #table UnitCategories Table of unit categories. See [DCS Class Unit](https://wiki.hoggitworld.com/view/DCS_Class_Unit). Default {Unit.Category.GROUND_UNIT}.
|
-- @param #table UnitCategories Table of unit categories. See [DCS Class Unit](https://wiki.hoggitworld.com/view/DCS_Class_Unit). Default {Unit.Category.GROUND_UNIT}.
|
||||||
-- @param #table ObjectCategories Table of unit categories. See [DCS Class Object](https://wiki.hoggitworld.com/view/DCS_Class_Object). Default {Object.Category.UNIT, Object.Category.STATIC}, i.e. all UNITS and STATICS.
|
-- @param #table ObjectCategories Table of unit categories. See [DCS Class Object](https://wiki.hoggitworld.com/view/DCS_Class_Object). Default {Object.Category.UNIT, Object.Category.STATIC}, i.e. all UNITS and STATICS.
|
||||||
-- @return #ZONE_CAPTURE_COALITION
|
-- @return #ZONE_CAPTURE_COALITION
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
--
|
--
|
||||||
-- ZONE_GOAL_CARGO models processes that have a Goal with a defined achievement involving a Zone and Cargo.
|
-- ZONE_GOAL_CARGO models processes that have a Goal with a defined achievement involving a Zone and Cargo.
|
||||||
-- Derived classes implement the ways how the achievements can be realized.
|
-- Derived classes implement the ways how the achievements can be realized.
|
||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # 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
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
@@ -61,7 +61,7 @@ do -- ZoneGoal
|
|||||||
--- ZONE_GOAL_CARGO Constructor.
|
--- ZONE_GOAL_CARGO Constructor.
|
||||||
-- @param #ZONE_GOAL_CARGO self
|
-- @param #ZONE_GOAL_CARGO self
|
||||||
-- @param Core.Zone#ZONE Zone A @{Core.Zone} object with the goal to be achieved.
|
-- @param Core.Zone#ZONE Zone A @{Core.Zone} object with the goal to be achieved.
|
||||||
-- @param DCSCoalition.DCSCoalition#coalition Coalition The initial coalition owning the zone.
|
-- @param #number Coalition The initial coalition owning the zone.
|
||||||
-- @return #ZONE_GOAL_CARGO
|
-- @return #ZONE_GOAL_CARGO
|
||||||
function ZONE_GOAL_CARGO:New( Zone, Coalition )
|
function ZONE_GOAL_CARGO:New( Zone, Coalition )
|
||||||
|
|
||||||
@@ -259,7 +259,7 @@ do -- ZoneGoal
|
|||||||
|
|
||||||
--- Set the owning coalition of the zone.
|
--- Set the owning coalition of the zone.
|
||||||
-- @param #ZONE_GOAL_CARGO self
|
-- @param #ZONE_GOAL_CARGO self
|
||||||
-- @param DCSCoalition.DCSCoalition#coalition Coalition
|
-- @param #number Coalition
|
||||||
function ZONE_GOAL_CARGO:SetCoalition( Coalition )
|
function ZONE_GOAL_CARGO:SetCoalition( Coalition )
|
||||||
self.Coalition = Coalition
|
self.Coalition = Coalition
|
||||||
end
|
end
|
||||||
@@ -267,7 +267,7 @@ do -- ZoneGoal
|
|||||||
|
|
||||||
--- Get the owning coalition of the zone.
|
--- Get the owning coalition of the zone.
|
||||||
-- @param #ZONE_GOAL_CARGO self
|
-- @param #ZONE_GOAL_CARGO self
|
||||||
-- @return DCSCoalition.DCSCoalition#coalition Coalition.
|
-- @return #number Coalition.
|
||||||
function ZONE_GOAL_CARGO:GetCoalition()
|
function ZONE_GOAL_CARGO:GetCoalition()
|
||||||
return self.Coalition
|
return self.Coalition
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ do -- ZoneGoal
|
|||||||
--- ZONE_GOAL_COALITION Constructor.
|
--- ZONE_GOAL_COALITION Constructor.
|
||||||
-- @param #ZONE_GOAL_COALITION self
|
-- @param #ZONE_GOAL_COALITION self
|
||||||
-- @param Core.Zone#ZONE Zone A @{Core.Zone} object with the goal to be achieved.
|
-- @param Core.Zone#ZONE Zone A @{Core.Zone} object with the goal to be achieved.
|
||||||
-- @param DCSCoalition.DCSCoalition#coalition Coalition The initial coalition owning the zone. Default coalition.side.NEUTRAL.
|
-- @param #number Coalition The initial coalition owning the zone. Default coalition.side.NEUTRAL.
|
||||||
-- @param #table UnitCategories Table of unit categories. See [DCS Class Unit](https://wiki.hoggitworld.com/view/DCS_Class_Unit). Default {Unit.Category.GROUND_UNIT}.
|
-- @param #table UnitCategories Table of unit categories. See [DCS Class Unit](https://wiki.hoggitworld.com/view/DCS_Class_Unit). Default {Unit.Category.GROUND_UNIT}.
|
||||||
-- @return #ZONE_GOAL_COALITION
|
-- @return #ZONE_GOAL_COALITION
|
||||||
function ZONE_GOAL_COALITION:New( Zone, Coalition, UnitCategories )
|
function ZONE_GOAL_COALITION:New( Zone, Coalition, UnitCategories )
|
||||||
@@ -80,7 +80,7 @@ do -- ZoneGoal
|
|||||||
|
|
||||||
--- Set the owning coalition of the zone.
|
--- Set the owning coalition of the zone.
|
||||||
-- @param #ZONE_GOAL_COALITION self
|
-- @param #ZONE_GOAL_COALITION self
|
||||||
-- @param DCSCoalition.DCSCoalition#coalition Coalition The coalition ID, e.g. *coalition.side.RED*.
|
-- @param #number Coalition The coalition ID, e.g. *coalition.side.RED*.
|
||||||
-- @return #ZONE_GOAL_COALITION
|
-- @return #ZONE_GOAL_COALITION
|
||||||
function ZONE_GOAL_COALITION:SetCoalition( Coalition )
|
function ZONE_GOAL_COALITION:SetCoalition( Coalition )
|
||||||
self.PreviousCoalition = self.Coalition or Coalition
|
self.PreviousCoalition = self.Coalition or Coalition
|
||||||
@@ -120,14 +120,14 @@ do -- ZoneGoal
|
|||||||
|
|
||||||
--- Get the owning coalition of the zone.
|
--- Get the owning coalition of the zone.
|
||||||
-- @param #ZONE_GOAL_COALITION self
|
-- @param #ZONE_GOAL_COALITION self
|
||||||
-- @return DCSCoalition.DCSCoalition#coalition Coalition.
|
-- @return #number Coalition.
|
||||||
function ZONE_GOAL_COALITION:GetCoalition()
|
function ZONE_GOAL_COALITION:GetCoalition()
|
||||||
return self.Coalition
|
return self.Coalition
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the previous coalition, i.e. the one owning the zone before the current one.
|
--- Get the previous coalition, i.e. the one owning the zone before the current one.
|
||||||
-- @param #ZONE_GOAL_COALITION self
|
-- @param #ZONE_GOAL_COALITION self
|
||||||
-- @return DCSCoalition.DCSCoalition#coalition Coalition.
|
-- @return #number Coalition.
|
||||||
function ZONE_GOAL_COALITION:GetPreviousCoalition()
|
function ZONE_GOAL_COALITION:GetPreviousCoalition()
|
||||||
return self.PreviousCoalition
|
return self.PreviousCoalition
|
||||||
end
|
end
|
||||||
|
|||||||
+178
-169
@@ -1,180 +1,189 @@
|
|||||||
__Moose.Include( 'Scripts/Moose/Utilities/Enums.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Enums.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Utilities/FiFo.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Utils.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Utilities/Profiler.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Profiler.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Utilities/Socket.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Templates.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Utilities/STTS.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/STTS.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Utilities/Templates.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/FiFo.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Utilities/Utils.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Socket.lua' )
|
||||||
|
|
||||||
__Moose.Include( 'Scripts/Moose/Core/Base.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/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/Core/ClientMenu.lua')
|
||||||
|
|
||||||
__Moose.Include( 'Scripts/Moose/Core/Astar.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Object.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Core/Beacon.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Identifiable.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Core/Condition.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Positionable.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Core/ClientMenu.lua')
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Controllable.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Core/Database.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Group.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Core/Event.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Unit.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Core/Fsm.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Client.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Core/Goal.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Static.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Core/MarkerOps_Base.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Airbase.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Core/Menu.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Scenery.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Core/Message.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Marker.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Core/Point.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Weapon.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Core/Report.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Net.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Core/ScheduleDispatcher.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Storage.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( 'Scripts/Moose/Wrapper/Airbase.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/Cargo.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Wrapper/Client.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/CargoUnit.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Wrapper/Controllable.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/CargoSlingload.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Wrapper/Group.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/CargoCrate.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Wrapper/Identifiable.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/CargoGroup.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( 'Scripts/Moose/Cargo/Cargo.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Scoring.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Cargo/CargoUnit.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/CleanUp.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Cargo/CargoSlingload.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Movement.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Cargo/CargoCrate.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Sead.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Cargo/CargoGroup.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Escort.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/AICSAR.lua' )
|
||||||
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/AmmoTruck.lua' )
|
||||||
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Autolase.lua' )
|
||||||
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/ZoneGoalCargo.lua' )
|
||||||
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Tiresias.lua' )
|
||||||
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Stratego.lua' )
|
||||||
|
|
||||||
__Moose.Include( 'Scripts/Moose/Functional/AICSAR.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Airboss.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Functional/AmmoTruck.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/RecoveryTanker.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Functional/Artillery.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/RescueHelo.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Functional/ATC_Ground.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/ATIS.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Functional/Autolase.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/CTLD.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Functional/CleanUp.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/CSAR.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Functional/Designate.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/AirWing.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Functional/Detection.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/ArmyGroup.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Functional/DetectionZones.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Auftrag.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Functional/Escort.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Awacs.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Functional/Fox.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Brigade.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Functional/Mantis.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Chief.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Functional/MissileTrainer.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Cohort.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Functional/Movement.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Commander.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Functional/PseudoATC.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Fleet.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Functional/Range.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/FlightControl.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Functional/RAT.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/FlightGroup.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Functional/Scoring.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Flotilla.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Functional/Sead.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Intelligence.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Functional/Shorad.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Legion.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Functional/Suppression.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/NavyGroup.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Functional/Warehouse.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Operation.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Functional/ZoneCaptureCoalition.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/OpsGroup.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Functional/ZoneGoal.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/OpsTransport.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Functional/ZoneGoalCargo.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/OpsZone.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Functional/ZoneGoalCoalition.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Platoon.lua' )
|
||||||
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/PlayerTask.lua' )
|
||||||
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/PlayerRecce.lua' )
|
||||||
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Squadron.lua' )
|
||||||
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Target.lua' )
|
||||||
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/EasyGCICAP.lua' )
|
||||||
|
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/Airboss.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Balancer.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/AirWing.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Air.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/ArmyGroup.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Air_Patrol.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/ATIS.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Air_Engage.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/Auftrag.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2A_Patrol.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/Awacs.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2A_Cap.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/Brigade.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2A_Gci.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/Chief.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2A_Dispatcher.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/Cohort.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2G_BAI.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/Commander.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2G_CAS.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/CSAR.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2G_SEAD.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/CTLD.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2G_Dispatcher.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/Fleet.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Patrol.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/FlightControl.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_CAP.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/FlightGroup.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_CAS.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/Flotilla.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_BAI.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/Intelligence.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Formation.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/Legion.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Escort.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/NavyGroup.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Escort_Request.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/Operation.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Escort_Dispatcher.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/OpsGroup.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Escort_Dispatcher_Request.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/OpsTransport.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/OpsZone.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_APC.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/Platoon.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Helicopter.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/PlayerTask.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Airplane.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/PlayerRecce.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Ship.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/RecoveryTanker.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Dispatcher.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/RescueHelo.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Dispatcher_APC.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/Squadron.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Dispatcher_Helicopter.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/Target.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Dispatcher_Airplane.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Ops/EasyGCICAP.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Dispatcher_Ship.lua' )
|
||||||
|
|
||||||
__Moose.Include( 'Scripts/Moose/AI/AI_Balancer.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Actions/Act_Assign.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/AI/AI_Air.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Actions/Act_Route.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/AI/AI_Air_Patrol.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Actions/Act_Account.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/AI/AI_Air_Engage.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Actions/Act_Assist.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( 'Scripts/Moose/Actions/Act_Assign.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Shapes/ShapeBase.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Actions/Act_Route.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Shapes/Circle.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Actions/Act_Account.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Shapes/Cube.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Actions/Act_Assist.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Shapes/Line.lua' )
|
||||||
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Shapes/Oval.lua' )
|
||||||
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Shapes/Polygon.lua' )
|
||||||
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Shapes/Triangle.lua' )
|
||||||
|
|
||||||
__Moose.Include( 'Scripts/Moose/Sound/Radio.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Sound/UserSound.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Sound/RadioQueue.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Sound/SoundOutput.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Sound/RadioSpeech.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Sound/Radio.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Sound/SoundOutput.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Sound/RadioQueue.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Sound/SRS.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Sound/RadioSpeech.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Sound/UserSound.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Sound/SRS.lua' )
|
||||||
|
|
||||||
__Moose.Include( 'Scripts/Moose/Tasking/CommandCenter.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/CommandCenter.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Tasking/Mission.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Mission.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Tasking/Task.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Tasking/TaskInfo.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/TaskInfo.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Tasking/Task_Manager.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Manager.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Tasking/DetectionManager.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/DetectionManager.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Tasking/Task_A2G_Dispatcher.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_A2G_Dispatcher.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Tasking/Task_A2G.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_A2G.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Tasking/Task_A2A_Dispatcher.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_A2A_Dispatcher.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Tasking/Task_A2A.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_A2A.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Tasking/Task_CARGO.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_CARGO.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Tasking/Task_Cargo_Transport.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Cargo_Transport.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Tasking/Task_Cargo_CSAR.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Cargo_CSAR.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Tasking/Task_Cargo_Dispatcher.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Cargo_Dispatcher.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Tasking/Task_Capture_Zone.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Capture_Zone.lua' )
|
||||||
__Moose.Include( 'Scripts/Moose/Tasking/Task_Capture_Dispatcher.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Capture_Dispatcher.lua' )
|
||||||
|
|
||||||
__Moose.Include( 'Scripts/Moose/Globals.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Globals.lua' )
|
||||||
|
|||||||
@@ -316,6 +316,12 @@
|
|||||||
--
|
--
|
||||||
-- This uses a male voice with US accent. It requires SRS to be installed in the `D:\DCS\_SRS\` directory. Note that backslashes need to be escaped or simply use slashes (as in linux).
|
-- This uses a male voice with US accent. It requires SRS to be installed in the `D:\DCS\_SRS\` directory. Note that backslashes need to be escaped or simply use slashes (as in linux).
|
||||||
--
|
--
|
||||||
|
-- ### SRS can use multiple frequencies:
|
||||||
|
--
|
||||||
|
-- atis=ATIS:New("Batumi", {305,103.85}, {radio.modulation.AM,radio.modulation.FM})
|
||||||
|
-- atis:SetSRS("D:\\DCS\\_SRS\\", "male", "en-US")
|
||||||
|
-- atis:Start()
|
||||||
|
--
|
||||||
-- ### SRS Localization
|
-- ### SRS Localization
|
||||||
--
|
--
|
||||||
-- You can localize the SRS output, all you need is to provide a table of translations and set the `locale` of your instance. You need to provide the translations in your script **before you instantiate your ATIS**.
|
-- You can localize the SRS output, all you need is to provide a table of translations and set the `locale` of your instance. You need to provide the translations in your script **before you instantiate your ATIS**.
|
||||||
@@ -353,6 +359,7 @@
|
|||||||
-- DEWPOINT = "Taupunkt",
|
-- DEWPOINT = "Taupunkt",
|
||||||
-- ALTIMETER = "Hoehenmesser",
|
-- ALTIMETER = "Hoehenmesser",
|
||||||
-- ACTIVERUN = "Aktive Startbahn",
|
-- ACTIVERUN = "Aktive Startbahn",
|
||||||
|
-- ACTIVELANDING = "Aktive Landebahn",
|
||||||
-- LEFT = "Links",
|
-- LEFT = "Links",
|
||||||
-- RIGHT = "Rechts",
|
-- RIGHT = "Rechts",
|
||||||
-- RWYLENGTH = "Startbahn",
|
-- RWYLENGTH = "Startbahn",
|
||||||
@@ -693,7 +700,7 @@ ATIS.Messages = {
|
|||||||
EN =
|
EN =
|
||||||
{
|
{
|
||||||
HOURS = "hours",
|
HOURS = "hours",
|
||||||
TIME = "hours",
|
TIME = "Hours",
|
||||||
NOCLOUDINFO = "Cloud coverage information not available",
|
NOCLOUDINFO = "Cloud coverage information not available",
|
||||||
OVERCAST = "Overcast",
|
OVERCAST = "Overcast",
|
||||||
BROKEN = "Broken clouds",
|
BROKEN = "Broken clouds",
|
||||||
@@ -721,7 +728,8 @@ ATIS.Messages = {
|
|||||||
TEMPERATURE = "Temperature",
|
TEMPERATURE = "Temperature",
|
||||||
DEWPOINT = "Dew point",
|
DEWPOINT = "Dew point",
|
||||||
ALTIMETER = "Altimeter",
|
ALTIMETER = "Altimeter",
|
||||||
ACTIVERUN = "Active runway",
|
ACTIVERUN = "Active runway departure",
|
||||||
|
ACTIVELANDING = "Active runway arrival",
|
||||||
LEFT = "Left",
|
LEFT = "Left",
|
||||||
RIGHT = "Right",
|
RIGHT = "Right",
|
||||||
RWYLENGTH = "Runway length",
|
RWYLENGTH = "Runway length",
|
||||||
@@ -781,6 +789,7 @@ ATIS.Messages = {
|
|||||||
DEWPOINT = "Taupunkt",
|
DEWPOINT = "Taupunkt",
|
||||||
ALTIMETER = "Hoehenmesser",
|
ALTIMETER = "Hoehenmesser",
|
||||||
ACTIVERUN = "Aktive Startbahn",
|
ACTIVERUN = "Aktive Startbahn",
|
||||||
|
ACTIVELANDING = "Aktive Landebahn",
|
||||||
LEFT = "Links",
|
LEFT = "Links",
|
||||||
RIGHT = "Rechts",
|
RIGHT = "Rechts",
|
||||||
RWYLENGTH = "Startbahn",
|
RWYLENGTH = "Startbahn",
|
||||||
@@ -841,6 +850,7 @@ ATIS.Messages = {
|
|||||||
DEWPOINT = "Punto de rocio",
|
DEWPOINT = "Punto de rocio",
|
||||||
ALTIMETER = "Altímetro",
|
ALTIMETER = "Altímetro",
|
||||||
ACTIVERUN = "Pista activa",
|
ACTIVERUN = "Pista activa",
|
||||||
|
ACTIVELANDING = "Pista de aterrizaje activa",
|
||||||
LEFT = "Izquierda",
|
LEFT = "Izquierda",
|
||||||
RIGHT = "Derecha",
|
RIGHT = "Derecha",
|
||||||
RWYLENGTH = "Longitud de pista",
|
RWYLENGTH = "Longitud de pista",
|
||||||
@@ -880,13 +890,14 @@ _ATIS = {}
|
|||||||
|
|
||||||
--- ATIS class version.
|
--- ATIS class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
ATIS.version = "0.10.2"
|
ATIS.version = "1.0.0"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- TODO: Correct fog for elevation.
|
-- TODO: Correct fog for elevation.
|
||||||
|
-- DONE: Option to add multiple frequencies for SRS
|
||||||
-- DONE: Zulu time --> Zulu in output.
|
-- DONE: Zulu time --> Zulu in output.
|
||||||
-- DONE: Fix for AB not having a runway - Helopost like Naqoura
|
-- DONE: Fix for AB not having a runway - Helopost like Naqoura
|
||||||
-- DONE: Add new Normandy airfields.
|
-- DONE: Add new Normandy airfields.
|
||||||
@@ -895,13 +906,14 @@ ATIS.version = "0.10.2"
|
|||||||
-- DONE: Visibility reported twice over SRS
|
-- DONE: Visibility reported twice over SRS
|
||||||
-- DONE: Add text report for output.
|
-- DONE: Add text report for output.
|
||||||
-- DONE: Add stop FMS functions.
|
-- DONE: Add stop FMS functions.
|
||||||
-- NOGO: Use local time. Not realisitc!
|
-- NOGO: Use local time. Not realistic!
|
||||||
-- DONE: Dew point. Approx. done.
|
-- DONE: Dew point. Approx. done.
|
||||||
-- DONE: Metric units.
|
-- DONE: Metric units.
|
||||||
-- DONE: Set UTC correction.
|
-- DONE: Set UTC correction.
|
||||||
-- DONE: Set magnetic variation.
|
-- DONE: Set magnetic variation.
|
||||||
-- DONE: New DCS 2.7 weather presets.
|
-- DONE: New DCS 2.7 weather presets.
|
||||||
-- DONE: Added TextAndSound localization
|
-- DONE: Added TextAndSound localization
|
||||||
|
-- DONE: Added SRS spelling out both take off and landing runway
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- Constructor
|
-- Constructor
|
||||||
@@ -910,8 +922,8 @@ ATIS.version = "0.10.2"
|
|||||||
--- Create a new ATIS class object for a specific airbase.
|
--- Create a new ATIS class object for a specific airbase.
|
||||||
-- @param #ATIS self
|
-- @param #ATIS self
|
||||||
-- @param #string AirbaseName Name of the airbase.
|
-- @param #string AirbaseName Name of the airbase.
|
||||||
-- @param #number Frequency Radio frequency in MHz. Default 143.00 MHz.
|
-- @param #number Frequency Radio frequency in MHz. Default 143.00 MHz. When using **SRS** this can be passed as a table of multiple frequencies.
|
||||||
-- @param #number Modulation Radio modulation: 0=AM, 1=FM. Default 0=AM. See `radio.modulation.AM` and `radio.modulation.FM` enumerators.
|
-- @param #number Modulation Radio modulation: 0=AM, 1=FM. Default 0=AM. See `radio.modulation.AM` and `radio.modulation.FM` enumerators. When using **SRS** this can be passed as a table of multiple modulations.
|
||||||
-- @return #ATIS self
|
-- @return #ATIS self
|
||||||
function ATIS:New(AirbaseName, Frequency, Modulation)
|
function ATIS:New(AirbaseName, Frequency, Modulation)
|
||||||
|
|
||||||
@@ -1514,33 +1526,62 @@ function ATIS:MarkRunways( markall )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Use SRS Simple-Text-To-Speech for transmissions. No sound files necessary.
|
--- Use SRS Simple-Text-To-Speech for transmissions. No sound files necessary.`SetSRS()` will try to use as many attributes configured with @{Sound.SRS#MSRS.LoadConfigFile}() as possible.
|
||||||
-- @param #ATIS self
|
-- @param #ATIS self
|
||||||
-- @param #string PathToSRS Path to SRS directory.
|
-- @param #string PathToSRS Path to SRS directory (only necessary if SRS exe backend is used).
|
||||||
-- @param #string Gender Gender: "male" or "female" (default).
|
-- @param #string Gender Gender: "male" or "female" (default).
|
||||||
-- @param #string Culture Culture, e.g. "en-GB" (default).
|
-- @param #string Culture Culture, e.g. "en-GB" (default).
|
||||||
-- @param #string Voice Specific voice. Overrides `Gender` and `Culture`.
|
-- @param #string Voice Specific voice. Overrides `Gender` and `Culture`.
|
||||||
-- @param #number Port SRS port. Default 5002.
|
-- @param #number Port SRS port. Default 5002.
|
||||||
-- @param #string GoogleKey Path to Google JSON-Key.
|
-- @param #string GoogleKey Path to Google JSON-Key (SRS exe backend) or Google API key (DCS-gRPC backend).
|
||||||
-- @return #ATIS self
|
-- @return #ATIS self
|
||||||
function ATIS:SetSRS(PathToSRS, Gender, Culture, Voice, Port, GoogleKey)
|
function ATIS:SetSRS(PathToSRS, Gender, Culture, Voice, Port, GoogleKey)
|
||||||
if PathToSRS or MSRS.path then
|
--if PathToSRS or MSRS.path then
|
||||||
self.useSRS=true
|
self.useSRS=true
|
||||||
self.msrs=MSRS:New(PathToSRS, self.frequency, self.modulation)
|
|
||||||
self.msrs:SetGender(Gender)
|
local path = PathToSRS or MSRS.path
|
||||||
self.msrs:SetCulture(Culture)
|
local gender = Gender or MSRS.gender
|
||||||
self.msrs:SetVoice(Voice)
|
local culture = Culture or MSRS.culture
|
||||||
self.msrs:SetPort(Port)
|
local voice = Voice or MSRS.voice
|
||||||
|
local port = Port or MSRS.port or 5002
|
||||||
|
|
||||||
|
self.msrs=MSRS:New(path, self.frequency, self.modulation)
|
||||||
|
self.msrs:SetGender(gender)
|
||||||
|
self.msrs:SetCulture(culture)
|
||||||
|
self.msrs:SetPort(port)
|
||||||
self.msrs:SetCoalition(self:GetCoalition())
|
self.msrs:SetCoalition(self:GetCoalition())
|
||||||
self.msrs:SetLabel("ATIS")
|
self.msrs:SetLabel("ATIS")
|
||||||
self.msrs:SetGoogle(GoogleKey)
|
if GoogleKey then
|
||||||
|
self.msrs:SetProviderOptionsGoogle(GoogleKey,GoogleKey)
|
||||||
|
self.msrs:SetProvider(MSRS.Provider.GOOGLE)
|
||||||
|
end
|
||||||
|
-- Pre-configured Google?
|
||||||
|
if (not GoogleKey) and self.msrs:GetProvider() == MSRS.Provider.GOOGLE then
|
||||||
|
voice = Voice or MSRS.poptions.gcloud.voice
|
||||||
|
end
|
||||||
|
self.msrs:SetVoice(voice)
|
||||||
|
self.msrs:SetCoordinate(self.airbase:GetCoordinate())
|
||||||
self.msrsQ = MSRSQUEUE:New("ATIS")
|
self.msrsQ = MSRSQUEUE:New("ATIS")
|
||||||
self.msrsQ:SetTransmitOnlyWithPlayers(self.TransmitOnlyWithPlayers)
|
self.msrsQ:SetTransmitOnlyWithPlayers(self.TransmitOnlyWithPlayers)
|
||||||
if self.dTQueueCheck<=10 then
|
if self.dTQueueCheck<=10 then
|
||||||
self:SetQueueUpdateTime(90)
|
self:SetQueueUpdateTime(90)
|
||||||
end
|
end
|
||||||
|
--else
|
||||||
|
--self:E(self.lid..string.format("ERROR: No SRS path specified!"))
|
||||||
|
--end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Set an alternative provider to the one set in your MSRS configuration file.
|
||||||
|
-- @param #ATIS self
|
||||||
|
-- @param #string Provider The provider to use. Known providers are: `MSRS.Provider.WINDOWS` and `MSRS.Provider.GOOGLE`
|
||||||
|
-- @return #ATIS self
|
||||||
|
function ATIS:SetSRSProvider(Provider)
|
||||||
|
self:T(self.lid.."SetSRSProvider")
|
||||||
|
if self.msrs then
|
||||||
|
self.msrs:SetProvider(Provider)
|
||||||
else
|
else
|
||||||
self:E(self.lid..string.format("ERROR: No SRS path specified!"))
|
MESSAGE:New(self.lid.."Set up SRS first before trying to change the provider!",30,"ATIS"):ToAll():ToLog()
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -1588,8 +1629,16 @@ function ATIS:onafterStart( From, Event, To )
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Info.
|
-- Info.
|
||||||
self:I( self.lid .. string.format( "Starting ATIS v%s for airbase %s on %.3f MHz Modulation=%d", ATIS.version, self.airbasename, self.frequency, self.modulation ) )
|
if type(self.frequency) == "table" then
|
||||||
|
local frequency = table.concat(self.frequency,"/")
|
||||||
|
local modulation = self.modulation
|
||||||
|
if type(self.modulation) == "table" then
|
||||||
|
modulation = table.concat(self.modulation,"/")
|
||||||
|
end
|
||||||
|
self:I( self.lid .. string.format( "Starting ATIS v%s for airbase %s on %s MHz Modulation=%s", ATIS.version, self.airbasename, frequency, modulation ) )
|
||||||
|
else
|
||||||
|
self:I( self.lid .. string.format( "Starting ATIS v%s for airbase %s on %.3f MHz Modulation=%d", ATIS.version, self.airbasename, self.frequency, self.modulation ) )
|
||||||
|
end
|
||||||
-- Start radio queue.
|
-- Start radio queue.
|
||||||
if not self.useSRS then
|
if not self.useSRS then
|
||||||
self.radioqueue = RADIOQUEUE:New( self.frequency, self.modulation, string.format( "ATIS %s", self.airbasename ) )
|
self.radioqueue = RADIOQUEUE:New( self.frequency, self.modulation, string.format( "ATIS %s", self.airbasename ) )
|
||||||
@@ -1647,7 +1696,17 @@ function ATIS:onafterStatus( From, Event, To )
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Info text.
|
-- Info text.
|
||||||
local text = string.format( "State %s: Freq=%.3f MHz %s", fsmstate, self.frequency, UTILS.GetModulationName( self.modulation ) )
|
local text = ""
|
||||||
|
if type(self.frequency) == "table" then
|
||||||
|
local frequency = table.concat(self.frequency,"/")
|
||||||
|
local modulation = self.modulation
|
||||||
|
if type(self.modulation) == "table" then
|
||||||
|
modulation = table.concat(self.modulation,"/")
|
||||||
|
end
|
||||||
|
text = string.format( "State %s: Freq=%s MHz %s", fsmstate, frequency, modulation )
|
||||||
|
else
|
||||||
|
text = string.format( "State %s: Freq=%.3f MHz %s", fsmstate, self.frequency, UTILS.GetModulationName( self.modulation ) )
|
||||||
|
end
|
||||||
if self.useSRS then
|
if self.useSRS then
|
||||||
text = text .. string.format( ", SRS path=%s (%s), gender=%s, culture=%s, voice=%s", tostring( self.msrs.path ), tostring( self.msrs.port ), tostring( self.msrs.gender ), tostring( self.msrs.culture ), tostring( self.msrs.voice ) )
|
text = text .. string.format( ", SRS path=%s (%s), gender=%s, culture=%s, voice=%s", tostring( self.msrs.path ), tostring( self.msrs.port ), tostring( self.msrs.gender ), tostring( self.msrs.culture ), tostring( self.msrs.voice ) )
|
||||||
else
|
else
|
||||||
@@ -2506,10 +2565,10 @@ function ATIS:onafterBroadcast( From, Event, To )
|
|||||||
|
|
||||||
if not self.ATISforFARPs then
|
if not self.ATISforFARPs then
|
||||||
-- Active runway.
|
-- Active runway.
|
||||||
local subtitle
|
local subtitle = ""
|
||||||
if runwayLanding then
|
if runwayLanding then
|
||||||
local actrun = self.gettext:GetEntry("ACTIVERUN",self.locale)
|
local actrun = self.gettext:GetEntry("ACTIVELANDING",self.locale)
|
||||||
--subtitle=string.format("Active runway %s", runwayLanding)
|
--subtitle=string.format("Active runway landing %s", runwayLanding)
|
||||||
subtitle=string.format("%s %s", actrun, runwayLanding)
|
subtitle=string.format("%s %s", actrun, runwayLanding)
|
||||||
if rwyLandingLeft==true then
|
if rwyLandingLeft==true then
|
||||||
--subtitle=subtitle.." Left"
|
--subtitle=subtitle.." Left"
|
||||||
@@ -2518,6 +2577,19 @@ function ATIS:onafterBroadcast( From, Event, To )
|
|||||||
--subtitle=subtitle.." Right"
|
--subtitle=subtitle.." Right"
|
||||||
subtitle=subtitle.." "..self.gettext:GetEntry("RIGHT",self.locale)
|
subtitle=subtitle.." "..self.gettext:GetEntry("RIGHT",self.locale)
|
||||||
end
|
end
|
||||||
|
alltext = alltext .. ";\n" .. subtitle
|
||||||
|
end
|
||||||
|
if runwayTakeoff then
|
||||||
|
local actrun = self.gettext:GetEntry("ACTIVERUN",self.locale)
|
||||||
|
--subtitle=string.format("Active runway %s", runwayLanding)
|
||||||
|
subtitle=string.format("%s %s", actrun, runwayTakeoff)
|
||||||
|
if rwyTakeoffLeft==true then
|
||||||
|
--subtitle=subtitle.." Left"
|
||||||
|
subtitle=subtitle.." "..self.gettext:GetEntry("LEFT",self.locale)
|
||||||
|
elseif rwyTakeoffLeft==false then
|
||||||
|
--subtitle=subtitle.." Right"
|
||||||
|
subtitle=subtitle.." "..self.gettext:GetEntry("RIGHT",self.locale)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
_RUNACT = subtitle
|
_RUNACT = subtitle
|
||||||
if not self.useSRS then
|
if not self.useSRS then
|
||||||
@@ -2900,8 +2972,17 @@ function ATIS:UpdateMarker( information, runact, wind, altimeter, temperature )
|
|||||||
if self.markerid then
|
if self.markerid then
|
||||||
self.airbase:GetCoordinate():RemoveMark( self.markerid )
|
self.airbase:GetCoordinate():RemoveMark( self.markerid )
|
||||||
end
|
end
|
||||||
|
local text = ""
|
||||||
local text = string.format( "ATIS on %.3f %s, %s:\n", self.frequency, UTILS.GetModulationName( self.modulation ), tostring( information ) )
|
if type(self.frequency) == "table" then
|
||||||
|
local frequency = table.concat(self.frequency,"/")
|
||||||
|
local modulation = self.modulation
|
||||||
|
if type(modulation) == "table" then
|
||||||
|
modulation = table.concat(self.modulation,"/")
|
||||||
|
end
|
||||||
|
text = string.format( "ATIS on %s %s, %s:\n", tostring(frequency), tostring(modulation), tostring( information ) )
|
||||||
|
else
|
||||||
|
text = string.format( "ATIS on %.3f %s, %s:\n", self.frequency, UTILS.GetModulationName( self.modulation ), tostring( information ) )
|
||||||
|
end
|
||||||
text = text .. string.format( "%s\n", tostring( runact ) )
|
text = text .. string.format( "%s\n", tostring( runact ) )
|
||||||
text = text .. string.format( "%s\n", tostring( wind ) )
|
text = text .. string.format( "%s\n", tostring( wind ) )
|
||||||
text = text .. string.format( "%s\n", tostring( altimeter ) )
|
text = text .. string.format( "%s\n", tostring( altimeter ) )
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Example Missions:
|
-- ## Example Missions:
|
||||||
--
|
--
|
||||||
-- Demo missions can be found on [github](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/OPS%20-%20Airwing).
|
-- Demo missions can be found on [github](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/Ops/Airwing).
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -56,6 +56,8 @@
|
|||||||
-- @field #boolean despawnAfterHolding Aircraft are despawned after holding.
|
-- @field #boolean despawnAfterHolding Aircraft are despawned after holding.
|
||||||
-- @field #boolean capOptionPatrolRaceTrack Use closer patrol race track or standard orbit auftrag.
|
-- @field #boolean capOptionPatrolRaceTrack Use closer patrol race track or standard orbit auftrag.
|
||||||
-- @field #number capFormation If capOptionPatrolRaceTrack is true, set the formation, also.
|
-- @field #number capFormation If capOptionPatrolRaceTrack is true, set the formation, also.
|
||||||
|
-- @field #number capOptionVaryStartTime If set, vary mission start time for CAP missions generated random between capOptionVaryStartTime and capOptionVaryEndTime
|
||||||
|
-- @field #number capOptionVaryEndTime If set, vary mission start time for CAP missions generated random between capOptionVaryStartTime and capOptionVaryEndTime
|
||||||
--
|
--
|
||||||
-- @extends Ops.Legion#LEGION
|
-- @extends Ops.Legion#LEGION
|
||||||
|
|
||||||
@@ -132,6 +134,8 @@ AIRWING = {
|
|||||||
markpoints = false,
|
markpoints = false,
|
||||||
capOptionPatrolRaceTrack = false,
|
capOptionPatrolRaceTrack = false,
|
||||||
capFormation = nil,
|
capFormation = nil,
|
||||||
|
capOptionVaryStartTime = nil,
|
||||||
|
capOptionVaryEndTime = nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Payload data.
|
--- Payload data.
|
||||||
@@ -183,7 +187,7 @@ AIRWING = {
|
|||||||
|
|
||||||
--- AIRWING class version.
|
--- AIRWING class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
AIRWING.version="0.9.4"
|
AIRWING.version="0.9.5"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- ToDo list
|
-- ToDo list
|
||||||
@@ -721,6 +725,17 @@ function AIRWING:SetCapCloseRaceTrack(OnOff)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set CAP mission start to vary randomly between Start end End seconds.
|
||||||
|
-- @param #AIRWING self
|
||||||
|
-- @param #number Start
|
||||||
|
-- @param #number End
|
||||||
|
-- @return #AIRWING self
|
||||||
|
function AIRWING:SetCapStartTimeVariation(Start, End)
|
||||||
|
self.capOptionVaryStartTime = Start or 5
|
||||||
|
self.capOptionVaryEndTime = End or 60
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Set number of TANKER flights with Boom constantly in the air.
|
--- Set number of TANKER flights with Boom constantly in the air.
|
||||||
-- @param #AIRWING self
|
-- @param #AIRWING self
|
||||||
-- @param #number Nboom Number of flights. Default 1.
|
-- @param #number Nboom Number of flights. Default 1.
|
||||||
@@ -1165,6 +1180,14 @@ function AIRWING:CheckCAP()
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if self.capOptionVaryStartTime then
|
||||||
|
|
||||||
|
local ClockStart = math.random(self.capOptionVaryStartTime, self.capOptionVaryEndTime)
|
||||||
|
|
||||||
|
missionCAP:SetTime(ClockStart)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
missionCAP.patroldata=patrol
|
missionCAP.patroldata=patrol
|
||||||
|
|
||||||
patrol.noccupied=patrol.noccupied+1
|
patrol.noccupied=patrol.noccupied+1
|
||||||
@@ -1398,9 +1421,9 @@ function AIRWING:GetTankerForFlight(flightgroup)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Add the ability to call back an Ops.Awacs#AWACS object with an FSM call "FlightOnMission(FlightGroup, Mission)".
|
--- Add the ability to call back an Ops.AWACS#AWACS object with an FSM call "FlightOnMission(FlightGroup, Mission)".
|
||||||
-- @param #AIRWING self
|
-- @param #AIRWING self
|
||||||
-- @param Ops.Awacs#AWACS ConnectecdAwacs
|
-- @param Ops.AWACS#AWACS ConnectecdAwacs
|
||||||
-- @return #AIRWING self
|
-- @return #AIRWING self
|
||||||
function AIRWING:SetUsingOpsAwacs(ConnectecdAwacs)
|
function AIRWING:SetUsingOpsAwacs(ConnectecdAwacs)
|
||||||
self:I(self.lid .. "Added AWACS Object: "..ConnectecdAwacs:GetName() or "unknown")
|
self:I(self.lid .. "Added AWACS Object: "..ConnectecdAwacs:GetName() or "unknown")
|
||||||
@@ -1409,7 +1432,7 @@ function AIRWING:SetUsingOpsAwacs(ConnectecdAwacs)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Remove the ability to call back an Ops.Awacs#AWACS object with an FSM call "FlightOnMission(FlightGroup, Mission)".
|
--- Remove the ability to call back an Ops.AWACS#AWACS object with an FSM call "FlightOnMission(FlightGroup, Mission)".
|
||||||
-- @param #AIRWING self
|
-- @param #AIRWING self
|
||||||
-- @return #AIRWING self
|
-- @return #AIRWING self
|
||||||
function AIRWING:RemoveUsingOpsAwacs()
|
function AIRWING:RemoveUsingOpsAwacs()
|
||||||
|
|||||||
@@ -27,17 +27,17 @@
|
|||||||
-- **Supported Carriers:**
|
-- **Supported Carriers:**
|
||||||
--
|
--
|
||||||
-- * [USS John C. Stennis](https://en.wikipedia.org/wiki/USS_John_C._Stennis) (CVN-74)
|
-- * [USS John C. Stennis](https://en.wikipedia.org/wiki/USS_John_C._Stennis) (CVN-74)
|
||||||
-- * [USS Theodore Roosevelt](https://en.wikipedia.org/wiki/USS_Theodore_Roosevelt_(CVN-71\)) (CVN-71) [Super Carrier Module]
|
-- * [USS Theodore Roosevelt](https://en.wikipedia.org/wiki/USS_Theodore_Roosevelt_\(CVN-71\)) (CVN-71) [Super Carrier Module]
|
||||||
-- * [USS Abraham Lincoln](https://en.wikipedia.org/wiki/USS_Abraham_Lincoln_(CVN-72\)) (CVN-72) [Super Carrier Module]
|
-- * [USS Abraham Lincoln](https://en.wikipedia.org/wiki/USS_Abraham_Lincoln_\(CVN-72\)) (CVN-72) [Super Carrier Module]
|
||||||
-- * [USS George Washington](https://en.wikipedia.org/wiki/USS_George_Washington_(CVN-73\)) (CVN-73) [Super Carrier Module]
|
-- * [USS George Washington](https://en.wikipedia.org/wiki/USS_George_Washington_\(CVN-73\)) (CVN-73) [Super Carrier Module]
|
||||||
-- * [USS Harry S. Truman](https://en.wikipedia.org/wiki/USS_Harry_S._Truman) (CVN-75) [Super Carrier Module]
|
-- * [USS Harry S. Truman](https://en.wikipedia.org/wiki/USS_Harry_S._Truman) (CVN-75) [Super Carrier Module]
|
||||||
-- * [USS Forrestal](https://en.wikipedia.org/wiki/USS_Forrestal_(CV-59\)) (CV-59) [Heatblur Carrier Module]
|
-- * [USS Forrestal](https://en.wikipedia.org/wiki/USS_Forrestal_\(CV-59\)) (CV-59) [Heatblur Carrier Module]
|
||||||
-- * [HMS Hermes](https://en.wikipedia.org/wiki/HMS_Hermes_(R12\)) (R12)
|
-- * [HMS Hermes](https://en.wikipedia.org/wiki/HMS_Hermes_\(R12\)) (R12)
|
||||||
-- * [HMS Invincible](https://en.wikipedia.org/wiki/HMS_Invincible_(R05\)) (R05)
|
-- * [HMS Invincible](https://en.wikipedia.org/wiki/HMS_Invincible_\(R05\)) (R05)
|
||||||
-- * [USS Tarawa](https://en.wikipedia.org/wiki/USS_Tarawa_(LHA-1\)) (LHA-1)
|
-- * [USS Tarawa](https://en.wikipedia.org/wiki/USS_Tarawa_\(LHA-1\)) (LHA-1)
|
||||||
-- * [USS America](https://en.wikipedia.org/wiki/USS_America_(LHA-6\)) (LHA-6)
|
-- * [USS America](https://en.wikipedia.org/wiki/USS_America_\(LHA-6\)) (LHA-6)
|
||||||
-- * [Juan Carlos I](https://en.wikipedia.org/wiki/Spanish_amphibious_assault_ship_Juan_Carlos_I) (L61)
|
-- * [Juan Carlos I](https://en.wikipedia.org/wiki/Spanish_amphibious_assault_ship_Juan_Carlos_I) (L61)
|
||||||
-- * [HMAS Canberra](https://en.wikipedia.org/wiki/HMAS_Canberra_(L02\)) (L02)
|
-- * [HMAS Canberra](https://en.wikipedia.org/wiki/HMAS_Canberra_\(L02\)) (L02)
|
||||||
--
|
--
|
||||||
-- **Supported Aircraft:**
|
-- **Supported Aircraft:**
|
||||||
--
|
--
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
-- * [F-14A/B Tomcat](https://forums.eagle.ru/forumdisplay.php?f=395) (Player & AI)
|
-- * [F-14A/B Tomcat](https://forums.eagle.ru/forumdisplay.php?f=395) (Player & AI)
|
||||||
-- * [A-4E Skyhawk Community Mod](https://forums.eagle.ru/showthread.php?t=224989) (Player & AI)
|
-- * [A-4E Skyhawk Community Mod](https://forums.eagle.ru/showthread.php?t=224989) (Player & AI)
|
||||||
-- * [AV-8B N/A Harrier](https://forums.eagle.ru/forumdisplay.php?f=555) (Player & AI)
|
-- * [AV-8B N/A Harrier](https://forums.eagle.ru/forumdisplay.php?f=555) (Player & AI)
|
||||||
-- * [T-45C Goshawk](https://www.vnao-cvw-7.com/t-45-goshawk) (VNAO mod) (Player & AI)
|
-- * [T-45C Goshawk](https://forum.dcs.world/topic/203816-vnao-t-45-goshawk/) (VNAO mod) (Player & AI)
|
||||||
-- * [FE/A-18E/F/G Superhornet](https://forum.dcs.world/topic/316971-cjs-super-hornet-community-mod-v20-official-thread/) (CJS mod) (Player & AI)
|
-- * [FE/A-18E/F/G Superhornet](https://forum.dcs.world/topic/316971-cjs-super-hornet-community-mod-v20-official-thread/) (CJS mod) (Player & AI)
|
||||||
-- * F/A-18C Hornet (AI)
|
-- * F/A-18C Hornet (AI)
|
||||||
-- * F-14A Tomcat (AI)
|
-- * F-14A Tomcat (AI)
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
--
|
--
|
||||||
-- Heatblur's mighty F-14B Tomcat has been added (March 13th 2019) as well. Same goes for the A version.
|
-- Heatblur's mighty F-14B Tomcat has been added (March 13th 2019) as well. Same goes for the A version.
|
||||||
--
|
--
|
||||||
-- The [DCS Supercarriers](https://forums.eagle.ru/forum/151-dcs-supercarrier/) are also supported.
|
-- The [DCS Supercarriers](https://www.digitalcombatsimulator.com/de/shop/modules/supercarrier/) are also supported.
|
||||||
--
|
--
|
||||||
-- ## Discussion
|
-- ## Discussion
|
||||||
--
|
--
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Example Missions
|
-- ## Example Missions
|
||||||
--
|
--
|
||||||
-- Example missions can be found [here](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/OPS%20-%20Airboss).
|
-- Example missions can be found [here](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Ops/Airboss).
|
||||||
-- They contain the latest development Moose.lua file.
|
-- They contain the latest development Moose.lua file.
|
||||||
--
|
--
|
||||||
-- ## IMPORTANT
|
-- ## IMPORTANT
|
||||||
@@ -95,11 +95,6 @@
|
|||||||
-- * [[MOOSE] Airboss - CASE I, "Until We Go Down" featuring the F-14B by Pikes](https://www.youtube.com/watch?v=ojgHDSw3Doc)
|
-- * [[MOOSE] Airboss - CASE I, "Until We Go Down" featuring the F-14B by Pikes](https://www.youtube.com/watch?v=ojgHDSw3Doc)
|
||||||
-- * [[MOOSE] Airboss - Skipper Menu](https://youtu.be/awnecCxRoNQ)
|
-- * [[MOOSE] Airboss - Skipper Menu](https://youtu.be/awnecCxRoNQ)
|
||||||
--
|
--
|
||||||
-- ### Lex explaining Boat Ops:
|
|
||||||
--
|
|
||||||
-- * [( DCS HORNET ) Some boat ops basics VID 1](https://www.youtube.com/watch?v=LvGQS-3AzMc)
|
|
||||||
-- * [( DCS HORNET ) Some boat ops basics VID 2](https://www.youtube.com/watch?v=bN44wvtRsw0)
|
|
||||||
--
|
|
||||||
-- ### Jabbers Case I and III Recovery Tutorials:
|
-- ### Jabbers Case I and III Recovery Tutorials:
|
||||||
--
|
--
|
||||||
-- * [DCS World - F/A-18 - Case I Carrier Recovery Tutorial](https://www.youtube.com/watch?v=lm-M3VUy-_I)
|
-- * [DCS World - F/A-18 - Case I Carrier Recovery Tutorial](https://www.youtube.com/watch?v=lm-M3VUy-_I)
|
||||||
@@ -260,6 +255,7 @@
|
|||||||
-- @field #boolean skipperUturn U-turn on/off via menu.
|
-- @field #boolean skipperUturn U-turn on/off via menu.
|
||||||
-- @field #number skipperOffset Holding offset angle in degrees for Case II/III manual recoveries.
|
-- @field #number skipperOffset Holding offset angle in degrees for Case II/III manual recoveries.
|
||||||
-- @field #number skipperTime Recovery time in min for manual recovery.
|
-- @field #number skipperTime Recovery time in min for manual recovery.
|
||||||
|
-- @field #boolean intowindold If true, use old into wind calculation.
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
--- Be the boss!
|
--- Be the boss!
|
||||||
@@ -1751,7 +1747,7 @@ AIRBOSS.MenuF10Root = nil
|
|||||||
|
|
||||||
--- Airboss class version.
|
--- Airboss class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
AIRBOSS.version = "1.3.2"
|
AIRBOSS.version = "1.3.3"
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -2729,6 +2725,18 @@ function AIRBOSS:SetLSOCallInterval( TimeInterval )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set if old into wind calculation is used when carrier turns into the wind for a recovery.
|
||||||
|
-- @param #AIRBOSS self
|
||||||
|
-- @param #boolean SwitchOn If `true` or `nil`, use old into wind calculation.
|
||||||
|
-- @return #AIRBOSS self
|
||||||
|
function AIRBOSS:SetIntoWindLegacy( SwitchOn )
|
||||||
|
if SwitchOn==nil then
|
||||||
|
SwitchOn=true
|
||||||
|
end
|
||||||
|
self.intowindold=SwitchOn
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Airboss is a rather nice guy and not strictly following the rules. Fore example, he does allow you into the landing pattern if you are not coming from the Marshal stack.
|
--- Airboss is a rather nice guy and not strictly following the rules. Fore example, he does allow you into the landing pattern if you are not coming from the Marshal stack.
|
||||||
-- @param #AIRBOSS self
|
-- @param #AIRBOSS self
|
||||||
-- @param #boolean Switch If true or nil, Airboss bends the rules a bit.
|
-- @param #boolean Switch If true or nil, Airboss bends the rules a bit.
|
||||||
@@ -3067,7 +3075,7 @@ function AIRBOSS:EnableSRS(PathToSRS,Port,Culture,Gender,Voice,GoogleCreds,Volum
|
|||||||
-- SRS
|
-- SRS
|
||||||
local Frequency = self.AirbossRadio.frequency
|
local Frequency = self.AirbossRadio.frequency
|
||||||
local Modulation = self.AirbossRadio.modulation
|
local Modulation = self.AirbossRadio.modulation
|
||||||
self.SRS = MSRS:New(PathToSRS,Frequency,Modulation,Volume,AltBackend)
|
self.SRS = MSRS:New(PathToSRS,Frequency,Modulation,AltBackend)
|
||||||
self.SRS:SetCoalition(self:GetCoalition())
|
self.SRS:SetCoalition(self:GetCoalition())
|
||||||
self.SRS:SetCoordinate(self:GetCoordinate())
|
self.SRS:SetCoordinate(self:GetCoordinate())
|
||||||
self.SRS:SetCulture(Culture or "en-US")
|
self.SRS:SetCulture(Culture or "en-US")
|
||||||
@@ -3076,9 +3084,12 @@ function AIRBOSS:EnableSRS(PathToSRS,Port,Culture,Gender,Voice,GoogleCreds,Volum
|
|||||||
self.SRS:SetPath(PathToSRS)
|
self.SRS:SetPath(PathToSRS)
|
||||||
self.SRS:SetPort(Port or 5002)
|
self.SRS:SetPort(Port or 5002)
|
||||||
self.SRS:SetLabel(self.AirbossRadio.alias or "AIRBOSS")
|
self.SRS:SetLabel(self.AirbossRadio.alias or "AIRBOSS")
|
||||||
|
self.SRS:SetCoordinate(self.carrier:GetCoordinate())
|
||||||
|
self.SRS:SetVolume(Volume or 1)
|
||||||
--self.SRS:SetModulations(Modulations)
|
--self.SRS:SetModulations(Modulations)
|
||||||
if GoogleCreds then
|
if GoogleCreds then
|
||||||
self.SRS:SetGoogle(GoogleCreds)
|
self.SRS:SetProviderOptionsGoogle(GoogleCreds,GoogleCreds)
|
||||||
|
self.SRS:SetProvider(MSRS.Provider.GOOGLE)
|
||||||
end
|
end
|
||||||
if Voice then
|
if Voice then
|
||||||
self.SRS:SetVoice(Voice)
|
self.SRS:SetVoice(Voice)
|
||||||
@@ -3644,6 +3655,12 @@ function AIRBOSS:onafterStatus( From, Event, To )
|
|||||||
local pos = self:GetCoordinate()
|
local pos = self:GetCoordinate()
|
||||||
local speed = self.carrier:GetVelocityKNOTS()
|
local speed = self.carrier:GetVelocityKNOTS()
|
||||||
|
|
||||||
|
-- Update magnetic variation if we can get it from DCS.
|
||||||
|
if require then
|
||||||
|
self.magvar=pos:GetMagneticDeclination()
|
||||||
|
--env.info(string.format("FF magvar=%.1f", self.magvar))
|
||||||
|
end
|
||||||
|
|
||||||
-- Check water is ahead.
|
-- Check water is ahead.
|
||||||
local collision = false -- self:_CheckCollisionCoord(pos:Translate(self.collisiondist, hdg))
|
local collision = false -- self:_CheckCollisionCoord(pos:Translate(self.collisiondist, hdg))
|
||||||
|
|
||||||
@@ -5203,6 +5220,7 @@ function AIRBOSS:_InitVoiceOvers()
|
|||||||
TOMCAT = { file = "PILOT-Tomcat", suffix = "ogg", loud = false, subtitle = "", duration = 0.66, subduration = 5 },
|
TOMCAT = { file = "PILOT-Tomcat", suffix = "ogg", loud = false, subtitle = "", duration = 0.66, subduration = 5 },
|
||||||
HORNET = { file = "PILOT-Hornet", suffix = "ogg", loud = false, subtitle = "", duration = 0.56, subduration = 5 },
|
HORNET = { file = "PILOT-Hornet", suffix = "ogg", loud = false, subtitle = "", duration = 0.56, subduration = 5 },
|
||||||
VIKING = { file = "PILOT-Viking", suffix = "ogg", loud = false, subtitle = "", duration = 0.61, subduration = 5 },
|
VIKING = { file = "PILOT-Viking", suffix = "ogg", loud = false, subtitle = "", duration = 0.61, subduration = 5 },
|
||||||
|
GREYHOUND = { file = "PILOT-Greyhound", suffix = "ogg", loud = false, subtitle = "", duration = 0.61, subduration = 5 },
|
||||||
BALL = { file = "PILOT-Ball", suffix = "ogg", loud = false, subtitle = "", duration = 0.50, subduration = 5 },
|
BALL = { file = "PILOT-Ball", suffix = "ogg", loud = false, subtitle = "", duration = 0.50, subduration = 5 },
|
||||||
BINGOFUEL = { file = "PILOT-BingoFuel", suffix = "ogg", loud = false, subtitle = "", duration = 0.80 },
|
BINGOFUEL = { file = "PILOT-BingoFuel", suffix = "ogg", loud = false, subtitle = "", duration = 0.80 },
|
||||||
GASATDIVERT = { file = "PILOT-GasAtDivert", suffix = "ogg", loud = false, subtitle = "", duration = 1.80 },
|
GASATDIVERT = { file = "PILOT-GasAtDivert", suffix = "ogg", loud = false, subtitle = "", duration = 1.80 },
|
||||||
@@ -6477,7 +6495,7 @@ function AIRBOSS:_LandAI( flight )
|
|||||||
or flight.actype == AIRBOSS.AircraftCarrier.RHINOF
|
or flight.actype == AIRBOSS.AircraftCarrier.RHINOF
|
||||||
or flight.actype == AIRBOSS.AircraftCarrier.GROWLER then
|
or flight.actype == AIRBOSS.AircraftCarrier.GROWLER then
|
||||||
Speed = UTILS.KnotsToKmph( 200 )
|
Speed = UTILS.KnotsToKmph( 200 )
|
||||||
elseif flight.actype == AIRBOSS.AircraftCarrier.E2D then
|
elseif flight.actype == AIRBOSS.AircraftCarrier.E2D or flight.actype == AIRBOSS.AircraftCarrier.C2A then
|
||||||
Speed = UTILS.KnotsToKmph( 150 )
|
Speed = UTILS.KnotsToKmph( 150 )
|
||||||
elseif flight.actype == AIRBOSS.AircraftCarrier.F14A_AI or flight.actype == AIRBOSS.AircraftCarrier.F14A or flight.actype == AIRBOSS.AircraftCarrier.F14B then
|
elseif flight.actype == AIRBOSS.AircraftCarrier.F14A_AI or flight.actype == AIRBOSS.AircraftCarrier.F14A or flight.actype == AIRBOSS.AircraftCarrier.F14B then
|
||||||
Speed = UTILS.KnotsToKmph( 175 )
|
Speed = UTILS.KnotsToKmph( 175 )
|
||||||
@@ -8216,7 +8234,7 @@ function AIRBOSS:OnEventBirth( EventData )
|
|||||||
self:E( EventData )
|
self:E( EventData )
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if EventData.IniUnit == nil then
|
if EventData.IniUnit == nil and (not EventData.IniObjectCategory == Object.Category.STATIC) then
|
||||||
self:E( self.lid .. "ERROR: EventData.IniUnit=nil in event BIRTH!" )
|
self:E( self.lid .. "ERROR: EventData.IniUnit=nil in event BIRTH!" )
|
||||||
self:E( EventData )
|
self:E( EventData )
|
||||||
return
|
return
|
||||||
@@ -9757,7 +9775,7 @@ function AIRBOSS:_Groove( playerData )
|
|||||||
local glideslopeError = groovedata.GSE
|
local glideslopeError = groovedata.GSE
|
||||||
local AoA = groovedata.AoA
|
local AoA = groovedata.AoA
|
||||||
|
|
||||||
if rho <= RXX and playerData.step == AIRBOSS.PatternStep.GROOVE_XX and (math.abs( groovedata.Roll ) <= 4.0 or playerData.unit:IsInZone( self:_GetZoneLineup() )) then
|
if rho <= RXX and playerData.step == AIRBOSS.PatternStep.GROOVE_XX and (math.abs( groovedata.Roll ) <= 4.0 and playerData.unit:IsInZone( self:_GetZoneLineup() )) then
|
||||||
|
|
||||||
-- Start time in groove
|
-- Start time in groove
|
||||||
playerData.TIG0 = timer.getTime()
|
playerData.TIG0 = timer.getTime()
|
||||||
@@ -10271,7 +10289,7 @@ function AIRBOSS:_GetSternCoord()
|
|||||||
elseif case==2 or case==1 then
|
elseif case==2 or case==1 then
|
||||||
-- V/Stol: Translate 8 meters port.
|
-- V/Stol: Translate 8 meters port.
|
||||||
self.sterncoord:Translate(self.carrierparam.sterndist, hdg, true, true):Translate(8, FB-90, true, true)
|
self.sterncoord:Translate(self.carrierparam.sterndist, hdg, true, true):Translate(8, FB-90, true, true)
|
||||||
end
|
end
|
||||||
elseif self.carriertype==AIRBOSS.CarrierType.STENNIS then
|
elseif self.carriertype==AIRBOSS.CarrierType.STENNIS then
|
||||||
-- Stennis: translate 7 meters starboard wrt Final bearing.
|
-- Stennis: translate 7 meters starboard wrt Final bearing.
|
||||||
self.sterncoord:Translate( self.carrierparam.sterndist, hdg, true, true ):Translate( 7, FB + 90, true, true )
|
self.sterncoord:Translate( self.carrierparam.sterndist, hdg, true, true ):Translate( 7, FB + 90, true, true )
|
||||||
@@ -11201,7 +11219,7 @@ function AIRBOSS:_AttitudeMonitor( playerData )
|
|||||||
end
|
end
|
||||||
text = text .. string.format( "\nPitch=%.1f° | Roll=%.1f° | Yaw=%.1f°", pitch, roll, yaw )
|
text = text .. string.format( "\nPitch=%.1f° | Roll=%.1f° | Yaw=%.1f°", pitch, roll, yaw )
|
||||||
text = text .. string.format( "\nClimb Angle=%.1f° | Rate=%d ft/min", unit:GetClimbAngle(), velo.y * 196.85 )
|
text = text .. string.format( "\nClimb Angle=%.1f° | Rate=%d ft/min", unit:GetClimbAngle(), velo.y * 196.85 )
|
||||||
local dist = self:_GetOptLandingCoordinate():Get3DDistance( playerData.unit )
|
local dist = self:_GetOptLandingCoordinate():Get3DDistance( playerData.unit:GetVec3() )
|
||||||
-- Get player velocity in km/h.
|
-- Get player velocity in km/h.
|
||||||
local vplayer = playerData.unit:GetVelocityKMH()
|
local vplayer = playerData.unit:GetVelocityKMH()
|
||||||
-- Get carrier velocity in km/h.
|
-- Get carrier velocity in km/h.
|
||||||
@@ -11478,7 +11496,7 @@ end
|
|||||||
|
|
||||||
--- Get wind direction and speed at carrier position.
|
--- Get wind direction and speed at carrier position.
|
||||||
-- @param #AIRBOSS self
|
-- @param #AIRBOSS self
|
||||||
-- @param #number alt Altitude ASL in meters. Default 15 m.
|
-- @param #number alt Altitude ASL in meters. Default 18 m.
|
||||||
-- @param #boolean magnetic Direction including magnetic declination.
|
-- @param #boolean magnetic Direction including magnetic declination.
|
||||||
-- @param Core.Point#COORDINATE coord (Optional) Coordinate at which to get the wind. Default is current carrier position.
|
-- @param Core.Point#COORDINATE coord (Optional) Coordinate at which to get the wind. Default is current carrier position.
|
||||||
-- @return #number Direction the wind is blowing **from** in degrees.
|
-- @return #number Direction the wind is blowing **from** in degrees.
|
||||||
@@ -11550,10 +11568,31 @@ end
|
|||||||
|
|
||||||
--- Get true (or magnetic) heading of carrier into the wind. This accounts for the angled runway.
|
--- Get true (or magnetic) heading of carrier into the wind. This accounts for the angled runway.
|
||||||
-- @param #AIRBOSS self
|
-- @param #AIRBOSS self
|
||||||
|
-- @param #number vdeck Desired wind velocity over deck in knots.
|
||||||
-- @param #boolean magnetic If true, calculate magnetic heading. By default true heading is returned.
|
-- @param #boolean magnetic If true, calculate magnetic heading. By default true heading is returned.
|
||||||
-- @param Core.Point#COORDINATE coord (Optional) Coordinate from which heading is calculated. Default is current carrier position.
|
-- @param Core.Point#COORDINATE coord (Optional) Coordinate from which heading is calculated. Default is current carrier position.
|
||||||
-- @return #number Carrier heading in degrees.
|
-- @return #number Carrier heading in degrees.
|
||||||
function AIRBOSS:GetHeadingIntoWind_old( magnetic, coord )
|
-- @return #number Carrier speed in knots to reach desired wind speed on deck.
|
||||||
|
function AIRBOSS:GetHeadingIntoWind(vdeck, magnetic, coord )
|
||||||
|
|
||||||
|
if self.intowindold then
|
||||||
|
--env.info("FF use OLD into wind")
|
||||||
|
return self:GetHeadingIntoWind_old(vdeck, magnetic, coord)
|
||||||
|
else
|
||||||
|
--env.info("FF use NEW into wind")
|
||||||
|
return self:GetHeadingIntoWind_new(vdeck, magnetic, coord)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Get true (or magnetic) heading of carrier into the wind. This accounts for the angled runway.
|
||||||
|
-- @param #AIRBOSS self
|
||||||
|
-- @param #number vdeck Desired wind velocity over deck in knots.
|
||||||
|
-- @param #boolean magnetic If true, calculate magnetic heading. By default true heading is returned.
|
||||||
|
-- @param Core.Point#COORDINATE coord (Optional) Coordinate from which heading is calculated. Default is current carrier position.
|
||||||
|
-- @return #number Carrier heading in degrees.
|
||||||
|
function AIRBOSS:GetHeadingIntoWind_old( vdeck, magnetic, coord )
|
||||||
|
|
||||||
local function adjustDegreesForWindSpeed(windSpeed)
|
local function adjustDegreesForWindSpeed(windSpeed)
|
||||||
local degreesAdjustment = 0
|
local degreesAdjustment = 0
|
||||||
@@ -11610,7 +11649,13 @@ function AIRBOSS:GetHeadingIntoWind_old( magnetic, coord )
|
|||||||
intowind = intowind + 360
|
intowind = intowind + 360
|
||||||
end
|
end
|
||||||
|
|
||||||
return intowind
|
-- Wind speed.
|
||||||
|
--local _, vwind = self:GetWind()
|
||||||
|
|
||||||
|
-- Speed of carrier in m/s but at least 4 knots.
|
||||||
|
local vtot = math.max(vdeck-UTILS.MpsToKnots(vwind), 4)
|
||||||
|
|
||||||
|
return intowind, vtot
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get true (or magnetic) heading of carrier into the wind. This accounts for the angled runway.
|
--- Get true (or magnetic) heading of carrier into the wind. This accounts for the angled runway.
|
||||||
@@ -11621,7 +11666,7 @@ end
|
|||||||
-- @param Core.Point#COORDINATE coord (Optional) Coordinate from which heading is calculated. Default is current carrier position.
|
-- @param Core.Point#COORDINATE coord (Optional) Coordinate from which heading is calculated. Default is current carrier position.
|
||||||
-- @return #number Carrier heading in degrees.
|
-- @return #number Carrier heading in degrees.
|
||||||
-- @return #number Carrier speed in knots to reach desired wind speed on deck.
|
-- @return #number Carrier speed in knots to reach desired wind speed on deck.
|
||||||
function AIRBOSS:GetHeadingIntoWind( vdeck, magnetic, coord )
|
function AIRBOSS:GetHeadingIntoWind_new( vdeck, magnetic, coord )
|
||||||
|
|
||||||
-- Default offset angle.
|
-- Default offset angle.
|
||||||
local Offset=self.carrierparam.rwyangle or 0
|
local Offset=self.carrierparam.rwyangle or 0
|
||||||
@@ -12125,16 +12170,18 @@ function AIRBOSS:_LSOgrade( playerData )
|
|||||||
local GIC, nIC = self:_Flightdata2Text( playerData, AIRBOSS.GroovePos.IC )
|
local GIC, nIC = self:_Flightdata2Text( playerData, AIRBOSS.GroovePos.IC )
|
||||||
local GAR, nAR = self:_Flightdata2Text( playerData, AIRBOSS.GroovePos.AR )
|
local GAR, nAR = self:_Flightdata2Text( playerData, AIRBOSS.GroovePos.AR )
|
||||||
|
|
||||||
|
-- VTOL approach, which is graded differently (currently only Harrier).
|
||||||
|
local vtol=playerData.actype==AIRBOSS.AircraftCarrier.AV8B
|
||||||
|
|
||||||
-- Put everything together.
|
-- Put everything together.
|
||||||
local G = GXX .. " " .. GIM .. " " .. " " .. GIC .. " " .. GAR
|
local G = GXX .. " " .. GIM .. " " .. " " .. GIC .. " " .. GAR
|
||||||
|
|
||||||
-- Count number of minor, normal and major deviations.
|
-- Count number of minor/small nS, normal nN and major/large deviations nL.
|
||||||
local N=nXX+nIM+nIC+nAR
|
local N=nXX+nIM+nIC+nAR
|
||||||
local Nv=nXX+nIM
|
|
||||||
local nL=count(G, '_')/2
|
local nL=count(G, '_')/2
|
||||||
local nS=count(G, '%(')
|
local nS=count(G, '%(')
|
||||||
local nN=N-nS-nL
|
local nN=N-nS-nL
|
||||||
local nNv=Nv-nS-nL
|
|
||||||
|
|
||||||
-- Groove time 15-18.99 sec for a unicorn. Or 60-65 for V/STOL unicorn.
|
-- Groove time 15-18.99 sec for a unicorn. Or 60-65 for V/STOL unicorn.
|
||||||
local Tgroove=playerData.Tgroove
|
local Tgroove=playerData.Tgroove
|
||||||
@@ -12150,34 +12197,64 @@ function AIRBOSS:_LSOgrade( playerData )
|
|||||||
G = "Unicorn"
|
G = "Unicorn"
|
||||||
else
|
else
|
||||||
|
|
||||||
-- Add AV-8B Harrier devation allowances due to lower groundspeed and 3x conventional groove time, this allows to maintain LSO tolerances while respecting the deviations are not unsafe.--Pene testing
|
if vtol then
|
||||||
-- Large devaitions still result in a No Grade, A Unicorn still requires a clean pass with no deviation.
|
|
||||||
if nL > 1 and playerData.actype==AIRBOSS.AircraftCarrier.AV8B then
|
|
||||||
-- Larger deviations ==> "No grade" 2.0 points.
|
|
||||||
grade="--"
|
|
||||||
points=2.0
|
|
||||||
elseif nNv >= 1 and playerData.actype==AIRBOSS.AircraftCarrier.AV8B then
|
|
||||||
-- Only average deviations ==> "Fair Pass" Pass with average deviations and corrections.
|
|
||||||
grade="(OK)"
|
|
||||||
points=3.0
|
|
||||||
elseif nNv < 1 and playerData.actype==AIRBOSS.AircraftCarrier.AV8B then
|
|
||||||
-- Only minor average deviations ==> "OK" Pass with minor deviations and corrections. (test nNv<=1 and)
|
|
||||||
grade="OK"
|
|
||||||
points=4.0
|
|
||||||
elseif nL > 0 then
|
|
||||||
-- Larger deviations ==> "No grade" 2.0 points.
|
|
||||||
grade="--"
|
|
||||||
points=2.0
|
|
||||||
elseif nN> 0 then
|
|
||||||
-- No larger but average deviations ==> "Fair Pass" Pass with average deviations and corrections.
|
|
||||||
grade="(OK)"
|
|
||||||
points=3.0
|
|
||||||
else
|
|
||||||
-- Only minor corrections
|
|
||||||
grade="OK"
|
|
||||||
points=4.0
|
|
||||||
end
|
|
||||||
|
|
||||||
|
-- Add AV-8B Harrier devation allowances due to lower groundspeed and 3x conventional groove time, this allows to maintain LSO tolerances while respecting the deviations are not unsafe.--Pene testing
|
||||||
|
-- Large devaitions still result in a No Grade, A Unicorn still requires a clean pass with no deviation.
|
||||||
|
|
||||||
|
-- Normal laning part at the beginning
|
||||||
|
local Gb = GXX .. " " .. GIM
|
||||||
|
|
||||||
|
-- Number of deviations that occurred at the the beginning of the landing (XX or IM). These are graded like in non-VTOL landings, i.e. on deviations is
|
||||||
|
local N=nXX+nIM
|
||||||
|
local nL=count(Gb, '_')/2
|
||||||
|
local nS=count(Gb, '%(')
|
||||||
|
local nN=N-nS-nL
|
||||||
|
|
||||||
|
|
||||||
|
-- VTOL part of the landing
|
||||||
|
local Gv = GIC .. " " .. GAR
|
||||||
|
|
||||||
|
-- Number of deviations that occurred at the the end (VTOL part) of the landing (IC or AR).
|
||||||
|
local Nv=nIC+nAR
|
||||||
|
local nLv=count(Gv, '_')/2
|
||||||
|
local nSv=count(Gv, '%(')
|
||||||
|
local nNv=Nv-nSv-nLv
|
||||||
|
|
||||||
|
if nL>0 or nLv>1 then
|
||||||
|
-- Larger deviations at XX or IM or at least one larger deviation IC or AR==> "No grade" 2.0 points.
|
||||||
|
-- In other words, we allow one larger deviation at IC+AR
|
||||||
|
grade="--"
|
||||||
|
points=2.0
|
||||||
|
elseif nN>0 or nNv>1 or nLv==1 then
|
||||||
|
-- Average deviations at XX+IM or more than one normal deviation IC or AR ==> "Fair Pass" Pass with average deviations and corrections.
|
||||||
|
grade="(OK)"
|
||||||
|
points=3.0
|
||||||
|
else
|
||||||
|
-- Only minor corrections
|
||||||
|
grade="OK"
|
||||||
|
points=4.0
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
-- This is a normal (non-VTOL) landing.
|
||||||
|
|
||||||
|
if nL > 0 then
|
||||||
|
-- Larger deviations ==> "No grade" 2.0 points.
|
||||||
|
grade="--"
|
||||||
|
points=2.0
|
||||||
|
elseif nN> 0 then
|
||||||
|
-- No larger but average/normal deviations ==> "Fair Pass" Pass with average deviations and corrections.
|
||||||
|
grade="(OK)"
|
||||||
|
points=3.0
|
||||||
|
else
|
||||||
|
-- Only minor corrections ==> "Okay pass" 4.0 points.
|
||||||
|
grade="OK"
|
||||||
|
points=4.0
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Replace" )"( and "__"
|
-- Replace" )"( and "__"
|
||||||
@@ -14250,6 +14327,8 @@ function AIRBOSS:_GetACNickname( actype )
|
|||||||
nickname = "Harrier"
|
nickname = "Harrier"
|
||||||
elseif actype == AIRBOSS.AircraftCarrier.E2D then
|
elseif actype == AIRBOSS.AircraftCarrier.E2D then
|
||||||
nickname = "Hawkeye"
|
nickname = "Hawkeye"
|
||||||
|
elseif actype == AIRBOSS.AircraftCarrier.C2A then
|
||||||
|
nickname = "Greyhound"
|
||||||
elseif actype == AIRBOSS.AircraftCarrier.F14A_AI or actype == AIRBOSS.AircraftCarrier.F14A or actype == AIRBOSS.AircraftCarrier.F14B then
|
elseif actype == AIRBOSS.AircraftCarrier.F14A_AI or actype == AIRBOSS.AircraftCarrier.F14A or actype == AIRBOSS.AircraftCarrier.F14B then
|
||||||
nickname = "Tomcat"
|
nickname = "Tomcat"
|
||||||
elseif actype == AIRBOSS.AircraftCarrier.FA18C or actype == AIRBOSS.AircraftCarrier.HORNET then
|
elseif actype == AIRBOSS.AircraftCarrier.FA18C or actype == AIRBOSS.AircraftCarrier.HORNET then
|
||||||
@@ -14287,32 +14366,55 @@ function AIRBOSS:_GetOnboardNumbers( group, playeronly )
|
|||||||
-- Debug text.
|
-- Debug text.
|
||||||
local text = string.format( "Onboard numbers of group %s:", groupname )
|
local text = string.format( "Onboard numbers of group %s:", groupname )
|
||||||
|
|
||||||
-- Units of template group.
|
local template=group:GetTemplate()
|
||||||
local units = group:GetTemplate().units
|
|
||||||
|
|
||||||
-- Get numbers.
|
|
||||||
local numbers = {}
|
local numbers = {}
|
||||||
for _, unit in pairs( units ) do
|
if template then
|
||||||
|
|
||||||
-- Onboard number and unit name.
|
-- Units of template group.
|
||||||
local n = tostring( unit.onboard_num )
|
local units = template.units
|
||||||
local name = unit.name
|
|
||||||
local skill = unit.skill or "Unknown"
|
|
||||||
|
|
||||||
-- Debug text.
|
-- Get numbers.
|
||||||
text = text .. string.format( "\n- unit %s: onboard #=%s skill=%s", name, n, tostring( skill ) )
|
for _, unit in pairs( units ) do
|
||||||
|
|
||||||
if playeronly and skill == "Client" or skill == "Player" then
|
-- Onboard number and unit name.
|
||||||
-- There can be only one player in the group, so we skip everything else.
|
local n = tostring( unit.onboard_num )
|
||||||
return n
|
local name = unit.name
|
||||||
|
local skill = unit.skill or "Unknown"
|
||||||
|
|
||||||
|
-- Debug text.
|
||||||
|
text = text .. string.format( "\n- unit %s: onboard #=%s skill=%s", name, n, tostring( skill ) )
|
||||||
|
|
||||||
|
if playeronly and skill == "Client" or skill == "Player" then
|
||||||
|
-- There can be only one player in the group, so we skip everything else.
|
||||||
|
return n
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Table entry.
|
||||||
|
numbers[name] = n
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Table entry.
|
-- Debug info.
|
||||||
numbers[name] = n
|
self:T2( self.lid .. text )
|
||||||
end
|
|
||||||
|
|
||||||
-- Debug info.
|
else
|
||||||
self:T2( self.lid .. text )
|
|
||||||
|
if playeronly then
|
||||||
|
return 101
|
||||||
|
else
|
||||||
|
|
||||||
|
local units=group:GetUnits()
|
||||||
|
|
||||||
|
for i,_unit in pairs(units) do
|
||||||
|
local name=_unit:GetName()
|
||||||
|
|
||||||
|
numbers[name]=100+i
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
return numbers
|
return numbers
|
||||||
end
|
end
|
||||||
@@ -14890,10 +14992,6 @@ function AIRBOSS:RadioTransmission( radio, call, loud, delay, interval, click, p
|
|||||||
-- SRS transmission
|
-- SRS transmission
|
||||||
if call.subtitle ~= nil and string.len(call.subtitle) > 1 then
|
if call.subtitle ~= nil and string.len(call.subtitle) > 1 then
|
||||||
|
|
||||||
|
|
||||||
else
|
|
||||||
-- SRS transmission
|
|
||||||
|
|
||||||
local frequency = self.MarshalRadio.frequency
|
local frequency = self.MarshalRadio.frequency
|
||||||
local modulation = self.MarshalRadio.modulation
|
local modulation = self.MarshalRadio.modulation
|
||||||
local voice = nil
|
local voice = nil
|
||||||
@@ -14944,9 +15042,9 @@ function AIRBOSS:RadioTransmission( radio, call, loud, delay, interval, click, p
|
|||||||
|
|
||||||
--local text = tostring(call.modexreceiver).."; "..radio.alias.."; "..call.subtitle
|
--local text = tostring(call.modexreceiver).."; "..radio.alias.."; "..call.subtitle
|
||||||
local text = call.subtitle
|
local text = call.subtitle
|
||||||
self:I(self.lid..text)
|
self:T(self.lid..text)
|
||||||
local srstext = self:_GetNiceSRSText(text)
|
local srstext = self:_GetNiceSRSText(text)
|
||||||
self.SRSQ:NewTransmission(srstext, call.duration, self.SRS, tstart, 0.1, subgroups, call.subtitle, call.subduration, frequency, modulation, gender, culture, voice, volume, radio.alias)
|
self.SRSQ:NewTransmission(srstext, call.duration, self.SRS, nil, 0.1, nil, call.subtitle, call.subduration, frequency, modulation, gender, culture, voice, volume, radio.alias)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -14965,7 +15063,7 @@ function AIRBOSS:SetSRSPilotVoice( Voice, Gender, Culture )
|
|||||||
self.PilotRadio.gender = Gender or "male"
|
self.PilotRadio.gender = Gender or "male"
|
||||||
self.PilotRadio.culture = Culture or "en-US"
|
self.PilotRadio.culture = Culture or "en-US"
|
||||||
|
|
||||||
if (not Voice) and self.SRS and self.SRS.google then
|
if (not Voice) and self.SRS and self.SRS:GetProvider() == MSRS.Provider.GOOGLE then
|
||||||
self.PilotRadio.voice = MSRS.Voices.Google.Standard.en_US_Standard_J
|
self.PilotRadio.voice = MSRS.Voices.Google.Standard.en_US_Standard_J
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -15259,7 +15357,7 @@ end
|
|||||||
-- @param #boolean clear If true, clear screen from previous messages.
|
-- @param #boolean clear If true, clear screen from previous messages.
|
||||||
-- @param #number delay Delay in seconds, before the message is displayed.
|
-- @param #number delay Delay in seconds, before the message is displayed.
|
||||||
function AIRBOSS:MessageToPlayer( playerData, message, sender, receiver, duration, clear, delay )
|
function AIRBOSS:MessageToPlayer( playerData, message, sender, receiver, duration, clear, delay )
|
||||||
self:I({sender,receiver,message})
|
self:T({sender,receiver,message})
|
||||||
if playerData and message and message ~= "" then
|
if playerData and message and message ~= "" then
|
||||||
|
|
||||||
-- Default duration.
|
-- Default duration.
|
||||||
@@ -15362,10 +15460,10 @@ function AIRBOSS:MessageToPlayer( playerData, message, sender, receiver, duratio
|
|||||||
--sender = "AIRBOSS"
|
--sender = "AIRBOSS"
|
||||||
end
|
end
|
||||||
|
|
||||||
self:I(self.lid..text)
|
self:T(self.lid..text)
|
||||||
self:I({sender,frequency,modulation,voice})
|
self:T({sender,frequency,modulation,voice})
|
||||||
local srstext = self:_GetNiceSRSText(text)
|
local srstext = self:_GetNiceSRSText(text)
|
||||||
self.SRSQ:NewTransmission(srstext,duration,self.SRS,tstart,0.1,subgroups,subtitle,subduration,frequency,modulation,gender,culture,voice,volume,sender)
|
self.SRSQ:NewTransmission(srstext,duration,self.SRS,nil,0.1,nil,nil,nil,frequency,modulation,gender,culture,voice,nil,sender)
|
||||||
end
|
end
|
||||||
-- Text message to player client.
|
-- Text message to player client.
|
||||||
if playerData.client then
|
if playerData.client then
|
||||||
@@ -15614,6 +15712,11 @@ function AIRBOSS:_Number2Radio( radio, number, delay, interval, pilotcall )
|
|||||||
Sender = "PilotCall"
|
Sender = "PilotCall"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if Sender=="" then
|
||||||
|
self:E( self.lid .. string.format( "ERROR: Sender unknown!") )
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- Split string into characters.
|
-- Split string into characters.
|
||||||
local numbers = _split( number )
|
local numbers = _split( number )
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Example Missions:
|
-- ## Example Missions:
|
||||||
--
|
--
|
||||||
-- Demo missions can be found on [github](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/OPS%20-%20Armygroup).
|
-- Demo missions can be found on [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/Ops/Armygroup).
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -976,7 +976,10 @@ function ARMYGROUP:onafterSpawned(From, Event, To)
|
|||||||
-- Update route.
|
-- Update route.
|
||||||
if Nwp>1 and self.isMobile then
|
if Nwp>1 and self.isMobile then
|
||||||
self:T(self.lid..string.format("Got %d waypoints on spawn ==> Cruise in -1.0 sec!", Nwp))
|
self:T(self.lid..string.format("Got %d waypoints on spawn ==> Cruise in -1.0 sec!", Nwp))
|
||||||
self:__Cruise(-1, nil, self.option.Formation)
|
local wp=self:GetWaypointNext()
|
||||||
|
self.option.Formation=wp.action
|
||||||
|
--self:__Cruise(-1, nil, self.option.Formation)
|
||||||
|
self:__Cruise(-1)
|
||||||
else
|
else
|
||||||
self:T(self.lid.."No waypoints on spawn ==> Full Stop!")
|
self:T(self.lid.."No waypoints on spawn ==> Full Stop!")
|
||||||
self:FullStop()
|
self:FullStop()
|
||||||
@@ -1287,6 +1290,7 @@ function ARMYGROUP:onafterUpdateRoute(From, Event, To, n, N, Speed, Formation)
|
|||||||
|
|
||||||
-- Current set speed in m/s.
|
-- Current set speed in m/s.
|
||||||
self.speedWp=wp.speed
|
self.speedWp=wp.speed
|
||||||
|
self:T(self.lid..string.format("Expected/waypoint speed=%.1f m/s", self.speedWp))
|
||||||
|
|
||||||
-- Debug output.
|
-- Debug output.
|
||||||
if self.verbose>=10 then --or self.attribute==GROUP.Attribute.GROUND_APC then
|
if self.verbose>=10 then --or self.attribute==GROUP.Attribute.GROUND_APC then
|
||||||
@@ -1860,6 +1864,7 @@ function ARMYGROUP:_UpdateEngageTarget()
|
|||||||
else
|
else
|
||||||
|
|
||||||
-- Could not get position of target (not alive any more?) ==> Disengage.
|
-- Could not get position of target (not alive any more?) ==> Disengage.
|
||||||
|
self:T(self.lid.."Could not get position of target ==> Disengage!")
|
||||||
self:Disengage()
|
self:Disengage()
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -1867,6 +1872,7 @@ function ARMYGROUP:_UpdateEngageTarget()
|
|||||||
else
|
else
|
||||||
|
|
||||||
-- Target not alive any more ==> Disengage.
|
-- Target not alive any more ==> Disengage.
|
||||||
|
self:T(self.lid.."Target not ALIVE ==> Disengage!")
|
||||||
self:Disengage()
|
self:Disengage()
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -1948,7 +1954,7 @@ function ARMYGROUP:onafterCruise(From, Event, To, Speed, Formation)
|
|||||||
self.dTwait=nil
|
self.dTwait=nil
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:T(self.lid.."Cruise ==> Update route in 0.01 sec")
|
self:T(self.lid..string.format("Cruise ==> Update route in 0.01 sec (speed=%s, formation=%s)", tostring(Speed), tostring(Formation)))
|
||||||
|
|
||||||
-- Update route.
|
-- Update route.
|
||||||
self:__UpdateRoute(-0.01, nil, nil, Speed, Formation)
|
self:__UpdateRoute(-0.01, nil, nil, Speed, Formation)
|
||||||
@@ -2043,8 +2049,11 @@ end
|
|||||||
-- @param #ARMYGROUP self
|
-- @param #ARMYGROUP self
|
||||||
-- @param #table Template Template used to init the group. Default is `self.template`.
|
-- @param #table Template Template used to init the group. Default is `self.template`.
|
||||||
-- @return #ARMYGROUP self
|
-- @return #ARMYGROUP self
|
||||||
function ARMYGROUP:_InitGroup(Template)
|
function ARMYGROUP:_InitGroup(Template, Delay)
|
||||||
|
|
||||||
|
if Delay and Delay>0 then
|
||||||
|
self:ScheduleOnce(Delay, ARMYGROUP._InitGroup, self, Template, 0)
|
||||||
|
else
|
||||||
-- First check if group was already initialized.
|
-- First check if group was already initialized.
|
||||||
if self.groupinitialized then
|
if self.groupinitialized then
|
||||||
self:T(self.lid.."WARNING: Group was already initialized! Will NOT do it again!")
|
self:T(self.lid.."WARNING: Group was already initialized! Will NOT do it again!")
|
||||||
@@ -2067,10 +2076,11 @@ function ARMYGROUP:_InitGroup(Template)
|
|||||||
self.speedMax=self.group:GetSpeedMax()
|
self.speedMax=self.group:GetSpeedMax()
|
||||||
|
|
||||||
-- Is group mobile?
|
-- Is group mobile?
|
||||||
if self.speedMax>3.6 then
|
if self.speedMax and self.speedMax>3.6 then
|
||||||
self.isMobile=true
|
self.isMobile=true
|
||||||
else
|
else
|
||||||
self.isMobile=false
|
self.isMobile=false
|
||||||
|
self.speedMax = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Cruise speed in km/h
|
-- Cruise speed in km/h
|
||||||
@@ -2093,32 +2103,84 @@ function ARMYGROUP:_InitGroup(Template)
|
|||||||
-- Set default formation to "on road".
|
-- Set default formation to "on road".
|
||||||
self.optionDefault.Formation=ENUMS.Formation.Vehicle.OnRoad
|
self.optionDefault.Formation=ENUMS.Formation.Vehicle.OnRoad
|
||||||
|
|
||||||
-- Default TACAN off.
|
-- First check if group was already initialized.
|
||||||
self:SetDefaultTACAN(nil, nil, nil, nil, true)
|
if self.groupinitialized then
|
||||||
self.tacan=UTILS.DeepCopy(self.tacanDefault)
|
self:T(self.lid.."WARNING: Group was already initialized! Will NOT do it again!")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- Units of the group.
|
self:T(self.lid.."FF Initializing Group")
|
||||||
local units=self.group:GetUnits()
|
|
||||||
|
|
||||||
-- DCS group.
|
-- Get template of group.
|
||||||
local dcsgroup=Group.getByName(self.groupname)
|
local template=Template or self:_GetTemplate()
|
||||||
local size0=dcsgroup:getInitialSize()
|
|
||||||
|
|
||||||
-- Quick check.
|
-- Ground are always AI.
|
||||||
if #units~=size0 then
|
self.isAI=true
|
||||||
self:T(self.lid..string.format("ERROR: Got #units=%d but group consists of %d units!", #units, size0))
|
|
||||||
|
-- Is (template) group late activated.
|
||||||
|
self.isLateActivated=template.lateActivation
|
||||||
|
|
||||||
|
-- Ground groups cannot be uncontrolled.
|
||||||
|
self.isUncontrolled=false
|
||||||
|
|
||||||
|
-- Max speed in km/h.
|
||||||
|
self.speedMax=self.group:GetSpeedMax()
|
||||||
|
|
||||||
|
-- Is group mobile?
|
||||||
|
if self.speedMax>3.6 then
|
||||||
|
self.isMobile=true
|
||||||
|
else
|
||||||
|
self.isMobile=false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Cruise speed in km/h
|
||||||
|
self.speedCruise=self.speedMax*0.7
|
||||||
|
|
||||||
|
-- Group ammo.
|
||||||
|
self.ammo=self:GetAmmoTot()
|
||||||
|
|
||||||
|
-- Radio parameters from template.
|
||||||
|
self.radio.On=false -- Radio is always OFF for ground.
|
||||||
|
self.radio.Freq=133
|
||||||
|
self.radio.Modu=radio.modulation.AM
|
||||||
|
|
||||||
|
-- Set default radio.
|
||||||
|
self:SetDefaultRadio(self.radio.Freq, self.radio.Modu, self.radio.On)
|
||||||
|
|
||||||
|
-- Get current formation from first waypoint.
|
||||||
|
self.option.Formation=template.route.points[1].action
|
||||||
|
|
||||||
|
-- Set default formation to "on road".
|
||||||
|
self.optionDefault.Formation=ENUMS.Formation.Vehicle.OnRoad
|
||||||
|
|
||||||
|
-- Default TACAN off.
|
||||||
|
self:SetDefaultTACAN(nil, nil, nil, nil, true)
|
||||||
|
self.tacan=UTILS.DeepCopy(self.tacanDefault)
|
||||||
|
|
||||||
|
-- Units of the group.
|
||||||
|
local units=self.group:GetUnits()
|
||||||
|
|
||||||
|
-- DCS group.
|
||||||
|
local dcsgroup=Group.getByName(self.groupname)
|
||||||
|
local size0=dcsgroup:getInitialSize()
|
||||||
|
local u=dcsgroup:getUnits()
|
||||||
|
|
||||||
|
-- Quick check.
|
||||||
|
if #units~=size0 then
|
||||||
|
self:T(self.lid..string.format("ERROR: Got #units=%d but group consists of %d units! u=%d", #units, size0, #u))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Add elemets.
|
||||||
|
for _,unit in pairs(units) do
|
||||||
|
local unitname=unit:GetName()
|
||||||
|
self:_AddElementByName(unitname)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Init done.
|
||||||
|
self.groupinitialized=true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Add elemets.
|
|
||||||
for _,unit in pairs(units) do
|
|
||||||
local unitname=unit:GetName()
|
|
||||||
self:_AddElementByName(unitname)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Init done.
|
|
||||||
self.groupinitialized=true
|
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -145,7 +145,7 @@
|
|||||||
-- @field #table NassetsLegMax Number of required warehouse assets for each assigned legion.
|
-- @field #table NassetsLegMax Number of required warehouse assets for each assigned legion.
|
||||||
-- @field #table requestID The ID of the queued warehouse request. Necessary to cancel the request if the mission was cancelled before the request is processed.
|
-- @field #table requestID The ID of the queued warehouse request. Necessary to cancel the request if the mission was cancelled before the request is processed.
|
||||||
-- @field #table payloads User specified airwing payloads for this mission. Only these will be considered for the job!
|
-- @field #table payloads User specified airwing payloads for this mission. Only these will be considered for the job!
|
||||||
-- @field Ops.AirWing#AIRWING.PatrolData patroldata Patrol data.
|
-- @field Ops.Airwing#AIRWING.PatrolData patroldata Patrol data.
|
||||||
--
|
--
|
||||||
-- @field #table specialLegions User specified legions assigned for this mission. Only these will be considered for the job!
|
-- @field #table specialLegions User specified legions assigned for this mission. Only these will be considered for the job!
|
||||||
-- @field #table specialCohorts User specified cohorts assigned for this mission. Only these will be considered for the job!
|
-- @field #table specialCohorts User specified cohorts assigned for this mission. Only these will be considered for the job!
|
||||||
@@ -338,7 +338,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Legion Level
|
-- ## Legion Level
|
||||||
--
|
--
|
||||||
-- Adding an AUFTRAG to an airwing is done via the @{Ops.AirWing#AIRWING.AddMission} function. See AIRWING docs for further details.
|
-- Adding an AUFTRAG to an airwing is done via the @{Ops.Airwing#AIRWING.AddMission} function. See AIRWING docs for further details.
|
||||||
-- Similarly, an AUFTRAG can be added to a brigade via the @{Ops.Brigade#BRIGADE.AddMission} function.
|
-- Similarly, an AUFTRAG can be added to a brigade via the @{Ops.Brigade#BRIGADE.AddMission} function.
|
||||||
--
|
--
|
||||||
-- ## Commander Level
|
-- ## Commander Level
|
||||||
@@ -434,6 +434,7 @@ _AUFTRAGSNR=0
|
|||||||
-- @field #string ARMORATTACK Armor attack.
|
-- @field #string ARMORATTACK Armor attack.
|
||||||
-- @field #string CASENHANCED Enhanced CAS.
|
-- @field #string CASENHANCED Enhanced CAS.
|
||||||
-- @field #string HOVER Hover.
|
-- @field #string HOVER Hover.
|
||||||
|
-- @field #string LANDATCOORDINATE Land at coordinate.
|
||||||
-- @field #string GROUNDATTACK Ground attack.
|
-- @field #string GROUNDATTACK Ground attack.
|
||||||
-- @field #string CARGOTRANSPORT Cargo transport.
|
-- @field #string CARGOTRANSPORT Cargo transport.
|
||||||
-- @field #string RELOCATECOHORT Relocate a cohort from one legion to another.
|
-- @field #string RELOCATECOHORT Relocate a cohort from one legion to another.
|
||||||
@@ -480,6 +481,7 @@ AUFTRAG.Type={
|
|||||||
ARMORATTACK="Armor Attack",
|
ARMORATTACK="Armor Attack",
|
||||||
CASENHANCED="CAS Enhanced",
|
CASENHANCED="CAS Enhanced",
|
||||||
HOVER="Hover",
|
HOVER="Hover",
|
||||||
|
LANDATCOORDINATE="Land at Coordinate",
|
||||||
GROUNDATTACK="Ground Attack",
|
GROUNDATTACK="Ground Attack",
|
||||||
CARGOTRANSPORT="Cargo Transport",
|
CARGOTRANSPORT="Cargo Transport",
|
||||||
RELOCATECOHORT="Relocate Cohort",
|
RELOCATECOHORT="Relocate Cohort",
|
||||||
@@ -1052,6 +1054,42 @@ function AUFTRAG:NewHOVER(Coordinate, Altitude, Time, Speed, MissionAlt)
|
|||||||
return mission
|
return mission
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- **[AIR ROTARY]** Create an LANDATCOORDINATE mission.
|
||||||
|
-- @param #AUFTRAG self
|
||||||
|
-- @param Core.Point#COORDINATE Coordinate Where to land.
|
||||||
|
-- @param #number OuterRadius (Optional) Vary the coordinate by this many feet, e.g. get a new random coordinate between OuterRadius and (optionally) avoiding InnerRadius of the coordinate.
|
||||||
|
-- @param #number InnerRadius (Optional) Vary the coordinate by this many feet, e.g. get a new random coordinate between OuterRadius and (optionally) avoiding InnerRadius of the coordinate.
|
||||||
|
-- @param #number Time Time in seconds to stay. Default 300 seconds.
|
||||||
|
-- @param #number Speed Speed in knots to fly to the target coordinate. Default 150kn.
|
||||||
|
-- @param #number MissionAlt Altitude to fly towards the mission in feet AGL. Default 1000ft.
|
||||||
|
-- @return #AUFTRAG self
|
||||||
|
function AUFTRAG:NewLANDATCOORDINATE(Coordinate, OuterRadius, InnerRadius, Time, Speed, MissionAlt)
|
||||||
|
|
||||||
|
local mission=AUFTRAG:New(AUFTRAG.Type.LANDATCOORDINATE)
|
||||||
|
|
||||||
|
mission:_TargetFromObject(Coordinate)
|
||||||
|
|
||||||
|
mission.stayTime = Time or 300
|
||||||
|
mission.stayAt = Coordinate
|
||||||
|
self:SetMissionSpeed(Speed or 150)
|
||||||
|
self:SetMissionAltitude(MissionAlt or 1000)
|
||||||
|
|
||||||
|
if OuterRadius then
|
||||||
|
mission.stayAt = Coordinate:GetRandomCoordinateInRadius(UTILS.FeetToMeters(OuterRadius),UTILS.FeetToMeters(InnerRadius or 0))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Mission options:
|
||||||
|
mission.missionFraction=0.9
|
||||||
|
mission.optionROE=ENUMS.ROE.ReturnFire
|
||||||
|
mission.optionROT=ENUMS.ROT.PassiveDefense
|
||||||
|
|
||||||
|
mission.categories={AUFTRAG.Category.HELICOPTER}
|
||||||
|
|
||||||
|
mission.DCStask=mission:GetDCSMissionTask()
|
||||||
|
|
||||||
|
return mission
|
||||||
|
end
|
||||||
|
|
||||||
--- **[AIR]** Create an enhanced orbit race track mission. Planes will keep closer to the track.
|
--- **[AIR]** Create an enhanced orbit race track mission. Planes will keep closer to the track.
|
||||||
-- @param #AUFTRAG self
|
-- @param #AUFTRAG self
|
||||||
-- @param Core.Point#COORDINATE Coordinate Where to start the race track.
|
-- @param Core.Point#COORDINATE Coordinate Where to start the race track.
|
||||||
@@ -3696,7 +3734,7 @@ end
|
|||||||
|
|
||||||
--- Add a required payload for this mission. Only these payloads will be used for this mission. If they are not available, the mission cannot start. Only available for use with an AIRWING.
|
--- Add a required payload for this mission. Only these payloads will be used for this mission. If they are not available, the mission cannot start. Only available for use with an AIRWING.
|
||||||
-- @param #AUFTRAG self
|
-- @param #AUFTRAG self
|
||||||
-- @param Ops.AirWing#AIRWING.Payload Payload Required payload.
|
-- @param Ops.Airwing#AIRWING.Payload Payload Required payload.
|
||||||
-- @return #AUFTRAG self
|
-- @return #AUFTRAG self
|
||||||
function AUFTRAG:AddRequiredPayload(Payload)
|
function AUFTRAG:AddRequiredPayload(Payload)
|
||||||
|
|
||||||
@@ -6446,6 +6484,18 @@ function AUFTRAG:GetDCSMissionTask()
|
|||||||
|
|
||||||
table.insert(DCStasks, DCStask)
|
table.insert(DCStasks, DCStask)
|
||||||
|
|
||||||
|
elseif self.type==AUFTRAG.Type.LANDATCOORDINATE then
|
||||||
|
|
||||||
|
---------------------
|
||||||
|
-- LANDATCOORDINATE Mission
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
local DCStask={}
|
||||||
|
local Vec2 = self.stayAt:GetVec2()
|
||||||
|
local DCStask = CONTROLLABLE.TaskLandAtVec2(nil,Vec2,self.stayTime)
|
||||||
|
|
||||||
|
table.insert(DCStasks, DCStask)
|
||||||
|
|
||||||
elseif self.type==AUFTRAG.Type.ONGUARD or self.type==AUFTRAG.Type.ARMOREDGUARD then
|
elseif self.type==AUFTRAG.Type.ONGUARD or self.type==AUFTRAG.Type.ARMOREDGUARD then
|
||||||
|
|
||||||
----------------------
|
----------------------
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
--
|
--
|
||||||
-- ## Example Missions:
|
-- ## Example Missions:
|
||||||
--
|
--
|
||||||
-- Demo missions can be found on [github](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/OPS%20-%20Awacs/).
|
-- Demo missions can be found on [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/Ops/Awacs/).
|
||||||
--
|
--
|
||||||
-- ## Videos:
|
-- ## Videos:
|
||||||
--
|
--
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **applevangelist**
|
-- ### Author: **applevangelist**
|
||||||
-- @date Last Update July 2023
|
-- @date Last Update Jan 2024
|
||||||
-- @module Ops.AWACS
|
-- @module Ops.AWACS
|
||||||
-- @image OPS_AWACS.jpg
|
-- @image OPS_AWACS.jpg
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ do
|
|||||||
-- @field #number Frequency
|
-- @field #number Frequency
|
||||||
-- @field #number Modulation
|
-- @field #number Modulation
|
||||||
-- @field Wrapper.Airbase#AIRBASE Airbase
|
-- @field Wrapper.Airbase#AIRBASE Airbase
|
||||||
-- @field Ops.AirWing#AIRWING AirWing
|
-- @field Ops.Airwing#AIRWING AirWing
|
||||||
-- @field #number AwacsAngels
|
-- @field #number AwacsAngels
|
||||||
-- @field Core.Zone#ZONE OrbitZone
|
-- @field Core.Zone#ZONE OrbitZone
|
||||||
-- @field #number CallSign
|
-- @field #number CallSign
|
||||||
@@ -121,6 +121,7 @@ do
|
|||||||
-- @field #number TacticalIncrFreq
|
-- @field #number TacticalIncrFreq
|
||||||
-- @field #number TacticalModulation
|
-- @field #number TacticalModulation
|
||||||
-- @field #number TacticalInterval
|
-- @field #number TacticalInterval
|
||||||
|
-- @field Core.Set#SET_GROUP DetectionSet
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
|
|
||||||
@@ -158,10 +159,10 @@ do
|
|||||||
--
|
--
|
||||||
-- ## 3 Airwing(s)
|
-- ## 3 Airwing(s)
|
||||||
--
|
--
|
||||||
-- The AWACS plane, the optional escort planes, and the AI CAP planes work based on the @{Ops.AirWing} class. Read and understand the manual for this class in
|
-- The AWACS plane, the optional escort planes, and the AI CAP planes work based on the @{Ops.Airwing} class. Read and understand the manual for this class in
|
||||||
-- order to set everything up correctly. You will at least need one Squadron containing the AWACS plane itself.
|
-- order to set everything up correctly. You will at least need one Squadron containing the AWACS plane itself.
|
||||||
--
|
--
|
||||||
-- Set up the AirWing
|
-- Set up the Airwing
|
||||||
--
|
--
|
||||||
-- local AwacsAW = AIRWING:New("AirForce WH-1","AirForce One")
|
-- local AwacsAW = AIRWING:New("AirForce WH-1","AirForce One")
|
||||||
-- AwacsAW:SetMarker(false)
|
-- AwacsAW:SetMarker(false)
|
||||||
@@ -225,7 +226,7 @@ do
|
|||||||
--
|
--
|
||||||
-- ## 5 Set up AWACS
|
-- ## 5 Set up AWACS
|
||||||
--
|
--
|
||||||
-- -- Set up AWACS called "AWACS North". It will use the AwacsAW AirWing set up above and be of the "blue" coalition. Homebase is Kutaisi.
|
-- -- Set up AWACS called "AWACS North". It will use the AwacsAW Airwing set up above and be of the "blue" coalition. Homebase is Kutaisi.
|
||||||
-- -- The AWACS Orbit Zone is a round zone set in the mission editor named "Awacs Orbit", the FEZ is a Polygon-Zone called "Rock" we have also
|
-- -- The AWACS Orbit Zone is a round zone set in the mission editor named "Awacs Orbit", the FEZ is a Polygon-Zone called "Rock" we have also
|
||||||
-- -- set up in the mission editor with a late activated helo named "Rock#ZONE_POLYGON". Note this also sets the BullsEye to be referenced as "Rock".
|
-- -- set up in the mission editor with a late activated helo named "Rock#ZONE_POLYGON". Note this also sets the BullsEye to be referenced as "Rock".
|
||||||
-- -- The CAP station zone is called "Fremont". We will be on 255 AM.
|
-- -- The CAP station zone is called "Fremont". We will be on 255 AM.
|
||||||
@@ -247,7 +248,7 @@ do
|
|||||||
--
|
--
|
||||||
-- ### 5.1 Alternative - Set up as GCI (no AWACS plane needed) Theater Air Control System (TACS)
|
-- ### 5.1 Alternative - Set up as GCI (no AWACS plane needed) Theater Air Control System (TACS)
|
||||||
--
|
--
|
||||||
-- -- Set up as TACS called "GCI Senaki". It will use the AwacsAW AirWing set up above and be of the "blue" coalition. Homebase is Senaki.
|
-- -- Set up as TACS called "GCI Senaki". It will use the AwacsAW Airwing set up above and be of the "blue" coalition. Homebase is Senaki.
|
||||||
-- -- No need to set the AWACS Orbit Zone; the FEZ is still a Polygon-Zone called "Rock" we have also
|
-- -- No need to set the AWACS Orbit Zone; the FEZ is still a Polygon-Zone called "Rock" we have also
|
||||||
-- -- set up in the mission editor with a late activated helo named "Rock#ZONE_POLYGON". Note this also sets the BullsEye to be referenced as "Rock".
|
-- -- set up in the mission editor with a late activated helo named "Rock#ZONE_POLYGON". Note this also sets the BullsEye to be referenced as "Rock".
|
||||||
-- -- The CAP station zone is called "Fremont". We will be on 255 AM. Note the Orbit Zone is given as *nil* in the `New()`-Statement
|
-- -- The CAP station zone is called "Fremont". We will be on 255 AM. Note the Orbit Zone is given as *nil* in the `New()`-Statement
|
||||||
@@ -507,7 +508,7 @@ do
|
|||||||
-- @field #AWACS
|
-- @field #AWACS
|
||||||
AWACS = {
|
AWACS = {
|
||||||
ClassName = "AWACS", -- #string
|
ClassName = "AWACS", -- #string
|
||||||
version = "0.2.57", -- #string
|
version = "0.2.64", -- #string
|
||||||
lid = "", -- #string
|
lid = "", -- #string
|
||||||
coalition = coalition.side.BLUE, -- #number
|
coalition = coalition.side.BLUE, -- #number
|
||||||
coalitiontxt = "blue", -- #string
|
coalitiontxt = "blue", -- #string
|
||||||
@@ -603,6 +604,7 @@ AWACS = {
|
|||||||
TacticalIncrFreq = 0.5,
|
TacticalIncrFreq = 0.5,
|
||||||
TacticalModulation = radio.modulation.AM,
|
TacticalModulation = radio.modulation.AM,
|
||||||
TacticalInterval = 120,
|
TacticalInterval = 120,
|
||||||
|
DetectionSet = nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -850,8 +852,8 @@ AWACS.Messages = {
|
|||||||
--- Contact Data
|
--- Contact Data
|
||||||
-- @type AWACS.ManagedContact
|
-- @type AWACS.ManagedContact
|
||||||
-- @field #number CID
|
-- @field #number CID
|
||||||
-- @field Ops.Intelligence#INTEL.Contact Contact
|
-- @field Ops.Intel#INTEL.Contact Contact
|
||||||
-- @field Ops.Intelligence#INTEL.Cluster Cluster
|
-- @field Ops.Intel#INTEL.Cluster Cluster
|
||||||
-- @field #string IFF -- ID'ed or not (yet)
|
-- @field #string IFF -- ID'ed or not (yet)
|
||||||
-- @field Ops.Target#TARGET Target
|
-- @field Ops.Target#TARGET Target
|
||||||
-- @field #number LinkedTask --> TID
|
-- @field #number LinkedTask --> TID
|
||||||
@@ -900,8 +902,8 @@ AWACS.TaskStatus = {
|
|||||||
-- @field #AWACS.TaskStatus Status
|
-- @field #AWACS.TaskStatus Status
|
||||||
-- @field #AWACS.TaskDescription ToDo
|
-- @field #AWACS.TaskDescription ToDo
|
||||||
-- @field #string ScreenText Long descrition
|
-- @field #string ScreenText Long descrition
|
||||||
-- @field Ops.Intelligence#INTEL.Contact Contact
|
-- @field Ops.Intel#INTEL.Contact Contact
|
||||||
-- @field Ops.Intelligence#INTEL.Cluster Cluster
|
-- @field Ops.Intel#INTEL.Cluster Cluster
|
||||||
-- @field #number CurrentAuftrag
|
-- @field #number CurrentAuftrag
|
||||||
-- @field #number RequestedTimestamp
|
-- @field #number RequestedTimestamp
|
||||||
|
|
||||||
@@ -954,7 +956,7 @@ AWACS.TaskStatus = {
|
|||||||
-- DONE - Shift Change, Change on asset RTB or dead or mission done (done for AWACS and Escorts)
|
-- DONE - Shift Change, Change on asset RTB or dead or mission done (done for AWACS and Escorts)
|
||||||
-- DONE - TripWire - WIP - Threat (35nm), Meld (45nm, on mission), Merged (<3nm)
|
-- DONE - TripWire - WIP - Threat (35nm), Meld (45nm, on mission), Merged (<3nm)
|
||||||
--
|
--
|
||||||
-- DONE - Escorts via AirWing not staying on
|
-- DONE - Escorts via Airwing not staying on
|
||||||
-- DONE - Borders for INTEL. Optional, i.e. land based defense within borders
|
-- DONE - Borders for INTEL. Optional, i.e. land based defense within borders
|
||||||
-- DONE - Use AO as Anchor of Bulls, AO as default
|
-- DONE - Use AO as Anchor of Bulls, AO as default
|
||||||
-- DONE - SRS TTS output
|
-- DONE - SRS TTS output
|
||||||
@@ -971,6 +973,7 @@ AWACS.TaskStatus = {
|
|||||||
-- DONE - (WIP) Reporting
|
-- DONE - (WIP) Reporting
|
||||||
-- DONE - Do not report non-airborne groups
|
-- DONE - Do not report non-airborne groups
|
||||||
-- DONE - Added option for helos
|
-- DONE - Added option for helos
|
||||||
|
-- DONE - Added setting a coordinate for SRS
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- Constructor
|
-- Constructor
|
||||||
@@ -981,7 +984,7 @@ AWACS.TaskStatus = {
|
|||||||
--- Set up a new AI AWACS.
|
--- Set up a new AI AWACS.
|
||||||
-- @param #AWACS self
|
-- @param #AWACS self
|
||||||
-- @param #string Name Name of this AWACS for the radio menu.
|
-- @param #string Name Name of this AWACS for the radio menu.
|
||||||
-- @param #string AirWing The core Ops.AirWing#AIRWING managing the AWACS, Escort and (optionally) AI CAP planes for us.
|
-- @param #string AirWing The core Ops.Airwing#AIRWING managing the AWACS, Escort and (optionally) AI CAP planes for us.
|
||||||
-- @param #number Coalition Coalition, e.g. coalition.side.BLUE. Can also be passed as "blue", "red" or "neutral".
|
-- @param #number Coalition Coalition, e.g. coalition.side.BLUE. Can also be passed as "blue", "red" or "neutral".
|
||||||
-- @param #string AirbaseName Name of the home airbase.
|
-- @param #string AirbaseName Name of the home airbase.
|
||||||
-- @param #string AwacsOrbit Name of the round, mission editor created zone where this AWACS orbits.
|
-- @param #string AwacsOrbit Name of the round, mission editor created zone where this AWACS orbits.
|
||||||
@@ -1021,7 +1024,7 @@ function AWACS:New(Name,AirWing,Coalition,AirbaseName,AwacsOrbit,OpsZone,Station
|
|||||||
|
|
||||||
-- base setup
|
-- base setup
|
||||||
self.Name = Name -- #string
|
self.Name = Name -- #string
|
||||||
self.AirWing = AirWing -- Ops.AirWing#AIRWING object
|
self.AirWing = AirWing -- Ops.Airwing#AIRWING object
|
||||||
|
|
||||||
AirWing:SetUsingOpsAwacs(self)
|
AirWing:SetUsingOpsAwacs(self)
|
||||||
|
|
||||||
@@ -1029,7 +1032,7 @@ function AWACS:New(Name,AirWing,Coalition,AirbaseName,AwacsOrbit,OpsZone,Station
|
|||||||
self.CAPAirwings:Push(AirWing,1)
|
self.CAPAirwings:Push(AirWing,1)
|
||||||
|
|
||||||
self.AwacsFG = nil
|
self.AwacsFG = nil
|
||||||
--self.AwacsPayload = PayLoad -- Ops.AirWing#AIRWING.Payload
|
--self.AwacsPayload = PayLoad -- Ops.Airwing#AIRWING.Payload
|
||||||
--self.ModernEra = true -- use of EPLRS
|
--self.ModernEra = true -- use of EPLRS
|
||||||
self.RadarBlur = 15 -- +/-15% detection precision i.e. 85-115 reported group size
|
self.RadarBlur = 15 -- +/-15% detection precision i.e. 85-115 reported group size
|
||||||
if type(OpsZone) == "string" then
|
if type(OpsZone) == "string" then
|
||||||
@@ -1381,7 +1384,7 @@ end
|
|||||||
-- Functions
|
-- Functions
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
--- [User] Set the tactical information option, create 10 radio channels groups can subscribe and get Bogey Dope on a specific frequency automatically.
|
--- [User] Set the tactical information option, create 10 radio channels groups can subscribe and get Bogey Dope on a specific frequency automatically. You **need** to set up SRS first before using this!
|
||||||
-- @param #AWACS self
|
-- @param #AWACS self
|
||||||
-- @param #number BaseFreq Base Frequency to use, defaults to 130.
|
-- @param #number BaseFreq Base Frequency to use, defaults to 130.
|
||||||
-- @param #number Increase Increase to use, defaults to 0.5, thus channels created are 130, 130.5, 131 .. etc.
|
-- @param #number Increase Increase to use, defaults to 0.5, thus channels created are 130, 130.5, 131 .. etc.
|
||||||
@@ -1391,6 +1394,10 @@ end
|
|||||||
-- @return #AWACS self
|
-- @return #AWACS self
|
||||||
function AWACS:SetTacticalRadios(BaseFreq,Increase,Modulation,Interval,Number)
|
function AWACS:SetTacticalRadios(BaseFreq,Increase,Modulation,Interval,Number)
|
||||||
self:T(self.lid.."SetTacticalRadios")
|
self:T(self.lid.."SetTacticalRadios")
|
||||||
|
if not self.AwacsSRS then
|
||||||
|
MESSAGE:New("AWACS: Setup SRS in your code BEFORE trying to add tac radios please!",30,"ERROR",true):ToLog():ToAll()
|
||||||
|
return self
|
||||||
|
end
|
||||||
self.TacticalMenu = true
|
self.TacticalMenu = true
|
||||||
self.TacticalBaseFreq = BaseFreq or 130
|
self.TacticalBaseFreq = BaseFreq or 130
|
||||||
self.TacticalIncrFreq = Increase or 0.5
|
self.TacticalIncrFreq = Increase or 0.5
|
||||||
@@ -1404,15 +1411,18 @@ function AWACS:SetTacticalRadios(BaseFreq,Increase,Modulation,Interval,Number)
|
|||||||
self.TacticalFrequencies[freq] = freq
|
self.TacticalFrequencies[freq] = freq
|
||||||
end
|
end
|
||||||
if self.AwacsSRS then
|
if self.AwacsSRS then
|
||||||
self.TacticalSRS = MSRS:New(self.PathToSRS,self.TacticalBaseFreq,self.TacticalModulation,self.Volume)
|
self.TacticalSRS = MSRS:New(self.PathToSRS,self.TacticalBaseFreq,self.TacticalModulation,self.Backend)
|
||||||
self.TacticalSRS:SetCoalition(self.coalition)
|
self.TacticalSRS:SetCoalition(self.coalition)
|
||||||
self.TacticalSRS:SetGender(self.Gender)
|
self.TacticalSRS:SetGender(self.Gender)
|
||||||
self.TacticalSRS:SetCulture(self.Culture)
|
self.TacticalSRS:SetCulture(self.Culture)
|
||||||
self.TacticalSRS:SetVoice(self.Voice)
|
self.TacticalSRS:SetVoice(self.Voice)
|
||||||
self.TacticalSRS:SetPort(self.Port)
|
self.TacticalSRS:SetPort(self.Port)
|
||||||
self.TacticalSRS:SetLabel("AWACS")
|
self.TacticalSRS:SetLabel("AWACS")
|
||||||
|
self.TacticalSRS:SetVolume(self.Volume)
|
||||||
if self.PathToGoogleKey then
|
if self.PathToGoogleKey then
|
||||||
self.TacticalSRS:SetGoogle(self.PathToGoogleKey)
|
--self.TacticalSRS:SetGoogle(self.PathToGoogleKey)
|
||||||
|
self.TacticalSRS:SetProviderOptionsGoogle(self.PathToGoogleKey,self.AccessKey)
|
||||||
|
self.TacticalSRS:SetProvider(MSRS.Provider.GOOGLE)
|
||||||
end
|
end
|
||||||
self.TacticalSRSQ = MSRSQUEUE:New("Tactical AWACS")
|
self.TacticalSRSQ = MSRSQUEUE:New("Tactical AWACS")
|
||||||
end
|
end
|
||||||
@@ -2068,38 +2078,50 @@ function AWACS:AddGroupToDetection(Group)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- [User] Set AWACS SRS TTS details - see @{Sound.SRS} for details
|
--- [User] Set AWACS SRS TTS details - see @{Sound.SRS} for details. `SetSRS()` will try to use as many attributes configured with @{Sound.SRS#MSRS.LoadConfigFile}() as possible.
|
||||||
-- @param #AWACS self
|
-- @param #AWACS self
|
||||||
-- @param #string PathToSRS Defaults to "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
-- @param #string PathToSRS Defaults to "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
||||||
-- @param #string Gender Defaults to "male"
|
-- @param #string Gender Defaults to "male"
|
||||||
-- @param #string Culture Defaults to "en-US"
|
-- @param #string Culture Defaults to "en-US"
|
||||||
-- @param #number Port Defaults to 5002
|
-- @param #number Port Defaults to 5002
|
||||||
-- @param #string Voice (Optional) Use a specifc voice with the @{Sound.SRS.SetVoice} function, e.g, `:SetVoice("Microsoft Hedda Desktop")`.
|
-- @param #string Voice (Optional) Use a specifc voice with the @{Sound.SRS#SetVoice} function, e.g, `:SetVoice("Microsoft Hedda Desktop")`.
|
||||||
-- Note that this must be installed on your windows system. Can also be Google voice types, if you are using Google TTS.
|
-- Note that this must be installed on your windows system. Can also be Google voice types, if you are using Google TTS.
|
||||||
-- @param #number Volume Volume - between 0.0 (silent) and 1.0 (loudest)
|
-- @param #number Volume Volume - between 0.0 (silent) and 1.0 (loudest)
|
||||||
-- @param #string PathToGoogleKey Path to your google key if you want to use google TTS
|
-- @param #string PathToGoogleKey (Optional) Path to your google key if you want to use google TTS; if you use a config file for MSRS, hand in nil here.
|
||||||
|
-- @param #string AccessKey (Optional) Your Google API access key. This is necessary if DCS-gRPC is used as backend; if you use a config file for MSRS, hand in nil here.
|
||||||
|
-- @param #string Backend (Optional) Your MSRS Backend if different from your config file settings, e.g. MSRS.Backend.SRSEXE or MSRS.Backend.GRPC
|
||||||
-- @return #AWACS self
|
-- @return #AWACS self
|
||||||
function AWACS:SetSRS(PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey)
|
function AWACS:SetSRS(PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey,AccessKey,Backend)
|
||||||
self:T(self.lid.."SetSRS")
|
self:T(self.lid.."SetSRS")
|
||||||
self.PathToSRS = PathToSRS or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
self.PathToSRS = PathToSRS or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
||||||
self.Gender = Gender or "male"
|
self.Gender = Gender or MSRS.gender or "male"
|
||||||
self.Culture = Culture or "en-US"
|
self.Culture = Culture or MSRS.culture or "en-US"
|
||||||
self.Port = Port or 5002
|
self.Port = Port or MSRS.port or 5002
|
||||||
self.Voice = Voice
|
self.Voice = Voice or MSRS.voice
|
||||||
self.PathToGoogleKey = PathToGoogleKey
|
self.PathToGoogleKey = PathToGoogleKey
|
||||||
|
self.AccessKey = AccessKey
|
||||||
self.Volume = Volume or 1.0
|
self.Volume = Volume or 1.0
|
||||||
|
self.Backend = Backend or MSRS.backend
|
||||||
self.AwacsSRS = MSRS:New(self.PathToSRS,self.MultiFrequency,self.MultiModulation,self.Volume)
|
BASE:I({backend = self.Backend})
|
||||||
|
self.AwacsSRS = MSRS:New(self.PathToSRS,self.MultiFrequency,self.MultiModulation,self.Backend)
|
||||||
self.AwacsSRS:SetCoalition(self.coalition)
|
self.AwacsSRS:SetCoalition(self.coalition)
|
||||||
self.AwacsSRS:SetGender(self.Gender)
|
self.AwacsSRS:SetGender(self.Gender)
|
||||||
self.AwacsSRS:SetCulture(self.Culture)
|
self.AwacsSRS:SetCulture(self.Culture)
|
||||||
self.AwacsSRS:SetVoice(self.Voice)
|
|
||||||
self.AwacsSRS:SetPort(self.Port)
|
self.AwacsSRS:SetPort(self.Port)
|
||||||
self.AwacsSRS:SetLabel("AWACS")
|
self.AwacsSRS:SetLabel("AWACS")
|
||||||
|
self.AwacsSRS:SetVolume(Volume)
|
||||||
if self.PathToGoogleKey then
|
if self.PathToGoogleKey then
|
||||||
self.AwacsSRS:SetGoogle(self.PathToGoogleKey)
|
--self.AwacsSRS:SetGoogle(self.PathToGoogleKey)
|
||||||
|
self.AwacsSRS:SetProviderOptionsGoogle(self.PathToGoogleKey,self.AccessKey)
|
||||||
|
self.AwacsSRS:SetProvider(MSRS.Provider.GOOGLE)
|
||||||
end
|
end
|
||||||
|
-- Pre-configured Google?
|
||||||
|
if (not PathToGoogleKey) and self.AwacsSRS:GetProvider() == MSRS.Provider.GOOGLE then
|
||||||
|
self.PathToGoogleKey = MSRS.poptions.gcloud.credentials
|
||||||
|
self.Voice = Voice or MSRS.poptions.gcloud.voice
|
||||||
|
self.AccessKey = AccessKey or MSRS.poptions.gcloud.key
|
||||||
|
end
|
||||||
|
self.AwacsSRS:SetVoice(self.Voice)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -2447,7 +2469,7 @@ function AWACS:_UpdateContactFromCluster(CID)
|
|||||||
|
|
||||||
local function GetFirstAliveContact(table)
|
local function GetFirstAliveContact(table)
|
||||||
for _,_contact in pairs (table) do
|
for _,_contact in pairs (table) do
|
||||||
local contact = _contact -- Ops.Intelligence#INTEL.Contact
|
local contact = _contact -- Ops.Intel#INTEL.Contact
|
||||||
if contact and contact.group and contact.group:IsAlive() then
|
if contact and contact.group and contact.group:IsAlive() then
|
||||||
return contact
|
return contact
|
||||||
end
|
end
|
||||||
@@ -2483,13 +2505,22 @@ function AWACS:_CheckMerges()
|
|||||||
local cpos = contact.Cluster.coordinate or contact.Contact.position or contact.Contact.group:GetCoordinate()
|
local cpos = contact.Cluster.coordinate or contact.Contact.position or contact.Contact.group:GetCoordinate()
|
||||||
local dist = ppos:Get2DDistance(cpos)
|
local dist = ppos:Get2DDistance(cpos)
|
||||||
local distnm = UTILS.Round(UTILS.MetersToNM(dist),0)
|
local distnm = UTILS.Round(UTILS.MetersToNM(dist),0)
|
||||||
if (pilot.IsPlayer or self.debug) and distnm <= 5 and not contact.MergeCallDone then
|
if (pilot.IsPlayer or self.debug) and distnm <= 5 then --and ((not contact.MergeCallDone) or (timer.getTime() - contact.MergeCallDone > 30)) then
|
||||||
local label = contact.EngagementTag or ""
|
--local label = contact.EngagementTag or ""
|
||||||
if not contact.MergeCallDone or not string.find(label,pcallsign) then
|
--if not contact.MergeCallDone or not string.find(label,pcallsign) then
|
||||||
self:T(self.lid.."Merged")
|
self:T(self.lid.."Merged")
|
||||||
self:_MergedCall(_id)
|
self:_MergedCall(_id)
|
||||||
contact.MergeCallDone = true
|
--contact.MergeCallDone = true
|
||||||
end
|
--end
|
||||||
|
end
|
||||||
|
if (pilot.IsPlayer or self.debug) and distnm >5 and distnm <= self.ThreatDistance then
|
||||||
|
self:_ThreatRangeCall(_id,Contact)
|
||||||
|
end
|
||||||
|
if (pilot.IsPlayer or self.debug) and distnm > self.ThreatDistance and distnm <= self.MeldDistance then
|
||||||
|
self:_MeldRangeCall(_id,Contact)
|
||||||
|
end
|
||||||
|
if (pilot.IsPlayer or self.debug) and distnm > self.MeldDistance and distnm <= self.TacDistance then
|
||||||
|
self:_TACRangeCall(_id,Contact)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
@@ -2934,7 +2965,7 @@ function AWACS:_Picture(Group,IsGeneral)
|
|||||||
if not self.intel then
|
if not self.intel then
|
||||||
-- no intel yet!
|
-- no intel yet!
|
||||||
local picclean = self.gettext:GetEntry("PICCLEAN",self.locale)
|
local picclean = self.gettext:GetEntry("PICCLEAN",self.locale)
|
||||||
text = string.format(picclean,self.callsigntxt, gcallsign)
|
text = string.format(picclean,gcallsign,self.callsigntxt)
|
||||||
textScreen = text
|
textScreen = text
|
||||||
|
|
||||||
self:_NewRadioEntry(text,text,GID,false,true,true,false)
|
self:_NewRadioEntry(text,text,GID,false,true,true,false)
|
||||||
@@ -2987,7 +3018,10 @@ function AWACS:_Picture(Group,IsGeneral)
|
|||||||
|
|
||||||
if clustersAO == 0 and clustersEWR == 0 then
|
if clustersAO == 0 and clustersEWR == 0 then
|
||||||
-- clean
|
-- clean
|
||||||
self:_NewRadioEntry(text,textScreen,GID,Outcome,true,true,false)
|
local picclean = self.gettext:GetEntry("PICCLEAN",self.locale)
|
||||||
|
text = string.format(picclean,gcallsign,self.callsigntxt)
|
||||||
|
textScreen = text
|
||||||
|
self:_NewRadioEntry(text,text,GID,Outcome,true,true,false)
|
||||||
else
|
else
|
||||||
|
|
||||||
if clustersAO > 0 then
|
if clustersAO > 0 then
|
||||||
@@ -3080,7 +3114,7 @@ function AWACS:_BogeyDope(Group,Tactical)
|
|||||||
local clean = self.gettext:GetEntry("CLEAN",self.locale)
|
local clean = self.gettext:GetEntry("CLEAN",self.locale)
|
||||||
text = string.format(clean,self:_GetCallSign(Group,GID) or "Ghost 1", self.callsigntxt)
|
text = string.format(clean,self:_GetCallSign(Group,GID) or "Ghost 1", self.callsigntxt)
|
||||||
|
|
||||||
self:_NewRadioEntry(text,textScreen,GID,Outcome,Outcome,true,false,true,Tactical)
|
self:_NewRadioEntry(text,text,GID,Outcome,Outcome,true,false,true,Tactical)
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
@@ -3122,9 +3156,13 @@ end
|
|||||||
function AWACS:_ShowAwacsInfo(Group)
|
function AWACS:_ShowAwacsInfo(Group)
|
||||||
self:T(self.lid.."_ShowAwacsInfo")
|
self:T(self.lid.."_ShowAwacsInfo")
|
||||||
local report = REPORT:New("Info")
|
local report = REPORT:New("Info")
|
||||||
|
local STN = self.STN
|
||||||
report:Add("====================")
|
report:Add("====================")
|
||||||
report:Add(string.format("AWACS %s",self.callsigntxt))
|
report:Add(string.format("AWACS %s",self.callsigntxt))
|
||||||
report:Add(string.format("Radio: %.3f %s",self.Frequency,UTILS.GetModulationName(self.Modulation)))
|
report:Add(string.format("Radio: %.3f %s",self.Frequency,UTILS.GetModulationName(self.Modulation)))
|
||||||
|
if STN then
|
||||||
|
report:Add(string.format("Link-16 STN: %s",STN))
|
||||||
|
end
|
||||||
report:Add(string.format("Bulls Alias: %s",self.AOName))
|
report:Add(string.format("Bulls Alias: %s",self.AOName))
|
||||||
report:Add(string.format("Coordinate: %s",self.AOCoordinate:ToStringLLDDM()))
|
report:Add(string.format("Coordinate: %s",self.AOCoordinate:ToStringLLDDM()))
|
||||||
report:Add("====================")
|
report:Add("====================")
|
||||||
@@ -3662,7 +3700,7 @@ function AWACS:_CheckInAI(FlightGroup,Group,AuftragsNr)
|
|||||||
CAPVoice = self.CapVoices[math.floor(math.random(1,10))]
|
CAPVoice = self.CapVoices[math.floor(math.random(1,10))]
|
||||||
end
|
end
|
||||||
|
|
||||||
FlightGroup:SetSRS(self.PathToSRS,self.CAPGender,self.CAPCulture,CAPVoice,self.Port,self.PathToGoogleKey,"FLIGHT")
|
FlightGroup:SetSRS(self.PathToSRS,self.CAPGender,self.CAPCulture,CAPVoice,self.Port,self.PathToGoogleKey,"FLIGHT",1)
|
||||||
|
|
||||||
local checkai = self.gettext:GetEntry("CHECKINAI",self.locale)
|
local checkai = self.gettext:GetEntry("CHECKINAI",self.locale)
|
||||||
text = string.format(checkai,self.callsigntxt, managedgroup.CallSign, self.CAPTimeOnStation, self.AOName)
|
text = string.format(checkai,self.callsigntxt, managedgroup.CallSign, self.CAPTimeOnStation, self.AOName)
|
||||||
@@ -4241,7 +4279,7 @@ function AWACS:_StartIntel(awacs)
|
|||||||
|
|
||||||
intel:__Start(5)
|
intel:__Start(5)
|
||||||
|
|
||||||
self.intel = intel -- Ops.Intelligence#INTEL
|
self.intel = intel -- Ops.Intel#INTEL
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -4401,8 +4439,8 @@ end
|
|||||||
-- @param #table Object Object for Ops.Target#TARGET assignment
|
-- @param #table Object Object for Ops.Target#TARGET assignment
|
||||||
-- @param #AWACS.TaskStatus TaskStatus Status of this task
|
-- @param #AWACS.TaskStatus TaskStatus Status of this task
|
||||||
-- @param Ops.Auftrag#AUFTRAG Auftrag The Auftrag for this task if any
|
-- @param Ops.Auftrag#AUFTRAG Auftrag The Auftrag for this task if any
|
||||||
-- @param Ops.Intelligence#INTEL.Cluster Cluster Intel Cluster for this task
|
-- @param Ops.Intel#INTEL.Cluster Cluster Intel Cluster for this task
|
||||||
-- @param Ops.Intelligence#INTEL.Contact Contact Intel Contact for this task
|
-- @param Ops.Intel#INTEL.Contact Contact Intel Contact for this task
|
||||||
-- @return #number TID Task ID created
|
-- @return #number TID Task ID created
|
||||||
function AWACS:_CreateTaskForGroup(GroupID,Description,ScreenText,Object,TaskStatus,Auftrag,Cluster,Contact)
|
function AWACS:_CreateTaskForGroup(GroupID,Description,ScreenText,Object,TaskStatus,Auftrag,Cluster,Contact)
|
||||||
self:T(self.lid.."_CreateTaskForGroup "..GroupID .." Description: "..Description)
|
self:T(self.lid.."_CreateTaskForGroup "..GroupID .." Description: "..Description)
|
||||||
@@ -4601,7 +4639,7 @@ function AWACS:_CheckTaskQueue()
|
|||||||
|
|
||||||
-- Check ranges for TAC and MELD
|
-- Check ranges for TAC and MELD
|
||||||
-- postions relative to CAP position
|
-- postions relative to CAP position
|
||||||
|
--[[
|
||||||
local targetgrp = entry.Contact.group
|
local targetgrp = entry.Contact.group
|
||||||
local position = entry.Contact.position or entry.Cluster.coordinate
|
local position = entry.Contact.position or entry.Cluster.coordinate
|
||||||
if targetgrp and targetgrp:IsAlive() and managedgroup then
|
if targetgrp and targetgrp:IsAlive() and managedgroup then
|
||||||
@@ -4626,6 +4664,7 @@ function AWACS:_CheckTaskQueue()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
--]]
|
||||||
|
|
||||||
local auftrag = entry.Auftrag -- Ops.Auftrag#AUFTRAG
|
local auftrag = entry.Auftrag -- Ops.Auftrag#AUFTRAG
|
||||||
local auftragstatus = "Not Known"
|
local auftragstatus = "Not Known"
|
||||||
@@ -4824,6 +4863,7 @@ function AWACS:_CheckTaskQueue()
|
|||||||
elseif entry.Status == AWACS.TaskStatus.ASSIGNED then
|
elseif entry.Status == AWACS.TaskStatus.ASSIGNED then
|
||||||
self:T("Open Tasks VID ASSIGNED for GroupID "..entry.AssignedGroupID)
|
self:T("Open Tasks VID ASSIGNED for GroupID "..entry.AssignedGroupID)
|
||||||
-- check TAC/MELD ranges
|
-- check TAC/MELD ranges
|
||||||
|
--[[
|
||||||
local targetgrp = entry.Contact.group
|
local targetgrp = entry.Contact.group
|
||||||
local position = entry.Contact.position or entry.Cluster.coordinate
|
local position = entry.Contact.position or entry.Cluster.coordinate
|
||||||
if targetgrp and targetgrp:IsAlive() and managedgroup then
|
if targetgrp and targetgrp:IsAlive() and managedgroup then
|
||||||
@@ -4848,6 +4888,7 @@ function AWACS:_CheckTaskQueue()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
--]]
|
||||||
elseif entry.Status == AWACS.TaskStatus.SUCCESS then
|
elseif entry.Status == AWACS.TaskStatus.SUCCESS then
|
||||||
self:T("Open Tasks VID success for GroupID "..entry.AssignedGroupID)
|
self:T("Open Tasks VID success for GroupID "..entry.AssignedGroupID)
|
||||||
-- outcomes - player ID'd
|
-- outcomes - player ID'd
|
||||||
@@ -4959,7 +5000,7 @@ end
|
|||||||
|
|
||||||
--- [User] Add another AirWing for AI CAP Flights under management
|
--- [User] Add another AirWing for AI CAP Flights under management
|
||||||
-- @param #AWACS self
|
-- @param #AWACS self
|
||||||
-- @param Ops.AirWing#AIRWING AirWing The AirWing to (also) obtain CAP flights from
|
-- @param Ops.Airwing#AIRWING AirWing The AirWing to (also) obtain CAP flights from
|
||||||
-- @param Core.Zone#ZONE_RADIUS Zone (optional) This AirWing has it's own station zone, AI CAP will be send there
|
-- @param Core.Zone#ZONE_RADIUS Zone (optional) This AirWing has it's own station zone, AI CAP will be send there
|
||||||
-- @return #AWACS self
|
-- @return #AWACS self
|
||||||
function AWACS:AddCAPAirWing(AirWing,Zone)
|
function AWACS:AddCAPAirWing(AirWing,Zone)
|
||||||
@@ -5044,7 +5085,7 @@ function AWACS:_AnnounceContact(Contact,IsNew,Group,IsBogeyDope,Tag,IsPopup,Repo
|
|||||||
end
|
end
|
||||||
|
|
||||||
local cluster = Contact.Cluster
|
local cluster = Contact.Cluster
|
||||||
local intel = self.intel -- Ops.Intelligence#INTEL
|
local intel = self.intel -- Ops.Intel#INTEL
|
||||||
|
|
||||||
local size = self.intel:ClusterCountUnits(cluster)
|
local size = self.intel:ClusterCountUnits(cluster)
|
||||||
local threatsize, threatsizetext = self:_GetBlurredSize(size)
|
local threatsize, threatsizetext = self:_GetBlurredSize(size)
|
||||||
@@ -5446,9 +5487,10 @@ function AWACS:_TACRangeCall(GID,Contact)
|
|||||||
if not Contact then return self end
|
if not Contact then return self end
|
||||||
local pilotcallsign = self:_GetCallSign(nil,GID)
|
local pilotcallsign = self:_GetCallSign(nil,GID)
|
||||||
local managedgroup = self.ManagedGrps[GID] -- #AWACS.ManagedGroup
|
local managedgroup = self.ManagedGrps[GID] -- #AWACS.ManagedGroup
|
||||||
local contact = Contact.Contact -- Ops.Intelligence#INTEL.Contact
|
local contact = Contact.Contact -- Ops.Intel#INTEL.Contact
|
||||||
local contacttag = Contact.TargetGroupNaming
|
local contacttag = Contact.TargetGroupNaming
|
||||||
if contact and not Contact.TACCallDone then
|
local name = managedgroup.GroupName
|
||||||
|
if contact then --and not Contact.TACCallDone then
|
||||||
local position = contact.position -- Core.Point#COORDINATE
|
local position = contact.position -- Core.Point#COORDINATE
|
||||||
if position then
|
if position then
|
||||||
local distance = position:Get2DDistance(managedgroup.Group:GetCoordinate())
|
local distance = position:Get2DDistance(managedgroup.Group:GetCoordinate())
|
||||||
@@ -5456,8 +5498,18 @@ function AWACS:_TACRangeCall(GID,Contact)
|
|||||||
local grptxt = self.gettext:GetEntry("GROUP",self.locale)
|
local grptxt = self.gettext:GetEntry("GROUP",self.locale)
|
||||||
local miles = self.gettext:GetEntry("MILES",self.locale)
|
local miles = self.gettext:GetEntry("MILES",self.locale)
|
||||||
local text = string.format("%s. %s. %s %s, %d %s.",self.callsigntxt,pilotcallsign,contacttag,grptxt,distance,miles)
|
local text = string.format("%s. %s. %s %s, %d %s.",self.callsigntxt,pilotcallsign,contacttag,grptxt,distance,miles)
|
||||||
self:_NewRadioEntry(text,text,GID,true,self.debug,true,false,true)
|
if not self.TacticalSubscribers[name] then
|
||||||
|
self:_NewRadioEntry(text,text,GID,true,self.debug,true,false,true)
|
||||||
|
end
|
||||||
self:_UpdateContactEngagementTag(Contact.CID,Contact.EngagementTag,true,false,AWACS.TaskStatus.EXECUTING)
|
self:_UpdateContactEngagementTag(Contact.CID,Contact.EngagementTag,true,false,AWACS.TaskStatus.EXECUTING)
|
||||||
|
if GID and GID ~= 0 then
|
||||||
|
--local managedgroup = self.ManagedGrps[GID] -- #AWACS.ManagedGroup
|
||||||
|
if managedgroup and managedgroup.Group and managedgroup.Group:IsAlive() then
|
||||||
|
if self.TacticalSubscribers[name] then
|
||||||
|
self:_NewRadioEntry(text,text,GID,true,self.debug,true,false,true,true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
@@ -5475,9 +5527,10 @@ function AWACS:_MeldRangeCall(GID,Contact)
|
|||||||
local pilotcallsign = self:_GetCallSign(nil,GID)
|
local pilotcallsign = self:_GetCallSign(nil,GID)
|
||||||
local managedgroup = self.ManagedGrps[GID] -- #AWACS.ManagedGroup
|
local managedgroup = self.ManagedGrps[GID] -- #AWACS.ManagedGroup
|
||||||
local flightpos = managedgroup.Group:GetCoordinate()
|
local flightpos = managedgroup.Group:GetCoordinate()
|
||||||
local contact = Contact.Contact -- Ops.Intelligence#INTEL.Contact
|
local contact = Contact.Contact -- Ops.Intel#INTEL.Contact
|
||||||
local contacttag = Contact.TargetGroupNaming
|
local contacttag = Contact.TargetGroupNaming or "Bogey"
|
||||||
if contact and not Contact.MeldCallDone then
|
local name = managedgroup.GroupName
|
||||||
|
if contact then --and not Contact.MeldCallDone then
|
||||||
local position = contact.position -- Core.Point#COORDINATE
|
local position = contact.position -- Core.Point#COORDINATE
|
||||||
if position then
|
if position then
|
||||||
local BRATExt = ""
|
local BRATExt = ""
|
||||||
@@ -5488,8 +5541,19 @@ function AWACS:_MeldRangeCall(GID,Contact)
|
|||||||
end
|
end
|
||||||
local grptxt = self.gettext:GetEntry("GROUP",self.locale)
|
local grptxt = self.gettext:GetEntry("GROUP",self.locale)
|
||||||
local text = string.format("%s. %s. %s %s, %s",self.callsigntxt,pilotcallsign,contacttag,grptxt,BRATExt)
|
local text = string.format("%s. %s. %s %s, %s",self.callsigntxt,pilotcallsign,contacttag,grptxt,BRATExt)
|
||||||
self:_NewRadioEntry(text,text,GID,true,self.debug,true,false,true)
|
if not self.TacticalSubscribers[name] then
|
||||||
|
self:_NewRadioEntry(text,text,GID,true,self.debug,true,false,true)
|
||||||
|
end
|
||||||
self:_UpdateContactEngagementTag(Contact.CID,Contact.EngagementTag,true,true,AWACS.TaskStatus.EXECUTING)
|
self:_UpdateContactEngagementTag(Contact.CID,Contact.EngagementTag,true,true,AWACS.TaskStatus.EXECUTING)
|
||||||
|
if GID and GID ~= 0 then
|
||||||
|
--local managedgroup = self.ManagedGrps[GID] -- #AWACS.ManagedGroup
|
||||||
|
if managedgroup and managedgroup.Group and managedgroup.Group:IsAlive() then
|
||||||
|
local name = managedgroup.GroupName
|
||||||
|
if self.TacticalSubscribers[name] then
|
||||||
|
self:_NewRadioEntry(text,text,GID,true,self.debug,true,false,true,true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
@@ -5505,8 +5569,10 @@ function AWACS:_ThreatRangeCall(GID,Contact)
|
|||||||
local pilotcallsign = self:_GetCallSign(nil,GID)
|
local pilotcallsign = self:_GetCallSign(nil,GID)
|
||||||
local managedgroup = self.ManagedGrps[GID] -- #AWACS.ManagedGroup
|
local managedgroup = self.ManagedGrps[GID] -- #AWACS.ManagedGroup
|
||||||
local flightpos = managedgroup.Group:GetCoordinate() or managedgroup.LastKnownPosition
|
local flightpos = managedgroup.Group:GetCoordinate() or managedgroup.LastKnownPosition
|
||||||
local contact = Contact.Contact -- Ops.Intelligence#INTEL.Contact
|
local contact = Contact.Contact -- Ops.Intel#INTEL.Contact
|
||||||
local contacttag = Contact.TargetGroupNaming
|
local contacttag = Contact.TargetGroupNaming or "Bogey"
|
||||||
|
local name = managedgroup.GroupName
|
||||||
|
local IsSub = self.TacticalSubscribers[name] and true or false
|
||||||
if contact then
|
if contact then
|
||||||
local position = contact.position or contact.group:GetCoordinate() -- Core.Point#COORDINATE
|
local position = contact.position or contact.group:GetCoordinate() -- Core.Point#COORDINATE
|
||||||
if position then
|
if position then
|
||||||
@@ -5519,7 +5585,18 @@ function AWACS:_ThreatRangeCall(GID,Contact)
|
|||||||
local grptxt = self.gettext:GetEntry("GROUP",self.locale)
|
local grptxt = self.gettext:GetEntry("GROUP",self.locale)
|
||||||
local thrt = self.gettext:GetEntry("THREAT",self.locale)
|
local thrt = self.gettext:GetEntry("THREAT",self.locale)
|
||||||
local text = string.format("%s. %s. %s %s, %s. %s",self.callsigntxt,pilotcallsign,contacttag,grptxt, thrt, BRATExt)
|
local text = string.format("%s. %s. %s %s, %s. %s",self.callsigntxt,pilotcallsign,contacttag,grptxt, thrt, BRATExt)
|
||||||
self:_NewRadioEntry(text,text,GID,true,self.debug,true,false,true)
|
if IsSub == false then
|
||||||
|
self:_NewRadioEntry(text,text,GID,true,self.debug,true,false,true)
|
||||||
|
end
|
||||||
|
if GID and GID ~= 0 then
|
||||||
|
--local managedgroup = self.ManagedGrps[GID] -- #AWACS.ManagedGroup
|
||||||
|
if managedgroup and managedgroup.Group and managedgroup.Group:IsAlive() then
|
||||||
|
local name = managedgroup.GroupName
|
||||||
|
if self.TacticalSubscribers[name] then
|
||||||
|
self:_NewRadioEntry(text,text,GID,true,self.debug,true,false,true,true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
@@ -5535,11 +5612,17 @@ function AWACS:_MergedCall(GID)
|
|||||||
local pilotcallsign = self:_GetCallSign(nil,GID)
|
local pilotcallsign = self:_GetCallSign(nil,GID)
|
||||||
local merge = self.gettext:GetEntry("MERGED",self.locale)
|
local merge = self.gettext:GetEntry("MERGED",self.locale)
|
||||||
local text = string.format("%s. %s. %s.",self.callsigntxt,pilotcallsign,merge)
|
local text = string.format("%s. %s. %s.",self.callsigntxt,pilotcallsign,merge)
|
||||||
self:_NewRadioEntry(text,text,GID,true,self.debug,true,false,true)
|
local managedgroup = self.ManagedGrps[GID] -- #AWACS.ManagedGroup
|
||||||
|
local name
|
||||||
|
if managedgroup then
|
||||||
|
name = managedgroup.GroupName or "none"
|
||||||
|
end
|
||||||
|
if not self.TacticalSubscribers[name] then
|
||||||
|
self:_NewRadioEntry(text,text,GID,true,self.debug,true,false,true)
|
||||||
|
end
|
||||||
if GID and GID ~= 0 then
|
if GID and GID ~= 0 then
|
||||||
local managedgroup = self.ManagedGrps[GID] -- #AWACS.ManagedGroup
|
local managedgroup = self.ManagedGrps[GID] -- #AWACS.ManagedGroup
|
||||||
if managedgroup and managedgroup.Group and managedgroup.Group:IsAlive() then
|
if managedgroup and managedgroup.Group and managedgroup.Group:IsAlive() then
|
||||||
local name = managedgroup.GroupName
|
|
||||||
if self.TacticalSubscribers[name] then
|
if self.TacticalSubscribers[name] then
|
||||||
self:_NewRadioEntry(text,text,GID,true,self.debug,true,false,true,true)
|
self:_NewRadioEntry(text,text,GID,true,self.debug,true,false,true,true)
|
||||||
end
|
end
|
||||||
@@ -5813,7 +5896,7 @@ function AWACS:onafterStart(From, Event, To)
|
|||||||
|
|
||||||
if not self.GCI then
|
if not self.GCI then
|
||||||
-- set up the AWACS and let it orbit
|
-- set up the AWACS and let it orbit
|
||||||
local AwacsAW = self.AirWing -- Ops.AirWing#AIRWING
|
local AwacsAW = self.AirWing -- Ops.Airwing#AIRWING
|
||||||
local mission = AUFTRAG:NewORBIT_RACETRACK(self.OrbitZone:GetCoordinate(),self.AwacsAngels*1000,self.Speed,self.Heading,self.Leg)
|
local mission = AUFTRAG:NewORBIT_RACETRACK(self.OrbitZone:GetCoordinate(),self.AwacsAngels*1000,self.Speed,self.Heading,self.Leg)
|
||||||
local timeonstation = (self.AwacsTimeOnStation + self.ShiftChangeTime) * 3600
|
local timeonstation = (self.AwacsTimeOnStation + self.ShiftChangeTime) * 3600
|
||||||
mission:SetTime(nil,timeonstation)
|
mission:SetTime(nil,timeonstation)
|
||||||
@@ -5934,6 +6017,10 @@ function AWACS:_CheckAwacsStatus()
|
|||||||
local awacs = nil -- Wrapper.Group#GROUP
|
local awacs = nil -- Wrapper.Group#GROUP
|
||||||
if self.AwacsFG then
|
if self.AwacsFG then
|
||||||
awacs = self.AwacsFG:GetGroup() -- Wrapper.Group#GROUP
|
awacs = self.AwacsFG:GetGroup() -- Wrapper.Group#GROUP
|
||||||
|
local unit = awacs:GetUnit(1)
|
||||||
|
if unit then
|
||||||
|
self.STN = tostring(unit:GetSTN())
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local monitoringdata = self.MonitoringData -- #AWACS.MonitoringData
|
local monitoringdata = self.MonitoringData -- #AWACS.MonitoringData
|
||||||
@@ -6191,6 +6278,16 @@ function AWACS:onafterStatus(From, Event, To)
|
|||||||
-- Check on AUFTRAG status for CAP AI
|
-- Check on AUFTRAG status for CAP AI
|
||||||
if self:Is("Running") and (awacsalive or self.AwacsInZone) then
|
if self:Is("Running") and (awacsalive or self.AwacsInZone) then
|
||||||
|
|
||||||
|
|
||||||
|
-- update coord for SRS
|
||||||
|
|
||||||
|
if self.AwacsSRS then
|
||||||
|
self.AwacsSRS:SetCoordinate(self.AwacsFG:GetCoordinate())
|
||||||
|
if self.TacticalSRS then
|
||||||
|
self.TacticalSRS:SetCoordinate(self.AwacsFG:GetCoordinate())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
self:_CheckAICAPOnStation()
|
self:_CheckAICAPOnStation()
|
||||||
|
|
||||||
self:_CleanUpContacts()
|
self:_CleanUpContacts()
|
||||||
@@ -6397,7 +6494,7 @@ end
|
|||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Ops.Intelligence#INTEL.Cluster Cluster
|
-- @param Ops.Intel#INTEL.Cluster Cluster
|
||||||
-- @return #AWACS self
|
-- @return #AWACS self
|
||||||
function AWACS:onafterNewCluster(From,Event,To,Cluster)
|
function AWACS:onafterNewCluster(From,Event,To,Cluster)
|
||||||
self:T({From, Event, To, Cluster.index})
|
self:T({From, Event, To, Cluster.index})
|
||||||
@@ -6409,7 +6506,7 @@ function AWACS:onafterNewCluster(From,Event,To,Cluster)
|
|||||||
|
|
||||||
local function GetFirstAliveContact(table)
|
local function GetFirstAliveContact(table)
|
||||||
for _,_contact in pairs (table) do
|
for _,_contact in pairs (table) do
|
||||||
local contact = _contact -- Ops.Intelligence#INTEL.Contact
|
local contact = _contact -- Ops.Intel#INTEL.Contact
|
||||||
if contact and contact.group and contact.group:IsAlive() then
|
if contact and contact.group and contact.group:IsAlive() then
|
||||||
return contact, contact.group
|
return contact, contact.group
|
||||||
end
|
end
|
||||||
@@ -6417,7 +6514,7 @@ function AWACS:onafterNewCluster(From,Event,To,Cluster)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local Contact, Group = GetFirstAliveContact(ContactTable) -- Ops.Intelligence#INTEL.Contact
|
local Contact, Group = GetFirstAliveContact(ContactTable) -- Ops.Intel#INTEL.Contact
|
||||||
|
|
||||||
if not Contact then return self end
|
if not Contact then return self end
|
||||||
|
|
||||||
@@ -6428,7 +6525,7 @@ function AWACS:onafterNewCluster(From,Event,To,Cluster)
|
|||||||
local targetset = SET_GROUP:New()
|
local targetset = SET_GROUP:New()
|
||||||
-- SET for TARGET
|
-- SET for TARGET
|
||||||
for _,_grp in pairs(ContactTable) do
|
for _,_grp in pairs(ContactTable) do
|
||||||
local grp = _grp -- Ops.Intelligence#INTEL.Contact
|
local grp = _grp -- Ops.Intel#INTEL.Contact
|
||||||
targetset:AddGroup(grp.group, true)
|
targetset:AddGroup(grp.group, true)
|
||||||
end
|
end
|
||||||
local managedcontact = {} -- #AWACS.ManagedContact
|
local managedcontact = {} -- #AWACS.ManagedContact
|
||||||
@@ -6490,7 +6587,7 @@ end
|
|||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Ops.Intelligence#INTEL.Contact Contact
|
-- @param Ops.Intel#INTEL.Contact Contact
|
||||||
-- @return #AWACS self
|
-- @return #AWACS self
|
||||||
function AWACS:onafterNewContact(From,Event,To,Contact)
|
function AWACS:onafterNewContact(From,Event,To,Contact)
|
||||||
self:T({From, Event, To, Contact})
|
self:T({From, Event, To, Contact})
|
||||||
@@ -6519,7 +6616,7 @@ end
|
|||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Ops.Intelligence#INTEL.Contact Contact
|
-- @param Ops.Intel#INTEL.Contact Contact
|
||||||
-- @return #AWACS self
|
-- @return #AWACS self
|
||||||
function AWACS:onafterLostContact(From,Event,To,Contact)
|
function AWACS:onafterLostContact(From,Event,To,Contact)
|
||||||
self:T({From, Event, To, Contact})
|
self:T({From, Event, To, Contact})
|
||||||
@@ -6531,7 +6628,7 @@ end
|
|||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Ops.Intelligence#INTEL.Cluster Cluster
|
-- @param Ops.Intel#INTEL.Cluster Cluster
|
||||||
-- @param Ops.Auftrag#AUFTRAG Mission
|
-- @param Ops.Auftrag#AUFTRAG Mission
|
||||||
-- @return #AWACS self
|
-- @return #AWACS self
|
||||||
function AWACS:onafterLostCluster(From,Event,To,Cluster,Mission)
|
function AWACS:onafterLostCluster(From,Event,To,Cluster,Mission)
|
||||||
@@ -6584,7 +6681,7 @@ function AWACS:onafterCheckTacticalQueue(From,Event,To)
|
|||||||
if self.PathToGoogleKey then
|
if self.PathToGoogleKey then
|
||||||
gtext = string.format("<speak><prosody rate='medium'>%s</prosody></speak>",gtext)
|
gtext = string.format("<speak><prosody rate='medium'>%s</prosody></speak>",gtext)
|
||||||
end
|
end
|
||||||
self.TacticalSRSQ:NewTransmission(gtext,nil,self.TacticalSRS,nil,0.5,nil,nil,nil,frequency,self.TacticalModulation,nil,nil,nil,nil,nil)
|
self.TacticalSRSQ:NewTransmission(gtext,nil,self.TacticalSRS,nil,0.5,nil,nil,nil,frequency,self.TacticalModulation)
|
||||||
|
|
||||||
self:T(RadioEntry.TextTTS)
|
self:T(RadioEntry.TextTTS)
|
||||||
|
|
||||||
@@ -6603,7 +6700,7 @@ function AWACS:onafterCheckTacticalQueue(From,Event,To)
|
|||||||
|
|
||||||
end -- end while
|
end -- end while
|
||||||
|
|
||||||
if self:Is("Running") then
|
if not self:Is("Stopped") then
|
||||||
self:__CheckTacticalQueue(-self.TacticalInterval)
|
self:__CheckTacticalQueue(-self.TacticalInterval)
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
@@ -6732,7 +6829,7 @@ function AWACS:onafterAwacsShiftChange(From,Event,To)
|
|||||||
self.AwacsTimeStamp = timer.getTime()
|
self.AwacsTimeStamp = timer.getTime()
|
||||||
|
|
||||||
-- set up the AWACS and let it orbit
|
-- set up the AWACS and let it orbit
|
||||||
local AwacsAW = self.AirWing -- Ops.AirWing#AIRWING
|
local AwacsAW = self.AirWing -- Ops.Airwing#AIRWING
|
||||||
local mission = AUFTRAG:NewORBIT_RACETRACK(self.OrbitZone:GetCoordinate(),self.AwacsAngels*1000,self.Speed,self.Heading,self.Leg)
|
local mission = AUFTRAG:NewORBIT_RACETRACK(self.OrbitZone:GetCoordinate(),self.AwacsAngels*1000,self.Speed,self.Heading,self.Leg)
|
||||||
self.CatchAllMissions[#self.CatchAllMissions+1] = mission
|
self.CatchAllMissions[#self.CatchAllMissions+1] = mission
|
||||||
local timeonstation = (self.AwacsTimeOnStation + self.ShiftChangeTime) * 3600
|
local timeonstation = (self.AwacsTimeOnStation + self.ShiftChangeTime) * 3600
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user