Reverted teleport method.

Fixed server.dat corruption
This commit is contained in:
high 2011-08-09 23:24:02 -04:00
parent 074d87d0f7
commit ba67148ed8
2 changed files with 50 additions and 55 deletions

View file

@ -61,19 +61,19 @@ namespace TShockAPI.Net
} }
public void Pack(Stream stream) public void Pack(Stream stream)
{ {
stream.Write(Time); stream.WriteInt32(Time);
stream.Write(DayTime); stream.WriteBoolean(DayTime);
stream.Write(MoonPhase); stream.WriteInt8(MoonPhase);
stream.Write(BloodMoon); stream.WriteBoolean(BloodMoon);
stream.Write(MaxTilesX); stream.WriteInt32(MaxTilesX);
stream.Write(MaxTilesY); stream.WriteInt32(MaxTilesY);
stream.Write(SpawnX); stream.WriteInt32(SpawnX);
stream.Write(SpawnY); stream.WriteInt32(SpawnY);
stream.Write(WorldSurface); stream.WriteInt32(WorldSurface);
stream.Write(RockLayer); stream.WriteInt32(RockLayer);
stream.Write(WorldID); stream.WriteInt32(WorldID);
stream.Write((byte)WorldFlags); stream.WriteInt8((byte)WorldFlags);
stream.Write(Encoding.ASCII.GetBytes(WorldName)); stream.WriteBytes(Encoding.ASCII.GetBytes(WorldName));
} }
public void Unpack(Stream stream) public void Unpack(Stream stream)

View file

@ -188,8 +188,6 @@ namespace TShockAPI
} }
public bool Teleport(int tilex, int tiley) public bool Teleport(int tilex, int tiley)
{
if (!TpLock)
{ {
InitSpawn = false; InitSpawn = false;
@ -198,7 +196,7 @@ namespace TShockAPI
//150 Should avoid all client crash errors //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 //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) //Try 300 if it does not work (Higher number - Longer load times - Less chance of error)
if (!SendTileSquare(tilex, tiley)) if (!SendTileSquare(tilex, tiley, 150))
{ {
SendMessage("Warning, teleport failed due to being too close to the edge of the map.", Color.Red); SendMessage("Warning, teleport failed due to being too close to the edge of the map.", Color.Red);
return false; return false;
@ -238,9 +236,6 @@ namespace TShockAPI
return true; return true;
} }
SendMessage("Cannot teleport due to TP Lock", Color.Red);
return false;
}
public void Spawn() public void Spawn()
{ {