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

feat(newserver): Unturned (#2296)

Co-authored-by: admin@heihachi.pw
Heihachi 7 лет назад
Родитель
Сommit
7734a3519e

+ 136 - 0
lgsm/config-default/config-lgsm/untserver/_default.cfg

@@ -0,0 +1,136 @@
+##################################
+######## Default Settings ########
+##################################
+# DO NOT EDIT 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
+
+#### Server Settings ####
+
+## Server Start Settings | https://docs.linuxgsm.com/configuration/start-parameters
+ip="0.0.0.0"
+port="27015"
+maxplayers="20"
+defaultmap="pei"
+
+## SteamCMD Login | https://github.com/GameServerManagers/LinuxGSM/wiki/SteamCMD#steamcmd-login
+steamuser="username"
+steampass='password'
+
+## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
+
+# Parameters are changed in game.ini and engine.ini (Location: ${systemdir}/Saved/Config/LinuxServer)
+# Make sure you change the admin password before launching the server
+
+fn_parms(){
+parms="-port:${port} -players:${maxplayers} --nographics -${defaultmap} -batchmode +secureserver/${servicename}"
+}
+
+#### LinuxGSM Settings ####
+
+## Notification Alerts
+# (on|off)
+
+# More info | https://docs.linuxgsm.com/alerts#more-info
+postalert="off"
+postdays="7"
+posttarget="https://hastebin.com"
+
+# 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=""
+
+# IFTTT Alerts | https://docs.linuxgsm.com/alerts/ifttt
+iftttalert="off"
+ifttttoken="accesstoken"
+iftttevent="linuxgsm_alert"
+
+# Mailgun Email Alerts | https://docs.linuxgsm.com/alerts/mailgun
+mailgunalert="off"
+mailguntoken="accesstoken"
+mailgundomain="example.com"
+mailgunemailfrom="alert@example.com"
+mailgunemail="email@myemail.com"
+
+# 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"
+
+# Telegram Alerts | https://docs.linuxgsm.com/alerts/telegram
+# You can add a custom cURL string eg proxy (useful in Russia) or else in "curlcustomstring".
+# like a "--socks5 ipaddr:port" for socks5 proxy see more in "curl --help", if you not need
+# any custom string in curl - simple ignore this parameter.
+telegramalert="off"
+telegramtoken="accesstoken"
+telegramchatid=""
+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"
+
+#### LinuxGSM Advanced Settings ####
+
+# ANSI Colors
+ansi="on"
+
+## SteamCMD Settings
+# Server appid
+appid="304930"
+# Steam App Branch Select
+# Allows to opt into the various Steam app branches. Default branch is "".
+# Example: "-beta latest_experimental"
+branch=""
+
+## LinuxGSM Server Details
+# Do not edit
+gamename="Unturned"
+engine="unity3d"
+
+#### Directories ####
+# Edit with care
+
+## Server Specific Directories
+systemdir="${serverfiles}"
+executabledir="${serverfiles}"
+executable="./Unturned_Headless.x86"
+servercfgdir="${systemdir}/Servers/${servicename}"
+servercfg="Config.json"
+servercfgdefault="Config.json"
+servercfgfullpath="${servercfgdir}/${servercfg}"
+
+## Backup Directory
+backupdir="${lgsmdir}/backup"
+
+## Logging Directories
+logdir="${rootdir}/log"
+gamelogdir="${logdir}/server"
+lgsmlogdir="${logdir}/script"
+consolelogdir="${logdir}/console"
+lgsmlog="${lgsmlogdir}/${servicename}-script.log"
+consolelog="${consolelogdir}/${servicename}-console.log"
+alertlog="${lgsmlogdir}/${servicename}-alert.log"
+postdetailslog="${lgsmlogdir}/${servicename}-postdetails.log"
+
+## Logs Naming
+lgsmlogdate="${lgsmlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
+consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"

+ 1 - 0
lgsm/data/serverlist.csv

@@ -83,6 +83,7 @@ tu,tuserver,Tower Unite
 ut2k4,ut2k4server,Unreal Tournament 2004
 ut3,ut3server,Unreal Tournament 3
 ut99,ut99server,Unreal Tournament 99
+unt,untserver,Unturned
 vs,vsserver,Vampire Slayer
 wet,wetserver,Wolfenstein: Enemy Territory
 wurm,wurmserver,Wurm Unlimited

+ 2 - 0
lgsm/functions/command_validate.sh

@@ -27,6 +27,8 @@ fn_validation(){
 
 	if [ "${appid}" == "90" ]; then
 		${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_info_print 70 +app_set_config 90 mod "${appidmod}" +app_update "${appid}" ${branch} +app_update "${appid}" ${branch} validate +quit | tee -a "${lgsmlog}"
+	elif [ "${gamename}" == "Unturned" ]; then
+		${unbuffer} /steamcmd.sh +@sSteamCmdForcePlatformBitness 32 +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" ${branch} validate +quit
 	else
 		${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${branch} validate +quit | tee -a "${lgsmlog}"
 	fi

+ 5 - 0
lgsm/functions/core_functions.sh

@@ -402,6 +402,11 @@ functionfile="${FUNCNAME}"
 fn_fetch_function
 }
 
+fix_unt.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
 fix_wurm.sh(){
 functionfile="${FUNCNAME}"
 fn_fetch_function

+ 2 - 0
lgsm/functions/fix.sh

@@ -69,6 +69,8 @@ if [ "${function_selfname}" != "command_install.sh" ]&&[ -z "${fixbypass}" ]; th
 		fix_ts3.sh
 	elif [ "${shortname}" == "mta" ]; then
 		fix_mta.sh
+	elif [ "${shortname}" == "unt" ]; then
+		fix_unt.sh
 	elif [ "${shortname}" == "wurm" ]; then
 		fix_wurm.sh
 	fi

+ 11 - 0
lgsm/functions/fix_unt.sh

@@ -0,0 +1,11 @@
+#!/bin/bash
+# LinuxGSM fix_rust.sh function
+# Author: Daniel Gibbs
+# Website: https://linuxgsm.com
+# Description: Resolves startup issue with Unturned
+
+local commandname="FIX"
+local commandaction="Fix"
+
+# Fixes: [Raknet] Server Shutting Down (Shutting Down)
+export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${systemdir}/lib"

+ 3 - 0
lgsm/functions/info_glibc.sh

@@ -165,6 +165,9 @@ elif [ "${gamename}" == "Wurm Unlimited" ]; then
 elif [ "${gamename}" == "Multi Theft Auto" ]; then
 	glibcrequired="2.7"
 	glibcfix="no"
+elif [ "${gamename}" == "Unturned" ]; then
+	glibcrequired="2.15"
+	glibcfix="no"
 elif [ "${gamename}" == "Zombie Panic! Source" ]; then
 	glibcrequired="2.15"
 	glibcfix="yes"

+ 13 - 1
lgsm/functions/info_messages.sh

@@ -495,7 +495,7 @@ fn_info_message_ports(){
 		fi
 	done
 	# engines/games that require editing the parms
-	local ports_edit_array=( "goldsource" "Factorio" "Hurtworld" "iw3.0" "ioquake3" "Rust" "spark" "source" "starbound" "unreal4" "realvirtuality")
+	local ports_edit_array=( "goldsource" "Factorio" "Hurtworld" "iw3.0" "ioquake3" "Rust" "spark" "source" "starbound" "unreal4" "realvirtuality" "Unturned")
 	for port_edit in "${ports_edit_array[@]}"
 	do
 		if [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]||[ "${shortname}" == "${port_edit}" ]; then
@@ -1107,6 +1107,16 @@ fn_info_message_unreal3(){
 	} | column -s $'\t' -t
 }
 
+fn_info_message_unturned(){
+	echo -e "netstat -atunp | grep Unturned"
+	echo -e ""
+	{
+		echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
+		echo -e "> Game\tINBOUND\t${port}\tudp"
+		echo -e "> Query\tINBOUND\t${queryport}\tudp"
+	} | column -s $'\t' -t
+}
+
 fn_info_message_kf2(){
 	echo -e "netstat -atunp | grep KFGame"
 	echo -e ""
@@ -1229,6 +1239,8 @@ fn_info_message_select_engine(){
 		fn_info_message_teamspeak3
 	elif [ "${gamename}" == "Tower Unite" ]; then
 		fn_info_message_towerunite
+	elif [ "${shortname}" == "unt" ]; then
+		fn_info_message_unturned
 	elif [ "${gamename}" == "Multi Theft Auto" ]; then
 		fn_info_message_mta
 	elif [ "${gamename}" == "Mumble" ]; then

+ 7 - 0
lgsm/functions/info_parms.sh

@@ -164,6 +164,11 @@ fn_info_parms_unreal3(){
 	adminpassword=${adminpassword:-"NOT SET"}
 }
 
+fn_info_parms_unturned(){
+	servername=${servicename:-"NOT SET"}
+	port=${port:-"0"}
+	queryport=$((port + 1))
+}
 fn_info_parms_kf2(){
 	queryport=${queryport:-"0"}
 	defaultmap=${defaultmap:-"NOT SET"}
@@ -222,4 +227,6 @@ elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
 # Unreal 3 engine
 elif [ "${engine}" == "unreal3" ]; then
 	fn_info_parms_unreal3
+elif [ "${shortname}" == "unt" ]; then
+	fn_info_parms_unturned
 fi

+ 6 - 0
lgsm/functions/install_config.sh

@@ -607,6 +607,12 @@ elif [ "${gamename}" == "Unreal Tournament 99" ]; then
 	fn_fetch_default_config
 	fn_default_config_remote
 	fn_set_config_vars
+elif [ "${shortname}" == "unt" ]; then
+	gamedirname="Unturned"
+	array_configs+=( Config.json )
+	fn_fetch_default_config
+	fn_default_config_remote
+	fn_set_config_vars
 elif [ "${gamename}" == "Vampire Slayer" ]; then
 	gamedirname="VampireSlayer"
 	array_configs+=( server.cfg )

+ 3 - 0
lgsm/functions/install_server_files.sh

@@ -92,6 +92,9 @@ fn_install_server_files_steamcmd(){
 				if [ "${appid}" == "90" ]; then
 					${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" ${branch} +quit
 					local exitcode=$?
+				elif [ "${shortname}" == "unt" ]; then
+					${unbuffer} ./steamcmd.sh +@sSteamCmdForcePlatformBitness 32 +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${branch} validate +quit
+					local exitcode=$?
 				else
 					${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${branch} +quit
 					local exitcode=$?

+ 4 - 2
lgsm/functions/update_steamcmd.sh

@@ -20,6 +20,8 @@ fn_update_steamcmd_dl(){
 	cd "${steamcmddir}" || exit
 	if [ "${appid}" == "90" ]; then
 		${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" ${branch} +quit | tee -a "${lgsmlog}"
+	elif [ "${shortname}" == "unt" ]; then
+		${unbuffer} ./steamcmd.sh +@sSteamCmdForcePlatformBitness 32 +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" ${branch} validate +quit
 	else
 		${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${branch} +quit | tee -a "${lgsmlog}"
 	fi
@@ -73,7 +75,7 @@ fn_update_steamcmd_remotebuild(){
 			fn_script_log_fatal "Unable to get remote build"
 			core_exit.sh
 		fi
-	fi	
+	fi
 }
 
 fn_update_steamcmd_compare(){
@@ -134,7 +136,7 @@ fn_update_steamcmd_compare(){
 		if [ -v "${branch}" ]; then
 			echo -e "* Branch: ${branch}"
 		fi
-		echo -e "https://steamdb.info/app/${appid}/"	
+		echo -e "https://steamdb.info/app/${appid}/"
 		fn_script_log_info "No update available"
 		fn_script_log_info "Local build: ${localbuild}"
 		fn_script_log_info "Remote build: ${remotebuild}"