Force respawn after death.
(prevents some forms of invisibility)
This commit is contained in:
parent
8b59e1c525
commit
85f1ba6643
3 changed files with 9 additions and 0 deletions
|
|
@ -500,6 +500,8 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
return Tools.HandleGriefer(args.Player, TShock.Config.KillMeAbuseReason);
|
return Tools.HandleGriefer(args.Player, TShock.Config.KillMeAbuseReason);
|
||||||
}
|
}
|
||||||
|
args.Player.LastDeath = DateTime.Now;
|
||||||
|
args.Player.ForceSpawn = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,8 @@ namespace TShockAPI
|
||||||
public bool TpLock = false;
|
public bool TpLock = false;
|
||||||
Player FakePlayer;
|
Player FakePlayer;
|
||||||
public List<Vector2> RequestedSections = new List<Vector2>();
|
public List<Vector2> RequestedSections = new List<Vector2>();
|
||||||
|
public DateTime LastDeath { get; set; }
|
||||||
|
public bool ForceSpawn = false;
|
||||||
|
|
||||||
public bool RealPlayer
|
public bool RealPlayer
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -385,6 +385,11 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
if (CheckPlayerCollision(player.TileX, player.TileY))
|
if (CheckPlayerCollision(player.TileX, player.TileY))
|
||||||
player.SendMessage("You are currently nocliping!", Color.Red);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue