From 154026fbf86036061875c4f97844b27397cf4477 Mon Sep 17 00:00:00 2001 From: kaltokri Date: Thu, 4 Jan 2024 15:09:48 +0100 Subject: [PATCH 1/6] New guides added --- docs/advanced/basics.md | 80 +++++++++++++++++++++++++++ docs/advanced/desanitize-dcs.md | 2 +- docs/advanced/eclipse-installation.md | 2 +- docs/advanced/text-to-speech.md | 2 +- 4 files changed, 83 insertions(+), 3 deletions(-) create mode 100644 docs/advanced/basics.md diff --git a/docs/advanced/basics.md b/docs/advanced/basics.md new file mode 100644 index 000000000..edf74a23c --- /dev/null +++ b/docs/advanced/basics.md @@ -0,0 +1,80 @@ +--- +title: Basics +parent: Advanced +nav_order: 01 +--- + +If you want to get deeper into Moose, you will encounter a few terms and +concepts that we will explain here. You will need them for the later pages. + +# Git and GitHub + +Moose has about 260.000 lines of code and the amount is increasing each week. +To maintain such a big code base a vcs (version control system) is needed. +Moose uses [Git], a distributed source code management created 2005 by Linus +Torvalds for the development of the Linux kernel. + +As developer platform [GitHub] was choosen as a central place for Moose +to create, store, and manage the code. [GitHub] use [Git] for version control +and provides additional functionality like access control, bug tracking, feature +requests and much more. + +As a Moose you don't need to learn to use [Git]. You can download the files on +[GitHub] with a browser. But using [Git] will ease up the steps to keep the +Moose version on your hard disk up to date. + +You will need to interact with [GitHub]. At least to download the Moose files. +For non developers the page can be confusing. Take your time and read this +documentation. We are not able to explain every single detail on using [GitHub] +and [Git]. Especially because it is changing really quick and this documentaion +will not. So try to uns the help system of [GitHub] or find some videos on +[YouTube]. If you get stuck ask for help in the [Moose Discord]. + +Moose uses more then one repository on [GitHub] which doesn't exactly make it +any clearer. A list can be found on the [reposities] page. + +# Branches: master & develop + +As already explained in the [overview] two branches are used: + +- [master]: Stable release branch. +- [develop]: Newest development with more OPS classes. + +As a starter it is okay to begin your journey with the `master` branch. +If you are interested in some newer classes you need to use the `develop` +branch. The later one is also very stable, but it's missing more detailed +documentation and example missions. + +You can switch between these branches with a drop down in the upper left corner +of th GitHub repository page. The list of branches is long. So it is a best +practise to save a bookmark in your browser with the links above. + +# Build result vs. source files + +Moose consists of more than 140 individual files with the file extension `.lua`. +They are places in a directory tree, which makes it more organized and its +semantic is pre-defined for IntelliSense to work. + +On every change which is pushed to [GitHub] a build job will combine all of +these files to a the single file called `Moose.lua`. In a seconds step all +comments will be removed to decrease the file size and the result will be saved +as `Moose_.lua`. These both files are created for users of Moose to include in +your missions. + +The individual `.lua` files are used by the Mosse developers and power users. +It is complicated to use them, but in combination with an IDE and a debugger it +is very usefull to analyse even complex problems or write new additions to the +Moose framework. + +# Static loading vs. dynamic loading + +# IDE vs. Notepad++ + +# What is a debugger (good for) + +[Git]: https://en.wikipedia.org/wiki/Git +[Moose Discord]: https://discord.gg/gj68fm969S +[overview]: ../index.md +[reposities]: ../repositories.md +[master]: https://github.com/FlightControl-Master/MOOSE/tree/master +[develop]: https://github.com/FlightControl-Master/MOOSE/tree/develop diff --git a/docs/advanced/desanitize-dcs.md b/docs/advanced/desanitize-dcs.md index 91fad46d1..2134802ae 100644 --- a/docs/advanced/desanitize-dcs.md +++ b/docs/advanced/desanitize-dcs.md @@ -1,7 +1,7 @@ --- title: De-Sanitize DCS parent: Advanced -nav_order: 2 +nav_order: 98 --- # De-Sanitize the DCS scripting environment {: .no_toc } diff --git a/docs/advanced/eclipse-installation.md b/docs/advanced/eclipse-installation.md index 0bdcd37cb..942fff30c 100644 --- a/docs/advanced/eclipse-installation.md +++ b/docs/advanced/eclipse-installation.md @@ -1,6 +1,6 @@ --- parent: Advanced -nav_order: 1 +nav_order: 97 --- # Eclipse Installation {: .no_toc } diff --git a/docs/advanced/text-to-speech.md b/docs/advanced/text-to-speech.md index 129039708..c3851da25 100644 --- a/docs/advanced/text-to-speech.md +++ b/docs/advanced/text-to-speech.md @@ -1,6 +1,6 @@ --- parent: Advanced -nav_order: 2 +nav_order: 99 --- # Text to Speech {: .no_toc } From e895642157db05a2161e607ea77f36adbf7b5bee Mon Sep 17 00:00:00 2001 From: kaltokri Date: Fri, 19 Jan 2024 16:57:33 +0100 Subject: [PATCH 2/6] Small fixes in advanced guide --- docs/advanced/basics.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/advanced/basics.md b/docs/advanced/basics.md index edf74a23c..8c1ee4a1b 100644 --- a/docs/advanced/basics.md +++ b/docs/advanced/basics.md @@ -11,17 +11,17 @@ concepts that we will explain here. You will need them for the later pages. Moose has about 260.000 lines of code and the amount is increasing each week. To maintain such a big code base a vcs (version control system) is needed. -Moose uses [Git], a distributed source code management created 2005 by Linus -Torvalds for the development of the Linux kernel. +Moose uses [Git], a distributed source code management system created 2005 by +Linus Torvalds for the development of the Linux kernel. As developer platform [GitHub] was choosen as a central place for Moose -to create, store, and manage the code. [GitHub] use [Git] for version control -and provides additional functionality like access control, bug tracking, feature -requests and much more. +to create, store, and manage the code. [GitHub] use [Git] as version control +system and provides additional functionality like access control, bug tracking, +feature requests and much more. -As a Moose you don't need to learn to use [Git]. You can download the files on -[GitHub] with a browser. But using [Git] will ease up the steps to keep the -Moose version on your hard disk up to date. +As a Moose user you don't need to learn how to use [Git]. You can download the +files on [GitHub] with a browser. But using [Git] will ease up the steps to keep +the Moose version on your hard disk up to date. You will need to interact with [GitHub]. At least to download the Moose files. For non developers the page can be confusing. Take your time and read this @@ -73,6 +73,8 @@ Moose framework. # What is a debugger (good for) [Git]: https://en.wikipedia.org/wiki/Git +[GitHub]: https://github.com/ +[YouTube]: https://www.youtube.com/ [Moose Discord]: https://discord.gg/gj68fm969S [overview]: ../index.md [reposities]: ../repositories.md From 15dd2cf7357d355e95d7f8e95f5c8e9bfa9f302a Mon Sep 17 00:00:00 2001 From: kaltokri Date: Mon, 22 Jan 2024 17:36:32 +0100 Subject: [PATCH 3/6] Renamed basic.md to concepts.md and added more text --- docs/advanced/{basics.md => concepts.md} | 56 ++++++++++++++++++------ 1 file changed, 43 insertions(+), 13 deletions(-) rename docs/advanced/{basics.md => concepts.md} (54%) diff --git a/docs/advanced/basics.md b/docs/advanced/concepts.md similarity index 54% rename from docs/advanced/basics.md rename to docs/advanced/concepts.md index 8c1ee4a1b..b75b5273c 100644 --- a/docs/advanced/basics.md +++ b/docs/advanced/concepts.md @@ -1,5 +1,5 @@ --- -title: Basics +title: Concepts parent: Advanced nav_order: 01 --- @@ -11,13 +11,9 @@ concepts that we will explain here. You will need them for the later pages. Moose has about 260.000 lines of code and the amount is increasing each week. To maintain such a big code base a vcs (version control system) is needed. -Moose uses [Git], a distributed source code management system created 2005 by -Linus Torvalds for the development of the Linux kernel. - -As developer platform [GitHub] was choosen as a central place for Moose -to create, store, and manage the code. [GitHub] use [Git] as version control -system and provides additional functionality like access control, bug tracking, -feature requests and much more. +Moose uses [GitHub] as developer platform to create, store, and manage the code. +[GitHub] uses [Git] as version control system and provides additional +functionality like access control, bug tracking, feature requests and much more. As a Moose user you don't need to learn how to use [Git]. You can download the files on [GitHub] with a browser. But using [Git] will ease up the steps to keep @@ -27,7 +23,7 @@ You will need to interact with [GitHub]. At least to download the Moose files. For non developers the page can be confusing. Take your time and read this documentation. We are not able to explain every single detail on using [GitHub] and [Git]. Especially because it is changing really quick and this documentaion -will not. So try to uns the help system of [GitHub] or find some videos on +will not. So try to use the help system of [GitHub] or find some videos on [YouTube]. If you get stuck ask for help in the [Moose Discord]. Moose uses more then one repository on [GitHub] which doesn't exactly make it @@ -43,20 +39,26 @@ As already explained in the [overview] two branches are used: As a starter it is okay to begin your journey with the `master` branch. If you are interested in some newer classes you need to use the `develop` branch. The later one is also very stable, but it's missing more detailed -documentation and example missions. +documentation and example missions for some of the new OPS classes. You can switch between these branches with a drop down in the upper left corner -of th GitHub repository page. The list of branches is long. So it is a best +of th [GitHub] repository page. The list of branches is long. So it is a best practise to save a bookmark in your browser with the links above. +Both branches are available on most of the different repositories. But because +of a limitation of [GitHub pages], we had to split the documentation in two +different repositories: + +- Documentation of `master` branch: [MOOSE_DOCS] +- Documentation of `develop` branch: [MOOSE_DOCS_DEVELOP] # Build result vs. source files Moose consists of more than 140 individual files with the file extension `.lua`. -They are places in a directory tree, which makes it more organized and its +They are places in a [directory tree], which makes it more organized and its semantic is pre-defined for IntelliSense to work. On every change which is pushed to [GitHub] a build job will combine all of -these files to a the single file called `Moose.lua`. In a seconds step all +these files to a single file called `Moose.lua`. In a second step all comments will be removed to decrease the file size and the result will be saved as `Moose_.lua`. These both files are created for users of Moose to include in your missions. @@ -68,6 +70,30 @@ Moose framework. # Static loading vs. dynamic loading +If you add a script file with a `DO SCRIPT FILE` trigger, like we described in +[Create your own Hello world], the script file will be copied into the mission +file. This mission file (file extension .MIZ) is only a compressed ZIP archive +with another file ending. + +If you change the script file after adding it to the mission, the changes are +not available on mission start. You have to re-add the script after each change. +This can be very annoying and often leads to forgetting to add the change again. +Then you wonder why the script does not deliver the desired result. + +But when the mission is finished you can upload it to your dedicated DCS server +or give it to a friend and it should run without problems. This way of embedding +the scripts do we call `static loading` and the resulting mission is very +portable. + +The other way on loading scripts is by using `DO SCRIPT`. This time the mission +editor don't show a file browse button. Instead you see a (very small) text +field to enter the code directly into it. It is only usefull for very small +script snippets. But we can use it to load a file from our hard drive like this: + +```lua +aaa +``` + # IDE vs. Notepad++ # What is a debugger (good for) @@ -80,3 +106,7 @@ Moose framework. [reposities]: ../repositories.md [master]: https://github.com/FlightControl-Master/MOOSE/tree/master [develop]: https://github.com/FlightControl-Master/MOOSE/tree/develop +[GitHub pages]: https://pages.github.com/ +[MOOSE_DOCS]: https://flightcontrol-master.github.io/MOOSE_DOCS/ +[MOOSE_DOCS_DEVELOP]: https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/ +[directory tree]: https://github.com/FlightControl-Master/MOOSE/tree/master/Moose%20Development/Moose From 0ee7a38c618bec5defc9c70f1590affab7213198 Mon Sep 17 00:00:00 2001 From: kaltokri Date: Thu, 1 Feb 2024 10:53:53 +0100 Subject: [PATCH 4/6] Added content to concepts.md and added an empty debugger.md --- docs/advanced/concepts.md | 100 ++++++++++++++++++++++++++++++++++++-- docs/advanced/debugger.md | 8 +++ 2 files changed, 103 insertions(+), 5 deletions(-) create mode 100644 docs/advanced/debugger.md diff --git a/docs/advanced/concepts.md b/docs/advanced/concepts.md index b75b5273c..2b8d733d8 100644 --- a/docs/advanced/concepts.md +++ b/docs/advanced/concepts.md @@ -4,6 +4,12 @@ parent: Advanced nav_order: 01 --- +# Concepts +{: .no_toc } + +1. Table of contents +{:toc} + If you want to get deeper into Moose, you will encounter a few terms and concepts that we will explain here. You will need them for the later pages. @@ -68,7 +74,7 @@ It is complicated to use them, but in combination with an IDE and a debugger it is very usefull to analyse even complex problems or write new additions to the Moose framework. -# Static loading vs. dynamic loading +# Static loading If you add a script file with a `DO SCRIPT FILE` trigger, like we described in [Create your own Hello world], the script file will be copied into the mission @@ -85,18 +91,98 @@ or give it to a friend and it should run without problems. This way of embedding the scripts do we call `static loading` and the resulting mission is very portable. -The other way on loading scripts is by using `DO SCRIPT`. This time the mission +# Dynamic loading of mission scripts + +The other way of loading scripts is by using `DO SCRIPT`. This time the mission editor don't show a file browse button. Instead you see a (very small) text field to enter the code directly into it. It is only usefull for very small -script snippets. But we can use it to load a file from our hard drive like this: +script snippets. But we can use it to load a file from your hard drive like +this: ```lua -aaa +dofile('C:/MyScripts/hello-world.lua') +dofile('C:\\MyScripts\\hello-world.lua') +dofile([[C:\MyScripts\hello-world.lua]]) +``` + +So all lines above do the same. In [Lua] you need to specify the path with +slashes, escape backslashes or use double square brackets around the string. +But double square brackets is usefull, because you can copy paste the path +without any modification. + +If you upload a mission with this code, you need to create the folder +`C:\MyScripts\` on the server file system and upload the newest version of +`hello-world.lua`, too. The same applies if you give the mission to a friend. +This makes the mission less portable, but on the other hand the mission uses the +file on the hard disk without the need to add it to the mission again. +All you need to do is save the file and restart the mission. + +The following can be used to increase portability: + +```lua +dofile(lfs.writedir() .. '/Missions/hello-world.lua') +``` + +The function `lfs.writedir()` will return your [Saved Games folder]. +So you place the scripts in the subfolder Missions. This way the folder +structure is already available on all target systems. But you need to ensure +mission and script are both in sync to avoid problems. If you changed both and +upload only one of them to your server, you may get trouble. + +There is another method you may find usefull to dynamically load scripts: + +```lua +assert(loadfile('C:/MyScripts/hello-world.lua'))() +assert(loadfile('C:\\MyScripts\\hello-world.lua'))() +assert(loadfile([[C:\MyScripts\hello-world.lua]]))() +``` + +It is a little bit harder to read and write because of all these different +brackets. Especially the one on line 3. But it is a little safer then `dofile`. +Because of readability I prefer to use `dofile`. + +# Dynamic loading of Moose + +Of course you can use the same method to load Moose. This way you can place one +Moose file in your [Saved Games folder], which is used by multiple missions. +If you want to update Moose you just need to replace the file and all missions +will use the new version. But I prefer to add Moose by a `DO SCRIPT FILE` +trigger so I can add and test the new version for each mission step by step. + +But we added two different ways to load the Moose source files automatically. +This is usefull for Moose developers and it is a requirement to use a debugger. +This will be explained later in the [Debugger Guide]. + +# Automatic dynamic loading + +```lua +-- Use script file from hard disk instead of the one included in the .miz file +if lfs and io then + MissionScript = lfs.writedir() .. '/Missions/hello-world-autodyn.lua' + -- Check if the running skript is from temp directory to avoid an endless loop + if string.find( debug.getinfo(1).source, lfs.tempdir() ) then + local f=io.open(MissionScript,"r") + if f~=nil then + io.close(f) + + env.info( '*** LOAD MOOSE MISSION SCRIPT FROM HARD DISK *** ' ) + dofile(MissionScript) + do return end + end + end +else + env.error( '*** LOAD MOOSE MISSION SCRIPT FROM HARD DISK FAILED (Desanitize lfs and io)*** ' ) +end + +-- +-- Simple example mission to show the very basics of MOOSE +-- +MESSAGE:New( "Hello World! This messages is printed by MOOSE!", 35, "INFO" ):ToAll():ToLog() ``` # IDE vs. Notepad++ -# What is a debugger (good for) + [Git]: https://en.wikipedia.org/wiki/Git [GitHub]: https://github.com/ @@ -110,3 +196,7 @@ aaa [MOOSE_DOCS]: https://flightcontrol-master.github.io/MOOSE_DOCS/ [MOOSE_DOCS_DEVELOP]: https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/ [directory tree]: https://github.com/FlightControl-Master/MOOSE/tree/master/Moose%20Development/Moose +[Saved Games folder]: ../beginner/tipps-and-tricks.md#find-the-saved-games-folder +[Lua]: https://www.lua.org/ +[Create your own Hello world]: ../beginner/hello-world-build.md +[Debugger Guide]: debugger.md diff --git a/docs/advanced/debugger.md b/docs/advanced/debugger.md new file mode 100644 index 000000000..2c43bff06 --- /dev/null +++ b/docs/advanced/debugger.md @@ -0,0 +1,8 @@ +--- +title: Debugger +parent: Advanced +nav_order: 100 +--- + +{: .warning } +> THIS DOCUMENT IS STILL WORK IN PROGRESS! From 51f134538d3965376640e2be490a46b3f20bfacf Mon Sep 17 00:00:00 2001 From: kaltokri Date: Thu, 15 Feb 2024 16:45:51 +0100 Subject: [PATCH 5/6] Fixing typos and added text for Automatic dynamic loading and IDEs --- docs/advanced/concepts.md | 101 ++++++++++++++++++++++++++++++-------- 1 file changed, 81 insertions(+), 20 deletions(-) diff --git a/docs/advanced/concepts.md b/docs/advanced/concepts.md index 2b8d733d8..a5c73de4d 100644 --- a/docs/advanced/concepts.md +++ b/docs/advanced/concepts.md @@ -26,21 +26,21 @@ files on [GitHub] with a browser. But using [Git] will ease up the steps to keep the Moose version on your hard disk up to date. You will need to interact with [GitHub]. At least to download the Moose files. -For non developers the page can be confusing. Take your time and read this +For non-developers the page can be confusing. Take your time and read this documentation. We are not able to explain every single detail on using [GitHub] -and [Git]. Especially because it is changing really quick and this documentaion +and [Git]. Especially because it is changing really quick and this documentation will not. So try to use the help system of [GitHub] or find some videos on [YouTube]. If you get stuck ask for help in the [Moose Discord]. -Moose uses more then one repository on [GitHub] which doesn't exactly make it +Moose uses more than one repository on [GitHub] which doesn't exactly make it any clearer. A list can be found on the [reposities] page. # Branches: master & develop As already explained in the [overview] two branches are used: -- [master]: Stable release branch. -- [develop]: Newest development with more OPS classes. +- Branch [master]: Stable release branch. +- Branch [develop]: Newest development with more OPS classes. As a starter it is okay to begin your journey with the `master` branch. If you are interested in some newer classes you need to use the `develop` @@ -48,8 +48,8 @@ branch. The later one is also very stable, but it's missing more detailed documentation and example missions for some of the new OPS classes. You can switch between these branches with a drop down in the upper left corner -of th [GitHub] repository page. The list of branches is long. So it is a best -practise to save a bookmark in your browser with the links above. +of the [GitHub] repository page. The list of branches is long. So it is a best +practice to save a bookmark in your browser with the links above. Both branches are available on most of the different repositories. But because of a limitation of [GitHub pages], we had to split the documentation in two different repositories: @@ -61,7 +61,7 @@ different repositories: Moose consists of more than 140 individual files with the file extension `.lua`. They are places in a [directory tree], which makes it more organized and its -semantic is pre-defined for IntelliSense to work. +semantic is pre-defined for [IntelliSense] to work. On every change which is pushed to [GitHub] a build job will combine all of these files to a single file called `Moose.lua`. In a second step all @@ -69,9 +69,9 @@ comments will be removed to decrease the file size and the result will be saved as `Moose_.lua`. These both files are created for users of Moose to include in your missions. -The individual `.lua` files are used by the Mosse developers and power users. +The individual `.lua` files are used by the Moose developers and power users. It is complicated to use them, but in combination with an IDE and a debugger it -is very usefull to analyse even complex problems or write new additions to the +is very useful to analyze even complex problems or write new additions to the Moose framework. # Static loading @@ -84,7 +84,7 @@ with another file ending. If you change the script file after adding it to the mission, the changes are not available on mission start. You have to re-add the script after each change. This can be very annoying and often leads to forgetting to add the change again. -Then you wonder why the script does not deliver the desired result. +Then you wonder why the mission does not deliver the desired result. But when the mission is finished you can upload it to your dedicated DCS server or give it to a friend and it should run without problems. This way of embedding @@ -95,7 +95,7 @@ portable. The other way of loading scripts is by using `DO SCRIPT`. This time the mission editor don't show a file browse button. Instead you see a (very small) text -field to enter the code directly into it. It is only usefull for very small +field to enter the code directly into it. It is only useful for very small script snippets. But we can use it to load a file from your hard drive like this: @@ -107,14 +107,14 @@ dofile([[C:\MyScripts\hello-world.lua]]) So all lines above do the same. In [Lua] you need to specify the path with slashes, escape backslashes or use double square brackets around the string. -But double square brackets is usefull, because you can copy paste the path +Double square brackets are usefull, because you can copy paste the path without any modification. If you upload a mission with this code, you need to create the folder `C:\MyScripts\` on the server file system and upload the newest version of -`hello-world.lua`, too. The same applies if you give the mission to a friend. +`hello-world.lua`, too. The same applies, if you give the mission to a friend. This makes the mission less portable, but on the other hand the mission uses the -file on the hard disk without the need to add it to the mission again. +file on the hard disk, without the need to add it to the mission again. All you need to do is save the file and restart the mission. The following can be used to increase portability: @@ -129,7 +129,7 @@ structure is already available on all target systems. But you need to ensure mission and script are both in sync to avoid problems. If you changed both and upload only one of them to your server, you may get trouble. -There is another method you may find usefull to dynamically load scripts: +There is another method you may find useful to dynamically load scripts: ```lua assert(loadfile('C:/MyScripts/hello-world.lua'))() @@ -138,7 +138,7 @@ assert(loadfile([[C:\MyScripts\hello-world.lua]]))() ``` It is a little bit harder to read and write because of all these different -brackets. Especially the one on line 3. But it is a little safer then `dofile`. +brackets. Especially the one on line 3. But it is a little safer than `dofile`. Because of readability I prefer to use `dofile`. # Dynamic loading of Moose @@ -150,11 +150,31 @@ will use the new version. But I prefer to add Moose by a `DO SCRIPT FILE` trigger so I can add and test the new version for each mission step by step. But we added two different ways to load the Moose source files automatically. -This is usefull for Moose developers and it is a requirement to use a debugger. +This is useful for Moose developers and it is a requirement to use a debugger. This will be explained later in the [Debugger Guide]. # Automatic dynamic loading +With the code below you can have the advantages of both approaches. +- Copy the code into your mission script at the beginning. +- Save the mission script into the folder Missions in your [Saved Games folder]. +- Change script filename in line 2 to match to your script. +- [De-Sanitize] your `MissionScripting.lua`. + +Now the mission will use the script on your hard drive instead of the script +embedded in th MIZ file, as long as it is available. So you can chnge the +script, save it and restart the mission, without the need to readd it after each +change. + +If you reach a stable state in your script development and want to upload the +mission to your server or give it to a friend, then just add the script again +like in the static method and save the mission. + +{: .important } +> Do not forget to readd the script, prior uploading or sharing the mission, +> or it will run with an outdated version of your script and may fail if the +> objects in the mission don't match to this old version. + ```lua -- Use script file from hard disk instead of the one included in the .miz file if lfs and io then @@ -165,13 +185,13 @@ if lfs and io then if f~=nil then io.close(f) - env.info( '*** LOAD MOOSE MISSION SCRIPT FROM HARD DISK *** ' ) + env.info( '*** LOAD MISSION SCRIPT FROM HARD DISK *** ' ) dofile(MissionScript) do return end end end else - env.error( '*** LOAD MOOSE MISSION SCRIPT FROM HARD DISK FAILED (Desanitize lfs and io)*** ' ) + env.error( '*** LOAD MISSION SCRIPT FROM HARD DISK FAILED (Desanitize lfs and io)*** ' ) end -- @@ -182,7 +202,41 @@ MESSAGE:New( "Hello World! This messages is printed by MOOSE!", 35, "INFO" ):ToA # IDE vs. Notepad++ +As a beginner you should start with a good text editor, which supports syntax +highlighting of [Lua] code. This must not be [Notepad++]. It can be any other +powerful editor of your choice. Do yourself a favor and don't use the Windows +editor. +If you are a developer of [Lua] or another programming language, then your are +most likely familiar with an IDE (Integrated Develop Environment). + +Otherwise you should know, that an IDE may help you with code completion, +Refactoring, Autocorrection, Formatting Source Code, showing documentation +as popup on mouse hover over keywords and Debugging. + +There are different IDEs available. And not all IDEs support all features. +The three most important for Moose are: + +- [Eclipse LDT] +- [Visual Studio Code] +- [PyCharm] (or [IntelliJ IDEA]) + +Eclipse has the best support for hover documentation and [IntelliSense] with +Moose. The Inventor of Moose (FlightControl) did an amazing job by adding an +integration to Eclipse LDT (a special version for Lua). +Unfortunately Eclipse LDT is not maintained any longer (last release 2018). +And the debugger doesn't work anymore, since an update of DCS. + +In Visual Studio Code the support of Lua can be added by an addon. +The debugger works with Moose and DCS, but showing the LuaDoc and [IntelliSense] +is very limited. + +PyCharm supports Lua also with an addon. The debugger works with Moose and DCS, +but showing the LuaDoc and [IntelliSense] is very limited. + +It is up to you to choose the IDE according to your taste. Guides on how to +setup Moose with different IDEs and Debuggers are provided later in this +documentation. [Git]: https://en.wikipedia.org/wiki/Git [GitHub]: https://github.com/ @@ -200,3 +254,10 @@ MESSAGE:New( "Hello World! This messages is printed by MOOSE!", 35, "INFO" ):ToA [Lua]: https://www.lua.org/ [Create your own Hello world]: ../beginner/hello-world-build.md [Debugger Guide]: debugger.md +[IntelliSense]: https://en.wikipedia.org/wiki/IntelliSense +[De-Sanitize]: desanitize-dcs.md +[Notepad++]: https://notepad-plus-plus.org/downloads/ +[Eclipse LDT]: https://projects.eclipse.org/projects/tools.ldt +[Visual Studio Code]: https://code.visualstudio.com/ +[PyCharm]: https://www.jetbrains.com/pycharm/ +[IntelliJ IDEA]: https://www.jetbrains.com/idea/ From e5a60a2ef1fcf9271477eea34ca4eed69cb56034 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Thu, 15 Feb 2024 18:17:44 +0100 Subject: [PATCH 6/6] #AWACS * Ensure not only one Merged-Call * Enable Tac, Meld, Threat calls also for non-tasked flights --- Moose Development/Moose/Ops/Awacs.lua | 58 ++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 11 deletions(-) diff --git a/Moose Development/Moose/Ops/Awacs.lua b/Moose Development/Moose/Ops/Awacs.lua index 5df0f7f42..c3cfc95d8 100644 --- a/Moose Development/Moose/Ops/Awacs.lua +++ b/Moose Development/Moose/Ops/Awacs.lua @@ -508,7 +508,7 @@ do -- @field #AWACS AWACS = { ClassName = "AWACS", -- #string - version = "0.2.61", -- #string + version = "0.2.62", -- #string lid = "", -- #string coalition = coalition.side.BLUE, -- #number coalitiontxt = "blue", -- #string @@ -2499,13 +2499,22 @@ function AWACS:_CheckMerges() local cpos = contact.Cluster.coordinate or contact.Contact.position or contact.Contact.group:GetCoordinate() local dist = ppos:Get2DDistance(cpos) local distnm = UTILS.Round(UTILS.MetersToNM(dist),0) - if (pilot.IsPlayer or self.debug) and distnm <= 5 and not contact.MergeCallDone then - local label = contact.EngagementTag or "" - if not contact.MergeCallDone or not string.find(label,pcallsign) 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 "" + --if not contact.MergeCallDone or not string.find(label,pcallsign) then self:T(self.lid.."Merged") self:_MergedCall(_id) - contact.MergeCallDone = true - end + --contact.MergeCallDone = true + --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 ) @@ -3099,7 +3108,7 @@ function AWACS:_BogeyDope(Group,Tactical) local clean = self.gettext:GetEntry("CLEAN",self.locale) 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 @@ -5467,7 +5476,7 @@ function AWACS:_TACRangeCall(GID,Contact) local managedgroup = self.ManagedGrps[GID] -- #AWACS.ManagedGroup local contact = Contact.Contact -- Ops.Intel#INTEL.Contact local contacttag = Contact.TargetGroupNaming - if contact and not Contact.TACCallDone then + if contact then --and not Contact.TACCallDone then local position = contact.position -- Core.Point#COORDINATE if position then local distance = position:Get2DDistance(managedgroup.Group:GetCoordinate()) @@ -5477,6 +5486,15 @@ function AWACS:_TACRangeCall(GID,Contact) 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) 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 + 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 return self @@ -5495,8 +5513,8 @@ function AWACS:_MeldRangeCall(GID,Contact) local managedgroup = self.ManagedGrps[GID] -- #AWACS.ManagedGroup local flightpos = managedgroup.Group:GetCoordinate() local contact = Contact.Contact -- Ops.Intel#INTEL.Contact - local contacttag = Contact.TargetGroupNaming - if contact and not Contact.MeldCallDone then + local contacttag = Contact.TargetGroupNaming or "Bogey" + if contact then --and not Contact.MeldCallDone then local position = contact.position -- Core.Point#COORDINATE if position then local BRATExt = "" @@ -5509,6 +5527,15 @@ function AWACS:_MeldRangeCall(GID,Contact) 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) 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 return self @@ -5525,7 +5552,7 @@ function AWACS:_ThreatRangeCall(GID,Contact) local managedgroup = self.ManagedGrps[GID] -- #AWACS.ManagedGroup local flightpos = managedgroup.Group:GetCoordinate() or managedgroup.LastKnownPosition local contact = Contact.Contact -- Ops.Intel#INTEL.Contact - local contacttag = Contact.TargetGroupNaming + local contacttag = Contact.TargetGroupNaming or "Bogey" if contact then local position = contact.position or contact.group:GetCoordinate() -- Core.Point#COORDINATE if position then @@ -5539,6 +5566,15 @@ function AWACS:_ThreatRangeCall(GID,Contact) 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) self:_NewRadioEntry(text,text,GID,true,self.debug,true,false,true) + 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 return self