Просмотр исходного кода

feat(tf2c): add Team Fortress 2 Classified server (#4898)

Daniel Gibbs 1 месяц назад
Родитель
Сommit
0b7aa627c5

+ 197 - 0
lgsm/config-default/config-lgsm/tf2cserver/_default.cfg

@@ -0,0 +1,197 @@
+##################################
+######## Default Settings ########
+##################################
+# DO NOT EDIT, ANY CHANGES WILL BE OVERWRITTEN!
+# Copy settings from here and use them in either:
+# common.cfg - applies settings to every instance.
+# [instance].cfg - applies settings to a specific instance.
+
+#### Game Server Settings ####
+
+## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters
+# Note that for TF2, maxplayers > 33 must be specified like so:
+# maxplayers="101 -unrestricted_maxplayers"
+ip="0.0.0.0"
+port="27015"
+clientport="27005"
+sourcetvport="27020"
+defaultmap="4koth_frigid"
+maxplayers="16"
+
+## Game Server Login Token (GSLT): Optional
+# GSLT can be used for running a public server.
+# More info: https://docs.linuxgsm.com/steamcmd/gslt
+gslt=""
+
+## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
+startparameters="-game tf2classified -tf_path ${supportdir} -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +sv_setsteamaccount ${gslt} +servercfgfile ${servercfg} -maxplayers ${maxplayers}"
+
+#### LinuxGSM Settings ####
+
+## LinuxGSM Stats
+# Send useful stats to LinuxGSM developers.
+# https://docs.linuxgsm.com/configuration/linuxgsm-stats
+# (on|off)
+stats="off"
+
+## Notification Alerts
+# (on|off)
+
+# Display IP | https://docs.linuxgsm.com/alerts#display-ip
+displayip=""
+
+# More info | https://docs.linuxgsm.com/alerts#more-info
+postalert="off"
+
+# Alert on Start/Stop/Restart
+statusalert="off"
+
+# Discord Alerts | https://docs.linuxgsm.com/alerts/discord
+discordalert="off"
+discordwebhook="webhook"
+
+# Email Alerts | https://docs.linuxgsm.com/alerts/email
+emailalert="off"
+email="email@example.com"
+emailfrom=""
+
+# Gotify Alerts | https://docs.linuxgsm.com/alerts/gotify
+gotifyalert="off"
+gotifytoken="token"
+gotifywebhook="webhook"
+
+# IFTTT Alerts | https://docs.linuxgsm.com/alerts/ifttt
+iftttalert="off"
+ifttttoken="accesstoken"
+iftttevent="linuxgsm_alert"
+
+# Pushbullet Alerts | https://docs.linuxgsm.com/alerts/pushbullet
+pushbulletalert="off"
+pushbullettoken="accesstoken"
+channeltag=""
+
+# Pushover Alerts | https://docs.linuxgsm.com/alerts/pushover
+pushoveralert="off"
+pushovertoken="accesstoken"
+pushoveruserkey="userkey"
+
+# Rocket.Chat Alerts | https://docs.linuxgsm.com/alerts/rocket.chat
+rocketchatalert="off"
+rocketchatwebhook="webhook"
+
+# Slack Alerts | https://docs.linuxgsm.com/alerts/slack
+slackalert="off"
+slackwebhook="webhook"
+
+# Telegram Alerts | https://docs.linuxgsm.com/alerts/telegram
+# You can add a custom cURL string eg proxy (useful in Russia) in "curlcustomstring".
+# For example "--socks5 ipaddr:port" for socks5 proxy see more in "curl --help all".
+telegramapi="api.telegram.org"
+telegramalert="off"
+telegramtoken="accesstoken"
+telegramchatid=""
+telegramthreadid=""
+telegramsilentnotification="false"
+curlcustomstring=""
+
+## Updating | https://docs.linuxgsm.com/commands/update
+updateonstart="off"
+
+## Backup | https://docs.linuxgsm.com/commands/backup
+maxbackups="4"
+maxbackupdays="30"
+stoponbackup="on"
+
+## Logging | https://docs.linuxgsm.com/features/logging
+consolelogging="on"
+logdays="7"
+
+## Monitor | https://docs.linuxgsm.com/commands/monitor
+# Query delay time
+querydelay="1"
+
+## ANSI Colors | https://docs.linuxgsm.com/features/ansi-colors
+ansi="on"
+
+#### Advanced Settings ####
+
+## Message Display Time | https://docs.linuxgsm.com/features/message-display-time
+sleeptime="0.5"
+
+## SteamCMD Settings | https://docs.linuxgsm.com/steamcmd
+# Server appid
+baseappid="232250"
+appid="3557020"
+steamcmdforcewindows="no"
+# SteamCMD Branch | https://docs.linuxgsm.com/steamcmd/branch
+branch=""
+betapassword=""
+# Master Server | https://docs.linuxgsm.com/steamcmd/steam-master-server
+steammaster="true"
+
+## Stop Mode | https://docs.linuxgsm.com/features/stop-mode
+# 1: tmux kill
+# 2: CTRL+c
+# 3: quit
+# 4: quit 120s
+# 5: stop
+# 6: q
+# 7: exit
+# 8: 7 Days to Die
+# 9: GoldSrc
+# 10: Avorion
+# 11: end
+stopmode="3"
+
+## Query mode
+# 1: session only
+# 2: gamedig (gsquery fallback)
+# 3: gamedig
+# 4: gsquery
+# 5: tcp
+querymode="2"
+querytype="protocol-valve"
+
+## Console type
+consoleverbose="yes"
+consoleinteract="yes"
+
+## Game Server Details
+# Do not edit
+gamename="Team Fortress 2 Classified"
+engine="source"
+glibc="2.15"
+
+#### Directories ####
+# Edit with care
+
+## Game Server Directories
+systemdir="${serverfiles}/tf2classified"
+supportdir="${serverfiles}/tf2"
+executabledir="${serverfiles}"
+executable="./srcds.sh"
+servercfgdir="${systemdir}/cfg"
+servercfg="${selfname}.cfg"
+servercfgdefault="server.cfg"
+servercfgfullpath="${servercfgdir}/${servercfg}"
+
+## Backup Directory
+backupdir="${lgsmdir}/backup"
+
+## Logging Directories
+[ -n "${LGSM_LOGDIR}" ] && logdir="${LGSM_LOGDIR}" || logdir="${rootdir}/log"
+gamelogdir="${systemdir}/logs"
+lgsmlogdir="${logdir}/script"
+consolelogdir="${logdir}/console"
+lgsmlog="${lgsmlogdir}/${selfname}-script.log"
+consolelog="${consolelogdir}/${selfname}-console.log"
+alertlog="${lgsmlogdir}/${selfname}-alert.log"
+postdetailslog="${lgsmlogdir}/${selfname}-postdetails.log"
+
+## Logs Naming
+lgsmlogdate="${lgsmlogdir}/${selfname}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
+consolelogdate="${consolelogdir}/${selfname}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"
+
+## Log Parameters
+logtimestamp="off"
+logtimestampformat="%Y-%m-%d %H:%M:%S"

+ 1 - 0
lgsm/data/serverlist.csv

@@ -114,6 +114,7 @@ sven,svenserver,Sven Co-op,ubuntu-24.04
 terraria,terrariaserver,Terraria,ubuntu-24.04
 terraria,terrariaserver,Terraria,ubuntu-24.04
 tf,tfserver,The Front,ubuntu-24.04
 tf,tfserver,The Front,ubuntu-24.04
 tf2,tf2server,Team Fortress 2,ubuntu-24.04
 tf2,tf2server,Team Fortress 2,ubuntu-24.04
+tf2c,tf2cserver,Team Fortress 2 Classified,ubuntu-24.04
 tfc,tfcserver,Team Fortress Classic,ubuntu-24.04
 tfc,tfcserver,Team Fortress Classic,ubuntu-24.04
 ti,tiserver,The Isle,ubuntu-24.04
 ti,tiserver,The Isle,ubuntu-24.04
 ts,tsserver,The Specialists,ubuntu-24.04
 ts,tsserver,The Specialists,ubuntu-24.04

+ 26 - 0
lgsm/modules/core_dl.sh

@@ -81,6 +81,19 @@ fn_dl_steamcmd() {
 			fi
 			fi
 		# Force Windows Platform type.
 		# Force Windows Platform type.
 		elif [ "${steamcmdforcewindows}" == "yes" ]; then
 		elif [ "${steamcmdforcewindows}" == "yes" ]; then
+			# If a base app is required, install it first.
+			if [ -n "${baseappid}" ]; then
+				if [ -z "${supportdir}" ]; then
+					fn_print_failure_nl "${commandaction} ${selfname}: baseappid is set but supportdir is not defined"
+					fn_script_log_fail "${commandaction} ${selfname}: baseappid is set but supportdir is not defined"
+					core_exit.sh
+				fi
+				"${unbuffercommand[@]}" "${steamcmdcommandarray[@]}" +@sSteamCmdForcePlatformType windows +force_install_dir "${supportdir}" +login "${steamuser}" "${steampass}" +app_update "${baseappid}" "${validateparam[@]}" +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
+				exitcode="${PIPESTATUS[0]}"
+				if [ "${exitcode}" -ne 0 ]; then
+					continue
+				fi
+			fi
 			if [ -n "${branch}" ] && [ -n "${betapassword}" ]; then
 			if [ -n "${branch}" ] && [ -n "${betapassword}" ]; then
 				"${unbuffercommand[@]}" "${steamcmdcommandarray[@]}" +@sSteamCmdForcePlatformType windows +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_update "${appid}" -beta "${branch}" -betapassword "${betapassword}" "${validateparam[@]}" +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
 				"${unbuffercommand[@]}" "${steamcmdcommandarray[@]}" +@sSteamCmdForcePlatformType windows +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_update "${appid}" -beta "${branch}" -betapassword "${betapassword}" "${validateparam[@]}" +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
 			elif [ -n "${branch}" ]; then
 			elif [ -n "${branch}" ]; then
@@ -90,6 +103,19 @@ fn_dl_steamcmd() {
 			fi
 			fi
 		# All other servers.
 		# All other servers.
 		else
 		else
+			# If a base app is required, install it first.
+			if [ -n "${baseappid}" ]; then
+				if [ -z "${supportdir}" ]; then
+					fn_print_failure_nl "${commandaction} ${selfname}: baseappid is set but supportdir is not defined"
+					fn_script_log_fail "${commandaction} ${selfname}: baseappid is set but supportdir is not defined"
+					core_exit.sh
+				fi
+				"${unbuffercommand[@]}" "${steamcmdcommandarray[@]}" +force_install_dir "${supportdir}" +login "${steamuser}" "${steampass}" +app_update "${baseappid}" "${validateparam[@]}" +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
+				exitcode="${PIPESTATUS[0]}"
+				if [ "${exitcode}" -ne 0 ]; then
+					continue
+				fi
+			fi
 			if [ -n "${branch}" ] && [ -n "${betapassword}" ]; then
 			if [ -n "${branch}" ] && [ -n "${betapassword}" ]; then
 				"${unbuffercommand[@]}" "${steamcmdcommandarray[@]}" +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_update "${appid}" -beta "${branch}" -betapassword "${betapassword}" "${validateparam[@]}" +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
 				"${unbuffercommand[@]}" "${steamcmdcommandarray[@]}" +force_install_dir "${serverfiles}" +login "${steamuser}" "${steampass}" +app_update "${appid}" -beta "${branch}" -betapassword "${betapassword}" "${validateparam[@]}" +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
 			elif [ -n "${branch}" ]; then
 			elif [ -n "${branch}" ]; then

+ 5 - 0
lgsm/modules/install_config.sh

@@ -724,6 +724,11 @@ elif [ "${shortname}" == "tf2" ]; then
 	fn_default_config_remote
 	fn_default_config_remote
 	fn_set_config_vars
 	fn_set_config_vars
 	fn_list_config_locations
 	fn_list_config_locations
+elif [ "${shortname}" == "tf2c" ]; then
+	array_configs+=(server.cfg)
+	fn_default_config_remote
+	fn_set_config_vars
+	fn_list_config_locations
 elif [ "${shortname}" == "tfc" ]; then
 elif [ "${shortname}" == "tfc" ]; then
 	array_configs+=(server.cfg)
 	array_configs+=(server.cfg)
 	fn_default_config_remote
 	fn_default_config_remote