From fc2c4be6594a343838b72289c8699d6f516fd1c1 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Wed, 11 Oct 2023 22:16:00 +0100 Subject: [PATCH] Add support for +game_alias, use this as the preferred game mode declaration when defined. Updated readme. --- README.md | 26 +++++++++++++++++++++++--- bullseye/Dockerfile | 1 + bullseye/etc/entry.sh | 15 ++++++++++++--- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3264654..8e3aff4 100644 --- a/README.md +++ b/README.md @@ -32,21 +32,41 @@ $ docker run -d --net=host -v $(pwd)/cs2-data:/home/steam/cs2-dedicated/ --name= # Configuration ## Environment Variables Feel free to overwrite these environment variables, using -e (--env): + +### SteamCMD + ```dockerfile STEAMUSER="changeme" (Steam User for SteamCMD.) STEAMPASS="changeme" (Password for Steam User.) STEAMGUARD="" (Optional, Steam Guard key if enabled. Use your most recent Steam Guard key.) +``` + +### Server Configuration + +```dockerfile CS2_SERVERNAME="changeme" (Set the visible name for your private server) CS2_PORT=27015 (CS2 server listen port tcp_udp) CS2_LAN="0" (0 - LAN mode disabled, 1 - LAN Mode enabled) CS2_RCONPW="changeme" (RCON password) CS2_PW="changeme" (CS2 server password) CS2_MAXPLAYERS=10 (Max players) -CS2_GAMETYPE=0 (Game type, see https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) -CS2_GAMEMODE=1 (Game mode, see https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) +CS2_ADDITIONAL_ARGS="" (Optional additional arguments to pass into cs2) +``` + +### Game Modes + +```dockerfile +CS2_GAMEALIAS="" (Game type, e.g. casual, competitive, deathmatch. + See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) +CS2_GAMETYPE=0 (Used if CS2_GAMEALIAS not defined. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) +CS2_GAMEMODE=1 (Used if CS2_GAMEALIAS not defined. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) CS2_MAPGROUP="mg_active" (Map pool) CS2_STARTMAP="de_inferno" (Start map) -CS2_ADDITIONAL_ARGS="" (Optional additional arguments to pass into cs2) +``` + +### Bots + +```dockerfile CS2_BOT_DIFFICULTY="" (0 - easy, 1 - normal, 2 - hard, 3 - expert) CS2_BOT_QUOTA="" (Number of bots) CS2_BOT_QUOTA_MODE="" (fill, competitive) diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index 2354372..470ca3b 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -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 \ diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index b17dc8e..f4c26b6 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -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}" \