From 71533fe2c22b0411d0502a94ac61cfa5dcca4ff2 Mon Sep 17 00:00:00 2001 From: Bryce Van Dyk Date: Tue, 13 Oct 2015 22:44:23 +1300 Subject: [PATCH 1/3] Update terraria to install default config Update the terraria config to fit with the config convention. Update the terrariaserver script to contain a variable to reference the default config. Update fn_install_config to handle Terraria. --- .../cfg/{terraria-server.txt => lgsm-default.txt} | 0 Terraria/terrariaserver | 1 + functions/fn_install_config | 12 ++++++++++++ 3 files changed, 13 insertions(+) rename Terraria/cfg/{terraria-server.txt => lgsm-default.txt} (100%) diff --git a/Terraria/cfg/terraria-server.txt b/Terraria/cfg/lgsm-default.txt similarity index 100% rename from Terraria/cfg/terraria-server.txt rename to Terraria/cfg/lgsm-default.txt diff --git a/Terraria/terrariaserver b/Terraria/terrariaserver index 57392162c..a32af02d7 100644 --- a/Terraria/terrariaserver +++ b/Terraria/terrariaserver @@ -46,6 +46,7 @@ executable="./TerrariaServer" servercfg="${servicename}.txt" servercfgdir="${filesdir}" servercfgfullpath="${servercfgdir}/${servercfg}" +servercfgdefault="${servercfgdir}/lgsm-default.txt" backupdir="${rootdir}/backups" # Logging diff --git a/functions/fn_install_config b/functions/fn_install_config index 27b5586ae..a3b6b3d2a 100644 --- a/functions/fn_install_config +++ b/functions/fn_install_config @@ -116,6 +116,13 @@ sed -i "s/\"rconpassword\"/\"${rconpass}\"/g" "${servercfgfullpath}" echo "" } +fn_terrariaconfig(){ +echo "creating ${servercfg} config file." +cp -v "${servercfgdefault}" "${servercfgfullpath}" +sleep 1 +echo "" +} + fn_ts3config(){ echo "creating blank ${servercfg} config file." sleep 1 @@ -322,6 +329,11 @@ elif [ "${gamename}" == "Team Fortress Classic" ]; then wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/TeamFortressClassic/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq sleep 1 fn_goldsourceconfig +elif [ "${gamename}" == "Terraria" ]; then + echo -e "downloading lgsm-default.txt...\c" + wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/Terraria/cfg/lgsm-default.txt 2>&1 | grep -F HTTP | cut -c45- | uniq + sleep 1 + fn_terrariaconfig elif [ "${gamename}" == "Unreal Tournament 2004" ]; then fn_unreal2config elif [ "${gamename}" == "Unreal Tournament 99" ]; then From 4fb818cc1141d13b39bb13aff8c7e38df0b8393c Mon Sep 17 00:00:00 2001 From: Bryce Van Dyk Date: Tue, 13 Oct 2015 22:56:21 +1300 Subject: [PATCH 2/3] Comment out last line of default config --- Terraria/cfg/lgsm-default.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Terraria/cfg/lgsm-default.txt b/Terraria/cfg/lgsm-default.txt index c04a5b556..d6258d4cf 100644 --- a/Terraria/cfg/lgsm-default.txt +++ b/Terraria/cfg/lgsm-default.txt @@ -64,5 +64,5 @@ #npcstream=60 #Default system priority 0:Realtime, 1:High, 2:AboveNormal, 3:Normal, 4:BelowNormal, 5:Idle -priority=1 +#priority=1 From 375adb7f4875b70abb05d56a8b5f8054cf053425 Mon Sep 17 00:00:00 2001 From: Bryce Van Dyk Date: Wed, 14 Oct 2015 21:07:17 +1300 Subject: [PATCH 3/3] Add missing functionality for terraria details --- functions/fn_details | 4 +--- functions/fn_details_config | 10 ++++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/functions/fn_details b/functions/fn_details index 3463272a2..afa6edd46 100644 --- a/functions/fn_details +++ b/functions/fn_details @@ -512,7 +512,7 @@ echo -e "" echo -e "\e[92mPorts\e[0m" printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = echo -e "Change ports by editing the command-line" -echo -e "parameters in ${selfname}." +echo -e "parameters in ${servercfgfullpath}." echo -e "" echo -e "Useful port diagnostic command:" echo -e "netstat -atunp | grep terraia" @@ -520,8 +520,6 @@ echo -e "" { echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL" echo -e "> Game\tINBOUND\t${port}\ttcp" - echo -e "> Query\tINBOUND\t${queryport}\ttcp" - echo -e "> Rcon\tINBOUND\t${rconport}\ttcp" } >> .fn_details_ports column -s $'\t' -t .fn_details_ports rm -f .fn_details_ports diff --git a/functions/fn_details_config b/functions/fn_details_config index c85ea2316..233517d0f 100644 --- a/functions/fn_details_config +++ b/functions/fn_details_config @@ -382,6 +382,16 @@ elif [ "${gamename}" == "Teamspeak 3" ]; then fileport="30033" fi +elif [ "${engine}" == "terraria" ]; then + + # port + if [ -f "${servercfgfullpath}" ]; then + port=$(grep "port=" "${servercfgfullpath}" | tr -cd "[:digit:]") + fi + if [ ! -n "${port}" ]; then + port="0" + fi + elif [ "${engine}" == "unity3d" ]; then # server name