Files
CalamityModPublic/Tiles/Astral/AstralCrateTile.cs
T

54 lines
1.6 KiB
C#

using CalamityMod.Dusts;
using CalamityMod.Items.Fishing.AstralCatches;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
using Terraria.ObjectData;
namespace CalamityMod.Tiles.Astral
{
public class AstralCrateTile : ModTile
{
public override void SetDefaults()
{
Main.tileSolidTop[Type] = true;
Main.tileLighted[Type] = true;
Main.tileFrameImportant[Type] = true;
Main.tileNoAttach[Type] = true;
Main.tileTable[Type] = true;
Main.tileLavaDeath[Type] = true;
Main.tileWaterDeath[Type] = false;
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2);
TileObjectData.addTile(Type);
ModTranslation name = CreateMapEntryName();
name.SetDefault("Astral Crate");
AddMapEntry(new Color(47, 66, 90), name);
dustType = ModContent.DustType<AstralBlue>();
}
public override bool CreateDust(int i, int j, ref int type)
{
if (Main.rand.NextBool(2))
{
type = ModContent.DustType<AstralOrange>();
}
else
{
type = ModContent.DustType<AstralBlue>();
}
return true;
}
public override void NumDust(int i, int j, bool fail, ref int num)
{
num = fail ? 1 : 3;
}
public override void KillMultiTile(int i, int j, int frameX, int frameY)
{
Item.NewItem(i * 16, j * 16, 16, 32, ModContent.ItemType<AstralCrate>());
}
}
}