Make the Steam query port configurable. This is to prepare for other feature branches.

This commit is contained in:
Daniel Ceregatti 2024-06-21 14:04:58 -07:00
parent c25ca21574
commit bd8dac6d98
2 changed files with 13 additions and 9 deletions

View file

@ -49,7 +49,7 @@ adminLogPlayerList = 0; // 1 - log periodic player list with position every 5
enableDebugMonitor = 0; // shows info about the character using a debug window in a corner of the screen (value 0-1) enableDebugMonitor = 0; // shows info about the character using a debug window in a corner of the screen (value 0-1)
//steamQueryPort = 2305; // defines Steam query port, should fix the issue with server not being visible in client server browser steamQueryPort = 27016; // defines Steam query port, should fix the issue with server not being visible in client server browser
allowFilePatching = 1; // if set to 1 it will enable connection of clients with "-filePatching" launch parameter enabled allowFilePatching = 1; // if set to 1 it will enable connection of clients with "-filePatching" launch parameter enabled

View file

@ -11,6 +11,7 @@ mkdir -p ${SERVER_PROFILE}/battleye
SERVER_CFG_FILE="serverDZ.cfg" SERVER_CFG_FILE="serverDZ.cfg"
SERVER_CFG_DST="${SERVER_PROFILE}/${SERVER_CFG_FILE}" SERVER_CFG_DST="${SERVER_PROFILE}/${SERVER_CFG_FILE}"
SERVER_CFG_SRC="${FILES}/${SERVER_CFG_FILE}" SERVER_CFG_SRC="${FILES}/${SERVER_CFG_FILE}"
SERVER_CFG_SAVE="${SERVER_PROFILE}/${SERVER_CFG_FILE}.save"
# Command line parameters except mod, as that is handled separately. # Command line parameters except mod, as that is handled separately.
parameters="-config=${SERVER_CFG_DST} -port=${port} -freezecheck -BEpath=${SERVER_PROFILE}/battleye -profiles=${SERVER_PROFILE} -nologs" parameters="-config=${SERVER_CFG_DST} -port=${port} -freezecheck -BEpath=${SERVER_PROFILE}/battleye -profiles=${SERVER_PROFILE} -nologs"
@ -62,10 +63,10 @@ loadconfig(){
exit 1 exit 1
fi fi
# Handle the initial server configuration file # Handle the initial server configuration file
if [ ! -f ${SERVER_CFG_DST} ] if [ ! -f ${SERVER_CFG_SAVE} ]
then then
echo "Creating initial server configuration file" echo "Creating initial server configuration file"
cp "${SERVER_CFG_SRC}" "${SERVER_CFG_DST}" cp "${SERVER_CFG_SRC}" "${SERVER_CFG_SAVE}"
fi fi
# battleye config and rconpassword setup # battleye config and rconpassword setup
# The server creates a new file from this file, which it then uses. # The server creates a new file from this file, which it then uses.
@ -411,6 +412,9 @@ start(){
# actual status with those # actual status with those
echo ${mod_command_line} > /tmp/mod_command_line echo ${mod_command_line} > /tmp/mod_command_line
echo ${parameters} > /tmp/parameters echo ${parameters} > /tmp/parameters
# Add the steam port from the environment
cp -a "${SERVER_CFG_SAVE}" "${SERVER_CFG_DST}"
sed -e "s,^steamQueryPort.*,steamQueryPort = ${STEAM_PORT};," -i "${SERVER_CFG_DST}"
./DayZServer "${mod_command_line}" ${parameters} ./DayZServer "${mod_command_line}" ${parameters}
EXIT_CODE=$? EXIT_CODE=$?
printf "\n[ ${yellow}DayZ${default} ] Server exited. Exit code: ${EXIT_CODE}\n" printf "\n[ ${yellow}DayZ${default} ] Server exited. Exit code: ${EXIT_CODE}\n"
@ -446,20 +450,20 @@ force(){
# Handle any changes in the server config file by allowing them to be merged after viewing a diff. # Handle any changes in the server config file by allowing them to be merged after viewing a diff.
config(){ config(){
if ! diff -q "${SERVER_CFG_DST}" "${SERVER_CFG_SRC}" if ! diff -q "${SERVER_CFG_SAVE}" "${SERVER_CFG_SRC}"
then then
echo "=========================================================================" echo "========================================================================="
diff -Nau --color "${SERVER_CFG_DST}" "${SERVER_CFG_SRC}" | more diff -Nau --color "${SERVER_CFG_SAVE}" "${SERVER_CFG_SRC}" | more
echo "=========================================================================" echo "========================================================================="
if prompt_yn "The new server configuration file differs from what's installed. Use it?" if prompt_yn "The new server configuration file differs from what's installed. Use it?"
then then
echo "Updating the server configuration file" echo "Updating the server configuration file"
cp "${SERVER_CFG_SRC}" "${SERVER_CFG_DST}" cp "${SERVER_CFG_SRC}" "${SERVER_CFG_SAVE}"
else else
echo "NOT updating the server configuration file" echo "NOT updating the server configuration file"
fi fi
else else
echo "No differences found between ${SERVER_CFG_SRC} and ${SERVER_CFG_DST}" echo "No differences found between ${SERVER_CFG_SRC} and ${SERVER_CFG_SAVE}"
fi fi
} }
@ -540,9 +544,9 @@ activelist(){
get_map_name(){ get_map_name(){
MAP="none" MAP="none"
# Map name # Map name
if [[ -f ${SERVER_CFG_DST} ]] if [[ -f ${SERVER_CFG_SAVE} ]]
then then
MAP=$(grep -E "template=" ${SERVER_CFG_DST} | grep -vE "^//" | cut -d= -f2 | cut -d\; -f1 | tr -d '"') MAP=$(grep -E "template=" ${SERVER_CFG_SAVE} | grep -vE "^//" | cut -d= -f2 | cut -d\; -f1 | tr -d '"')
fi fi
echo ${MAP} echo ${MAP}
} }