Added TP Lock for modders

This commit is contained in:
Twitchy 2011-08-03 08:02:41 +12:00
parent de0f7e2c2b
commit f49ffe7647

View file

@ -52,6 +52,7 @@ namespace TShockAPI
public bool IsLoggedIn;
public int UserID = -1;
public bool HasBeenNaggedAboutLoggingIn;
public bool TpLock = false;
Player FakePlayer;
public bool RealPlayer
@ -184,24 +185,29 @@ namespace TShockAPI
public bool Teleport(int tilex, int tiley)
{
InitSpawn = false;
SendTeleport(tilex, tiley);
//150 Should avoid all client crash errors
//The error occurs when a tile trys to update which the client hasnt load yet, Clients only update tiles withen 150 blocks
//Try 300 if it does not work (Higher number - Longer load times - Less chance of error)
if (!SendTileSquare(tilex, tiley))
if (!TpLock)
{
SendMessage("Warning, teleport failed due to being too close to the edge of the map.", Color.Red);
return false;
InitSpawn = false;
SendTeleport(tilex, tiley);
//150 Should avoid all client crash errors
//The error occurs when a tile trys to update which the client hasnt load yet, Clients only update tiles withen 150 blocks
//Try 300 if it does not work (Higher number - Longer load times - Less chance of error)
if (!SendTileSquare(tilex, tiley))
{
SendMessage("Warning, teleport failed due to being too close to the edge of the map.", Color.Red);
return false;
}
Spawn();
SendTeleport(Main.spawnTileX, Main.spawnTileY);
return true;
}
Spawn();
SendTeleport(Main.spawnTileX, Main.spawnTileY);
return true;
SendMessage("Cannot teleport due to TP Lock", Color.Red);
return false;
}
public void Spawn()