Change remembered position teleporter to a short delay

This commit is contained in:
k0rd 2013-10-01 19:00:03 -04:00
parent 931e65fd80
commit c4bb414ab4
2 changed files with 26 additions and 8 deletions

View file

@ -62,7 +62,13 @@ namespace TShockAPI
/// A timer to keep track of whether or not the player has recently thrown an explosive /// A timer to keep track of whether or not the player has recently thrown an explosive
// </summary> // </summary>
public int RecentFuse = 0; public int RecentFuse = 0;
/// <summary>
/// A system to delay Remembered Position Teleports a few seconds
/// </summary>
public int RPPending = 0;
/// <summary> /// <summary>
/// A queue of tiles destroyed by the player for reverting. /// A queue of tiles destroyed by the player for reverting.
/// </summary> /// </summary>

View file

@ -677,6 +677,20 @@ namespace TShockAPI
if (player.RecentFuse >0) if (player.RecentFuse >0)
player.RecentFuse--; player.RecentFuse--;
if (player.RPPending >0)
{
if (player.RPPending == 1)
{
var pos = RememberedPos.GetLeavePos(player.Name, player.IP);
player.Teleport(pos.X*16, pos.Y*16 );
player.RPPending = 0;
}
else
{
player.RPPending--;
}
}
if (player.TileLiquidThreshold >= Config.TileLiquidThreshold) if (player.TileLiquidThreshold >= Config.TileLiquidThreshold)
{ {
@ -1088,14 +1102,12 @@ namespace TShockAPI
player.LastNetPosition = new Vector2(Main.spawnTileX*16f, Main.spawnTileY*16f); player.LastNetPosition = new Vector2(Main.spawnTileX*16f, Main.spawnTileY*16f);
if (Config.RememberLeavePos) if (Config.RememberLeavePos && (RememberedPos.GetLeavePos(player.Name, player.IP) != Vector2.Zero))
{ {
if (RememberedPos.GetLeavePos(player.Name, player.IP) != Vector2.Zero){ player.RPPending=3;
var pos = RememberedPos.GetLeavePos(player.Name, player.IP); player.SendMessage("You will be teleported to your last known location...", Color.Red);
}
player.Teleport(pos.X*16, pos.Y*16 );
}}
args.Handled = true; args.Handled = true;
} }