replaced tshock.position with vector2

This commit is contained in:
high 2011-06-14 19:51:54 -04:00
parent 12946c8a63
commit 760a81f74e
2 changed files with 7 additions and 18 deletions

View file

@ -16,6 +16,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<TShock.Position, Tile> TilesDestroyed { get; set; }
public Dictionary<Vector2, Tile> 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<TShock.Position, Tile>();
TilesDestroyed = new Dictionary<Vector2, Tile>();
TPlayer = ply;
}
}

View file

@ -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--)
{