public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) { int ID = mod.GetID <TEGrinder>(i, j); if (ID == -1) { return; } Tile tile = Main.tile[i, j]; if (tile.TopLeft()) { TEGrinder grinder = (TEGrinder)TileEntity.ByID[ID]; TileObjectDirection dir = TheOneLibrary.Utility.Utility.GetDirection(i, j, mod.TileType <Grinder>()); int startX = dir == TileObjectDirection.PlaceRight ? i + 2 : i - grinder.range / 16 - 1; int endX = dir == TileObjectDirection.PlaceRight ? i + 2 + grinder.range / 16 : i - 1; if (grinder.drawInfo) { spriteBatch.DrawOutline(new Point16(startX, j + 1 - grinder.range / 16), new Point16(endX, j + 1), Color.Goldenrod, 2, true); } grinder.drawInfo = false; } }
public override void Update() { TileObjectDirection dir = TheOneLibrary.Utility.Utility.GetDirection(Position.X, Position.Y, mod.TileType <Grinder>()); if (active && ++timer >= 120) { for (int i = 0; i < Main.npc.Length; i++) { if (Main.npc[i].active) { NPC npc = Main.npc[i]; Rectangle npcHitbox = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); Rectangle grinderBox = new Rectangle(Position.X * 16 + (dir == TileObjectDirection.PlaceRight ? 32 : -range), Position.Y * 16 + 32 - range, range, range); if (npcHitbox.Intersects(grinderBox)) { npc.StrikeNPC(npc.life, 0f, 0, true, true); Utils.PoofOfSmoke(npc.Center); } } } timer = 0; } }
public override void Update() { TileObjectDirection dir = TheOneLibrary.Utility.Utility.GetDirection(Position.X, Position.Y, mod.TileType <Fan>()); Rectangle fanBox = new Rectangle(Position.X * 16 + (dir == TileObjectDirection.PlaceRight ? 32 : -rangeX), Position.Y * 16 + 32 - rangeY, rangeX, rangeY); for (int i = 0; i < Main.npc.Length; i++) { if (Main.npc[i].active) { NPC npc = Main.npc[i]; Rectangle npcHitbox = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); if (npcHitbox.Intersects(fanBox)) { npc.velocity.X = (float)(dir == TileObjectDirection.PlaceRight ? speed : -speed) / 60f; } } } for (int i = 0; i < Main.item.Length; i++) { if (Main.item[i].active) { Item item = Main.item[i]; Rectangle itemHitbox = new Rectangle((int)item.position.X, (int)item.position.Y, item.width, item.height); if (itemHitbox.Intersects(fanBox)) { item.velocity.X = (float)(dir == TileObjectDirection.PlaceRight ? speed : -speed) / 60f; } } } this.HandleUIFar(); }
public TileObjectBaseModule(TileObjectBaseModule copyFrom = null) { if (copyFrom == null) { this.width = 1; this.height = 1; this.origin = Point16.Zero; this.direction = TileObjectDirection.None; this.randomRange = 0; this.flattenAnchors = false; return; } this.width = copyFrom.width; this.height = copyFrom.height; this.origin = copyFrom.origin; this.direction = copyFrom.direction; this.randomRange = copyFrom.randomRange; this.flattenAnchors = copyFrom.flattenAnchors; }
public TileObjectBaseModule(TileObjectBaseModule copyFrom = null) { if (copyFrom == null) { this.width = 1; this.height = 1; this.origin = Point16.Zero; this.direction = TileObjectDirection.None; this.randomRange = 0; this.flattenAnchors = false; return; } this.width = copyFrom.width; this.height = copyFrom.height; this.origin = copyFrom.origin; this.direction = copyFrom.direction; this.randomRange = copyFrom.randomRange; this.flattenAnchors = copyFrom.flattenAnchors; }
public TileObjectBaseModule(TileObjectBaseModule copyFrom = null) { if (copyFrom == null) { width = 1; height = 1; origin = Point16.Zero; direction = TileObjectDirection.None; randomRange = 0; flattenAnchors = false; } else { width = copyFrom.width; height = copyFrom.height; origin = copyFrom.origin; direction = copyFrom.direction; randomRange = copyFrom.randomRange; flattenAnchors = copyFrom.flattenAnchors; } }
public TileObjectBaseModule(TileObjectBaseModule copyFrom = null) { if (copyFrom == null) { width = 1; height = 1; origin = Point16.Zero; direction = TileObjectDirection.None; randomRange = 0; flattenAnchors = false; } else { width = copyFrom.width; height = copyFrom.height; origin = copyFrom.origin; direction = copyFrom.direction; randomRange = copyFrom.randomRange; flattenAnchors = copyFrom.flattenAnchors; } }