Example #1
0
        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;
            }
        }
Example #2
0
        public override void RightClick(int i, int j)
        {
            int ID = mod.GetID <TEGrinder>(i, j);

            if (ID == -1)
            {
                return;
            }

            TEGrinder grinder = (TEGrinder)TileEntity.ByID[ID];

            if (TheOneLibrary.Utility.Utility.HasWrench)
            {
                grinder.active = !grinder.active;
                Main.NewText($"Grinder has been {(grinder.active ? "activated" : "deactivated")}.");
            }
            else
            {
                Main.NewText(grinder.GetEnergy() + "/" + grinder.GetCapacity());
            }

            grinder.SendUpdate();
        }