From fe462b933788007317ff998b35805ac7593a5da9 Mon Sep 17 00:00:00 2001 From: bastimeyer Date: Tue, 21 Dec 2021 16:29:11 +0100 Subject: [PATCH] feat: support optional game launch parameters --- README.md | 4 +++- dayz-launcher.sh | 13 +++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d485fd2..c2a090e 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Please see the "Install DayZ" section down below on how to get the game running ## Usage ``` -Usage: dayz-launcher.sh [OPTION]... [MODID]... +Usage: dayz-launcher.sh [OPTION]... [MODID]... [-- [GAME-PARAM]...] Automatically set up mods for DayZ, launch the game and connect to a server, or print the game's -mod command line argument for custom configuration. @@ -38,6 +38,8 @@ Command line options: --launch Launch DayZ after resolving and setting up mods instead of printing the game's -mod command line argument. + Any custom game parameters that come after the first double-dash (--) will + be appended to the overall launch command line. This implies --launch. -n --name diff --git a/dayz-launcher.sh b/dayz-launcher.sh index b20cb3b..7324b94 100755 --- a/dayz-launcher.sh +++ b/dayz-launcher.sh @@ -31,6 +31,7 @@ PORT="27016" NAME="" INPUT=() MODS=() +PARAMS=() declare -A DEPS=( [gawk]="required for parsing the mod metadata" @@ -41,7 +42,7 @@ declare -A DEPS=( print_help() { cat < --name @@ -131,6 +134,12 @@ while (( "$#" )); do NAME="${2}" shift ;; + --) + shift + PARAMS+=("${@}") + LAUNCH=1 + break + ;; *) INPUT+=("${1}") ;; @@ -291,7 +300,7 @@ main() { [[ -n "${SERVER}" ]] && cmdline+=("-connect=${SERVER}" -nolauncher -world=empty) [[ -n "${NAME}" ]] && cmdline+=("-name=${NAME}") msg "Launching DayZ" - run_steam -applaunch "${DAYZ_ID}" "${cmdline[@]}" + run_steam -applaunch "${DAYZ_ID}" "${cmdline[@]}" "${PARAMS[@]}" elif [[ -n "${mods}" ]]; then msg "Add this to your game's launch options, including the quotes:" echo "\"-mod=${mods}\""