Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the terraria-tmodloader template #244

Open
wants to merge 4 commits into
base: v2.6
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions terraria-tmodloader/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
Terarria - tModLoader Template - made for linux non arm
# Template for [tModLoader](https://www.tmodloader.net/)
This template makes it possible to run [tModLoader](https://www.tmodloader.net/) with [PufferPanel](https://www.pufferpanel.com/) on Linux.

How to install mods:

1. Upload the .tmod file into the mods folder
2. Edit the enabled.json inside the mods folder
## Notes
* It features a script for automatic mod enable listing.
* Download your mods and put them in the mods folder.

For example in my mods folder i have three mods (mod1.tmod, mod2.tmod and mod3.tmod) and so my enabled.json looks like this:
[
"Mod1",
"Mod2",
"Mod3"
]
## Enabling mods

NOTE: Adding mods after the world was first created may not ever work
* If auto enables mod is set to true, mods will be enabled automatically.
* If auto enables mod is set to false :
* Edit the enabled.json inside the mods folder
* For example in my mods folder i have three mods (mod1.tmod, mod2.tmod and mod3.tmod) and so my enabled.json looks like this: [ "Mod1", "Mod2", "Mod3" ]

Do not forget to install the tModLoader also on your PC (https://store.steampowered.com/app/1281930/tModLoader) and also to activate the automatic mod download from the server!

This only supports Linux.
127 changes: 77 additions & 50 deletions terraria-tmodloader/terraria-tmodloader.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
{
"name": "terraria-tmodloader",
"type": "terraria",
"display": "Terraria - tModLoader",
"data": {
"abr": {
"type": "string",
"type": "integer",
"desc": "Sets the announcementbox text messaging range in pixels, -1 for serverwide announcements.",
"display": "announcementbox-range",
"required": true,
"value": "-1"
},
"autoEnableMods": {
"type": "boolean",
"desc": "Automatically enables all mods in the mods folder",
"display": "Auto Enable Mods",
"required": true,
"value": "true"
},
"backups": {
"type": "string",
"type": "integer",
"desc": "Sets the number of rolling world backups to keep",
"display": "Backups",
"required": true,
Expand All @@ -24,7 +32,7 @@
"value": "banlist.txt"
},
"difficulty": {
"type": "string",
"type": "integer",
"desc": "This can not be changed after the world was generated - Options: 0 - (normal), 1 - (expert), 2 - (master), 3 - (journey)",
"display": "Difficulty",
"required": true,
Expand Down Expand Up @@ -65,7 +73,7 @@
"value": "mods"
},
"npcs": {
"type": "string",
"type": "integer",
"desc": "Reduces enemy skipping but increases bandwidth usage. The lower the number the less skipping will happen, but more data is sent. 0 is off.",
"display": "npcstream",
"required": true,
Expand All @@ -79,28 +87,28 @@
"value": ""
},
"players": {
"type": "string",
"type": "integer",
"desc": "Max Players",
"display": "Players",
"required": true,
"value": "4"
},
"port": {
"type": "string",
"type": "integer",
"desc": "What port to bind the server to",
"display": "Port",
"required": true,
"value": "7777"
},
"priority": {
"type": "string",
"type": "integer",
"desc": "Set priority 0:Realtime, 1:High, 2:Above-Normal, 3:Normal, 4:Below-Normal, 5:Idle",
"display": "priority",
"required": true,
"value": "1"
},
"secure": {
"type": "string",
"type": "integer",
"desc": "Enable cheat protection = 1 and disable = 0",
"display": "secure",
"required": true,
Expand All @@ -111,36 +119,36 @@
"desc": "This can not be changed after the world was generated - Seed of the World",
"display": "Seed",
"required": true,
"value": "VeryGoodStartingSeed"
"value": ""
},
"size": {
"type": "string",
"type": "integer",
"desc": "This can not be changed after the world was generated - World Size (1-3 - 3 is biggest)",
"display": "World-Size",
"required": true,
"value": "3"
},
"sl": {
"type": "string",
"type": "integer",
"desc": "Reduces maximum liquids moving at the same time. If enabled may reduce lags but liquids may take longer to settle.",
"display": "maximum liquids moving",
"required": true,
"value": "1"
},
"tversion": {
"type": "string",
"desc": "tModLoader Version",
"display": "tModLoader Version (Set this to the latest tModLoader version - see https://github.com/tModLoader/tModLoader/releases/latest)",
"required": true,
"value": "0.11.8.6"
},
"upnp": {
"type": "string",
"type": "integer",
"desc": "Enable upnp = 1 and disable = 0",
"display": "upnp",
"required": true,
"value": "1"
},
"version": {
"type": "string",
"desc": "tModLoader Version",
"display": "tModLoader Version (Set this to the latest tModLoader version - see https://github.com/tModLoader/tModLoader/releases/latest)",
"required": true,
"value": "v2024.03.3.2"
},
"world": {
"type": "string",
"desc": "Name of your World",
Expand All @@ -158,60 +166,79 @@
},
"install": [
{
"target": "server",
"type": "mkdir"
},
{
"target": "${wp}",
"type": "mkdir"
},
{
"target": "${mp}",
"type": "mkdir"
},
{
"type": "download",
"files": [
"https://github.com/tModLoader/tModLoader/releases/download/v${tversion}/tModLoader.Linux.v${tversion}.tar.gz"
],
"type": "download"
"https://github.com/tModLoader/tModLoader/releases/download/${version}/tModLoader.zip"
]
},
{
"commands": [
"mv ./${mp}/enabled.json ./",
"rm -r ./server",
"mkdir ./server",
"tar -xf tModLoader.Linux.v${tversion}.tar.gz --directory ./server",
"chmod +x ./server/tModLoaderServer",
"chmod +x ./server/tModLoaderServer.bin.x86",
"chmod +x ./server/tModLoaderServer.bin.x86_64",
"mkdir ./${wp}",
"mkdir ./${mp}",
"rm tModLoader.Linux.v${tversion}.tar.gz"
],
"type": "command"
"type": "writefile",
"target": "EnableAllMods.sh",
"text": "#!/bin/bash\nif [ \"$1\" == \"false\" ]; then\n exit 0\nfi\n\nenabledMods=\"[\"\n\nfor file in ./mods/*.tmod; do\n modName=\"$(basename \"$file\" .tmod)\"\n enabledMods=\"$enabledMods\\n\\t\\\"$modName\\\",\"\n echo \"$modName\"\ndone\n\nenabledMods=\"${enabledMods::-1}\\n]\"\necho -e \"Enabled Mods: $enabledMods\"\necho -e \"$enabledMods\" > \"mods/enabled.json\""
},
{
"type": "writefile",
"target": "serverconfig.txt",
"text": "world=../${wp}/${world}.wld\nautocreate=${size}\nseed=${seed}\nworldname=${world}\ndifficulty=${difficulty}\nmaxplayers=${players}\nport=${port}\npassword=${password}\nmotd=${motd}\nworldpath=../${wp}\nbanlist=../${ban}\nsecure=${secure}\nlanguage=${lang}\nupnp=${upnp}\nnpcstream=${npcs}\npriority=${priority}\nslowliquids=${sl}\nworldrollbackstokeep=${backups}",
"type": "writefile"
"text": "world=../${wp}/${world}.wld\nautocreate=${size}\nseed=${seed}\nworldname=${world}\ndifficulty=${difficulty}\nmaxplayers=${players}\nport=${port}\npassword=${password}\nmotd=${motd}\nworldpath=../${wp}\nbanlist=../${ban}\nsecure=${secure}\nlanguage=${lang}\nupnp=${upnp}\nnpcstream=${npcs}\npriority=${priority}\nslowliquids=${sl}\nworldrollbackstokeep=${backups}\nmodpath=../${mp}"
},
{
"target": "enabled.jsonn",
"text": "[\n \"Mod1\",\n \"Mod2\",\n \"Mod3\"\n]",
"type": "writefile"
"type": "writefile",
"target": "enabled.json",
"text": "[\n \"*\"\n]"
},
{
"type": "command",
"commands": [
"mv ./enabled.jsonn ./${mp}/enabled.json",
"mv ./enabled.json ./${mp}/enabled.json"
],
"type": "command"
"unzip -o tModLoader.zip -d ./server",
"chmod +x ./server/LaunchUtils/ScriptCaller.sh",
"rm tModLoader.zip",
"chmod +x ./EnableAllMods.sh"
]
},
{
"source": "enabled.json",
"target": "${mp}/enabled.json",
"type": "move"
}
],
"run": {
"command": "./server/tModLoaderServer -ip ${ip} ${disableannouncementbox} -announcementboxrange ${abr} -config ../serverconfig.txt",
"command": "server/LaunchUtils/ScriptCaller.sh -server -ip ${ip} ${disableannouncementbox} -announcementboxrange ${abr} -config ../serverconfig.txt",
"stop": "exit",
"environmentVars": {},
"pre": [
{
"target": "serverconfig.txt",
"text": "world=../${wp}/${world}.wld\nautocreate=${size}\nseed=${seed}\nworldname=${world}\ndifficulty=${difficulty}\nmaxplayers=${players}\nport=${port}\npassword=${password}\nmotd=${motd}\nworldpath=../${wp}\nbanlist=../${ban}\nsecure=${secure}\nlanguage=${lang}\nupnp=${upnp}\nnpcstream=${npcs}\npriority=${priority}\nslowliquids=${sl}\nworldrollbackstokeep=${backups}",
"type": "writefile"
"type": "command",
"commands": [
"./EnableAllMods.sh ${autoEnableMods} "
]
}
]
],
"post": []
},
"environment": {
"type": "tty"
},
"supportedEnvironments": [
{
"type": "tty"
}
],
"requirements": {
"binaries": [ "tar" ],
"binaries": [
"unzip"
],
"os": "linux",
"arch": "amd64"
}
Expand Down