tModLoader Defenced Target Dummies

WVlad

Terrarian
So you want to test how your weapon will scale with enemy defence but vanilla Target Dummy has 0 defence... Now you have a solution!

You can craft defenced Target Dummies by hand from normal dummies. There are different recipes for different defence values made for different game stages.

Also it changes your DPS counter so that it displays values *after* defence, not before.

But note that each time you take dummy back to inventory you have to craft defenced version again. I couldn't make the game to not drop the original Target Dummy when you destroy the dummy tile. Though TModLoader API allows it still it just doesn't work for Target Dummy. But it's not such an issue since they are "converted" to defenced version by hand crafting without any materials.


Multiplayer: not tested.

Installation: unpack archive and put content to your Terraria\ModLoader\Mods\ directory, enable in game "Mods" menu and press "Reload mods".
 

Attachments

  • DefencedDummies.zip
    24.1 KB · Views: 152
Last edited:
I couldn't make the game to not drop the original Target Dummy when you destroy the dummy tile. Though TModLoader API allows it still it just doesn't work for Target Dummy. But it's not such an issue since they are "converted" to defenced version by hand crafting without any materials.
 
I couldn't make the game to not drop the original Target Dummy when you destroy the dummy tile. Though TModLoader API allows it still it just doesn't work for Target Dummy. But it's not such an issue since they are "converted" to defenced version by hand crafting without any materials.
Wouldn't it just be something along these lines (obviously with the rest of it) in the tile's code?
Code:
public override void SetDefaults () {
drop = mod.ItemType("DummyNameHere");
}
Or is that not working?
 
My mod adds only items. I don't need to have a separate tile, I just track which dummies what defence have and update their npc defence value. Because I need to track it anyway as there is internal logic for TileEntity which is hard to copy so I use the original logic.

I tried to intercept Drop of the original tile and it correctly drops my version of item but the original item is still dropped too.

GlobalTile:
Code:
  // doesn't work, still drops normal dummy too
  //public override bool Drop(int i, int j, int type)
  //{
  //  if (type == TileID.TargetDummy)
  //  {
   //  int defence;
   //  if (DefenceValues.TryGetValue(new Point(i, j), out defence))
   //  {
    //  int itemType = DefencedDummies.DefencedDummies.Instance.ItemType("TargetDummyDefence" + defence);
    //  //Main.item[Item.NewItem(i * 16, j * 16, 16, 16, itemType, 1, false, -1)].;
    //  return false;
   //  }
  //  }
  //  return true;
  //}

Maybe I could still make a separate ModTile for this but use the original TileEntity. But... the mod mostly works and I'm lazy ~:sigh: (even didn't setup this on github) Feel free to Extract code and suggest edits.
 
Last edited:
My mod adds only items. I don't need to have a separate tile, I just track which dummies what defence have and update their npc defence value. Because I need to track it anyway as there is internal logic for TileEntity which is hard to copy so I use the original logic.

I tried to intercept Drop of the original tile and it correctly drops my version of item but the original item is still dropped too.

GlobalTile:
Code:
  // doesn't work, still drops normal dummy too
  //public override bool Drop(int i, int j, int type)
  //{
  //  if (type == TileID.TargetDummy)
  //  {
   //  int defence;
   //  if (DefenceValues.TryGetValue(new Point(i, j), out defence))
   //  {
    //  int itemType = DefencedDummies.DefencedDummies.Instance.ItemType("TargetDummyDefence" + defence);
    //  //Main.item[Item.NewItem(i * 16, j * 16, 16, 16, itemType, 1, false, -1)].;
    //  return false;
   //  }
  //  }
  //  return true;
  //}

Maybe I could still make a separate ModTile for this but use the original TileEntity. But... the mod mostly works and I'm lazy ~:sigh: (even didn't setup this on github) Feel free to Extract code and suggest edits.
I might do that once I find some time, as the semester just started back up and I'm settling back into a college schedule. I need to learn how to use ModTileEntity anyway for a different mod that I'm working on, so that would be useful to look at too.
 
The TileEntity for dummies uses internal code which you wouldn't want to mess with. The thing you want can be done with ModTile, not ModTileEntity.
 
Back
Top Bottom