feat: add -connect launch arg when --server is set

This commit is contained in:
bastimeyer 2021-12-05 21:20:40 +01:00
parent 175bfb7c23
commit 1a947d3d76

View file

@ -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