Merge branch 'Fix-Semicolumn-Skill' of https://github.com/WoodyXP/DCSOlympus into Fix-Semicolumn-Skill

This commit is contained in:
Stefan Arsic
2024-02-08 00:15:11 +01:00
250 changed files with 23210 additions and 186862 deletions

28
scripts/batch/build.bat Normal file
View File

@@ -0,0 +1,28 @@
REM dll version file must be set before compilation and changes can be committed
call node .\scripts\node\set_version_dll.js
cd backend
msbuild olympus.sln /t:Build /p:Configuration=Release
cd ..
cd client
rmdir /s /q hgt
call npm install
call npm run emit-declarations
call npm run build-release
cd plugins\controltips
call npm install
call npm run build-release
cd ..\..
cd plugins\databasemanager
call npm install
call npm run build-release
cd ..\..
cd ..
cd manager
call npm run build-release
cd ..

79
scripts/batch/install.bat Normal file
View File

@@ -0,0 +1,79 @@
@echo OFF
echo "*********************************************************************"
echo "* _____ _____ _____ ____ _ *"
echo "* | __ \ / ____|/ ____| / __ \| | *"
echo "* | | | | | | (___ | | | | |_ _ _ __ ___ _ __ _ _ ___ *"
echo "* | | | | | \___ \ | | | | | | | | '_ ` _ \| '_ \| | | / __| *"
echo "* | |__| | |____ ____) | | |__| | | |_| | | | | | | |_) | |_| \__ \ *"
echo "* |_____/ \_____|_____/ \____/|_|\__, |_| |_| |_| .__/ \__,_|___/ *"
echo "* __/ | | | *"
echo "* |___/ |_| *"
echo "*********************************************************************"
echo Welcome to the DCS Olympus {{OLYMPUS_VERSION_NUMBER}} installation script. Please wait while the necessary dependencies are installed!
echo:
WHERE /q powershell
if %ERRORLEVEL% NEQ 0 (
echo Powershell not installed in the system, no output log available.
) else (
echo The output of this script is also available in the file "%CD%\output.log". If you encounter any error, make sure to attach that file to your help request!
)
timeout /t 5
echo Checking if node.js framework is installed...
REM Check if node is installed
node -v 2> Nul
if "%errorlevel%" == "9009" (
echo node.js could not be found, installing it...
msiexec /i "%CD%\dependencies\node-v20.10.0-x64.msi" /passive
set "PATH=%PATH%;%programfiles%\nodejs"
) else (
echo node.js is already installed, continuing installation!
)
echo Installing node modules for client application...
cd .\client
call npm install --omit=dev
cd..
echo Installing node modules for manager application...
cd .\manager
call npm install --omit=dev
cd..
echo Generating shortcuts...
set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs"
echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT%
echo sLinkFile = "%USERPROFILE%\Desktop\DCS Olympus Manager.lnk" >> %SCRIPT%
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT%
echo oLink.TargetPath = "%CD%\manager\manager.vbs" >> %SCRIPT%
echo oLink.WorkingDirectory = "%CD%\manager" >> %SCRIPT%
echo oLink.IconLocation = "%CD%\img\olympus_configurator.ico" >> %SCRIPT%
echo oLink.Save >> %SCRIPT%
cscript /nologo %SCRIPT%
del %SCRIPT%
set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs"
echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT%
echo sLinkFile = "%CD%\DCS Olympus Manager.lnk" >> %SCRIPT%
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT%
echo oLink.TargetPath = "%CD%\manager\manager.vbs" >> %SCRIPT%
echo oLink.WorkingDirectory = "%CD%\manager" >> %SCRIPT%
echo oLink.IconLocation = "%CD%\img\olympus_configurator.ico" >> %SCRIPT%
echo oLink.Save >> %SCRIPT%
cscript /nologo %SCRIPT%
del %SCRIPT%
echo All done! This window will close in 5 seconds. It may take a couple of seconds for the Olympus Manager to start, please wait... 
timeout /t 5
cd manager
start cscript manager.vbs

View File

@@ -0,0 +1,11 @@
@echo OFF
SET PATH=%PATH%;%WINDIR%\System32;%WINDIR%\System32\WindowsPowerShell\v1.0;
WHERE /q powershell
if %ERRORLEVEL% NEQ 0 (
.\scripts\install.bat
) else (
powershell ".\scripts\install.bat | tee output.log"
)

44
scripts/batch/package.bat Normal file
View File

