From 99b24290bb89b6edf96b5dc1b6a01b5688120ebd Mon Sep 17 00:00:00 2001 From: John Edwards Date: Sun, 1 Oct 2023 14:57:11 +0100 Subject: [PATCH] Added environment variables to control bot behaviour --- README.md | 6 +++++- bullseye/etc/entry.sh | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b26732b..7bd6365 100644 --- a/README.md +++ b/README.md @@ -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) -# 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. 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_STARTMAP="de_inferno" (Start map) 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 This container leans heavily on the work of [CM2Walki](https://github.com/CM2Walki/), especially his [SteamCMD](https://github.com/CM2Walki/steamcmd) container image. GG! diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index f988562..511cf97 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -1,11 +1,25 @@ #!/bin/bash mkdir -p "${STEAMAPPDIR}" || true +# Download Updates + bash "${STEAMCMDDIR}/steamcmd.sh" +force_install_dir "${STEAMAPPDIR}" \ +login "${STEAMUSER}" "${STEAMPASS}" \ +app_update "${STEAMAPPID}" \ +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 \ -usercon \