Fix last pos at join. Reject all movement until server can verify the last position set.
This commit is contained in:
parent
1e6c74ace0
commit
4d2639bb2a
2 changed files with 8 additions and 0 deletions
|
|
@ -735,6 +735,11 @@ namespace TShockAPI
|
|||
return true;
|
||||
}
|
||||
|
||||
if(args.Player.LastNetPosition == Vector2.Zero)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!pos.Equals(args.Player.LastNetPosition))
|
||||
{
|
||||
float distance = Vector2.Distance(new Vector2(pos.X / 16f, pos.Y / 16f), new Vector2(args.Player.LastNetPosition.X / 16f, args.Player.LastNetPosition.Y / 16f));
|
||||
|
|
|
|||
|
|
@ -839,9 +839,12 @@ namespace TShockAPI
|
|||
StartInvasion();
|
||||
}
|
||||
|
||||
player.LastNetPosition = new Vector2(Main.spawnTileX * 16f, Main.spawnTileY * 16f);
|
||||
|
||||
if (Config.RememberLeavePos)
|
||||
{
|
||||
var pos = RememberedPos.GetLeavePos(player.Name, player.IP);
|
||||
player.LastNetPosition = pos;
|
||||
player.Teleport((int) pos.X, (int) pos.Y + 3);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue