forked from tModLoader/tModLoader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathElementalPurge.cs
47 lines (43 loc) · 1.79 KB
/
ElementalPurge.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;
namespace ExampleMod.Tiles
{
public class ElementalPurge : ModTile
{
public override void SetDefaults() {
Main.tileFrameImportant[Type] = true;
TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX);
TileObjectData.newTile.Height = 3;
TileObjectData.newTile.Origin = new Point16(1, 2);
TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 18 };
TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(ModContent.GetInstance<TEElementalPurge>().Hook_AfterPlacement, -1, 0, false);
TileObjectData.addTile(Type);
ModTranslation name = CreateMapEntryName();
name.SetDefault("Elemental Purge");
AddMapEntry(new Color(190, 230, 190), name);
dustType = 11;
disableSmartCursor = true;
}
public override void KillMultiTile(int i, int j, int frameX, int frameY) {
Item.NewItem(i * 16, j * 16, 32, 48, ModContent.ItemType<Items.Placeable.ElementalPurge>());
ModContent.GetInstance<TEElementalPurge>().Kill(i, j);
}
public override void PostDraw(int i, int j, SpriteBatch spriteBatch) {
Tile tile = Main.tile[i, j];
Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange);
if (Main.drawToScreen) {
zero = Vector2.Zero;
}
int height = tile.frameY == 36 ? 18 : 16;
Main.spriteBatch.Draw(mod.GetTexture("Tiles/ElementalPurge_Glow"), new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, new Rectangle(tile.frameX, tile.frameY, 16, height), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
}
public override bool AutoSelect(int i, int j, Item item) {
return item.type == ItemID.Bunny;
}
}
}