tModLoader Making Items to place natural walls

Stormalisk

Empress of Light
I have been fiddling with making an item to place the natural version of dungeon walls.

My item is working, but I think it is still placing player placed versions of dungeon walls as no dungeon guardians have come to ruin my testing yet. (testing on a world with no skeletron defeated)

Code:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace BetterBoneWelder.Items.Placeable
{
    public class BlueDungeonBrickNatural : ModItem
    {
            public override void SetStaticDefaults()
            {
                DisplayName.SetDefault("Cursed Blue Dungeon Brick");
            }


            public override void SetDefaults()
            {
               
                item.width = 12;
                item.height = 12;
                item.useTime = 15;
                item.useAnimation = 10;
                item.useStyle = 1;
                item.value = 50;
                item.UseSound = SoundID.Item1;
                item.autoReuse = true;
                item.consumable = true;
                item.createWall = (WallID.BlueDungeonUnsafe);
                item.maxStack = 999;
            }

            public override void AddRecipes()
            {
                ModRecipe recipe = new ModRecipe(mod);
                recipe.AddIngredient(ItemID.BlueBrick);
                recipe.AddTile(TileID.BoneWelder);
                recipe.SetResult (mod.ItemType("BlueDungeonBrickNatural"), 4);
                recipe.AddRecipe();
            }
    }
}
 
Pretty sure that is placing the correct wall as intended. It's not the wall that causes dungeon guardian to spawn, but the wall and the number of dungeon tiles nearby and the depth:

Code:
            this.ZoneDungeon = false;
            if (Main.dungeonTiles >= 250 && (double)base.Center.Y > Main.worldSurface * 16.0)
            {
                int num = (int)base.Center.X / 16;
                int num2 = (int)base.Center.Y / 16;
                if (Main.wallDungeon[(int)Main.tile[num, num2].wall])
                {
                    this.ZoneDungeon = true;
                }
            }

Also, if you can read this code, you can see All the Walls is doing the same thing: https://github.com/JavidPack/AllTheWalls
 
I had a suspicion it was that, though I swore I made a tiny dungeon shrine with Tedit years ago and it was considered a dungeon biome. So I wasn't majorly sure since I couldn't find info about how big a dungeon biome had to be on the wiki.
 
Back
Top Bottom