Fix anti dead protection, some item bans, and default configs.

This commit is contained in:
Zidonuke 2011-12-29 02:50:05 -05:00
parent bbf1818512
commit 6353f9c877
4 changed files with 14 additions and 11 deletions

View file

@ -193,7 +193,7 @@ namespace TShockAPI
public string ForceTime = "normal"; public string ForceTime = "normal";
[Description("Disable/Revert a player if they exceed this number of tile kills within 1 second.")] [Description("Disable/Revert a player if they exceed this number of tile kills within 1 second.")]
public int TileKillThreshold = 80; public int TileKillThreshold = 60;
[Description("Disable/Revert a player if they exceed this number of tile places within 1 second.")] [Description("Disable/Revert a player if they exceed this number of tile places within 1 second.")]
public int TilePlaceThreshold = 20; public int TilePlaceThreshold = 20;
@ -202,7 +202,7 @@ namespace TShockAPI
public int TileLiquidThreshold = 15; public int TileLiquidThreshold = 15;
[Description("Disable a player if they exceed this number of projectile new within 1 second.")] [Description("Disable a player if they exceed this number of projectile new within 1 second.")]
public int ProjectileThreshold = 100; public int ProjectileThreshold = 50;
[Description("Require all players to register or login before being allowed to play.")] [Description("Require all players to register or login before being allowed to play.")]
public bool RequireLogin = false; public bool RequireLogin = false;

View file

@ -597,7 +597,7 @@ namespace TShockAPI
args.Player.SendTileSquare(tileX, tileY); args.Player.SendTileSquare(tileX, tileY);
return true; return true;
} }
if (tiletype == 48 && !args.Player.Group.HasPermission(Permissions.usebanneditem) && TShock.Itembans.ItemIsBanned("Spikes", args.Player)) if (tiletype == 48 && !args.Player.Group.HasPermission(Permissions.usebanneditem) && TShock.Itembans.ItemIsBanned("Spike", args.Player))
{ {
args.Player.SendTileSquare(tileX, tileY); args.Player.SendTileSquare(tileX, tileY);
return true; return true;
@ -757,6 +757,11 @@ namespace TShockAPI
return true; return true;
} }
if (args.Player.Dead)
{
return true;
}
if (!args.Player.Group.HasPermission(Permissions.ignorenoclipdetection) && Collision.SolidCollision(pos, args.TPlayer.width, args.TPlayer.height)) if (!args.Player.Group.HasPermission(Permissions.ignorenoclipdetection) && Collision.SolidCollision(pos, args.TPlayer.width, args.TPlayer.height))
{ {
int lastTileX = (int)(args.Player.LastNetPosition.X / 16f); int lastTileX = (int)(args.Player.LastNetPosition.X / 16f);
@ -959,9 +964,7 @@ namespace TShockAPI
} }
args.Player.LastDeath = DateTime.Now; args.Player.LastDeath = DateTime.Now;
args.Player.Dead = true;
if (args.Player.Difficulty != 2)
args.Player.ForceSpawn = true;
return false; return false;
} }
@ -1107,7 +1110,7 @@ namespace TShockAPI
else else
args.Player.InitSpawn = true; args.Player.InitSpawn = true;
args.Player.ForceSpawn = false; args.Player.Dead = false;
return false; return false;
} }

View file

@ -65,7 +65,7 @@ namespace TShockAPI
Player FakePlayer; Player FakePlayer;
public bool RequestedSection = false; public bool RequestedSection = false;
public DateTime LastDeath { get; set; } public DateTime LastDeath { get; set; }
public bool ForceSpawn = false; public bool Dead = false;
public string Country = "??"; public string Country = "??";
public int Difficulty; public int Difficulty;
private string CacheIP; private string CacheIP;

View file

@ -528,7 +528,7 @@ namespace TShockAPI
{ {
player.ProjectileThreshold = 0; player.ProjectileThreshold = 0;
} }
if (player.ForceSpawn && (DateTime.Now - player.LastDeath).Seconds >= 3) if (player.Dead && (DateTime.Now - player.LastDeath).Seconds >= 3 && player.Difficulty != 2)
{ {
player.Spawn(); player.Spawn();
} }
@ -761,7 +761,7 @@ namespace TShockAPI
return; return;
} }
if ((player.State < 10 || player.ForceSpawn) && (int)type > 12 && (int)type != 16 && (int)type != 42 && (int)type != 50 && (int)type != 38) if ((player.State < 10 || player.Dead) && (int)type > 12 && (int)type != 16 && (int)type != 42 && (int)type != 50 && (int)type != 38)
{ {
e.Handled = true; e.Handled = true;
return; return;
@ -1016,7 +1016,7 @@ namespace TShockAPI
return true; return true;
} }
if (type == 17 && !player.Group.HasPermission(Permissions.usebanneditem) && TShock.Itembans.ItemIsBanned("Dirt Wand", player)) //Dirt Wand Projectile if (type == 17 && !player.Group.HasPermission(Permissions.usebanneditem) && TShock.Itembans.ItemIsBanned("Dirt Rod", player)) //Dirt Rod Projectile
{ {
return true; return true;
} }