feat: easier compilation

- no need to edit KFEditor.ini manually;
- the original ModPackages are always kept.
This commit is contained in:
GenZmeY 2021-01-09 23:31:30 +03:00
parent 5a8b04c913
commit 2e0b498982
2 changed files with 47 additions and 9 deletions

View File

@ -33,16 +33,12 @@ The full changelog is available on [steam workshop](https://steamcommunity.com/s
# Build
1. Install [Killing Floor 2](https://store.steampowered.com/app/232090/Killing_Floor_2/), Killing Floor 2 - SDK and [git for windows](https://git-scm.com/download/win);
2. Open the file `C:\Users\<USERNAME>\Documents\My Games\KillingFloor2\KFGame\Config\KFEditor.ini`
and add the following lines to the `[ModPackages]` section:
> ModPackages=ServerExt
> ModPackages=ServerExtMut
3. Open git-bash in the folder: `C:\Users\<USERNAME>\Documents\My Games\KillingFloor2\KFGame`
4. Clone this repository and go to the source folder:
2. Open git-bash in the folder: `C:\Users\<USERNAME>\Documents\My Games\KillingFloor2\KFGame`
3. Clone this repository and go to the source folder:
`git clone https://github.com/inklesspen1scripter/KF2-Server-Extension ./Src && cd ./Src`
5. Run make.sh script:
4. Run make.sh script:
`./make.sh --compile`
6. The compiled files will be here:
5. The compiled files will be here:
`C:\Users\<USERNAME>\Documents\My Games\KillingFloor2\KFGame\Unpublished\BrewedPC\Script\`
# Testing

44
make.sh
View File

@ -39,8 +39,40 @@ function show_help ()
echo " -h, --help"
}
function get_latest_multini ()
{
local ApiUrl="https://api.github.com/repos/GenZmeY/multini/releases/latest"
local LatestTag=$(curl --silent "$ApiUrl" | grep -Po '"tag_name": "\K.*?(?=")')
local DownloadUrl="https://github.com/GenZmeY/multini/releases/download/$LatestTag/multini-windows-amd64.exe"
mkdir -p "$ThirdPartyBin"
curl -LJs "$DownloadUrl" -o "$ThirdPartyBin/multini.exe"
}
function backup_kfeditorconf ()
{
cp "$KFEditorConf" "$KFEditorConfBackup"
}
function restore_kfeditorconf ()
{
mv -f "$KFEditorConfBackup" "$KFEditorConf"
}
function set_serverext_modpackages ()
{
multini --set "$KFEditorConf" 'ModPackages' 'ModPackages' 'ServerExt'
multini --add "$KFEditorConf" 'ModPackages' 'ModPackages' 'ServerExtMut'
}
function compile ()
{
if ! command -v multini &> /dev/null; then
get_latest_multini
fi
backup_kfeditorconf && set_serverext_modpackages
rm -rf "$MutUnpublish"
mkdir -p \
"$MutUnpublish" \
@ -61,6 +93,8 @@ function compile ()
fi
sleep 2
done
restore_kfeditorconf
}
function brew ()
@ -137,8 +171,12 @@ KFGame="$KFBin/Win64/KFGame.exe"
KFWorkshop="$KFBin/WorkshopUserTool.exe"
KFDoc="$DocumentsPath/My Games/KillingFloor2"
KFConfig="$KFDoc/KFGame/Config"
MutSource="$KFDoc/KFGame/src"
KFEditorConf="$KFConfig/KFEditor.ini"
KFEditorConfBackup="${KFEditorConf}.backup"
MutSource="$KFDoc/KFGame/Src"
MutPubContent="$MutSource/PublicationContent"
MutUnpublish="$KFDoc/KFGame/Unpublished"
MutPublish="$KFDoc/KFGame/Published"
@ -151,6 +189,10 @@ MutTestingIni="$MutSource/testing.ini"
MutWsInfoName="wsinfo_serverext.txt"
MutWsInfo="$KFDoc/$MutWsInfoName"
ThirdPartyBin="$MutSource/3rd-party-bin"
export PATH="$PATH:$ThirdPartyBin"
if [[ $# -eq 0 ]]; then show_help; exit 0; fi
case $1 in
-h|--help ) show_help ; ;;