Improved build script, now with more options

This commit is contained in:
Ambroise Garel
2025-07-29 15:05:00 +02:00
parent 1488001442
commit c7cd1aa462
5 changed files with 57 additions and 18 deletions
+1
View File
@@ -1,4 +1,5 @@
{
"files.exclude": { "*.miz": true },
"Lua.workspace.library": ["Libraries/dcs-world-api.lua"],
"Lua.diagnostics.disable": ["deprecated"]
}
+41 -9
View File
@@ -1,25 +1,57 @@
@echo off
cls
@REM -------------------------------------------
@REM DELETE PREVIOUSLY GENERATED MISSIONS
@REM -------------------------------------------
if exist *.miz del *.miz
@REM -------------------------------------------
@REM CREATE SCENARIOS
@REM -------------------------------------------
c:\php\php Make.php
set buildConfig=p
echo THE ULTIMATE MISSION BUILDER SCRIPT:
echo - Build [P]ersianGulf debug theater only (default)
echo - Build all [D]ebug theaters
echo - Build all [R]elease theaters
echo.
set /p buildConfig=Your choice:
echo.
IF "%buildConfig%" == "d" goto BUILD-DEBUG-ALL
IF "%buildConfig%" == "D" goto BUILD-DEBUG-ALL
IF "%buildConfig%" == "p" goto BUILD-DEBUG-PERSIAN
IF "%buildConfig%" == "P" goto BUILD-DEBUG-PERSIAN
IF "%buildConfig%" == "r" goto BUILD-RELEASE
IF "%buildConfig%" == "R" goto BUILD-RELEASE
IF "%buildConfig%" == "s" goto START-DEBUG
IF "%buildConfig%" == "S" goto START-DEBUG
goto CANCEL-END
:BUILD-DEBUG-ALL
if exist *.miz del *.miz
c:\php\php Make.php debug
goto END
:BUILD-DEBUG-PERSIAN
if exist *.miz del *.miz
c:\php\php Make.php debug persiangulf
goto END
:BUILD-RELEASE
if exist *.miz del *.miz
c:\php\php Make.php release
goto END
@REM -------------------------------------------
@REM COPY OUTPUT MIZ FILES TO DCS'S MISSIONS DIRECTORY
@REM -------------------------------------------
if not exist "%userprofile%\Saved Games\DCS\Missions\" goto EOF
if not exist *.miz goto EOF
if not exist "%userprofile%\Saved Games\DCS\Missions\" goto END
if not exist *.miz goto END
echo Copying output MIZ files to %userprofile%\Saved Games\DCS\Missions...
copy /y *.miz "%userprofile%\Saved Games\DCS\Missions"
echo DONE
echo.
:EOF
:CANCEL-END
echo.
echo Build cancelled.
goto END
:END
echo.
+9 -6
View File
@@ -5,9 +5,7 @@ require_once("./BuildScript/Script.php");
require_once("./BuildScript/Warehouses.php");
if (!is_dir("./_DebugOutput"))
{
mkdir("./_DebugOutput");
}
function packMiz($theaterJson, $debugMode)
{
@@ -45,12 +43,20 @@ function packMiz($theaterJson, $debugMode)
return true;
}
$buildType = "debug";
if (count($argv) > 1) $buildType = strtolower($argv[1]);
$buildSingleTheater = null;
if (count($argv) > 2) $buildSingleTheater = strtolower($argv[2]);
$theaterFiles = scandir("./Theaters");
foreach ($theaterFiles as $theaterFile)
{
if (($theaterFile === ".") || ($theaterFile === "..")) continue;
if (!str_ends_with(strtolower($theaterFile), ".json")) continue;
if (($buildSingleTheater != null) && (strtolower($theaterFile) !== $buildSingleTheater.".json"))
continue;
$theaterJson = json_decode(file_get_contents("./Theaters/$theaterFile"), true);
if ($theaterJson == null)
{
@@ -59,10 +65,7 @@ foreach ($theaterFiles as $theaterFile)
}
echo "Building scenario \"".$theaterFile."\"...\n";
for ($i = 0; $i <= 1; $i++)
{
packMiz($theaterJson, $i == 1);
}
packMiz($theaterJson, $buildType !== "release");
echo "\n";
}
+4 -1
View File
@@ -202,8 +202,10 @@ If you want to build the .miz files yourself, you'll need to:
- Add the PHP directory it to your system PATH so the batch file will find it
- In the PHP directory, rename php.ini-production to php.ini, edit it and uncomment or delete the "extension=mbstring" line to enable the MBString extension that my script uses.
- Then run Make.bat in the source directory (or, alternatively, open the source directory in VSCode and press Ctrl+Alt+B)
- You will be asked if you want to build only the Persian Gulf debug mission (useful, as build is quicker and PG is one of the fastest loading maps in DCS World), debug versions of all theaters or release version of all theaters.
- Debug version of the mission give access to debugging options in the F10 menu and output additional logs during the mission. Debug missions are generated with an F-16C player aircraft as it's a good jack-of-all-trades to test various things, but you're free to change it in the mission editor.
- .Miz files will be generated in the project root directory, and a copy will be sent to your DCS World "missions" directory (if it exists)
- Please note that a second version of each file marked "DEBUG" will also be generated. This version allows access to the debug menu and additional text outputs during the mission. Debug missions are generated with an F-16C player aircraft as it's a good jack-of-all-trades to test various things.
- If you use VSCode, be aware that .miz files are ignored in the explorer (as per .vscode/settings.json settings) to unclutter the explorer panel, so don't be suprise if you don't see them when building from VSCode.
## Want to contribute to the project?
@@ -239,6 +241,7 @@ The core script is quite simple and small, I probably won't need too much help w
- Fixed missing airbase name in "aircraft landed safely" messages
- Friendly CAP flights now take off from near the centerpoint of mission player slots
- Improved display of XP modifiers in menu
- Improved the script used to build the project
- Improved wording of many lines and commands, correct a bunch of typos
- Increased minimum aircraft spawn altitude to avoir crashes in nearby hills
- Infantry escaping from destroyed vehicles is now hidden on F10 map, as it should be
+2 -2
View File
@@ -101,7 +101,7 @@ do
trigger.action.outSound("UI-MissionStart.ogg")
end
trigger.action.outText("MISSION OBJECTIVES:\n"..TUM.mission.getSummaryString(), 10)
trigger.action.outText("MISSION OBJECTIVES:\n\n"..TUM.mission.getSummaryString(), 10)
objectivesReminderIntervalLeft = OBJECTIVES_REMINDER_INTERVAL
end
@@ -119,7 +119,7 @@ do
if not o.completed or not onlyShowIncomplete then
local bulletCharacter = ""
if validObjCount == 1 then bulletCharacter = ""
elseif validObjCount == 2 then bulletCharacter = ""
elseif validObjCount == 2 then bulletCharacter = ""
elseif validObjCount == 3 then bulletCharacter = ""
elseif validObjCount == 4 then bulletCharacter = ""
elseif validObjCount == 5 then bulletCharacter = ""