diff --git a/.github/workflows/docs-autoupdate.yml b/.github/workflows/docs-autoupdate.yml index 6485968..21e1d6f 100644 --- a/.github/workflows/docs-autoupdate.yml +++ b/.github/workflows/docs-autoupdate.yml @@ -9,7 +9,7 @@ jobs: update-docs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - name: Update docs diff --git a/.github/workflows/shellcheck-dev.yml b/.github/workflows/shellcheck-dev.yml index 3af277f..45d88ee 100644 --- a/.github/workflows/shellcheck-dev.yml +++ b/.github/workflows/shellcheck-dev.yml @@ -11,7 +11,7 @@ jobs: name: shellcheck runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Run ShellCheck uses: ludeeus/action-shellcheck@master env: diff --git a/.github/workflows/shellcheck-master.yml b/.github/workflows/shellcheck-master.yml index 6c381aa..130bad2 100644 --- a/.github/workflows/shellcheck-master.yml +++ b/.github/workflows/shellcheck-master.yml @@ -10,7 +10,7 @@ jobs: name: shellcheck runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Run ShellCheck uses: ludeeus/action-shellcheck@master env: diff --git a/README.md b/README.md index 143ad28..9fc01e8 100644 --- a/README.md +++ b/README.md @@ -15,11 +15,6 @@ - Killing Floor 2 - SDK; - [git-bash](https://git-scm.com/download/win). -# Limits -You can keep mod sources anywhere, but `Killing Floor 2` and `Killing Floor 2 - SDK` must be installed on the system drive (C:\ in most cases). - -(I plan to fix this limitation in the future) - # Add to your project Make sure that the location of folders and files in your project as follows (Correct it if it's not): `//Classes/*.uc` @@ -117,8 +112,5 @@ By the way, this allows you to use a script to upload maps (although this was no **two mutators are uploaded to the steam workshop:** - [UnofficialMod](https://github.com/GenZmeY/UnofficialMod) -# Other -[TODO List](TODO.md) - # License [GNU GPLv3](LICENSE) diff --git a/TODO.md b/TODO.md index 0cd03d5..62e4250 100644 --- a/TODO.md +++ b/TODO.md @@ -1,6 +1,2 @@ # TODO: -- [ ] add kf2 support in another steam library (`Steam\steamapps\libraryfolders.vdf` may help) -- [ ] hooks (precompile, postcompile, prebrew, etc...) - [ ] improve error parser (class vs name mismatch, etc...) -- [ ] server testing -- [ ] check description for quotes and warn about it (or add quotes support somehow) diff --git a/builder b/builder index 6fd4c0c..d49a495 100644 --- a/builder +++ b/builder @@ -34,6 +34,32 @@ function reg_readkey () # $1: path, $2: key fi } +function steamlib_by_steamid () # $1: SteamID +{ + local Path + + if ! [[ -f "$SteamLibFoldersVdf" ]]; then + return + fi + + while read -r Line + do + if echo "$Line" | grep -Foq '"path"'; then + Path="$(echo "$Line" | sed -r 's|^\s*\"path\"\s*||' | sed 's|"||g')" + fi + if echo "$Line" | grep -Poq "^\s*\"${1}\"\s*\"\d+\"$"; then + wrapped_cygpath --unix "$Path" + fi + done < "$SteamLibFoldersVdf" +} + +function wrapped_cygpath () # $@: Params +{ + if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" ]]; then + cygpath "$@" + fi +} + # Whoami ScriptFullname="$(readlink -e "$0")" ScriptName="$(basename "$0")" @@ -41,19 +67,23 @@ ScriptDir="$(dirname "$ScriptFullname")" # Common SteamPath="$(reg_readkey "HKCU\Software\Valve\Steam" "SteamPath")" -DocumentsPath="$(reg_readkey "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Personal")" +DocumentsPath="$(wrapped_cygpath --mydocs)" ThirdPartyBin="$ScriptDir/3rd-party-bin" DummyPreview="$ScriptDir/dummy_preview.png" +SteamLibFoldersVdf="$SteamPath/steamapps/libraryfolders.vdf" # Usefull KF2 executables / Paths / Configs KFDoc="$DocumentsPath/My Games/KillingFloor2" -KFPath="$SteamPath/steamapps/common/killingfloor2" -KFDev="$KFPath/Development/Src" -KFWin64="$KFPath/Binaries/Win64" +KFSteamLibraryFolder="$(steamlib_by_steamid "232090")" +KFSDKSteamLibraryFolder="$(steamlib_by_steamid "232150")" +KFPath="$KFSteamLibraryFolder/steamapps/common/killingfloor2" +KFSDKPath="$KFSDKSteamLibraryFolder/steamapps/common/killingfloor2" +KFDev="$KFSDKPath/Development/Src" +KFWin64="$KFSDKPath/Binaries/Win64" KFEditor="$KFWin64/KFEditor.exe" KFEditorPatcher="$KFWin64/kfeditor_patcher.exe" KFEditorMergePackages="$KFWin64/KFEditor_mergepackages.exe" -KFGame="$KFWin64/KFGame.exe" +KFGame="$KFPath/Binaries/Win64/KFGame.exe" KFWorkshop="$KFPath/Binaries/WorkshopUserTool.exe" KFUnpublish="$KFDoc/KFGame/Unpublished" KFPublish="$KFDoc/KFGame/Published" @@ -931,6 +961,11 @@ function upload () warn "The size of $(basename "$Preview") is greater than 1mb. Steam may prevent you from loading content with this image. if you get an error while loading - try using a smaller preview." fi + if grep -Fq '"' "$MutPubContentDescription"; then + warn "Double quotes (\") found in $(basename "$MutPubContentDescription"), this may prevent the item from being uploaded to the workshop" + warn "Remove double quotes if there are problems uploading to the workshop" + fi + find "$KFPublish" -type d -empty -delete # it's a bad idea to use the $KFPublish folder for upload @@ -1057,6 +1092,22 @@ function main () if is_true "$ArgVersion"; then version; die "" 0; fi if is_true "$ArgHelp"; then usage; die "" 0; fi + # Checks + if [[ -z "$KFSteamLibraryFolder" ]]; then + err "\"Killing Floor 2\" not found" + fi + + if [[ -z "$KFSDKSteamLibraryFolder" ]]; then + err "\"Killing Floor 2 - SDK\" not found" + fi + + if [[ -z "$KFSteamLibraryFolder" ]] || [[ -z "$KFSDKSteamLibraryFolder" ]]; then + die "" 1 + elif [[ "$KFPath" != "$KFSDKPath" ]]; then + warn "\"Killing Floor 2\" and \"Killing Floor 2 - SDK\" installed in different steam library folders." + warn "If you get errors, install them in the same steam library folder." + fi + # Backup if is_true "$ArgCompile" || is_true "$ArgBrew"; then backup_kfeditorconf; fi