Adds option to remember leave positions. Change to true in config.json
This commit is contained in:
parent
f790d9378c
commit
df1cbab1f5
6 changed files with 162 additions and 3 deletions
|
|
@ -102,11 +102,11 @@ namespace TShockAPI
|
|||
Log.Info("Commands initialized");
|
||||
|
||||
RegionManager.ReadAllSettings();
|
||||
|
||||
WarpsManager.ReadAllSettings();
|
||||
|
||||
ItemManager.LoadBans();
|
||||
|
||||
|
||||
|
||||
Backups.KeepFor = ConfigurationManager.BackupKeepFor;
|
||||
Backups.Interval = ConfigurationManager.BackupInterval;
|
||||
|
||||
|
|
@ -270,6 +270,12 @@ namespace TShockAPI
|
|||
if (tsplr != null && tsplr.ReceivedInfo)
|
||||
Log.Info(string.Format("{0} left.", tsplr.Name));
|
||||
|
||||
if (ConfigurationManager.RememberLeavePos)
|
||||
{
|
||||
RemeberedPosManager.RemeberedPosistions.Add(new RemeberedPos(Players[ply].IP, new Vector2(Players[ply].X / 16, (Players[ply].Y / 16) + 3)));
|
||||
RemeberedPosManager.WriteSettings();
|
||||
}
|
||||
|
||||
Players[ply] = null;
|
||||
}
|
||||
|
||||
|
|
@ -416,6 +422,16 @@ namespace TShockAPI
|
|||
{
|
||||
StartInvasion();
|
||||
}
|
||||
if (ConfigurationManager.RememberLeavePos)
|
||||
{
|
||||
foreach (RemeberedPos playerIP in RemeberedPosManager.RemeberedPosistions)
|
||||
{
|
||||
if (playerIP.IP == Players[who].IP)
|
||||
{
|
||||
Players[who].Teleport((int)playerIP.Pos.X, (int)playerIP.Pos.Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue