This commit is contained in:
Nathan Rashleigh 2025-12-20 00:49:28 +11:00
parent b0d23c1dac
commit b223c3afd3
10 changed files with 247 additions and 18 deletions

28
.env
View File

@ -2,8 +2,28 @@ STEAMAPPID=232330
STEAMAPP=css
SRCDS_TOKEN=C02633B3395EA6BEF7D8DFBA440ABB7F
SRCDS_RCONPW="hahahahhaha"
SRCDS_PW="hahahahhaha"
SRCDS_STARTMAP="ctf_2fort"
SRCDS_RCONPW="lol"
SRCDS_PW="6"
SRCDS_STARTMAP="de_chateau"
SRCDS_HOSTNAME="megastructure surf"
SRCDS_SECURED=0
SRCDS_MAXPLAYERS=16
SRCDS_FPSMAX=300
SRCDS_TICKRATE=66
SRCDS_PORT=27015
SRCDS_TV_PORT=27020
SRCDS_CLIENT_PORT=27005
SRCDS_NET_PUBLIC_ADDRESS="0.0.0.0"
SRCDS_IP="0.0.0.0"
SRCDS_SECURED=1
# au
SRCDS_REGION=5
SRCDS_WORKSHOP_START_MAP=0
SRCDS_HOST_WORKSHOP_COLLECTION=0
SRCDS_WORKSHOP_AUTHKEY=""
SRCDS_CFG="server.cfg"
SRCDS_MAPCYCLE="mapcycle.txt"

View File

@ -2,16 +2,16 @@ build-css:
docker build -f css/css.dockerfile css/ -t megastructure/css
up:
docker compose -f surf.yaml up --remove-orphans
docker compose up --remove-orphans
down:
docker compose -f surf.yaml down -v --remove-orphans
docker compose down -v --remove-orphans
build:
docker compose -f surf.yaml build
docker compose build
cssds-run:
docker compose -f surf.yaml run -it cssds bash
docker compose run -u root -it cssds bash
cssds-exec:
docker compose -f surf.yaml exec -it cssds bash
docker compose exec -u root -it cssds bash

View File

@ -0,0 +1,4 @@
//This file re-enables a server from "war mode" by unlocking plugin loading
//and refreshing the plugins list.
sm plugins load_unlock
sm plugins refresh

View File

@ -0,0 +1,10 @@
//This file unloads all plugins, re-loads a few "safe" ones, and then prevents
//any more plugins from being loaded.
sm plugins unload_all
sm plugins load_unlock
sm plugins load basebans.smx
sm plugins load basecommands.smx
sm plugins load admin-flatfile.smx
sm plugins load adminhelp.smx
sm plugins load adminmenu.smx
sm plugins load_lock

View File

@ -0,0 +1,138 @@
// SourceMod Configuration File
// This file is automatically executed by SourceMod every mapchange.
// Specifies how admin activity should be relayed to users. Add up the values
// below to get the functionality you want.
// 1: Show admin activity to non-admins anonymously.
// 2: If 1 is specified, admin names will be shown.
// 4: Show admin activity to admins anonymously.
// 8: If 4 is specified, admin names will be shown.
// 16: Always show admin names to root users.
// --
// Default: 13 (1+4+8)
sm_show_activity 13
// Specifies whether menu sounds are enabled for menus created by SourceMod.
// Menu sounds can be further configured in addons/sourcemod/configs/core.cfg.
// --
// Default: 1
sm_menu_sounds 1
// Specifies how long of a delay, in seconds, should be used in between votes
// that are "public" or can be spammed. Whether or not this delay is obeyed
// is dependent on the menu/command.
// --
// Default: 30
sm_vote_delay 30
// Default datetime formatting rules when displaying to clients.
// For full options, see: http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html
// --
// Default: %m/%d/%Y - %H:%M:%S
// 12 hour format: %m/%d/%Y - %I:%M:%S %p
sm_datetime_format "%m/%d/%Y - %H:%M:%S"
// Sets how SourceMod should check immunity levels when administrators target
// each other.
// 0: Ignore immunity levels (except for specific group immunities).
// 1: Protect from admins of lower access only.
// 2: Protect from admins of equal to or lower access.
// 3: Same as 2, except admins with no immunity can affect each other.
// --
// Default: 1
sm_immunity_mode 1
// Sets how many seconds SourceMod should adjust time values for incorrect
// server clocks. This can be positive or negative and will affect every
// system time in SourceMod, including logging stamps.
// --
// Default: 0
sm_time_adjustment 0
// Specifies the amount of time that is allowed between chat messages. This
// includes the say and say_team commands. If a client sends a message faster
// than this time, they receive a flood token. When the client has accumulated
// 3 or more tokens, a warning message is shown instead of the chat message.
// --
// Requires: antiflood.smx
// Default: 0.75
sm_flood_time 0.75
// Specifies how the reserved slots plugin operates. Valid values are:
// 0 : Public slots are used in preference to reserved slots. Reserved slots are freed before public slots.
// 1 : If someone with reserve access joins into a reserved slot, the player with the highest latency and
// no reserved slot access (spectator players are selected first) is kicked to make room. Thus, the reserved
// slots always remains free. The only situation where the reserved slot(s) can become properly occupied is
// if the server is full with reserve slot access clients.
// 2 : The same as sm_reserve_type 1 except once a certain number of admins have been reached, the reserve slot
// stops kicking people and anyone can join to fill the server. You can use this to simulate having a large
// number of reserved slots with sm_reserve_type 0 but with only need to have 1 slot unavailable when there are
// less admins connected.
// --
// Requires: reservedslots.smx
// Default: 0
sm_reserve_type 0
// Specifies the number of reserved player slots. Users with the reservation
// admin flag set will be able to join the server when there are no public slots
// remaining. If someone does not have this flag, they will be kicked.
// (Public slots are defined as: maxplayers - number of reserved slots)
// --
// Requires: reservedslots.smx
// Default: 0
sm_reserved_slots 0
// Specifies whether or not reserved slots will be hidden (subtracted from max
// slot count). Valid values are 0 (Visible) or 1 (Hidden).
// --
// Requires: reservedslots.smx
// Default: 0
sm_hide_slots 0
// Specifies whether or not non-admins can send messages to admins using
// say_team @<message>. Valid values are 0 (Disabled) or 1 (Enabled)
// --
// Requires: basechat.smx
// Default: 1
sm_chat_mode 1
// Specifies whether or not "timeleft" will automatically be triggered every
// x seconds. Valid values are 0 (Disabled) to 1800 seconds.
// --
// Requires: basetriggers.smx
// Default: 0
sm_timeleft_interval 0
// Specifies whether or not chat triggers are broadcast to the server or just
// the player who requested the info trigger. Valid values are 0 (Disabled) or
// 1 (Enabled)
// --
// Requires: basetriggers.smx
// Default: 0
sm_trigger_show 0
// Specifies whether or not to display vote progress to clients in the
// "hint" box (near the bottom of the screen in most games).
// Valid values are 0 (Disabled) or 1 (Enabled).
// --
// Default: 0
sm_vote_progress_hintbox 0
// Specifies whether or not to display vote progress to clients in the
// chat area. Valid values are 0 (Disabled) or 1 (Enabled).
// --
// Default: 0
sm_vote_progress_chat 0
// Specifies whether or not to display vote progress in the server console.
// Valid values are 0 (Disabled) or 1 (Enabled).
// --
// Default: 0
sm_vote_progress_console 0
// Specifies whether or not to display vote progress to clients in the
// client console. Valid values are 0 (Disabled) or 1 (Enabled).
// --
// Default: 0
sm_vote_progress_client_console 0

