Can i have some help please? I need help with two things: a boulder trap (with infinite uses) and a mine trap, they each need help on at least one thing about them, mine trap: i need to make it remove itself WITHOUT dropping a item, boulder trap (edited because i fixed one issue, and found another, fixed it, and found a few more): i need it to have a delay and place able on any side of any block (without being place able midair), the block can also be placed on in the end, and the top and sides have collision (not the inside or the bottom), here is my code:
mine trap:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.DataStructures;
using Terraria.ObjectData;
namespace XtraTraps.Tiles
{
public class MineTrap : ModTile
{
public override void SetDefaults()
{
Main.tileSolid[Type] = false;
Main.tileMergeDirt[Type] = false;
Main.tileBlockLight[Type] = false;
Main.tileLighted[Type] = true;
dustType = mod.DustType("Sparkle");
drop = mod.ItemType("MineTrap");
AddMapEntry(new Color(200, 200, 200));
}
public override bool Dangersense(int i, int j, Player player)
{
return true;
}
public override void HitWire(int i, int j)
{
Projectile.NewProjectile((i + 0.5f) * 16f, (j + 0.5f) * 16f, 0f, 0f, mod.ProjectileType("MineExplode"), 70, 10f, Main.myPlayer, 0f, 0f);
WorldGen.KillTile(i, j);
}
}
}
boulder trap:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.Enums;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;
namespace XtraTraps.Tiles
{
// This example shows how to have a tile that is cut by weapons, like vines and grass.
// This example also shows how to spawn a projectile on death like Beehive and Boulder trap.
class BoulderTrapTile : ModTile
{
public override void SetDefaults()
{
Main.tileFrameImportant[Type] = true;
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2);
// We need to change the 3x3 default to allow only placement anchored to top rather than on bottom. Also, the 1,1 means that only the middle tile needs to attach
TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide,0,1);
TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide,0,1);
TileObjectData.newTile.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide,0,1);
TileObjectData.newTile.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide,0,1);
// This is so we can place from above.
TileObjectData.newTile.Origin = new Point16(0, 0);
TileObjectData.addTile(Type);
}
public override bool Dangersense(int i, int j, Player player)
{
return true;
}
public override bool CreateDust(int i, int j, ref int type)
{
return false;
}
public override void HitWire(int i, int j)
{
int y = j - (Main.tile[i, j].frameY / 18);
int x = i - (Main.tile[i, j].frameX / 18);
Projectile.NewProjectile((x + 1f) * 16f, (y + 1f) * 16f, 0f, 0f, ProjectileID.Boulder, 70, 10f, Main.myPlayer, 0f, 0f);
}
public override void KillMultiTile(int i, int j, int frameX, int frameY)
{
Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("BoulderTrapItem"));
}
}
class BoulderTrapItem : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Boulder Trap");
}
public override void SetDefaults()
{
item.CloneDefaults(ItemID.DartTrap);
item.createTile = mod.TileType("BoulderTrapTile");
item.value = 1000;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock, 1);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
(edit #1)
The dirt blocks for the recipes are temporary, so i can test them easier
(edit #2)
i also have a fireball trap, does anyone know what the ID of the fire flower fireball is, because that is the fire i want it to launch
(edit #3)
also, can you tell me how to make hammering a block change the block type? I dont want sloped blocks in my mod, and i also need to know how to make a block appear different depending on what it is placed on (if there is a background wall, use texture one, left, texture 2, top, texture 3, etc)