From 43243a434593c13061d200a3379b0d64fe291e32 Mon Sep 17 00:00:00 2001 From: David Pierron Date: Fri, 10 Jan 2020 13:46:43 +0100 Subject: [PATCH] veafAssets: Added an option to respawn multiple groups when respawning an asset --- buildMission.cmd => buildDemoMission.cmd | 1 - buildOTMission.cmd | 82 ++++++++++++++++++------ scripts/veaf/veafAssets.lua | 15 ++++- 3 files changed, 76 insertions(+), 22 deletions(-) rename buildMission.cmd => buildDemoMission.cmd (98%) diff --git a/buildMission.cmd b/buildDemoMission.cmd similarity index 98% rename from buildMission.cmd rename to buildDemoMission.cmd index 58b802a5..36dd5d12 100644 --- a/buildMission.cmd +++ b/buildDemoMission.cmd @@ -94,7 +94,6 @@ rem -- copy the documentation images to the kneeboard xcopy /y /e %MISSION_PATH%\doc\*.png .\build\tempsrc\KNEEBOARD\IMAGES >nul 2>&1 rem -- copy all the community scripts -copy %MISSION_PATH%\src\scripts\community\*.lua .\build\tempsrc\l10n\Default >nul 2>&1 copy .\scripts\community\*.lua .\build\tempsrc\l10n\Default >nul 2>&1 rem -- copy all the common scripts diff --git a/buildOTMission.cmd b/buildOTMission.cmd index 6f21511c..d78afbd4 100644 --- a/buildOTMission.cmd +++ b/buildOTMission.cmd @@ -1,60 +1,99 @@ @echo off set MISSION_NAME=VEAF-Open-Training-Mission -set MISSION_PATH=..\VEAF-Open-Training-Mission\ +set MISSION_PATH=..\VEAF-Open-Training-Mission set SECURITY_DISABLED_FLAG=true set VERBOSE_LOG_FLAG=true - -echo ------------------------------ -echo building VEAF-Open-Training-Mission -echo ------------------------------ - -rem -- prepare the folders -echo preparing the folders -rd /s /q .\build -mkdir .\build -mkdir .\build\tempsrc +set LUA_SCRIPTS_DEBUG_PARAMETER=-debug +echo. +echo ---------------------------------------- +echo building %MISSION_NAME% +echo ---------------------------------------- +echo. rem -- default options values -echo options values : +echo This script can use these environment variables to customize its behavior : +echo ---------------------------------------- +echo VERBOSE_LOG_FLAG if set to "true", will create a mission with tracing enabled (meaning that, when run, it will log a lot of details in the dcs log file) +echo defaults to "false" IF [%VERBOSE_LOG_FLAG%] == [] GOTO DefineDefaultVERBOSE_LOG_FLAG goto DontDefineDefaultVERBOSE_LOG_FLAG :DefineDefaultVERBOSE_LOG_FLAG set VERBOSE_LOG_FLAG=false :DontDefineDefaultVERBOSE_LOG_FLAG -echo VERBOSE_LOG_FLAG = %VERBOSE_LOG_FLAG% +echo current value is "%VERBOSE_LOG_FLAG%" + +echo ---------------------------------------- +echo LUA_SCRIPTS_DEBUG_PARAMETER can be set to "-debug" or "-trace" (or not set) ; this will be passed to the lua helper scripts (e.g. veafMissionRadioPresetsEditor and veafMissionNormalizer) +echo defaults to not set +IF [%LUA_SCRIPTS_DEBUG_PARAMETER%] == [] GOTO DefineDefaultLUA_SCRIPTS_DEBUG_PARAMETER +goto DontDefineDefaultLUA_SCRIPTS_DEBUG_PARAMETER +:DefineDefaultLUA_SCRIPTS_DEBUG_PARAMETER +set LUA_SCRIPTS_DEBUG_PARAMETER= +:DontDefineDefaultLUA_SCRIPTS_DEBUG_PARAMETER +echo current value is "%LUA_SCRIPTS_DEBUG_PARAMETER%" +echo ---------------------------------------- +echo SECURITY_DISABLED_FLAG if set to "true", will create a mission with security disabled (meaning that no password is ever required) +echo defaults to "false" IF [%SECURITY_DISABLED_FLAG%] == [] GOTO DefineDefaultSECURITY_DISABLED_FLAG goto DontDefineDefaultSECURITY_DISABLED_FLAG :DefineDefaultSECURITY_DISABLED_FLAG set SECURITY_DISABLED_FLAG=false :DontDefineDefaultSECURITY_DISABLED_FLAG -echo SECURITY_DISABLED_FLAG = %SECURITY_DISABLED_FLAG% +echo current value is "%SECURITY_DISABLED_FLAG%" +echo ---------------------------------------- +echo MISSION_FILE_SUFFIX (a string) will be appended to the mission file name to make it more unique +echo defaults to the current iso date IF [%MISSION_FILE_SUFFIX%] == [] GOTO DefineDefaultMISSION_FILE_SUFFIX goto DontDefineDefaultMISSION_FILE_SUFFIX :DefineDefaultMISSION_FILE_SUFFIX +set TIMEBUILD=%TIME: =0% set MISSION_FILE_SUFFIX=%date:~-4,4%%date:~-7,2%%date:~-10,2% :DontDefineDefaultMISSION_FILE_SUFFIX set MISSION_FILE=.\build\%MISSION_NAME%_%MISSION_FILE_SUFFIX% -echo MISSION_FILE = %MISSION_FILE%.miz +echo current value is "%MISSION_FILE_SUFFIX%" +echo ---------------------------------------- +echo SEVENZIP (a string) points to the 7za executable +echo defaults "7za", so it needs to be in the path IF [%SEVENZIP%] == [] GOTO DefineDefaultSEVENZIP goto DontDefineDefaultSEVENZIP :DefineDefaultSEVENZIP set SEVENZIP=7za :DontDefineDefaultSEVENZIP -echo SEVENZIP = %SEVENZIP% +echo current value is "%SEVENZIP%" +echo ---------------------------------------- +echo LUA (a string) points to the lua executable +echo defaults "lua", so it needs to be in the path +IF [%LUA%] == [] GOTO DefineDefaultLUA +goto DontDefineDefaultLUA +:DefineDefaultLUA +set LUA=lua +:DontDefineDefaultLUA +echo current value is "%LUA%" +echo ---------------------------------------- +rem -- prepare the folders +echo preparing the folders +rd /s /q .\build +mkdir .\build +mkdir .\build\tempsrc echo building the mission rem -- copy all the source mission files and mission-specific scripts xcopy /y /e %MISSION_PATH%\src\caucasus\mission .\build\tempsrc\ >nul 2>&1 -copy %MISSION_PATH%\src\caucasus\scripts\*.lua .\build\tempsrc\l10n\Default >nul 2>&1 +xcopy /y /e %MISSION_PATH%\src\caucasus\scripts\*.lua .\build\tempsrc\l10n\Default\ >nul 2>&1 + +rem -- set the radio presets according to the settings file +echo set the radio presets according to the settings file +pushd scripts\veaf +%LUA% veafMissionRadioPresetsEditor.lua ..\..\build\tempsrc ..\..\%MISSION_PATH%\src\caucasus\radioSettings.lua %LUA_SCRIPTS_DEBUG_PARAMETER% +popd rem -- copy the documentation images to the kneeboard xcopy /y /e %MISSION_PATH%\doc\*.png .\build\tempsrc\KNEEBOARD\IMAGES >nul 2>&1 rem -- copy all the community scripts -copy %MISSION_PATH%\src\scripts\community\*.lua .\build\tempsrc\l10n\Default >nul 2>&1 copy .\scripts\community\*.lua .\build\tempsrc\l10n\Default >nul 2>&1 rem -- copy all the common scripts @@ -68,7 +107,12 @@ rem -- compile the mission "%SEVENZIP%" a -r -tzip %MISSION_FILE%.miz .\build\tempsrc\* -mem=AES256 >nul 2>&1 rem -- cleanup -rd /s /q .\build\tempsrc +rd /s /q .\build\tempsrc +echo. +echo ---------------------------------------- rem -- done ! echo Built %MISSION_FILE%.miz +echo ---------------------------------------- + +pause \ No newline at end of file diff --git a/scripts/veaf/veafAssets.lua b/scripts/veaf/veafAssets.lua index 3394fbe2..402a605b 100644 --- a/scripts/veaf/veafAssets.lua +++ b/scripts/veaf/veafAssets.lua @@ -24,10 +24,10 @@ veafAssets = {} veafAssets.Id = "ASSETS - " --- Version. -veafAssets.Version = "1.2.3" +veafAssets.Version = "1.3.0" -- trace level, specific to this module -veafAssets.Trace = false +veafAssets.Trace = true veafAssets.Assets = { -- list the assets common to all missions below @@ -212,6 +212,17 @@ function veafAssets.respawn(name) end if theAsset then mist.respawnGroup(name, true) + if theAsset.linked then + veafAssets.logTrace(string.format("veafAssets[%s].linked=%s",name, veaf.p(theAsset.linked))) + -- there are linked groups to respawn + if type(theAsset.linked) == "string" then + theAsset.linked = {theAsset.linked} + end + for _, linkedGroup in pairs(theAsset.linked) do + veafAssets.logTrace(string.format("respawning linked group [%s]",linkedGroup)) + mist.respawnGroup(linkedGroup, true) + end + end local text = "I've respawned " .. theAsset.description if theAsset.jtac then ctld.JTACAutoLase(name, theAsset.jtac, false, "vehicle")