Add tModLoader module (#90)

* Add tModLoader module

* Remove diplicate envvars line

* Add seed as formattedarg

* lowercase names

* lowercase fetch

* use kvp merging

* fix capitalisation

* add adminmethod to kvp

* fix case typo, remove unused ports

* include world in commandline
This commit is contained in:
Jasper Borsboom 2022-03-23 18:26:43 +01:00 committed by GitHub
parent 3c7d9eede5
commit e318c423f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 454 additions and 0 deletions

61
tmodloader.kvp Normal file
View File

@ -0,0 +1,61 @@
Meta.DisplayName=tModLoader
Meta.Description=tModLoader server using Steam or GitHub
Meta.Author=JasperFirecai2, EnderWolf, IceOfWraith
Meta.MetaConfigManifest=tmodloadermetaconfig.json
Meta.ConfigRoot=tmodloader.kvp
Meta.ConfigManifest=tmodloaderconfig.json
Meta.DisplayImageSource=steam:1281930
Meta.EndpointURIFormat=steam://connect/{0}
Meta.OS=3
Meta.URL=https://store.steampowered.com/app/1281930/tModLoader/
Meta.MinAMPVersion=
App.DisplayName=tModLoader
App.RootDir=./tModLoader/
App.BaseDirectory=./tModLoader/serverfiles
App.ExecutableWin=serverfiles/tModLoaderServer.exe
App.ExecutableLinux=serverfiles/tModLoaderServer
App.WorkingDir=serverfiles
App.EnvironmentVariables={"LD_LIBRARY_PATH": "./linux64:%LD_LIBRARY_PATH%", "SteamAppId": "1281930"}
App.LinuxCommandLineArgs=
App.WindowsCommandLineArgs=
App.CommandLineArgs=-server {{$FormattedArgs}} -players {{$MaxUsers}} -port {{$ApplicationPort1}} -config {{Config}}
App.CommandLineParameterFormat=-{0} {1}
App.AppSettings={"Config":"tmodloaderserverconfig.txt"}
App.CommandLineVars={}
App.ExitMethod=String
App.ExitTimeout=30
App.ExitString=exit
App.ExitFile=app_exit.lck
App.HasWriteableConsole=True
App.HasReadableConsole=True
App.AdminMethod=STDIO
App.SupportsLiveSettingsChanges=False
App.LiveSettingChangeCommandFormat=set {0} "{1}"
App.ApplicationIPBinding=0.0.0.0
App.ApplicationPort1=7777
App.ApplicationPort2=0
App.ApplicationPort3=0
App.RemoteAdminPort=0
App.MaxUsers=8
App.UpdateSources=[{"UpdateStageName": "Config Template Download","UpdateSourcePlatform": "All","UpdateSource": "FetchURL","UpdateSourceData": "https://raw.githubusercontent.com/CubeCoders/AMPTemplates/main/tmodloaderserverconfig.txt","UpdateSourceTarget": "serverfiles","OverwriteExistingFiles": false},{"UpdateStageName": "SteamCMD tModLoader","UpdateSourcePlatform": "All","UpdateSource": "SteamCMD","UpdateSourceData": "1281930","UpdateSourceTarget": "serverfiles","UpdateSourceConditionSetting":"Source","UpdateSourceConditionValue":"Steam"},{"UpdateStageName": "GitHub tModLoader Windows","UpdateSourcePlatform": "Windows","UpdateSource": "FetchURLfromJQ","UpdateSourceData": "https://api.github.com/repos/tModLoader/tModLoader/releases/latest","UpdateSourceArgs": "$.assets[?(@.name =~ /tModLoader\\.Windows\\..+\\.zip/g)].browser_download_url","UnzipUpdateSource": true,"OverwriteExistingFiles": true,"UpdateSourceConditionSetting": "Source","UpdateSourceConditionValue": "GitHub","UpdateSourceTarget": "serverfiles"},{"UpdateStageName": "GitHub tModLoader Linux","UpdateSourcePlatform": "Linux","UpdateSource": "FetchURLfromJQ","UpdateSourceData": "https://api.github.com/repos/tModLoader/tModLoader/releases/latest","UpdateSourceArgs": "$.assets[?(@.name =~ /tModLoader\\.Linux\\..+\\.zip/g)].browser_download_url","UnzipUpdateSource": true,"OverwriteExistingFiles": true,"UpdateSourceConditionSetting": "Source","UpdateSourceConditionValue": "GitHub","UpdateSourceTarget": "serverfiles"}]
App.Compatibility=None
App.SteamUpdateAnonymousLogin=False
App.SteamForceLoginPrompt=False
App.RapidStartup=False
App.SupportsUniversalSleep=False
App.WakeupMode=Any
App.ApplicationReadyMode=RegexMatch
App.TemplateMatchRegex={{(\$?[\w]+)}}
Console.AppReadyRegex=^Listening on port (\d+)$
Console.UserJoinRegex=^(?<username>.+?) has joined\.$
Console.UserLeaveRegex=^(?<username>.+?) has left\.$
Console.UserChatRegex=^<(?<username>.+?)> (?<message>.+)$
Console.UpdateAvailableRegex=^\[\d\d:\d\d:\d\d\] \[INFO\] A new server update is available! v[\d\.]+.$
Console.ThrowawayMessageRegex=^??Error Logging Enabled.$
Console.SuppressLogAtStart=False
Console.UserActions={}
Limits.SleepMode=True
Limits.SleepOnStart=False
Limits.SleepDelayMinutes=5
Limits.DozeDelay=2
Limits.AutoRetryCount=5

300
tmodloaderconfig.json Normal file
View File

@ -0,0 +1,300 @@
[
{
"DisplayName": "World Seed",
"Category": "Terraria Generator settings",
"Keywords": "seed new world",
"Description": "Which world seed to use when generating a new world",
"FieldName": "Seed",
"ParamFieldName": "seed",
"placeholder": "PoweredByAMP",
"suffix": "",
"InputType": "text",
"IncludeInCommandLine": true,
"DefaultValue": ""
},
{
"DisplayName": "World Size",
"Category": "Terraria Generator settings",
"Keywords": "size new world",
"Description": "Set the Size of the World",
"FieldName": "WorldSize",
"ParamFieldName": "autocreate",
"IncludeInCommandLine": true,
"InputType": "enum",
"EnumValues": {
"1": "1 - Small World",
"2": "2 - Medium World",
"3": "3 - Large World"
},
"DefaultValue": "3"
},
{
"DisplayName": "Difficulty",
"Category": "Terraria Generator settings",
"Keywords": "difficulty new world journey expert master",
"Description": "The difficulty of a newly generated world",
"FieldName": "Difficulty",
"ParamFieldName": "difficulty",
"InputType": "enum",
"EnumValues": {
"0": "Classic",
"1": "Expert"
},
"IncludeInCommandLine": false,
"DefaultValue": "0"
},
{
"DisplayName": "Created World Name",
"Category": "Terraria Generator settings",
"Keywords": "name new world",
"Description": "How to name the new world if one is generated. Make sure the World name under Terraria Server Settings matches this name if you want to load it in subsequent starts.",
"FieldName": "WorldName",
"ParamFieldName": "worldname",
"placeholder": "World",
"suffix": "",
"InputType": "text",
"IncludeInCommandLine": true,
"DefaultValue": "world"
},
{
"DisplayName": "Backup count",
"Category": "Terraria Generator settings",
"Keywords": "backup backups count world rollback",
"Description": "Sets the number of rolling world backups to keep",
"FieldName": "Backups",
"ParamFieldName": "worldrollbackstokeep",
"placeholder": "some integer",
"suffix": "Backups",
"InputType": "number",
"IncludeInCommandLine": false,
"DefaultValue": 2
},
{
"DisplayName": "Mod Path",
"Category": "Terraria ModLoader settings",
"Keywords": "folder path mod mods tmodloader",
"Description": "Where tModLoader will read mods from. [instructions](https://github.com/jasperfirecai2/amp-templates/wiki/Managing-mods-with-tmodloader)",
"FieldName": "ModPath",
"ParamFieldName": "modpath",
"placeholder": "ModLoader/Mods",
"suffix": "",
"InputType": "text",
"IncludeInCommandLine": false,
"DefaultValue": "ModLoader/Mods"
},
{
"DisplayName": "Mod Pack",
"Category": "Terraria ModLoader settings",
"Keywords": "pack mod mods modpack tmodloader",
"Description": "Which modpack to load (does not install mods for you!)",
"FieldName": "ModPack",
"ParamFieldName": "modpack",
"placeholder": "modpack",
"suffix": ".json",
"InputType": "text",
"IncludeInCommandLine": false,
"DefaultValue": ""
},
{
"DisplayName": "Update Source",
"Category": "Terraria ModLoader settings",
"Keywords": "download source steam github tmodloader",
"Description": "Select where to obtain tModLoader. Steam requires you to own [Terraria](https://store.steampowered.com/app/105600/Terraria/) & [tModLoader](https://store.steampowered.com/app/1281930/tModLoader/) on your account and accept tModLoader's ToS by installing it as a game to a device you can login from.",
"FieldName": "Source",
"IncludeInCommandLine": false,
"InputType": "enum",
"EnumValues": {
"GitHub": "GitHub",
"Steam": "Steam"
},
"DefaultValue": "GitHub"
},
{
"DisplayName": "World Path",
"Category": "Terraria Server settings",
"Keywords": "folder path world saves savegame worlds",
"Description": "The relative path to save worlds in",
"FieldName": "WorldPath",
"ParamFieldName": "worldpath",
"placeholder": "ModLoader/Worlds",
"suffix": "",
"InputType": "text",
"IncludeInCommandLine": false,
"DefaultValue": "ModLoader/Worlds"
},
{
"DisplayName": "World Name",
"Category": "Terraria Server settings",
"Keywords": "name world worldname load boot",
"Description": "Which world to load on boot",
"FieldName": "World",
"ParamFieldName": "world",
"placeholder": "ModLoader/Worlds/world.wld",
"suffix": "",
"InputType": "text",
"IncludeInCommandLine": true,
"DefaultValue": "ModLoader/Worlds/world.wld"
},
{
"DisplayName": "Max Players",
"Category": "Terraria Server settings",
"Keywords": "players max maximum",
"Description": "The maximum players in the server",
"FieldName": "$MaxUsers",
"ParamFieldName": "maxplayers",
"placeholder": "8",
"suffix": "Users",
"InputType": "number",
"IncludeInCommandLine": false,
"DefaultValue": 8
},
{
"DisplayName": "Password",
"Category": "Terraria Server settings",
"Keywords": "password pw security",
"Description": "The password players must enter to join",
"FieldName": "Password",
"ParamFieldName": "password",
"placeholder": "Password123",
"suffix": "",
"InputType": "password",
"IncludeInCommandLine": false,
"DefaultValue": ""
},
{
"DisplayName": "Ban List",
"Category": "Terraria Server settings",
"Keywords": "ban banlist bans security",
"Description": "Where to store the ban list",
"FieldName": "BanList",
"ParamFieldName": "banlist",
"placeholder": "somefilename.txt",
"suffix": "",
"InputType": "text",
"IncludeInCommandLine": false,
"DefaultValue": "banlist.txt"
},
{
"DisplayName": "Motd",
"Category": "Terraria Server settings",
"Keywords": "motd motto message welcome",
"Description": "The motto/message of the day",
"FieldName": "Motd",
"ParamFieldName": "motd",
"placeholder": "Welcome!",
"suffix": "",
"InputType": "text",
"IncludeInCommandLine": false,
"DefaultValue": "Welcome!"
},
{
"DisplayName": "Language",
"Category": "Terraria Server settings",
"Keywords": "language lang",
"Description": "The language of your server",
"FieldName": "Language",
"ParamFieldName": "language",
"InputType": "enum",
"EnumValues": {
"en-US": "English",
"de-DE": "German",
"it-IT": "Italian",
"fr-FR": "French",
"es-ES": "Spanish",
"ru-RU": "Russian",
"zh-Hans": "Chinese",
"pt-PT": "Portuguese",
"pt-BR": "Portuguese (Brazil)",
"pl-PL": "Polish"
},
"IncludeInCommandLine": false,
"DefaultValue": "en-US"
},
{
"DisplayName": "Priority",
"Category": "Terraria Server settings",
"Keywords": "priority process prio performance",
"Description": "The process priority",
"FieldName": "Priority",
"ParamFieldName": "priority",
"InputType": "enum",
"EnumValues": {
"0": "Realtime",
"1": "High",
"2": "AboveNormal",
"3": "Normal",
"4": "BelowNormal",
"5": "Idle"
},
"IncludeInCommandLine": false,
"DefaultValue": "1"
},
{
"DisplayName": "NPC Stream",
"Category": "Terraria Server settings",
"Keywords": "npc stream skipping lag bandwidth performance",
"Description": "Reduces enemy skipping but increases bandwidth usage. The lower the number the less skipping will happen, but more data is sent. 0 is off.",
"FieldName": "NPCStream",
"ParamFieldName": "npcstream",
"placeholder": "60",
"suffix": "",
"InputType": "number",
"IncludeInCommandLine": false,
"DefaultValue": 60
},
{
"DisplayName": "Slower Liquids",
"Category": "Terraria Server settings",
"Keywords": "slow liquid liquids slower lag performance",
"Description": "Reduces maximum liquids moving at the same time. If enabled may reduce lag but liquids may take longer to settle.",
"FieldName": "Slowliquids",
"ParamFieldName": "slowliquids",
"InputType": "checkbox",
"IncludeInCommandLine": false,
"EnumValues": {
"False": "0",
"True": "1"
},
"DefaultValue": "1"
},
{
"DisplayName": "Cheat Protection",
"Category": "Terraria Server settings",
"Keywords": "security cheat cheats auto kick spam",
"Description": "Enable/Disable additional cheat protection. This may cause unwanted automatic kicks",
"FieldName": "Secure",
"ParamFieldName": "secure",
"InputType": "checkbox",
"IncludeInCommandLine": false,
"EnumValues": {
"False": "0",
"True": "1"
},
"DefaultValue": "0"
},
{
"DisplayName": "Disable Announcement Box",
"Category": "Terraria Server settings",
"Keywords": "announcement box disable griefing",
"Description": "Enable/Disable the text announcements Announcement Box makes when pulsed from wire.",
"FieldName": "DisableAnnouncementBox",
"InputType": "checkbox",
"IncludeInCommandLine": true,
"ParamFieldName": "disableannouncementbox",
"IsFlagArgument": true,
"DefaultValue": "-disableannouncementbox"
},
{
"DisplayName": "Announcement Box Range",
"Category": "Terraria Server settings",
"Keywords": "announcement box range griefing",
"Description": "Sets the announcement box text messaging range in pixels, -1 for serverwide announcements.",
"FieldName": "AnnouncementBoxRange",
"placeholder": "-1",
"suffix": "Pixels",
"InputType": "number",
"IncludeInCommandLine": true,
"ParamFieldName": "announcementboxrange",
"DefaultValue": "-1"
}
]

View File

@ -0,0 +1,8 @@
[
{
"ConfigFile": "tmodloaderserverconfig.txt",
"AutoMap": true,
"ConfigType": "kvp",
"ConfigFormat": "{0}={1}"
}
]

View File

@ -0,0 +1,85 @@
#serverconfig.txt
#This file is automatically generated by AMP. All uncommented settings are controlled by AMP.
#Any changes to uncommented settings will be lost when starting or updating the application
#Please use the AMP control panel to change these
#If you wish to configure other settings (those that are commented), you can do so manually
#But any future updates may overwrite these changes
#the following is a list of available command line parameters:
#-config <config file> Specifies the configuration file to use.
#-port <port number> Specifies the port to listen on.
#-players <number> / -maxplayers <number> Sets the max number of players
#-pass <password> / -password <password> Sets the server password
#-world <world file> Load a world and automatically start the server.
#-autocreate <#> Creates a world if none is found in the path specified by -world. World size is specified by: 1(small), 2(medium), and 3(large).
#-banlist <path> Specifies the location of the banlist. Defaults to "banlist.txt" in the working directory.
#-worldname <world name> Sets the name of the world when using -autocreate.
#-secure Adds addition cheat protection to the server.
#-noupnp Disables automatic port forwarding
#-steam Enables Steam Support
#-lobby <friends> or <private> Allows friends to join the server or sets it to private if Steam is enabled
#-ip <ip address> Sets the IP address for the server to listen on
#-forcepriority <priority> Sets the process priority for this task. If this is used the "priority" setting below will be ignored.
#-disableannouncementbox Disables the text announcements Announcement Box makes when pulsed from wire.
#-announcementboxrange <number> Sets the announcement box text messaging range in pixels, -1 for serverwide announcements.
#-seed <seed> Specifies the world seed when using -autocreate
#remove the # in front of commands to enable them.
#Load a world and automatically start the server.
world={{world}}
#Creates a new world if none is found. World size is specified by: 1(small), 2(medium), and 3(large).
autocreate={{autocreate}}
#Sets the world seed when using autocreate
seed={{seed}}
#Sets the name of the world when using autocreate
worldname={{worldname}}
#Sets the difficulty of the world when using autocreate 0(classic), 1(expert), 2(master), 3(journey)
difficulty={{Difficulty}}
#Sets the max number of players allowed on a server. Value must be between 1 and 255
maxplayers={{$MaxUsers}}
#Set the server password
password={{Password}}
#Set the message of the day
motd={{Motd}}
#Sets the folder where world files will be stored
worldpath={{WorldPath}}
#Path for mods
modpath={{ModPath}}
modpack={{ModPack}}
#Sets the number of rolling world backups to keep
worldrollbackstokeep={{Backups}}
#The location of the banlist. Defaults to "banlist.txt" in the working directory.
banlist={{BanList}}
#Adds addition cheat protection.
secure={{Secure}}
#Sets the server language from its language code.
#English = en-US, German = de-DE, Italian = it-IT, French = fr-FR, Spanish = es-ES, Russian = ru-RU, Chinese = zh-Hans, Portuguese = pt-BR, Polish = pl-PL,
language={{Language}}
#Automatically forward ports with uPNP
#upnp=1
#Reduces enemy skipping but increases bandwidth usage. The lower the number the less skipping will happen, but more data is sent. 0 is off.
npcstream={{NpcStream}}
#Default system priority 0:Realtime, 1:High, 2:AboveNormal, 3:Normal, 4:BelowNormal, 5:Idle
priority={{Priority}}
#Reduces maximum liquids moving at the same time. If enabled may reduce lags but liquids may take longer to settle.
slowliquids={{Slowliquids}}