parent
0701f5cf37
commit
e2d826a157
4 changed files with 20 additions and 7 deletions
|
|
@ -353,7 +353,10 @@ namespace TShockAPI
|
||||||
public bool LogRest = false;
|
public bool LogRest = false;
|
||||||
|
|
||||||
[Description("The number of seconds a player must wait before being respawned.")]
|
[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.")]
|
[Description("Disables a player if this number of tiles is painted within 1 second.")]
|
||||||
public int TilePaintThreshold = 15;
|
public int TilePaintThreshold = 15;
|
||||||
|
|
|
||||||
|
|
@ -2599,8 +2599,18 @@ namespace TShockAPI
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
args.Player.LastDeath = DateTime.Now;
|
|
||||||
args.Player.Dead = true;
|
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)
|
if (args.TPlayer.difficulty == 2 && TShock.Config.ServerSideCharacter && args.Player.IsLoggedIn)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -214,10 +214,10 @@ namespace TShockAPI
|
||||||
|
|
||||||
public bool RequestedSection;
|
public bool RequestedSection;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The last time the player died.
|
/// The player's respawn timer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime LastDeath { get; set; }
|
public int RespawnTimer;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the player is dead or not.
|
/// Whether the player is dead or not.
|
||||||
|
|
|
||||||
|
|
@ -782,7 +782,7 @@ namespace TShockAPI
|
||||||
player.PaintThreshold = 0;
|
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();
|
player.Spawn();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue