90 lines
3.4 KiB
C#
90 lines
3.4 KiB
C#
using CalamityMod.Tiles.Abyss.AbyssAmbient;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using ReLogic.Content;
|
|
using Terraria.Audio;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Tiles.Abyss
|
|
{
|
|
public class PyreMantle : ModTile
|
|
{
|
|
public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3) { Volume = 0.4f };
|
|
|
|
public byte[,] tileAdjacency;
|
|
public byte[,] secondTileAdjacency;
|
|
public byte[,] thirdTileAdjacency;
|
|
|
|
public override void SetStaticDefaults()
|
|
{
|
|
Main.tileSolid[Type] = true;
|
|
Main.tileBlockLight[Type] = true;
|
|
Main.tileBrick[Type] = true;
|
|
|
|
CalamityUtils.MergeWithGeneral(Type);
|
|
CalamityUtils.MergeWithAbyss(Type);
|
|
|
|
TileID.Sets.ChecksForMerge[Type] = true;
|
|
HitSound = MineSound;
|
|
MineResist = 10f;
|
|
MinPick = 180;
|
|
AddMapEntry(new Color(19, 20, 32));
|
|
|
|
TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency);
|
|
TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency);
|
|
TileFraming.SetUpUniversalMerge(Type, ModContent.TileType<AbyssGravel>(), out thirdTileAdjacency);
|
|
}
|
|
|
|
public override bool CreateDust(int i, int j, ref int type)
|
|
{
|
|
Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 162, 0f, 0f, 1, new Color(128, 128, 128), 1f);
|
|
return false;
|
|
}
|
|
|
|
public override bool CanExplode(int i, int j)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public override void RandomUpdate(int i, int j)
|
|
{
|
|
Tile tile = Main.tile[i, j];
|
|
Tile up = Main.tile[i, j - 1];
|
|
Tile up2 = Main.tile[i, j - 2];
|
|
|
|
// Place Phoviamare Halm
|
|
if (WorldGen.genRand.NextBool(12) && !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock)
|
|
{
|
|
up.TileType = (ushort)ModContent.TileType<PhoviamareHalm>();
|
|
up.HasTile = true;
|
|
up.TileFrameY = 0;
|
|
|
|
// 16 different frames, choose a random one
|
|
up.TileFrameX = (short)(WorldGen.genRand.Next(16) * 18);
|
|
WorldGen.SquareTileFrame(i, j - 1, true);
|
|
|
|
if (Main.netMode == NetmodeID.Server)
|
|
NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None);
|
|
}
|
|
}
|
|
|
|
public override void PostDraw(int i, int j, SpriteBatch spriteBatch)
|
|
{
|
|
TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/AbyssGravelMerge");
|
|
TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge");
|
|
TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge");
|
|
}
|
|
|
|
public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak)
|
|
{
|
|
TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]);
|
|
TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]);
|
|
TileFraming.GetAdjacencyData(i, j, ModContent.TileType<AbyssGravel>(), out thirdTileAdjacency[i, j]);
|
|
return true;
|
|
}
|
|
}
|
|
}
|