Skip to content

Instantly share code, notes, and snippets.

View its-truce's full-sized avatar
😶‍🌫️
history is just one damn thing after another

itstruce its-truce

😶‍🌫️
history is just one damn thing after another
View GitHub Profile
@its-truce
its-truce / Templates.md
Last active June 9, 2023 09:25
[tModLoader 1.4.4] VS Templates For Items & Projectiles

[tModLoader 1.4.4] VS Templates For Items & Projectiles

Here's a couple of item templates I made for VS. These are the steps to download and use them:

Downloading

Download the .zip files provided below and then copy them over to this location: %USERPROFILE%\Documents\Visual Studio 2022\My Exported Templates (going to this through explorer or run should work). Restart VS and continue.

Using the Templates

@its-truce
its-truce / DecompileMods.md
Last active March 17, 2024 17:17
[tModLoader] How To Decompile Mods

[tModLoader] How To Decompile Mods

NOTE: Please don't copy other people's code unless you have permission. Respect other people's wishes about distributing code. Copying code is plagiarism. This tutorial is only to teach you how to do it.

This is a bite-sized tutorial on how to decompile Terraria mods. If you want to replicate a certain effect that you saw in a mod of your own, you can decompile that mod. Here's how you can do it:

Obtaining the DLL

To obtain the .dll file, we have to use a TML.Patcher, a 3rd party tool for decompiling mods. Here's how you can install and use it:

  • Open Command Prompt.
  • Run dotnet tool install -g Tomat.TML.Patcher to install it.
  • Run tmlpatcher extract "Path/To/The/Mod.tmod" to extract the mod file at Path/To/The/Mod.tmod.
@its-truce
its-truce / Screenshake.md
Last active June 13, 2023 09:24
[tModLoader 1.4.4] How To Add Screenshake

[tModLoader 1.4.3] How To Add Screenshake

This is a bite-sized tutorial on shaking the screen in tModLoader [1.4.3]. It's usually used in boss fights and "heavy" weapons. Here's how you can implement it:

Adding Screenshake

To add screenshake, we use the ModifyScreenPosition hook in ModPlayer. Let's make a new .cs file in a Players folder (for organization; this is usually good for beginners but you can decide where to put it). Here's what our code would look like:

public class ScreenshakePlayer : ModPlayer
{
    public int screenshakeTimer;
 public int screenshakeMagnitude;