Force respawn after death.

(prevents some forms of invisibility)
This commit is contained in:
Deathmax 2011-08-20 20:45:19 +08:00
parent 8b59e1c525
commit 85f1ba6643
3 changed files with 9 additions and 0 deletions

View file

@ -500,6 +500,8 @@ namespace TShockAPI
{
return Tools.HandleGriefer(args.Player, TShock.Config.KillMeAbuseReason);
}
args.Player.LastDeath = DateTime.Now;
args.Player.ForceSpawn = true;
return false;
}

View file

@ -58,6 +58,8 @@ namespace TShockAPI
public bool TpLock = false;
Player FakePlayer;
public List<Vector2> RequestedSections = new List<Vector2>();
public DateTime LastDeath { get; set; }
public bool ForceSpawn = false;
public bool RealPlayer
{

View file

@ -385,6 +385,11 @@ namespace TShockAPI
}
if (CheckPlayerCollision(player.TileX, player.TileY))
player.SendMessage("You are currently nocliping!", Color.Red);
if (player.LastDeath != null && player.ForceSpawn && (DateTime.Now - player.LastDeath).Seconds >= 3)
{
player.Spawn();
player.ForceSpawn = false;
}
}
}
}