@@ -0,0 +1,44 @@
rmdir /s /q package
mkdir package
REM copy the main configuration file
echo F|xcopy /Y .\olympus.json .\package\olympus.json
REM copy the installation scripts
echo F|xcopy /Y .\scripts\batch\install.bat .\package\Scripts\install.bat
echo F|xcopy /Y .\scripts\batch\installer.bat .\package\installer.bat
REM copy the hooks script
echo F|xcopy /Y .\scripts\lua\hooks\OlympusHook.lua .\package\Scripts\OlympusHook.lua
REM copy the lua scripts
echo D|xcopy /Y /S /E .\scripts\lua\backend .\package\mod\scripts
REM copy the mod folder
echo D|xcopy /Y /S /E .\mod .\package\mod
REM copy the databases folder
echo D|xcopy /Y /S /E .\databases .\package\mod\databases
REM copy the backend dll
echo F|xcopy /Y /I .\build\backend\bin\*.dll .\package\mod\bin
REM copy the client
echo D|xcopy /Y /S /E .\build\client .\package\client
REM copy the manager
echo D|xcopy /Y /S /E .\build\manager .\package\manager
REM copy the images folder
echo D|xcopy /Y /S /E .\img\ .\package\img
REM copy the instructions and text files
echo F|xcopy /Y .\LEGAL.txt .\package\LEGAL.txt
echo F|xcopy /Y .\INSTRUCTIONS.txt .\package\INSTRUCTIONS.txt
echo F|xcopy /Y .\notes.txt .\package\notes.txt
REM copy the dependencies
echo D|xcopy /Y /S /E .\dependencies .\package\dependencies
REM other version tags are changed after compilation only in the package folder and should not be committed
call node .\scripts\node\set_version_text.js

View File

@@ -629,7 +629,7 @@ function Olympus.generateAirUnitsTable(units)
["y"] = spawnLocation.z,
["alt"] = unit.alt,
["alt_type"] = "BARO",
["skill"] = "Excellent",
["skill"] = unit.skill,
["payload"] = payload,
["heading"] = unit.heading,
["callsign"] = { [1] = 1, [2] = 1, [3] = 1, ["name"] = "Olympus" .. Olympus.unitCounter.. "-" .. #unitsTable + 1 },
@@ -709,7 +709,7 @@ function Olympus.generateGroundUnitsTable(units)
["x"] = spawnLocation.x + value.dx,
["y"] = spawnLocation.z + value.dy,
["heading"] = 0,
["skill"] = "High",
["skill"] = unit.skill,
["name"] = "Olympus-" .. Olympus.unitCounter .. "-" .. #unitsTable + 1
}
end
@@ -720,7 +720,7 @@ function Olympus.generateGroundUnitsTable(units)
["x"] = spawnLocation.x,
["y"] = spawnLocation.z,
["heading"] = unit.heading,
["skill"] = "High",
["skill"] = unit.skill,
["name"] = "Olympus-" .. Olympus.unitCounter .. "-" .. #unitsTable + 1,
["livery_id"] = unit.liveryID
}
@@ -743,7 +743,7 @@ function Olympus.generateNavyUnitsTable(units)
["x"] = spawnLocation.x + value.dx,
["y"] = spawnLocation.z + value.dy,
["heading"] = 0,
["skill"] = "High",
["skill"] = unit.skill,
["name"] = "Olympus-" .. Olympus.unitCounter .. "-" .. #unitsTable + 1,
["transportable"] = { ["randomTransportable"] = false }
}
@@ -755,7 +755,7 @@ function Olympus.generateNavyUnitsTable(units)
["x"] = spawnLocation.x,
["y"] = spawnLocation.z,
["heading"] = unit.heading,
["skill"] = "High",
["skill"] = unit.skill,
["name"] = "Olympus-" .. Olympus.unitCounter .. "-" .. #unitsTable + 1,
["transportable"] = { ["randomTransportable"] = false },
["livery_id"] = unit.liveryID

View File

@@ -1,24 +1,24 @@
function disableAutoCapture(airbaseName)
trigger.action.outText("Olympus.disableAutoCapture " .. airbaseName, 2)
local airbase = Airbase.getByName(airbaseName)
if airbase then
airbase:autoCapture(false)
trigger.action.outText("Olympus.disableAutoCapture " .. airbaseName .. " completed successfully", 2)
else
trigger.action.outText("Olympus.disableAutoCapture failed", 2)
end
end
function setAirbaseCoalition(airbaseName, coalitionColor)
trigger.action.outText("Olympus.setAirbaseCoalition trying to set " .. airbaseName .. " to " .. coalitionColor, 2)
local airbase = Airbase.getByName(airbaseName)
if airbase then
disableAutoCapture(airbaseName)
airbase:setCoalition(coalition.side[coalitionColor])
trigger.action.outText("Olympus.setAirbaseCoalition " .. airbaseName .. " set to " .. coalitionColor .. " completed successfully", 5)
else
trigger.action.outText("Olympus.setAirbaseCoalition Airbase not found: " .. airbaseName, 5)
end
end
function disableAutoCapture(airbaseName)
trigger.action.outText("Olympus.disableAutoCapture " .. airbaseName, 2)
local airbase = Airbase.getByName(airbaseName)
if airbase then
airbase:autoCapture(false)
trigger.action.outText("Olympus.disableAutoCapture " .. airbaseName .. " completed successfully", 2)
else
trigger.action.outText("Olympus.disableAutoCapture failed", 2)
end
end
function setAirbaseCoalition(airbaseName, coalitionColor)
trigger.action.outText("Olympus.setAirbaseCoalition trying to set " .. airbaseName .. " to " .. coalitionColor, 2)
local airbase = Airbase.getByName(airbaseName)
if airbase then
disableAutoCapture(airbaseName)
airbase:setCoalition(coalition.side[coalitionColor])
trigger.action.outText("Olympus.setAirbaseCoalition " .. airbaseName .. " set to " .. coalitionColor .. " completed successfully", 5)
else
trigger.action.outText("Olympus.setAirbaseCoalition Airbase not found: " .. airbaseName, 5)
end
end
setAirbaseCoalition("Khasab", "RED")

View File

@@ -0,0 +1,72 @@
const path = require("path");
const fs = require("fs");
let files = [];
const revision = require('child_process').execSync('git rev-parse --short HEAD').toString().trim();
function throughDirectory(directory) {
fs.readdirSync(directory).forEach(file => {
const absolute = path.join(directory, file);
if (!file.includes("increase_version.js") && !file.includes("node_modules")) {
if (fs.statSync(absolute).isDirectory())
{
return throughDirectory(absolute);
}
else {
return files.push(absolute);
}
}
});
}
fs.readFile("./version.json", "utf8", (error, data) => {
if (error) {
console.log(error);
return;
}
const versionJSON = JSON.parse(data);
var version = versionJSON["version"];
console.log(`Setting version number to ${version}`);
version = version.replace("v", "");
var arr = version.split(".");
const major = arr[0];
const minor = arr[1];
const minorminor = arr[2];
throughDirectory("./backend");
files.forEach((file) => {
fs.readFile(file, 'utf8', function (err,data) {
var fileChanged = false;
if (err) {
return console.log(err);
}
if (data.search(/FILEVERSION \d,\d,\d/g) >= 0) {
console.log(`Replacing version in ${file}`);
var data = data.replace(/FILEVERSION \d,\d,\d/g, `FILEVERSION ${major},${minor},${minorminor}`);
fileChanged = true;
}
if (data.search(/VALUE "FileVersion", "\d.\d.\d.0"/g) >= 0) {
console.log(`Replacing version in ${file}`);
data = data.replace(/VALUE "FileVersion", "\d.\d.\d.0"/g, `VALUE "FileVersion", "${major}.${minor}.${minorminor}.0"`);
fileChanged = true;
}
if (data.search(/VALUE "ProductVersion", "\d.\d.\d.0"/g) >= 0) {
console.log(`Replacing version in ${file}`);
data = data.replace(/VALUE "ProductVersion", "\d.\d.\d.0"/g, `VALUE "ProductVersion", "${major}.${minor}.${minorminor}.0"`);
fileChanged = true;
}
if (fileChanged) {
fs.writeFile(file, data, 'utf8', (err) => {
if (err) return console.log(err);
});
}
});
});
});

View File

@@ -0,0 +1,61 @@
const path = require("path");
const fs = require("fs");
let files = [];
const revision = require('child_process').execSync('git rev-parse --short HEAD').toString().trim();
function throughDirectory(directory) {
fs.readdirSync(directory).forEach(file => {
const absolute = path.join(directory, file);
if (!file.includes("increase_version.js") && !file.includes("node_modules")) {
if (fs.statSync(absolute).isDirectory())
{
return throughDirectory(absolute);
}
else {
return files.push(absolute);
}
}
});
}
fs.readFile("./version.json", "utf8", (error, data) => {
if (error) {
console.log(error);
return;
}
const versionJSON = JSON.parse(data);
var version = versionJSON["version"];
console.log(`Setting version number to ${version}`);
version = version.replace("v", "");
var arr = version.split(".");
const major = arr[0];
const minor = arr[1];
const minorminor = arr[2];
throughDirectory("./package");
files.forEach((file) => {
fs.readFile(file, 'utf8', function (err,data) {
var fileChanged = false;
if (err) {
return console.log(err);
}
if (data.search(/{{OLYMPUS_VERSION_NUMBER}}/g) >= 0) {
console.log(`Replacing version in ${file}`);
data = data.replace(/{{OLYMPUS_VERSION_NUMBER}}/g, `v${major}.${minor}.${minorminor}`);
data = data.replace(/{{OLYMPUS_COMMIT_HASH}}/g, revision);
fileChanged = true;
}
if (fileChanged) {
fs.writeFile(file, data, 'utf8', (err) => {
if (err) return console.log(err);
});
}
});
});
});