94 lines
3.2 KiB
C#
94 lines
3.2 KiB
C#
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 CalamityMod.Tiles
|
|
{
|
|
public class AbyssTorch : ModTile
|
|
{
|
|
public override void SetDefaults()
|
|
{
|
|
Main.tileLighted[Type] = true;
|
|
Main.tileFrameImportant[Type] = true;
|
|
Main.tileSolid[Type] = false;
|
|
Main.tileNoAttach[Type] = true;
|
|
Main.tileNoFail[Type] = true;
|
|
Main.tileWaterDeath[Type] = false;
|
|
TileObjectData.newTile.CopyFrom(TileObjectData.StyleTorch);
|
|
TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0);
|
|
TileObjectData.newAlternate.CopyFrom(TileObjectData.StyleTorch);
|
|
TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide | AnchorType.Tree | AnchorType.AlternateTile, TileObjectData.newTile.Height, 0);
|
|
TileObjectData.newAlternate.AnchorAlternateTiles = new int[]{ 124 };
|
|
TileObjectData.addAlternate(1);
|
|
TileObjectData.newAlternate.CopyFrom(TileObjectData.StyleTorch);
|
|
TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide | AnchorType.Tree | AnchorType.AlternateTile, TileObjectData.newTile.Height, 0);
|
|
TileObjectData.newAlternate.AnchorAlternateTiles = new int[]{ 124 };
|
|
TileObjectData.addAlternate(2);
|
|
TileObjectData.newAlternate.CopyFrom(TileObjectData.StyleTorch);
|
|
TileObjectData.newAlternate.AnchorWall = true;
|
|
TileObjectData.addAlternate(0);
|
|
TileObjectData.addTile(Type);
|
|
AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch);
|
|
ModTranslation name = CreateMapEntryName();
|
|
name.SetDefault("Torch");
|
|
AddMapEntry(new Color(200, 200, 200), name);
|
|
dustType = mod.DustType("Sparkle");
|
|
drop = mod.ItemType("AbyssTorch");
|
|
disableSmartCursor = true;
|
|
adjTiles = new int[]{ TileID.Torches };
|
|
torch = true;
|
|
}
|
|
|
|
public override void NumDust(int i, int j, bool fail, ref int num)
|
|
{
|
|
num = Main.rand.Next(1, 3);
|
|
}
|
|
|
|
public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b)
|
|
{
|
|
Tile tile = Main.tile[i, j];
|
|
if (tile.frameX < 66)
|
|
{
|
|
r = 0.9f;
|
|
g = 0.9f;
|
|
b = 0.9f;
|
|
}
|
|
}
|
|
|
|
public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height)
|
|
{
|
|
offsetY = 0;
|
|
if (WorldGen.SolidTile(i, j - 1))
|
|
{
|
|
offsetY = 2;
|
|
if (WorldGen.SolidTile(i - 1, j + 1) || WorldGen.SolidTile(i + 1, j + 1))
|
|
{
|
|
offsetY = 4;
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void PostDraw(int i, int j, SpriteBatch spriteBatch)
|
|
{
|
|
ulong randSeed = Main.TileFrameSeed ^ (ulong)((long)j << 32 | (long)((ulong)i));
|
|
Color color = new Color(100, 100, 100, 0);
|
|
int frameX = Main.tile[i, j].frameX;
|
|
int frameY = Main.tile[i, j].frameY;
|
|
Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange);
|
|
if (Main.drawToScreen)
|
|
{
|
|
zero = Vector2.Zero;
|
|
}
|
|
for (int k = 0; k < 7; k++)
|
|
{
|
|
float x = (float)Utils.RandomInt(ref randSeed, -10, 11) * 0.15f;
|
|
float y = (float)Utils.RandomInt(ref randSeed, -10, 1) * 0.35f;
|
|
}
|
|
}
|
|
}
|
|
} |