Add support for +game_alias, use this as the preferred game mode declaration when defined. Updated readme.

This commit is contained in:
John Edwards 2023-10-11 22:16:00 +01:00
parent dbb98f7bc6
commit fc2c4be659
3 changed files with 36 additions and 6 deletions

View file

@ -39,6 +39,7 @@ ENV CS2_SERVERNAME="cs2 private server" \
CS2_PW="changeme" \
CS2_MAPGROUP="mg_active" \
CS2_STARTMAP="de_inferno" \
CS2_GAMEALIAS="" \
CS2_GAMETYPE=0 \
CS2_GAMEMODE=1 \
CS2_LAN=0 \

View file

@ -34,15 +34,24 @@ fi
# Switch to server directory
cd "${STEAMAPPDIR}/game/bin/linuxsteamrt64"
# Construct server arguments
if [[ -z $CS2_GAMEALIAS ]]; then
# If CS2_GAMEALIAS is undefined then default to CS2_GAMETYPE and CS2_GAMEMODE
CS2_GAME_MODE_ARGS="+game_type ${CS2_GAMETYPE} +game_mode ${CS2_GAMEMODE}"
else
# Else, use alias to determine game mode
CS2_GAME_MODE_ARGS="+game_alias ${CS2_GAMEALIAS}"
fi
# Start Server
"./cs2" -dedicated \
eval "./cs2" -dedicated \
-port "${CS2_PORT}" \
-console \
-usercon \
-maxplayers_override "${CS2_MAXPLAYERS}" \
+game_type "${CS2_GAMETYPE}" \
+game_mode "${CS2_GAMEMODE}" \
"${CS2_GAME_MODE_ARGS}" \
+mapgroup "${CS2_MAPGROUP}" \
+map "${CS2_STARTMAP}" \
+rcon_password "${CS2_RCONPW}" \