sql and zones working

This commit is contained in:
Nathan Rashleigh 2025-12-20 16:45:46 +11:00
parent b223c3afd3
commit 4dbaaf1ec5
22 changed files with 144 additions and 818 deletions

10
.env
View File

@ -5,7 +5,7 @@ SRCDS_TOKEN=C02633B3395EA6BEF7D8DFBA440ABB7F
SRCDS_RCONPW="lol" SRCDS_RCONPW="lol"
SRCDS_PW="6" SRCDS_PW="6"
SRCDS_STARTMAP="de_chateau" SRCDS_STARTMAP="surf_boreas"
SRCDS_HOSTNAME="megastructure surf" SRCDS_HOSTNAME="megastructure surf"
SRCDS_MAXPLAYERS=16 SRCDS_MAXPLAYERS=16
@ -27,3 +27,11 @@ SRCDS_HOST_WORKSHOP_COLLECTION=0
SRCDS_WORKSHOP_AUTHKEY="" SRCDS_WORKSHOP_AUTHKEY=""
SRCDS_CFG="server.cfg" SRCDS_CFG="server.cfg"
SRCDS_MAPCYCLE="mapcycle.txt" SRCDS_MAPCYCLE="mapcycle.txt"
# ----------
# mariadb
MARIADB_ROOT_PASSWORD="surfsup"
MARIADB_DATABASE="influx"
MARIADB_USER="influx"
MARIADB_PASSWORD="righteous"

2
CREDITS.md Normal file
View File

@ -0,0 +1,2 @@
- https://github.com/noillt/surf-map-zones
-

7
README.md Normal file
View File

@ -0,0 +1,7 @@
# megastructure.surf
## todo
- fastdl
- influx
- psql
- momfix?

View File

@ -1,4 +0,0 @@
//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

@ -1,10 +0,0 @@
//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

@ -1,138 +0,0 @@
// 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,26 +0,0 @@
// Default mapcycle file for Counter-Strike.
//
// DO NOT MODIFY THIS FILE!
// Instead, copy it to mapcycle.txt and modify that file. If no custom mapcycle.txt file is found,
// this file will be used as the default.
//
// Also, note that the "mapcyclefile" convar can be used to specify a particular mapcycle file.
cs_italy
de_dust
de_aztec
de_cbble
cs_office
de_chateau
de_dust2
de_piranesi
cs_havana
de_prodigy
cs_compound
de_train
de_tides
de_port
de_inferno
cs_assault
de_nuke
cs_militia

View File

@ -1,26 +0,0 @@
// Default mapcycle file for Counter-Strike.
//
// DO NOT MODIFY THIS FILE!
// Instead, copy it to mapcycle.txt and modify that file. If no custom mapcycle.txt file is found,
// this file will be used as the default.
//
// Also, note that the "mapcyclefile" convar can be used to specify a particular mapcycle file.
cs_italy
de_dust
de_aztec
de_cbble
cs_office
de_chateau
de_dust2
de_piranesi
cs_havana
de_prodigy
cs_compound
de_train
de_tides
de_port
de_inferno
cs_assault
de_nuke
cs_militia

View File

