Change remembered position teleporter to a short delay
This commit is contained in:
parent
931e65fd80
commit
c4bb414ab4
2 changed files with 26 additions and 8 deletions
|
|
@ -63,6 +63,12 @@ namespace TShockAPI
|
||||||
// </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>
|
||||||
|
|
|
||||||
|
|
@ -678,6 +678,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)
|
||||||
{
|
{
|
||||||
player.Disable("Reached TileLiquid threshold.");
|
player.Disable("Reached TileLiquid threshold.");
|
||||||
|
|
@ -1088,13 +1102,11 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue