mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Merge branch 'Fix-Semicolumn-Skill' of https://github.com/WoodyXP/DCSOlympus into Fix-Semicolumn-Skill
This commit is contained in:
28
scripts/batch/build.bat
Normal file
28
scripts/batch/build.bat
Normal 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
79
scripts/batch/install.bat
Normal file
@@ -0,0 +1,79 @@
|
||||
@echo OFF
|
||||
echo [36m"*********************************************************************"[0m
|
||||
echo [36m"* _____ _____ _____ ____ _ *"[0m
|
||||
echo [36m"* | __ \ / ____|/ ____| / __ \| | *"[0m
|
||||
echo [36m"* | | | | | | (___ | | | | |_ _ _ __ ___ _ __ _ _ ___ *"[0m
|
||||
echo [36m"* | | | | | \___ \ | | | | | | | | '_ ` _ \| '_ \| | | / __| *"[0m
|
||||
echo [36m"* | |__| | |____ ____) | | |__| | | |_| | | | | | | |_) | |_| \__ \ *"[0m
|
||||
echo [36m"* |_____/ \_____|_____/ \____/|_|\__, |_| |_| |_| .__/ \__,_|___/ *"[0m
|
||||
echo [36m"* __/ | | | *"[0m
|
||||
echo [36m"* |___/ |_| *"[0m
|
||||
echo [36m"*********************************************************************"[0m
|
||||
echo [36mWelcome to the DCS Olympus {{OLYMPUS_VERSION_NUMBER}} installation script. Please wait while the necessary dependencies are installed![0m
|
||||
echo:
|
||||
|
||||
|
||||
WHERE /q powershell
|
||||
if %ERRORLEVEL% NEQ 0 (
|
||||
echo [30m[106mPowershell not installed in the system, no output log available.[0m
|
||||
) else (
|
||||
echo [30m[106mThe 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![0m
|
||||
)
|
||||
|
||||
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 [32mAll done! This window will close in 5 seconds. It may take a couple of seconds for the Olympus Manager to start, please wait... [0m
|
||||
|
||||
timeout /t 5
|
||||
|
||||
cd manager
|
||||
start cscript manager.vbs
|
||||
11
scripts/batch/installer.bat
Normal file
11
scripts/batch/installer.bat
Normal 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
44
scripts/batch/package.bat
Normal 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
|
||||
@@ -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
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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")
|
||||
72
scripts/node/set_version_dll.js
Normal file
72
scripts/node/set_version_dll.js
Normal 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);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
61
scripts/node/set_version_text.js
Normal file
61
scripts/node/set_version_text.js
Normal 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);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user