Did some tweaks to Teleport to make the bounds checks in one place.

Fixed item drop packet, as well as update the bounds.
This commit is contained in:
Zack Piispanen 2013-09-30 19:34:43 -04:00
parent b8a5492b20
commit d71aacc58d
4 changed files with 36 additions and 46 deletions

View file

@ -510,10 +510,27 @@ namespace TShockAPI
}
}
public bool Teleport(float x, float y)
public bool Teleport(float x, float y, byte style = 1)
{
TPlayer.Teleport(new Vector2(x, y), 1);
NetMessage.SendData(65, -1, -1, "", 0, (float)TPlayer.whoAmi, x, y, 1);
if (x > Main.rightWorld - 500)
{
x = Main.rightWorld - 500;
}
if (x < 500)
{
x = 500;
}
if (y > Main.bottomWorld - 500)
{
y = Main.bottomWorld - 500;
}
if (y < 500)
{
y = 500;
}
TPlayer.Teleport(new Vector2(x, y), style);
NetMessage.SendData(65, -1, -1, "", 0, TPlayer.whoAmi, x, y, style);
return true;
}