66 lines
2.3 KiB
C#
66 lines
2.3 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using Terraria;
|
|
using Terraria.DataStructures;
|
|
using Terraria.Enums;
|
|
using Terraria.ID;
|
|
using Terraria.Localization;
|
|
using Terraria.ModLoader;
|
|
using Terraria.ObjectData;
|
|
|
|
namespace CalamityMod.Tiles
|
|
{
|
|
public class MonsterBanner : ModTile
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
Main.tileFrameImportant[Type] = true;
|
|
Main.tileNoAttach[Type] = true;
|
|
Main.tileLavaDeath[Type] = true;
|
|
TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top);
|
|
TileObjectData.newTile.Height = 3;
|
|
TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 };
|
|
TileObjectData.newTile.StyleHorizontal = true;
|
|
TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0);
|
|
TileObjectData.addTile(Type);
|
|
DustType = -1;
|
|
TileID.Sets.DisableSmartCursor[Type] = true;
|
|
AddMapEntry(new Color(13, 88, 130), Language.GetText("MapObject.Banner"));
|
|
}
|
|
|
|
// TODO -- encode these giant switch statements as a sequence in the main class' lists section
|
|
public override void KillMultiTile(int i, int j, int frameX, int frameY)
|
|
{
|
|
int style = frameX / 18;
|
|
int banner = CalamityUtils.GetBannerItem(style);
|
|
if (banner != -1)
|
|
Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 48, banner);
|
|
}
|
|
|
|
public override void NearbyEffects(int i, int j, bool closer)
|
|
{
|
|
if (!closer)
|
|
return;
|
|
Player player = Main.LocalPlayer;
|
|
if (player is null || !player.active || player.dead)
|
|
return;
|
|
|
|
int style = Main.tile[i, j].TileFrameX / 18;
|
|
int npc = CalamityUtils.GetBannerNPC(style);
|
|
if (npc != -1)
|
|
{
|
|
Main.SceneMetrics.NPCBannerBuff[npc] = true;
|
|
Main.SceneMetrics.hasBanner = true;
|
|
}
|
|
}
|
|
|
|
public override void SetSpriteEffects(int i, int j, ref SpriteEffects spriteEffects)
|
|
{
|
|
if (i % 2 == 1)
|
|
{
|
|
spriteEffects = SpriteEffects.FlipHorizontally;
|
|
}
|
|
}
|
|
}
|
|
}
|