diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs
index 062e86de..7824267b 100755
--- a/TShockAPI/ConfigFile.cs
+++ b/TShockAPI/ConfigFile.cs
@@ -353,7 +353,10 @@ namespace TShockAPI
public bool LogRest = false;
[Description("The number of seconds a player must wait before being respawned.")]
- public int RespawnSeconds = 3;
+ public int RespawnSeconds = 5;
+
+ [Description("The number of seconds a player must wait before being respawned if there is a boss nearby.")]
+ public int RespawnBossSeconds = 10;
[Description("Disables a player if this number of tiles is painted within 1 second.")]
public int TilePaintThreshold = 15;
diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs
index c182a77c..da820780 100755
--- a/TShockAPI/GetDataHandlers.cs
+++ b/TShockAPI/GetDataHandlers.cs
@@ -2599,8 +2599,18 @@ namespace TShockAPI
return true;
}
- args.Player.LastDeath = DateTime.Now;
args.Player.Dead = true;
+ args.Player.RespawnTimer = TShock.Config.RespawnSeconds;
+
+ foreach (NPC npc in Main.npc)
+ {
+ if (npc.active && (npc.boss || npc.type == 13 || npc.type == 14 || npc.type == 15) &&
+ Math.Abs(args.TPlayer.center().X - npc.center().X) + Math.Abs(args.TPlayer.center().Y - npc.center().Y) < 4000f)
+ {
+ args.Player.RespawnTimer = TShock.Config.RespawnBossSeconds;
+ break;
+ }
+ }
if (args.TPlayer.difficulty == 2 && TShock.Config.ServerSideCharacter && args.Player.IsLoggedIn)
{
diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs
index d9dcee30..9c957747 100755
--- a/TShockAPI/TSPlayer.cs
+++ b/TShockAPI/TSPlayer.cs
@@ -214,10 +214,10 @@ namespace TShockAPI
public bool RequestedSection;
- ///
- /// The last time the player died.
- ///
- public DateTime LastDeath { get; set; }
+ ///
+ /// The player's respawn timer.
+ ///
+ public int RespawnTimer;
///
/// Whether the player is dead or not.
diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs
index 091f125c..c5b3f191 100755
--- a/TShockAPI/TShock.cs
+++ b/TShockAPI/TShock.cs
@@ -782,7 +782,7 @@ namespace TShockAPI
player.PaintThreshold = 0;
}
- if (player.Dead && (DateTime.Now - player.LastDeath).Seconds >= Config.RespawnSeconds && player.Difficulty != 2)
+ if (player.RespawnTimer > 0 && --player.RespawnTimer == 0 && player.Difficulty != 2)
{
player.Spawn();
}