Git Product home page Git Product logo

tshock's Introduction

TShock for Terraria
AppVeyor Build Status GitHub Actions Build Status

查看中文版

TShock is a toolbox for Terraria servers and communities. That toolbox is jam packed with anti-cheat tools, server-side characters, groups, permissions, item bans, tons of commands, and limitless potential. It's one of a kind.

This is the readme for TShock developers and hackers. We're building out new TShock documentation for server operators and plugin developers, but this is a work-in-progress right now.

Developing TShock

If you want to contribute to TShock by sending a pull request or customize it to suit your own sparkly desires, this is the best starting point. By the end of this, you'll be able to build TShock from source, start to finish. More than that, though, you'll know how to start on the path of becoming an expert TShock developer.

This guide works assuming that you have the .NET 6 SDK installed and that you're familiar with the command line. If that doesn't describe you, you should be able to accomplish the same thing using Visual Studio 2022 or Visual Studio Code.

  1. Clone the repository: git clone https://github.com/Pryaxis/TShock.git --recurse-submodules
  2. cd TShock to enter the repo.
  3. dotnet build. No really, that will build things!

If you want to run the TShockLauncher (which runs a server), run:

  1. dotnet run --project TShockLauncher

To produce a packaged release (suitable for distribution), run:

  1. cd TShockLauncher
  2. dotnet publish -r win-x64 -f net6.0 -c Release -p:PublishSingleFile=true --self-contained false

Note that in this example, you'd be building for win-x64. You can build for win-x64, osx-x64, linux-x64, linux-arm64, linux-arm. Your release will be in the TShockLauncher/bin/Release/net6.0/ folder under the architecture you specified.

Working with Terraria

Working with Terraria in TShock and in other Terraria Server API plugins is different from most other APIs. Due to the nature of how OTAPI works, you have direct access to all public fields in the Terraria namespace. This means that you can access Terraria member methods directly. TShock and other plugins do this quite often, mostly to modify the game world, send data, and receive data. Calls to Main are one such example of direct access to Terraria. This is the equivalent to net.minecraft.server (NMS) calls in CraftBukkit.

You might find yourself wondering where these fields are. Pryaxis provides the decompiled Sources to Terraria's server, updated with each release. These sources are made available to developers of TShock. If you have submitted a pull request to TShock, reach out on Discord to get access. In lieu of this, you can download ILSpy and decompile Terraria or the server itself.

Finally, you may be interested in developing other Terraria Server API plugins. The TShockResources organization has several plugins you can look at and build on. TShock is itself a plugin, and most plugins are open source. This gives you ample room to figure out where to go next.

Need help? Join us on Discord.

Code of Conduct

By participating in the TShock for Terraria community, all members will adhere to maintaining decorum with respect to all humans, in and out of the community. Members will not engage in discussion that inappropriately disparages or marginalizes any group of people or any individual. Members will not attempt to further or advance an agenda to the point of being overbearing or close minded (such as through spreading FUD). Members will not abuse services provided to them and will follow the guidance of community leaders on a situational basis about what abuse consists of. Members will adhere to United States and international law. If members notice a violation of this code of conduct, they will not engage but will instead contact the leadership team on either the forums or Discord.

