Added environment variables to control bot behaviour

This commit is contained in:
John Edwards 2023-10-01 14:57:11 +01:00
parent 9ca9832d89
commit 99b24290bb
2 changed files with 19 additions and 1 deletions

View file

@ -1,6 +1,6 @@
[![Docker Image CI](https://github.com/joedwards32/CS2/actions/workflows/docker-image.yml/badge.svg?branch=main)](https://github.com/joedwards32/CS2/actions/workflows/docker-image.yml) [![Docker Image CI](https://github.com/joedwards32/CS2/actions/workflows/docker-image.yml/badge.svg?branch=main)](https://github.com/joedwards32/CS2/actions/workflows/docker-image.yml)
# What is Counter-Strike 2 # What is Counter-Strike 2?
For over two decades, Counter-Strike has offered an elite competitive experience, one shaped by millions of players from across the globe. And now the next chapter in the CS story is about to begin. This is Counter-Strike 2. For over two decades, Counter-Strike has offered an elite competitive experience, one shaped by millions of players from across the globe. And now the next chapter in the CS story is about to begin. This is Counter-Strike 2.
This Docker image contains the dedicated server of the game. This Docker image contains the dedicated server of the game.
@ -46,7 +46,11 @@ CS2_GAMEMODE=0 (Game mode, see https://developer.valvesoftware.com/
CS2_MAPGROUP="mg_active" (Map pool) CS2_MAPGROUP="mg_active" (Map pool)
CS2_STARTMAP="de_inferno" (Start map) CS2_STARTMAP="de_inferno" (Start map)
CS2_ADDITIONAL_ARGS="" (Optional additional arguments to pass into cs2) CS2_ADDITIONAL_ARGS="" (Optional additional arguments to pass into cs2)
CS2_BOT_DIFFICULTY="" (0 - easy, 1 - normal, 2 - hard, 3 - expert)
CS2_BOT_QUOTA="" (Number of bots)
CS2_BOT_QUOTA_MODE="" (fill, competitive)
``` ```
# Credits # Credits
This container leans heavily on the work of [CM2Walki](https://github.com/CM2Walki/), especially his [SteamCMD](https://github.com/CM2Walki/steamcmd) container image. GG! This container leans heavily on the work of [CM2Walki](https://github.com/CM2Walki/), especially his [SteamCMD](https://github.com/CM2Walki/steamcmd) container image. GG!

View file

@ -1,11 +1,25 @@
#!/bin/bash #!/bin/bash
mkdir -p "${STEAMAPPDIR}" || true mkdir -p "${STEAMAPPDIR}" || true
# Download Updates
bash "${STEAMCMDDIR}/steamcmd.sh" +force_install_dir "${STEAMAPPDIR}" \ bash "${STEAMCMDDIR}/steamcmd.sh" +force_install_dir "${STEAMAPPDIR}" \
+login "${STEAMUSER}" "${STEAMPASS}" \ +login "${STEAMUSER}" "${STEAMPASS}" \
+app_update "${STEAMAPPID}" \ +app_update "${STEAMAPPID}" \
+quit +quit
# Rewrite Config Files
if [[ ! -z $CS2_BOT_DIFFICULTY ]] ; then
sed -i "s/bot_difficulty.*/bot_difficulty ${CS2_BOT_DIFFICULTY}/" /home/steam/cs2-dedicated/game/csgo/cfg/*
fi
if [[ ! -z $CS2_BOT_QUOTA ]] ; then
sed -i "s/bot_quota.*/bot_quota ${CS2_BOT_QUOTA}/" /home/steam/cs2-dedicated/game/csgo/cfg/*
fi
if [[ ! -z $CS2_BOT_QUOTA_MODE ]] ; then
sed -i "s/bot_quota_mode.*/bot_quota_mode ${CS2_BOT_QUOTA_MODE}/" /home/steam/cs2-dedicated/game/csgo/cfg/*
fi
# Start Server
"${STEAMAPPDIR}/game/bin/linuxsteamrt64/cs2" -dedicated \ "${STEAMAPPDIR}/game/bin/linuxsteamrt64/cs2" -dedicated \
-usercon \ -usercon \