Merge pull request #128 from joedwards32/57-worshop-maps-support

experimental support for workshop maps
This commit is contained in:
John Edwards 2024-09-01 19:50:23 +01:00 committed by GitHub
commit 78009c6396
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 43 additions and 6 deletions

View file

@ -77,8 +77,8 @@ CS2_GAMEALIAS="" (Game type, e.g. casual, competitive, deathmatch.
See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) 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_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_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_MAPGROUP="mg_active" (Map pool. Ignored if workshop maps are defined.)
CS2_STARTMAP="de_inferno" (Start map) CS2_STARTMAP="de_inferno" (Start map. Ignored if workshop maps are defined.)
``` ```
### Bots ### Bots
@ -110,6 +110,22 @@ CS2_LOG_DETAIL=0 (Combat damage logging: 0=disabled, 1=enemy, 2=frien
CS2_LOG_ITEMS=0 (Turns item logging on/off: 0=off, 1=on) CS2_LOG_ITEMS=0 (Turns item logging on/off: 0=off, 1=on)
``` ```
### Steam Workshop
Support for Steam Workshop is experimental!
```dockerfile
CS2_HOST_WORKSHOP_MAP="" (Steam Workshop Map ID to load on server start)
CS2_HOST_WORKSHOP_COLLECTION="" (Steam Workshop Collection ID to download)
```
If a Workshop Collection is set, maps can be selected via rcon. E.g:
```
ds_workshop_listmaps
ds_workshop_changelevel $map_name
```
# Customizing this Container # Customizing this Container
## Validating Game Files ## Validating Game Files

View file

@ -93,6 +93,22 @@ if [[ ! -z $SRCDS_TOKEN ]]; then
SV_SETSTEAMACCOUNT_ARGS="+sv_setsteamaccount ${SRCDS_TOKEN}" SV_SETSTEAMACCOUNT_ARGS="+sv_setsteamaccount ${SRCDS_TOKEN}"
fi fi
if [[ ! -z $CS2_HOST_WORKSHOP_COLLECTION ]] || [[ ! -z $CS2_HOST_WORKSHOP_MAP ]]; then
CS2_MP_MATCH_END_CHANGELEVEL="+mp_match_end_changelevel true" # https://github.com/joedwards32/CS2/issues/57#issuecomment-2245595368
CS2_STARTMAP="\<empty\>" # https://github.com/joedwards32/CS2/issues/57#issuecomment-2245595368
CS2_MAPGROUP_ARGS=
else
CS2_MAPGROUP_ARGS="+mapgroup ${CS2_MAPGROUP}"
fi
if [[ ! -z $CS2_HOST_WORKSHOP_COLLECTION ]]; then
CS2_HOST_WORKSHOP_COLLECTION_ARGS="+host_workshop_collection ${CS2_HOST_WORKSHOP_COLLECTION}"
fi
if [[ ! -z $CS2_HOST_WORKSHOP_MAP ]]; then
CS2_HOST_WORKSHOP_MAP_ARGS="+host_workshop_map ${CS2_HOST_WORKSHOP_MAP}"
fi
# Start Server # Start Server
if [[ ! -z $CS2_RCON_PORT ]]; then if [[ ! -z $CS2_RCON_PORT ]]; then
@ -107,8 +123,11 @@ eval "./cs2" -dedicated \
-usercon \ -usercon \
-maxplayers "${CS2_MAXPLAYERS}" \ -maxplayers "${CS2_MAXPLAYERS}" \
"${CS2_GAME_MODE_ARGS}" \ "${CS2_GAME_MODE_ARGS}" \
+mapgroup "${CS2_MAPGROUP}" \ "${CS2_MAPGROUP_ARGS}" \
+map "${CS2_STARTMAP}" \ +map "${CS2_STARTMAP}" \
"${CS2_HOST_WORKSHOP_COLLECTION_ARGS}" \
"${CS2_HOST_WORKSHOP_MAP_ARGS}" \
"${CS2_MP_MATCH_END_CHANGELEVEL}" \
+rcon_password "${CS2_RCONPW}" \ +rcon_password "${CS2_RCONPW}" \
"${SV_SETSTEAMACCOUNT_ARGS}" \ "${SV_SETSTEAMACCOUNT_ARGS}" \
+sv_password "${CS2_PW}" \ +sv_password "${CS2_PW}" \

View file

@ -1,4 +1,3 @@
version: '3.7'
services: services:
cs2-server: cs2-server:
image: joedwards32/cs2 image: joedwards32/cs2
@ -22,8 +21,11 @@ services:
- CS2_GAMEALIAS # (Game type, e.g. casual, competitive, deathmatch. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) - 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_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_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_MAPGROUP=mg_active # (Map pool. Ignored if Workshop maps are defined.)
- CS2_STARTMAP=de_inferno # (Start map) - CS2_STARTMAP=de_inferno # (Start map. Ignored if Workshop maps are defined.)
# Workshop Maps
- CS2_HOST_WORKSHOP_COLLECTION # The workshop collection to use
- CS2_HOST_WORKSHOP_MAP # The workshop map to use. If collection is also defined, this is the starting map.
# Bots # Bots
- CS2_BOT_DIFFICULTY # (0 - easy, 1 - normal, 2 - hard, 3 - expert) - CS2_BOT_DIFFICULTY # (0 - easy, 1 - normal, 2 - hard, 3 - expert)
- CS2_BOT_QUOTA # (Number of bots) - CS2_BOT_QUOTA # (Number of bots)