Bone wall

This commit is contained in:
Heart-Plus-Up committed 2023-02-06 22:53:21 -07:00
1 parent 332f72d748
commit 8c4f4154ef
6 files changed
+110

No files matched your search

Binary file not shown.

Before

Width:  |  Height:  |  Size: 226 B

After

Width:  |  Height:  |  Size: 226 B

@@ -0,0 +1,37 @@
using Terraria.ModLoader;
using WallTiles = CalamityMod.Walls;
using Terraria.ID;
namespace CalamityMod.Items.Placeables.Walls
{
public class ScorchedBoneWall : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Scorched Bone Wall");
SacrificeTotal = 400;
}
public override void SetDefaults()
{
Item.width = 18;
Item.height = 18;
Item.maxStack = 999;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 7;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = true;
Item.createWall = ModContent.WallType<WallTiles.ScorchedBoneWall>();
}
public override void AddRecipes()
{
CreateRecipe(4).
AddIngredient(ModContent.ItemType<ScorchedBone>()).
AddTile(TileID.WorkBenches).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

+73
View File
@@ -0,0 +1,73 @@
using CalamityMod.Dusts.Furniture;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Walls
{
public class ScorchedBoneWall : ModWall
{
public override void SetStaticDefaults()
{
Main.wallHouse[Type] = true;
ItemDrop = ModContent.ItemType<Items.Placeables.Walls.ScorchedBoneWall>();
AddMapEntry(new Color(49, 33, 35));
}
public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3;
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
Texture2D sprite = ModContent.Request<Texture2D>("CalamityMod/Walls/ScorchedBoneWall").Value;
Color lightColor = GetWallColour(i, j);
Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange);
zero -= new Vector2(8, 8);
Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero;
int[] sheetOffset = CreatePattern(i, j);
spriteBatch.Draw
(
sprite,
drawOffset,
new Rectangle(sheetOffset[0] + Main.tile[i, j].WallFrameX, sheetOffset[1] + Main.tile[i, j].WallFrameY, 32, 32),
lightColor,
0,
new Vector2(0f, 0f),
1,
SpriteEffects.None,
0f
);
return false;
}
private int[] CreatePattern(int i, int j)
{
int[] sheetOffset = new int[2] { i % 3, j % 3 };
sheetOffset[0] = sheetOffset[0] * 468;
sheetOffset[1] = sheetOffset[1] * 180;
return sheetOffset;
}
private Color GetWallColour(int i, int j)
{
int colType = Main.tile[i, j].WallColor;
Color paintCol = WorldGen.paintColor(colType);
if (colType < 13)
{
paintCol.R = (byte)((paintCol.R / 2f) + 128);
paintCol.G = (byte)((paintCol.G / 2f) + 128);
paintCol.B = (byte)((paintCol.B / 2f) + 128);
}
if (colType == 29)
{
paintCol = Color.Black;
}
Color col = Lighting.GetColor(i, j);
col.R = (byte)(paintCol.R / 255f * col.R);
col.G = (byte)(paintCol.G / 255f * col.G);
col.B = (byte)(paintCol.B / 255f * col.B);
return col;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB