From 2e0b498982ca79aae0823cd8101fe96d9c5dd26e Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Sat, 9 Jan 2021 23:31:30 +0300 Subject: [PATCH 1/3] feat: easier compilation - no need to edit KFEditor.ini manually; - the original ModPackages are always kept. --- README.md | 12 ++++-------- make.sh | 44 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 21a4144..2c4f149 100644 --- a/README.md +++ b/README.md @@ -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\\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\\Documents\My Games\KillingFloor2\KFGame` -4. Clone this repository and go to the source folder: +2. Open git-bash in the folder: `C:\Users\\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\\Documents\My Games\KillingFloor2\KFGame\Unpublished\BrewedPC\Script\` # Testing diff --git a/make.sh b/make.sh index e0785d8..39cdea8 100644 --- a/make.sh +++ b/make.sh @@ -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 ; ;; From 70f599f6db342e7d2dc5b5d36943eebd69b9c6aa Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Sun, 17 Jan 2021 19:59:22 +0300 Subject: [PATCH 2/3] feat: can be compiled from anywhere --- make.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/make.sh b/make.sh index 39cdea8..96bf776 100644 --- a/make.sh +++ b/make.sh @@ -59,10 +59,11 @@ function restore_kfeditorconf () mv -f "$KFEditorConfBackup" "$KFEditorConf" } -function set_serverext_modpackages () +function setup_modpackages () { multini --set "$KFEditorConf" 'ModPackages' 'ModPackages' 'ServerExt' multini --add "$KFEditorConf" 'ModPackages' 'ModPackages' 'ServerExtMut' + multini --set "$KFEditorConf" 'ModPackages' 'ModPackagesInPath' "$(unixpath2win "$MutSource")" } function compile () @@ -71,7 +72,7 @@ function compile () get_latest_multini fi - backup_kfeditorconf && set_serverext_modpackages + backup_kfeditorconf && setup_modpackages rm -rf "$MutUnpublish" mkdir -p \ @@ -160,6 +161,7 @@ function game_test () ScriptFullname=$(readlink -e "$0") ScriptName=$(basename "$0") +ScriptDir=$(dirname "$ScriptFullname") SteamPath=$(reg_readkey "HKCU\Software\Valve\Steam" "SteamPath") DocumentsPath=$(reg_readkey "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Personal") @@ -176,7 +178,7 @@ KFConfig="$KFDoc/KFGame/Config" KFEditorConf="$KFConfig/KFEditor.ini" KFEditorConfBackup="${KFEditorConf}.backup" -MutSource="$KFDoc/KFGame/Src" +MutSource="$ScriptDir" MutPubContent="$MutSource/PublicationContent" MutUnpublish="$KFDoc/KFGame/Unpublished" MutPublish="$KFDoc/KFGame/Published" From 5a6d1a840551af79d69f82ba90f5db428bf0510b Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Sun, 17 Jan 2021 20:07:55 +0300 Subject: [PATCH 3/3] update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2c4f149..160aadf 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ The full changelog is available on [steam workshop](https://steamcommunity.com/s 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 git-bash in the folder: `C:\Users\\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` +`git clone https://github.com/inklesspen1scripter/KF2-Server-Extension && cd KF2-Server-Extension` 4. Run make.sh script: `./make.sh --compile` 5. The compiled files will be here: