diff --git a/.env b/.env index 220ff87..6b080f5 100644 --- a/.env +++ b/.env @@ -1,11 +1,11 @@ STEAMAPPID=232330 STEAMAPP=css -SRCDS_TOKEN=C02633B3395EA6BEF7D8DFBA440ABB7F +SRCDS_TOKEN=3C403551712E10420F08F5CA337F9B21 SRCDS_RCONPW="reebok" SRCDS_PW="6" -SRCDS_STARTMAP="surf_fornax" +SRCDS_STARTMAP="surf_anzchamps" SRCDS_HOSTNAME="megastructure surf" SRCDS_MAXPLAYERS=16 diff --git a/k8s.yaml b/k8s.yaml index 9e68af8..e34abc9 100644 --- a/k8s.yaml +++ b/k8s.yaml @@ -243,27 +243,17 @@ spec: value: "/tmp/mapsdl" - name: GOOGLE_APPLICATION_CREDENTIALS value: "/app/credentials/service-account.json" - - name: MAPS_WISHLIST - value: | - surf_anzchamps - surf_boreas - surf_deathstar - surf_ebony - surf_fornax - surf_garden - surf_in_space - surf_kepler - surf_kitsune - surf_kitsune2 - surf_lt_omnific - surf_pantheon - surf_utopia_njv + - name: MAPS_LIST_FILE + value: "/cfg/mapcycle.txt" volumeMounts: - name: fastdl-maps mountPath: /maps - name: credentials mountPath: /app/credentials readOnly: true + - name: cfg + mountPath: /cfg + readOnly: true volumes: - name: fastdl-maps persistentVolumeClaim: @@ -271,5 +261,8 @@ spec: - name: credentials hostPath: path: /run/desktop/mnt/host/c/Users/ntr/code/surf_megastructure/src/mapsdl/credentials + - name: cfg + configMap: + name: cfg --- diff --git a/src/cssds/Dockerfile b/src/cssds/Dockerfile index 3cf9b8e..161ebe0 100644 --- a/src/cssds/Dockerfile +++ b/src/cssds/Dockerfile @@ -17,6 +17,7 @@ RUN apt-get update && apt-get install -y \ libtinfo5 \ libcurl3-gnutls \ unzip \ + bzip2 \ rcon \ neovim \ tmux \ diff --git a/src/cssds/cfg/motd.txt b/src/cssds/cfg/motd.txt new file mode 100644 index 0000000..3e72b25 --- /dev/null +++ b/src/cssds/cfg/motd.txt @@ -0,0 +1,18 @@ + +
++███╗ ███╗███████╗ ██████╗ █████╗ ███████╗████████╗██████╗ ██╗ ██╗ ██████╗████████╗██╗ ██╗██████╗ ███████╗ +████╗ ████║██╔════╝██╔════╝ ██╔══██╗██╔════╝╚══██╔══╝██╔══██╗██║ ██║██╔════╝╚══██╔══╝██║ ██║██╔══██╗██╔════╝ +██╔████╔██║█████╗ ██║ ███╗███████║███████╗ ██║ ██████╔╝██║ ██║██║ ██║ ██║ ██║██████╔╝█████╗ +██║╚██╔╝██║██╔══╝ ██║ ██║██╔══██║╚════██║ ██║ ██╔══██╗██║ ██║██║ ██║ ██║ ██║██╔══██╗██╔══╝ +██║ ╚═╝ ██║███████╗╚██████╔╝██║ ██║███████║ ██║ ██║ ██║╚██████╔╝╚██████╗ ██║ ╚██████╔╝██║ ██║███████╗ +╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ +███████╗██╗ ██╗██████╗ ███████╗ +██╔════╝██║ ██║██╔══██╗██╔════╝ +███████╗██║ ██║██████╔╝█████╗ +╚════██║██║ ██║██╔══██╗██╔══╝ +███████║╚██████╔╝██║ ██║██║ +╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ++ + diff --git a/src/cssds/run.sh b/src/cssds/run.sh index 4eed120..c36c620 100755 --- a/src/cssds/run.sh +++ b/src/cssds/run.sh @@ -69,21 +69,6 @@ install_surf() { echo "Installed SourceMod $SOURCEMOD_VERSION" echo "--------------------------------------------------------------" fi - # Install sm-json (required for JSON zone loading - pure SourcePawn library) - if [ ! -f "$CSTRIKE/addons/sourcemod/scripting/include/json.inc" ]; then - cd /tmp - wget "https://github.com/clugg/sm-json/archive/refs/tags/v5.0.1.zip" -O sm-json-v5.0.1.zip - unzip -o sm-json-v5.0.1.zip - cp -r sm-json-5.0.1/addons/* "$CSTRIKE/addons/" 2>/dev/null || true - rm -rf sm-json-v5.0.1.zip sm-json-5.0.1/ - echo "--------------------------------------------------------------" - echo "Installed sm-json v5.0.1" - echo "--------------------------------------------------------------" - else - echo "--------------------------------------------------------------" - echo "sm-json already installed" - echo "--------------------------------------------------------------" - fi # Install sm_closestpos (required for ghost/replay functionality) if [ ! -f "$CSTRIKE/addons/sourcemod/extensions/closestpos.ext.so" ]; then @@ -211,8 +196,8 @@ install_surf() { cd /tmp wget "https://github.com/jason-e/rngfix/releases/download/v1.1.3/rngfix_1.1.3.zip" unzip -o "rngfix_1.1.3.zip" - cp -r addons/* "$CSTRIKE/addons/" 2>/dev/null || true - rm -rf "rngfix_1.1.3.zip" addons/ + cp -r rngfix_1.1.3/* "$CSTRIKE/addons/sourcemod/" 2>/dev/null || true + rm -rf "rngfix_1.1.3.zip" rngfix_1.1.3/ echo "--------------------------------------------------------------" echo "Installed RNGFix v1.1.3" echo "--------------------------------------------------------------" @@ -451,6 +436,7 @@ EOF cfg() { cd cp src/cfg/server.cfg cssds/cstrike/cfg/ + cp src/cfg/motd.txt cssds/cstrike/ cp cfg/mapcycle.txt cssds/cstrike/cfg/ sed -i "s|sv_downloadurl .*|sv_downloadurl \"${FASTDL_URL:-}/cstrike/\"|" "$CSTRIKE/cfg/server.cfg" } @@ -513,6 +499,7 @@ run_cssds() { ./srcds_run -game cstrike \ -port "${SRCDS_PORT}" \ + +sv_setsteamaccount "${SRCDS_TOKEN}" \ +maxplayers "${SRCDS_MAXPLAYERS}" \ +map "$startmap" \ -ip "${SRCDS_IP}" diff --git a/src/mapsdl/mapsdl.ts b/src/mapsdl/mapsdl.ts index ad1b6f6..76dffcd 100644 --- a/src/mapsdl/mapsdl.ts +++ b/src/mapsdl/mapsdl.ts @@ -7,8 +7,17 @@ import { downloadAndExtractMaps, } from "./common.ts"; +function loadMapList(): string[] { + const listFile = Deno.env.get("MAPS_LIST_FILE"); + if (listFile) { + const text = Deno.readTextFileSync(listFile); + return text.split("\n").map(s => s.replace(/\/\/.*/, "").trim()).filter(Boolean); + } + return (Deno.env.get("MAPS_WISHLIST") || "").split("\n").map(s => s.trim()).filter(Boolean); +} + const CONFIG = { - maps: (Deno.env.get("MAPS_WISHLIST") || "").split("\n").map(s => s.trim()).filter(Boolean), + maps: loadMapList(), mapsDir: Deno.env.get("MAPS_DIR") || "/home/ntr/surf_megastructure/data/cssds/cstrike/maps", tempDir: Deno.env.get("TEMP_DIR") || "/tmp/mapsdl", serviceAccountPath: Deno.env.get("GOOGLE_APPLICATION_CREDENTIALS") || "./credentials/service-account.json",