From 760a81f74e6f83501d9d9fcd5cda7b0fc1d7aa32 Mon Sep 17 00:00:00 2001 From: high Date: Tue, 14 Jun 2011 19:51:54 -0400 Subject: [PATCH] replaced tshock.position with vector2 --- TShockAPI/TSPlayer.cs | 9 +++++---- TShockAPI/TShock.cs | 16 ++-------------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 13e7b74a..61567dcb 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -16,6 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ using System.Collections.Generic; +using Microsoft.Xna.Framework; using Terraria; namespace TShockAPI @@ -26,7 +27,7 @@ namespace TShockAPI public uint TileThreshold { get; set; } - public Dictionary TilesDestroyed { get; set; } + public Dictionary TilesDestroyed { get; set; } public bool SyncHP { get; set; } public bool SyncMP { get; set; } public Group Group { get; set; } @@ -54,16 +55,16 @@ namespace TShockAPI } public int TileX { - get { return (int)(TPlayer.position.X / 16); } + get { return (int)(X / 16); } } public int TileY { - get { return (int)(TPlayer.position.Y / 16); } + get { return (int)(X / 16); } } public TSPlayer(Player ply) { - TilesDestroyed = new Dictionary(); + TilesDestroyed = new Dictionary(); TPlayer = ply; } } diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 598d193c..159efe0b 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -365,7 +365,7 @@ namespace TShockAPI if (type == 0 && BlacklistTiles[Main.tile[x, y].type] && Main.player[e.Msg.whoAmI].active) { Players[e.Msg.whoAmI].TileThreshold++; - Players[e.Msg.whoAmI].TilesDestroyed.Add(new Position(x, y), Main.tile[x, y]); + Players[e.Msg.whoAmI].TilesDestroyed.Add(new Vector2(x, y), Main.tile[x, y]); } return false; @@ -899,23 +899,11 @@ namespace TShockAPI return true; } - public class Position - { - public float X; - public float Y; - - public Position(float x, float y) - { - X = x; - Y = y; - } - } - public static void RevertKillTile(int ply) { Tile[] tiles = new Tile[Players[ply].TilesDestroyed.Count]; Players[ply].TilesDestroyed.Values.CopyTo(tiles, 0); - Position[] positions = new Position[Players[ply].TilesDestroyed.Count]; + Vector2[] positions = new Vector2[Players[ply].TilesDestroyed.Count]; Players[ply].TilesDestroyed.Keys.CopyTo(positions, 0); for (int i = (Players[ply].TilesDestroyed.Count - 1); i >= 0; i--) {