From 1a947d3d768b94b38570d750ed916dea075675a0 Mon Sep 17 00:00:00 2001 From: bastimeyer Date: Sun, 5 Dec 2021 21:20:40 +0100 Subject: [PATCH] feat: add -connect launch arg when --server is set --- dayz-mods.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dayz-mods.sh b/dayz-mods.sh index 1d69913..c2ae719 100755 --- a/dayz-mods.sh +++ b/dayz-mods.sh @@ -86,8 +86,8 @@ check_dir "${DIR_DAYZ}" check_dir "${DIR_WORKSHOP}" if [[ -n "${SERVER}" ]]; then - msg "Querying API for server: ${SERVER}:${PORT}" - query="$(sed -e "s/@ADDRESS@/${SERVER}/" -e "s/@PORT@/${PORT}/" <<< "${API_URL}")" + msg "Querying API for server: ${SERVER%:*}:${PORT}" + query="$(sed -e "s/@ADDRESS@/${SERVER%:*}/" -e "s/@PORT@/${PORT}/" <<< "${API_URL}")" debug "Querying ${query}" response="$(curl "${API_PARAMS[@]}" "${query}")" INPUT+=( $(jq -r ".mods[] | select(.app_id == ${DAYZ_ID}) | .id" <<< "${response}") ) @@ -117,6 +117,9 @@ cmdline=() if [[ "${#mods[@]}" -gt 0 ]]; then cmdline+=("\"-mod=$(IFS=";"; echo "${mods[*]}")\"") fi +if [[ "${LAUNCH}" == 1 ]] && [[ -n "${SERVER}" ]]; then + cmdline+=("-connect=${SERVER}") +fi if [[ "${LAUNCH}" == 1 ]]; then set -x