@ -1,197 +0,0 @@
// General Settings //
// Hostname for server.
hostname "New "css" Server"
// Overrides the max players reported to prospective clients
sv_visiblemaxplayers 24
// Maximum number of rounds to play before server changes maps
mp_maxrounds 5
// Set to lock per-frame time elapse
host_framerate 0
// Set the pause state of the server
setpause 0
// Control where the client gets content from
// 0 = anywhere, 1 = anywhere listed in white list, 2 = steam official content only
sv_pure 0
// Is the server pausable
sv_pausable 0
// Type of server 0=internet 1=lan
sv_lan 0
// Collect CPU usage stats
sv_stats 1
sv_lan 1
// Execute Banned Users //
exec banned_user.cfg
exec banned_ip.cfg
writeid
writeip
// Contact & Region //
// Contact email for server sysop
sv_contact test@example.com
// The region of the world to report this server in.
// -1 is the world, 0 is USA east coast, 1 is USA west coast
// 2 south america, 3 europe, 4 asia, 5 australia, 6 middle east, 7 africa
sv_region -1
// Rcon Settings //
// Password for rcon authentication (Remote CONtrol)
rcon_password changeme
// Number of minutes to ban users who fail rcon authentication
sv_rcon_banpenalty 1440
// Max number of times a user can fail rcon authentication before being banned
sv_rcon_maxfailures 5
// Log Settings //
// Enables logging to file, console, and udp < on | off >.
log on
// Log server information to only one file.
sv_log_onefile 0
// Log server information in the log file.
sv_logfile 1
// Log server bans in the server logs.
sv_logbans 1
// Echo log information to the console.
sv_logecho 1
// Rate Settings //
// Frame rate limiter
fps_max 600
// Min bandwidth rate allowed on server, 0 == unlimited
sv_minrate 0
// Max bandwidth rate allowed on server, 0 == unlimited
sv_maxrate 20000
// Minimum updates per second that the server will allow
sv_minupdaterate 66
// Maximum updates per second that the server will allow
sv_maxupdaterate 66
// Download Settings //
// Allow clients to upload customizations files
sv_allowupload 1
// Allow clients to download files
sv_allowdownload 1
// Maximum allowed file size for uploading in MB
net_maxfilesize 15
// Team Balancing //
// Enable team balancing
mp_autoteambalance 1
// Time after the teams become unbalanced to attempt to switch players.
mp_autoteambalance_delay 60
// Time after the teams become unbalanced to print a balance warning
mp_autoteambalance_warning_delay 30
// Teams are unbalanced when one team has this many more players than the other team. (0 disables check)
mp_teams_unbalance_limit 1
// Round and Game Times //
// Enable timers to wait between rounds. WARNING: Setting this to 0 has been known to cause a bug with setup times lasting 5:20 (5 minutes 20 seconds) on some servers!
mp_enableroundwaittime 1
// Time after round win until round restarts
mp_bonusroundtime 8
// If non-zero, the current round will restart in the specified number of seconds
mp_restartround 0
// Enable sudden death
mp_stalemate_enable 1
// Timelimit (in seconds) of the stalemate round.
mp_stalemate_timelimit 300
// Game time per map in minutes
mp_timelimit 35
// Client CVars //
// Restricts spectator modes for dead players
mp_forcecamera 0
// Toggles whether the server allows spectator mode or not
mp_allowspectators 1
// Toggles footstep sounds
mp_footsteps 1
// Toggles game cheats
sv_cheats 0
// After this many seconds without a message from a client, the client is dropped
sv_timeout 900
// Maximum time a player is allowed to be idle (in minutes), made this and sv_timeout equal same time?
mp_idlemaxtime 15
// Deals with idle players 1=send to spectator 2=kick
mp_idledealmethod 2
// Time (seconds) between decal sprays
decalfrequency 30
// Communications //
// enable voice communications
sv_voiceenable 1
// Players can hear all other players, no team restrictions 0=off 1=on
sv_alltalk 0
// Amount of time players can chat after the game is over
mp_chattime 10
// Enable party mode
tf_birthday 0

View File

@ -1,4 +0,0 @@
//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

@ -1,10 +0,0 @@
//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