Do not attempt to circumvent or bypass the code of conduct by using clever logic or reasoning (e.g., insulting Facepunch members, because they weren't directly mentioned here).

tshock's People

Contributors

agaspace avatar allcontributors[bot] avatar arthri avatar axeelander avatar axiskriel avatar bartico6 avatar cardinal-system avatar codercow avatar darky2k1 avatar dogoofalchion avatar drunderscore avatar hakusaro avatar ivanbiljan avatar marioe avatar mistzzt avatar mmavipc avatar moisterrific avatar olink avatar patrikkk avatar punchready avatar quicm avatar renovate[bot] avatar rjhazelwood avatar sgkoishi avatar signaturebeef avatar stevenh avatar tylerjwatson avatar whitexz avatar zeuno8 avatar zidonuke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tshock's Issues

Chests

Chests are unbreakable.

P.S. Also add an unban command.

Help not showing all commands

Help output seems to miss 6th, 11th and 16-20th command of the page.

Below is the to should only 15 per page and not miss the 6th and 11th command of the page.

public static void Help(CommandArgs args)
        {
            int ply = args.PlayerID;
            var commands = TShock.commandList;
            if (TShock.players[ply].IsAdmin())
                commands = TShock.admincommandList;
            Tools.SendMessage(ply, "TShock Commands:");
            int h = 1;
            int i = 0;
            string tempstring = "";
            int page = 1;
            if (args.Message.Split(' ').Length == 2)
                int.TryParse(args.Message.Split(' ')[1], out page);
            if (commands.Count > (15 * (page - 1)))
            {
                for (int j = (15 * (page - 1)); j < commands.Count; j++)
                {
                    if (i == 3) break;
                    if (j == commands.Count - 1)
                    {
                        tempstring += "/" + commands.Keys.ElementAt(j) + ", ";
                        Tools.SendMessage(ply, tempstring.TrimEnd(new char[] { ' ', ',' }), new float[] { 255f, 255f, 0f });
                    }
                    if ((h - 1) % 5 == 0 && (h - 1) != 0)
                    {
                        Tools.SendMessage(ply, tempstring.TrimEnd(new char[] { ' ', ',' }), new float[] { 255f, 255f, 0f });
                        tempstring = "/" + commands.Keys.ElementAt(j) + ", ";
                        i++;
                        h++;
                    }
                    else
                    {
                        tempstring += "/" + commands.Keys.ElementAt(j) + ", ";
                        h++;
                    }
                }
            }
            if (commands.Count > (15 * page))
            { Tools.SendMessage(ply, "Type /help " + (page + 1).ToString() + " for more commands.", new float[] { 255f, 0f, 255f }); }
            Tools.SendMessage(ply, "Terraria commands:");
            Tools.SendMessage(ply, "/playing, /p, /me", new float[] { 255f, 255f, 0f });
        }

BanExplosives has no effect

{
  "InvasionMultiplier": 40,
  "DefaultMaximumSpawns": 3,
  "DefaultSpawnRate": 400,
  "ServerPort": 7777,
  "EnableWhitelist": false,
  "InfiniteInvasion": false,
  "AlwaysPvP": false,
  "KickCheaters": false,
  "BanCheaters": false,
  "KickGriefers": true,
  "BanGriefers": true,
  "BanKillTileAbusers": false,
  "KickKillTileAbusers": true,
  "BanExplosives": true,
  "KickExplosives": true,
  "SpawnProtection": true,
  "SpawnProtectionRadius": 5,
  "DistributationAgent": "facepunch"
}

Teleport and cheaters check not working in latest

Get the following errors during cheater check (no one but admins are allowed to join if check is enabled) and teleport.

System.NullReferenceException: Object reference not set to an instance of an object.
at TShockAPI.Tools.HandleCheater(Int32 ply)
at TShockAPI.TShock.GetData(GetDataEventArgs e)

System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Terraria.NetMessage.SendData(Int32 msgType, Int32 remoteClient, Int32 ignoreClient, String text, Int32 number, Single number2, Single number3, Single number4)
at TShockAPI.TShock.Teleport(Int32 ply, Single x, Single y)
at TShockAPI.Commands.TPHere(CommandArgs args)
at TShockAPI.TShock.OnChat(Int32 ply, String msg, HandledEventArgs handler)

Show configuration command

Can you add the show-config command. Here is the patch of what I have been using.

diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs
index f9829ee..d62a5ed 100644
--- a/TShockAPI/Commands.cs
+++ b/TShockAPI/Commands.cs
@@ -29,6 +29,8 @@ namespace TShockAPI
             TShock.admincommandList.Add("kick", new CommandDelegate(Kick));
             TShock.admincommandList.Add("ban", new CommandDelegate(Ban));
             TShock.admincommandList.Add("off", new CommandDelegate(Off));
+            TShock.admincommandList.Add("off-nosave", new CommandDelegate(OffNoSave));
+            TShock.admincommandList.Add("show-config", new CommandDelegate(ShowConfig));
             TShock.admincommandList.Add("reload", new CommandDelegate(Reload));
             TShock.admincommandList.Add("dropmeteor", new CommandDelegate(DropMeteor));
             TShock.admincommandList.Add("star", new CommandDelegate(Star));
@@ -54,7 +56,6 @@ namespace TShockAPI
             TShock.admincommandList.Add("kill", new CommandDelegate(Kill));
             TShock.admincommandList.Add("help", new CommandDelegate(Help));
             TShock.admincommandList.Add("slap", new CommandDelegate(Slap));
-            TShock.admincommandList.Add("off-nosave", new CommandDelegate(OffNoSave));
             TShock.commandList.Add("help", new CommandDelegate(Help));
             TShock.commandList.Add("kill", new CommandDelegate(Kill));
         }
@@ -111,6 +112,27 @@ namespace TShockAPI
             Netplay.disconnect = true;
         }

+        public static void ShowConfig(CommandArgs args)
+        {
+            int ply = args.PlayerID;
+            var commands = TShock.commandList;
+            if (TShock.players[ply].IsAdmin())
+                commands = TShock.admincommandList;
+            Tools.SendMessage(ply, "TShock Config:");
+            string lineOne = "";
+            lineOne += "KickCheater : " + ConfigurationManager.kickCheater + ", ";
+            lineOne += "BanCheater : " + ConfigurationManager.banCheater + ", ";
+            lineOne += "KickGriefer : " + ConfigurationManager.kickGriefer + ", ";
+            lineOne += "BanGriefer : " + ConfigurationManager.banGriefer;
+            Tools.SendMessage(ply, lineOne, new float[] { 255f, 255f, 0f });
+            string lineTwo = "";
+            lineTwo += "BanTnt : " + ConfigurationManager.banTnt + ", ";
+            lineTwo += "KickTnt : " + ConfigurationManager.kickTnt + ", ";
+            lineTwo += "BanBoom : " + ConfigurationManager.banBoom + ", ";
+            lineTwo += "KickBoom : " + ConfigurationManager.kickBoom;
+            Tools.SendMessage(ply, lineTwo, new float[] { 255f, 255f, 0f });
+        }
+
         public static void Reload(CommandArgs args)
         {
             FileTools.SetupConfig();

Time command

/noon
/dawn
/dusk
/midnight
For Administrators

Revert kill tile changes - bugs

  • Liquids act weird, as if there were no tiles.
  • Things like chairs and such are not reverted.
  • Revertion is only done to a certain point. Might miss a couple of blocks.

making myself admin

Hey I need help with making myself admin. iv'e pput both my internal and external ip's in the admins.txt files and I still dont have access to all of the commands. Thanks for the help in advance!

Revert kill tile changes - bugs

  • Liquids act weird, as if there were no tiles.
  • Things like chairs and such are not reverted.
  • Revertion is only done to a certain point. Might miss a couple of blocks.

Lag gets people banned for KT abuse

You get banned for using Dirt Wand as it uses Place Tile so it trips the distance check.
You can get banned for using purification powder.

Goblin invasions

Goblin invasions don't work, you can start an invasion but the goblins never come...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.