Skip to content

Commit

Permalink
Merge pull request #21 from joedwards32/support-for-game_alias
Browse files Browse the repository at this point in the history
Add support for +game_alias
  • Loading branch information
joedwards32 authored Oct 11, 2023
2 parents dbb98f7 + fc2c4be commit 1a590a2
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 6 deletions.
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions bullseye/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
15 changes: 12 additions & 3 deletions bullseye/etc/entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}" \
Expand Down

0 comments on commit 1a590a2

Please sign in to comment.