allow teleporting and warps at edges of the map
This commit is contained in:
parent
7e26c40744
commit
1e8cb04fdd
1 changed files with 25 additions and 1 deletions
|
|
@ -313,11 +313,35 @@ namespace TShockAPI
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int num = (size - 1)/2;
|
int num = (size - 1)/2;
|
||||||
SendData(PacketTypes.TileSendSquare, "", size, (x - num), (y - num));
|
int m_x=0;
|
||||||
|
int m_y=0;
|
||||||
|
|
||||||
|
if (x - num <0){
|
||||||
|
m_x=0;
|
||||||
|
}else{
|
||||||
|
m_x = x - num;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (y - num <0){
|
||||||
|
m_y=0;
|
||||||
|
}else{
|
||||||
|
m_y = y - num;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_x + size > Main.maxTilesX){
|
||||||
|
m_x=Main.maxTilesX - size;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_y + size > Main.maxTilesY){
|
||||||
|
m_y=Main.maxTilesY - size;
|
||||||
|
}
|
||||||
|
|
||||||
|
SendData(PacketTypes.TileSendSquare, "", size, m_x, m_y);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (IndexOutOfRangeException)
|
catch (IndexOutOfRangeException)
|
||||||
{
|
{
|
||||||
|
|
||||||
// This is expected if square exceeds array.
|
// This is expected if square exceeds array.
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue