using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; using Terraria.ID; namespace CalamityMod.Tiles.FurnitureProfaned { public class RunicProfanedBrick : ModTile { public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeDecorativeTiles(Type); CalamityUtils.MergeSmoothTiles(Type); HitSound = SoundID.Tink; MineResist = 2f; AddMapEntry(new Color(122, 66, 59)); AnimationFrameHeight = 90; } int animationFrameWidth = 234; public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { frameXOffset = i % 2 * animationFrameWidth; frameYOffset = j % 2 * AnimationFrameHeight; } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; int xOffset = i % 2; int yOffset = j % 2; xOffset *= animationFrameWidth; yOffset *= AnimationFrameHeight; xPos += xOffset; yPos += yOffset; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureProfaned/RunicProfanedBrickGlow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Color drawColour = GetDrawColour(i, j, new Color(128, 128, 128, 128)); Tile trackTile = Main.tile[i, j]; double num6 = Main.time * 0.08; TileFraming.SlopedGlowmask(i, j, 0, glowmask, drawOffset, null, GetDrawColour(i, j, drawColour), default); } private Color GetDrawColour(int i, int j, Color colour) { int colType = Main.tile[i, j].TileColor; Color paintCol = WorldGen.paintColor(colType); if (colType >= 13 && colType <= 24) { colour.R = (byte)(paintCol.R / 255f * colour.R); colour.G = (byte)(paintCol.G / 255f * colour.G); colour.B = (byte)(paintCol.B / 255f * colour.B); } return colour; } } }