View File

@ -1,4 +1,4 @@
FROM cm2network/steamcmd:root AS build
FROM cm2network/steamcmd AS build
LABEL maintainer="ntr@megastructure.games"
EXPOSE 27015/tcp \
@ -7,7 +7,16 @@ EXPOSE 27015/tcp \
USER root
RUN apt-get update
RUN apt-get install -y wget
RUN apt-get install -y \
wget \
ca-certificates \
zlib1g \
lib32gcc-s1 \
libncurses5 \
libbz2-1.0 \
libtinfo5 \
libcurl3-gnutls \
rcon
ENV CSSDS="/home/steam/cssds"
ENV TF2DS="/home/steam/tf2ds"

View File

@ -28,6 +28,8 @@ sv_lan 0
// Collect CPU usage stats
sv_stats 1
sv_lan 1
// Execute Banned Users //

20
cssds/etc/filter.py Executable file
View File

@ -0,0 +1,20 @@
n = [1, 0, 0, 5, 10]
# can't do this like in js, rust, c#...
# loooong = o
# .filter()
# .map(o => 'l' + 'o' * o + 'ng')
# .collect() # maybe
# or this
# ['l' + 'o' * o + 'ng' for o in filter(n)]
# must be
loooong = ['l' + 'o' * o + 'ng' for o in filter(None, n)]
# loooong = ['l' + 'o' * o if o else "???" + 'ng' for o in n]
print(loooong)
if cats := len(loooong):
print(f"got {cats} long cats")

34
cssds/etc/run.sh Normal file → Executable file
View File

@ -2,6 +2,8 @@
set -uxe
SERVER_SECURITY_FLAG=""
update_cssds() {
cd $STEAMCMD
./steamcmd.sh +runscript "$HOME/etc/update_cssds.txt"
@ -54,7 +56,7 @@ symlink_binaries() {
for file in *_srv.so; do
echo "Symlinking \"$file\" to \"${file/_srv/}"
ln -s "$file" "${file/_srv/}"
ln -nfs "$file" "${file/_srv/}"
done
}
@ -72,20 +74,40 @@ steamclient_binary() {
}
run_cssds() {
if [ "$SRCDS_SECURED" -eq 0 ]; then
SERVER_SECURITY_FLAG="-insecure";
fi
echo "ready to run"
cd "$CSSDS"
./srcds_run_64 -game cstrike +map de_dust2 -debug
# ./srcds_run -game cstrike +map de_dust2 -debug
# +sv_setsteamaccount "${SRCDS_TOKEN}" \
# +tv_port "${SRCDS_TV_PORT}" \
# +clientport "${SRCDS_CLIENT_PORT}" \
# +rcon_password "${SRCDS_RCONPW}" \
# +sv_password "${SRCDS_PW}" \
# +sv_region "${SRCDS_REGION}" \
# +fps_max "${SRCDS_FPSMAX}" \
${SERVER_SECURITY_FLAG}
./srcds_run_64 -game cstrike \
-tickrate "${SRCDS_TICKRATE}" \
-port "${SRCDS_PORT}" \
+maxplayers "${SRCDS_MAXPLAYERS}" \
+map "${SRCDS_STARTMAP}" \
-ip "${SRCDS_IP}" \
-sv_lan 1
}
main() {
update_cssds
update_tf2ds
# update_cssds
# update_tf2ds
copy_64bit
symlink_binaries
steamclient_binary
install_metamod
install_sourcemod
# install_metamod
# install_sourcemod
run_cssds
}

View File

@ -9,7 +9,11 @@ services:
env_file:
- .env
# command: sleep 5000000
command: sleep 5000000
ports:
- "27015:27015"
- "27020:27020"
volumes:
- ./cssds/etc:/home/steam/etc