@ -1,138 +0,0 @@
// 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,164 +0,0 @@
#!/usr/bin/bash
set -o nounset
set -o errtrace
set -o pipefail
set -e
IFS=$'\n\t'
ME="$(basename "${0}")"
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
export SCRIPT_DIR=${SCRIPT_DIR%/*}
usage() {
cat <<HEREDOC
██████╗ ██╗ ██╗██████╗ ███████╗██████╗ ███████╗
██╔════╝ ██║ ██║██╔══██╗██╔════╝██╔══██╗██╔════╝
███████╗ ███████║██████╔╝███████╗██║ ██║███████╗
██╔═══██╗╚════██║██╔══██╗╚════██║██║ ██║╚════██║
╚██████╔╝ ██║██████╔╝███████║██████╔╝███████║
╚═════╝ ╚═╝╚═════╝ ╚══════╝╚═════╝ ╚══════╝
Quick installation of 64-bit Source Dedicated Server
Requirements: libncurses5 libncurses5:i386 lib32z1
Usage:
./${ME} <css/dods/hl2dm/hldm>
HEREDOC
}
if [ $# -ne 1 ]; then
usage
exit 1
else
case "$1" in
css|dods|hl2dm|hldm)
GAMESERVER=$1
;;
*)
usage
exit 1
;;
esac
fi
STEAMCMDBIN="/usr/games/steamcmd"
TF2DIR="$HOME/tf2-serverfiles"
DSDIR=""
prepare() {
DSDIR="$HOME/$GAMESERVER-serverfiles"
# Check if steamcmd installed and/or accessible
if command -v steamcmd >/dev/null 2&>1; then
STEAMCMDBIN=$(command -v steamcmd)
elif result=$(find "$HOME" -type f -name 'steamcmd' 2>/dev/null | head -n 1) && [ -n "$result" ]; then
STEAMCMDBIN="$result"
else
echo "SteamCMD not found. Please install following this guide: https://developer.valvesoftware.com/wiki/SteamCMD#Linux"
exit 1
fi
echo "SteamCMD found at $STEAMCMDBIN. Continuing..."
}
fetch_server_files() {
echo "Starting installation of $GAMESERVER dedicated server!"
# Update steamcmd-scripts to correct home dir
echo "Confirm steamcmd scripts are correct..."
for _steamcmdscriptfile in $SCRIPT_DIR/steamcmd-scripts/*; do
sed -i "s#/home/server/#/home/${USER}/#g" "$_steamcmdscriptfile"
done
if [ -d "$DSDIR" ]; then
echo "$DSDIR already contains files. Exiting..."
exit 1;
fi
echo "Starting to download server files using steamcmd"
# Fetch required game server and tf2 server files
"$STEAMCMDBIN" +runscript "$HOME/steamcmd-scripts/update_${GAMESERVER}_ds.txt" && \
echo "$DSDIR successfully downloaded!"
if [ -d "$TF2DIR" ]; then
echo "$TF2DIR already contains files. Validating..."
fi
"$STEAMCMDBIN" +runscript "$HOME/steamcmd-scripts/update_tf2_ds.txt" && \
echo "$TF2DIR successfully downloaded!"
}
copy_64bit() {
echo "Copying libsteam_api.so..."
cp -a "$TF2DIR/bin/linux64/libsteam_api.so" \
"$DSDIR/bin/linux64/."
echo "Copying srcds binaries..."
cp -a "$HOME/tf2-serverfiles/srcds_linux64" "$HOME/tf2-serverfiles/srcds_run_64" \
"$DSDIR/."
}
remove_tf2() {
echo "Removing $TF2DIR..."
[ -f "$DSDIR/srcds_linux64" ] && rm -r "$HOME/tf2-serverfiles" || \
# You should never see this message
echo "$DSDIR is missing 64-bit binaries. Cannot remove tf2-serverfiles"
}
symlink_binaries() {
cd "$DSDIR/bin/linux64"
for file in *_srv.so; do
echo "Symlinking \"$file\" to \"${file/_srv/}"
ln -s "$file" "${file/_srv/}"
done
}
steamclient_binary() {
echo "Looking for steamclient.so and symlinking it..."
local _steamclient64bit=$(find "$HOME" -type f -name 'steamclient.so' | grep "linux64" | head -n 1)
if [ ! -n $_steamclient64bit ]; then
echo "Could not locate 64-bit steamclient.so binary. Exiting..."
exit 1
fi
mkdir -p "$HOME/.steam/sdk64/" # srcds_linux64 looks for steamclient.so in this directory
ln -sf "$_steamclient64bit" "$HOME/.steam/sdk64/steamclient.so"
ln -sf "$_steamclient64bit" "$DSDIR/bin/linux64/steamclient.so"
}
main() {
prepare
fetch_server_files
copy_64bit
remove_tf2
symlink_binaries
steamclient_binary
SRCDSGAME=""
case "$GAMESERVER" in
css) SRCDSGAME="cstrike"; SRCDSMAP="de_dust2";;
dods) SRCDSGAME="dod"; SRCDSMAP="dod_anzio";;
hl2dm) SRCDSGAME="hl2mp"; SRCDSMAP="dm_lockdown";;
hldm) SRCDSGAME="hl1mp"; SRCDSMAP="crossfire";;
*) ;;
esac
cat <<SUCESSMSG
# --------------------------------------------------- #
Successfully installed $GAMESERVER dedicated server
to $DSDIR!
Confirm the server starts and runs without issue:
$ cd $DSDIR
$ ./srcds_run_64 -game $SRCDSGAME +map $SRCDSMAP -debug
# --------------------------------------------------- #
SUCESSMSG
}
main "$@"

View File

@ -1,51 +0,0 @@
#!/bin/bash
set -eux
# Are we in a metamod container and is the metamod folder missing?
if [ ! -z "$METAMOD_VERSION" ] && [ ! -d "${STEAMAPPDIR}/${STEAMAPP}/addons/metamod" ]; then
LATESTMM=$(wget -qO- https://mms.alliedmods.net/mmsdrop/"${METAMOD_VERSION}"/mmsource-latest-linux)
wget -qO- https://mms.alliedmods.net/mmsdrop/"${METAMOD_VERSION}"/"${LATESTMM}" | tar xvzf - -C "${STEAMAPPDIR}/${STEAMAPP}"
fi
# Are we in a sourcemod container and is the sourcemod folder missing?
if [ ! -z "$SOURCEMOD_VERSION" ] && [ ! -d "${STEAMAPPDIR}/${STEAMAPP}/addons/sourcemod" ]; then
LATESTSM=$(wget -qO- https://sm.alliedmods.net/smdrop/"${SOURCEMOD_VERSION}"/sourcemod-latest-linux)
wget -qO- https://sm.alliedmods.net/smdrop/"${SOURCEMOD_VERSION}"/"${LATESTSM}" | tar xvzf - -C "${STEAMAPPDIR}/${STEAMAPP}"
fi
# Is the config missing?
if [ -f "${STEAMAPPDIR}/${STEAMAPP}/cfg/server.cfg" ]; then
# Change hostname on first launch (you can comment this out if it has done its purpose)
sed -i -e 's/{{SERVER_HOSTNAME}}/'"${SRCDS_HOSTNAME}"'/g' "${STEAMAPPDIR}/${STEAMAPP}/cfg/server.cfg"
fi
# Believe it or not, if you don't do this srcds_run shits itself
cd "${STEAMAPPDIR}"
SERVER_SECURITY_FLAG="";
if [ "$SRCDS_SECURED" -eq 0 ]; then
SERVER_SECURITY_FLAG="-insecure";
fi
bash "${STEAMAPPDIR}/srcds_run_64" -game "${STEAMAPP}" -console -autoupdate \
-steam_dir "${STEAMCMDDIR}" \
-steamcmd_script "${HOMEDIR}/${STEAMAPP}_update.txt" \
-usercon \
+fps_max "${SRCDS_FPSMAX}" \
-tickrate "${SRCDS_TICKRATE}" \
-port "${SRCDS_PORT}" \
+tv_port "${SRCDS_TV_PORT}" \
+clientport "${SRCDS_CLIENT_PORT}" \
+maxplayers "${SRCDS_MAXPLAYERS}" \
+map "${SRCDS_STARTMAP}" \
+sv_setsteamaccount "${SRCDS_TOKEN}" \
+rcon_password "${SRCDS_RCONPW}" \
+sv_password "${SRCDS_PW}" \
+sv_region "${SRCDS_REGION}" \
-ip "${SRCDS_IP}" \
-authkey "${SRCDS_WORKSHOP_AUTHKEY}" \
+servercfgfile "${SRCDS_CFG}" \
+mapcyclefile "${SRCDS_MAPCYCLE}" \
${SERVER_SECURITY_FLAG}

View File

@ -1,20 +0,0 @@
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")

View File

@ -4,7 +4,9 @@ services:
build: build:
dockerfile: cssds.dockerfile dockerfile: cssds.dockerfile
context: ./cssds context: ./etc
user: "1000:1000"
env_file: env_file:
- .env - .env
@ -13,13 +15,24 @@ services:
ports: ports:
- "27015:27015" - "27015:27015"
- "27015:27015/udp"
- "27020:27020" - "27020:27020"
volumes: volumes:
- ./cssds/etc:/home/steam/etc - ./etc:/home/steam/etc
- cssds:/home/steam/cssds - ./data/cssds:/home/steam/cssds
- tf2ds:/home/steam/tf2ds - tf2ds:/home/steam/tf2ds
db:
image: mariadb:12
restart: always
ports:
- "3306:3306"
env_file:
- .env
volumes:
- ./etc/mariadb/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
volumes: volumes:
tf2ds: tf2ds:
cssds:

66
etc/cfg/server.cfg Normal file
View File

@ -0,0 +1,66 @@
hostname "megastructure.surf"
// surf specific
sv_accelerate 10
sv_airaccelerate 800
mp_falldamage 0
sv_enablebunnyhopping 1
sv_autobunnyhopping 1
sv_staminamax 0
sv_staminajumpcost 0
sv_staminalandcost 0
sv_staminarecoveryrate 0
sv_accelerate_use_weapon_speed 0
// server stuff
sv_visiblemaxplayers 24
mp_maxrounds 1
host_framerate 0
setpause 0
sv_pure 0
sv_pausable 0
sv_lan 0
sv_stats 1
// Execute Banned Users //
exec banned_user.cfg
exec banned_ip.cfg
writeid
writeip
// Contact & Region //
sv_contact ntr@megastructure.games
sv_region 5
// Rcon Settings //
rcon_password changeme
sv_rcon_banpenalty 1440
sv_rcon_maxfailures 5
// Log Settings //
log on
sv_log_onefile 0
sv_logfile 1
sv_logbans 1
sv_logecho 1
// Rate Settings //
fps_max 600
sv_minrate 0
sv_maxrate 20000
sv_minupdaterate 66
sv_maxupdaterate 66
// Download Settings //
sv_allowupload 1
sv_allowdownload 1
net_maxfilesize 500
sv_cheats 0
sv_timeout 900
mp_idlemaxtime 60
mp_idledealmethod 2
// Communications //
sv_voiceenable 1
sv_alltalk 0

View File

@ -16,6 +16,7 @@ RUN apt-get install -y \
libbz2-1.0 \ libbz2-1.0 \
libtinfo5 \ libtinfo5 \
libcurl3-gnutls \ libcurl3-gnutls \
unzip \
rcon rcon
ENV CSSDS="/home/steam/cssds" ENV CSSDS="/home/steam/cssds"
@ -37,5 +38,5 @@ WORKDIR /home/steam
ENV METAMOD_VERSION 1.12 ENV METAMOD_VERSION 1.12
ENV SOURCEMOD_VERSION 1.12 ENV SOURCEMOD_VERSION 1.12
COPY etc /home/steam/etc COPY . /home/steam/etc
CMD ["bash", "./etc/run.sh"] CMD ["bash", "./etc/run.sh"]

1
etc/mariadb/mariadb.cnf Normal file
View File

@ -0,0 +1 @@
/etc/mysql/conf.d/

View File

@ -2,7 +2,7 @@
set -uxe set -uxe
SERVER_SECURITY_FLAG="" CSTRIKE="$CSSDS/cstrike"
update_cssds() { update_cssds() {
cd $STEAMCMD cd $STEAMCMD
@ -24,9 +24,9 @@ update_tf2ds() {
install_metamod() { install_metamod() {
# is the metamod folder missing? # is the metamod folder missing?
if [ ! -d "$CSSDS/addons/metamod" ]; then if [ ! -d "$CSTRIKE/addons/metamod" ]; then
LATESTMM=$(wget -qO- https://mms.alliedmods.net/mmsdrop/"${METAMOD_VERSION}"/mmsource-latest-linux) LATESTMM=$(wget -qO- https://mms.alliedmods.net/mmsdrop/"${METAMOD_VERSION}"/mmsource-latest-linux)
wget -qO- https://mms.alliedmods.net/mmsdrop/"${METAMOD_VERSION}"/"${LATESTMM}" | tar xvzf - -C "$CSSDS" wget -qO- https://mms.alliedmods.net/mmsdrop/"${METAMOD_VERSION}"/"${LATESTMM}" | tar xvzf - -C "$CSTRIKE"
echo "--------------------------------------------------------------" echo "--------------------------------------------------------------"
echo "Installed MetaMod $METAMOD_VERSION" echo "Installed MetaMod $METAMOD_VERSION"
echo "--------------------------------------------------------------" echo "--------------------------------------------------------------"
@ -35,15 +35,38 @@ install_metamod() {
install_sourcemod() { install_sourcemod() {
# Are we in a sourcemod container and is the sourcemod folder missing? # Are we in a sourcemod container and is the sourcemod folder missing?
if [ ! -d "$CSSDS/addons/sourcemod" ]; then if [ ! -d "$CSTRIKE/addons/sourcemod" ]; then
LATESTSM=$(wget -qO- https://sm.alliedmods.net/smdrop/"${SOURCEMOD_VERSION}"/sourcemod-latest-linux) LATESTSM=$(wget -qO- https://sm.alliedmods.net/smdrop/"${SOURCEMOD_VERSION}"/sourcemod-latest-linux)
wget -qO- https://sm.alliedmods.net/smdrop/"${SOURCEMOD_VERSION}"/"${LATESTSM}" | tar xvzf - -C "$CSSDS" wget -qO- https://sm.alliedmods.net/smdrop/"${SOURCEMOD_VERSION}"/"${LATESTSM}" | tar xvzf - -C "$CSTRIKE"
echo "--------------------------------------------------------------" echo "--------------------------------------------------------------"
echo "Installed SourceMod $SOURCEMOD_VERSION" echo "Installed SourceMod $SOURCEMOD_VERSION"
echo "--------------------------------------------------------------" echo "--------------------------------------------------------------"
fi fi
} }
install_surf() {
cd $CSTRIKE
if [ ! -d "$CSTRIKE/cfg/influx" ]; then
wget "https://influxtimer.com/dl/influx_2_surf.zip"
unzip "influx_2_surf.zip"
rm "influx_2_surf.zip"
echo "--------------------------------------------------------------"
echo "Installed InfluxTimer"
echo "--------------------------------------------------------------"
fi
if [ ! -d "$CSTRIKE/addons/sourcemod/scripting/momsurffix" ]; then
wget "https://influxtimer.com/dl/influx_2_surf.zip"
wget "https://github.com/GAMMACASE/MomSurfFix/releases/download/1.1.5/MomSurfFix2v1.1.5.zip"
unzip "MomSurfFix2v1.1.5.zip"
rm "MomSurfFix2v1.1.5.zip"
echo "--------------------------------------------------------------"
echo "Installed MomSurfFix2v1.1.5"
echo "--------------------------------------------------------------"
fi
}
copy_64bit() { copy_64bit() {
cp -a "$TF2DS/bin/linux64/libsteam_api.so" \ cp -a "$TF2DS/bin/linux64/libsteam_api.so" \
"$CSSDS/bin/linux64/." "$CSSDS/bin/linux64/."
@ -73,30 +96,21 @@ steamclient_binary() {
ln -nfs "$_steamclient64bit" "$CSSDS/bin/linux64/steamclient.so" ln -nfs "$_steamclient64bit" "$CSSDS/bin/linux64/steamclient.so"
} }
run_cssds() { cfg() {
if [ "$SRCDS_SECURED" -eq 0 ]; then cd
SERVER_SECURITY_FLAG="-insecure"; cp etc/cfg/server.cfg cssds/cstrike/cfg/
fi }
run_cssds() {
echo "ready to run" echo "ready to run"
cd "$CSSDS" cd "$CSSDS"
# ./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 \ ./srcds_run_64 -game cstrike \
-tickrate "${SRCDS_TICKRATE}" \
-port "${SRCDS_PORT}" \ -port "${SRCDS_PORT}" \
+maxplayers "${SRCDS_MAXPLAYERS}" \ +maxplayers "${SRCDS_MAXPLAYERS}" \
+map "${SRCDS_STARTMAP}" \ +map "${SRCDS_STARTMAP}"
-ip "${SRCDS_IP}" \ # -ip "${SRCDS_IP}"
-sv_lan 1
} }
main() { main() {
@ -106,9 +120,11 @@ main() {
symlink_binaries symlink_binaries
steamclient_binary steamclient_binary
# install_metamod install_metamod
# install_sourcemod install_sourcemod
install_surf
cfg
run_cssds run_cssds
} }