Don't kick a player if they destroy a chest that is client side only due to hitting the max number of chests.

This commit is contained in:
Deathmax 2011-07-14 22:37:29 +08:00
parent 9b2409c9b5
commit e6d612ea4b
2 changed files with 15 additions and 1 deletions

View file

@ -524,7 +524,7 @@ namespace TShockAPI
if (tilex < 0 || tilex >= Main.maxTilesX || tiley < 0 || tiley >= Main.maxTilesY)
return false;
if (Main.tile[tilex, tiley].type != 0x15) //Chest
if (Main.tile[tilex, tiley].type != 0x15 && (!Tools.MaxChests() && Main.tile[tilex, tiley].type != 0)) //Chest
{
Log.Debug(string.Format("TileKill(TileXY:{0}_{1}, Type:{2})",
tilex, tiley, Main.tile[tilex, tiley].type));

View file

@ -519,5 +519,19 @@ namespace TShockAPI
}
return true;
}
/// <summary>
/// Checks if world has hit the max number of chests
/// </summary>
/// <returns>True if the entire chest array is used</returns>
public static bool MaxChests()
{
for (int i = 0; i < Main.chest.Length; i++)
{
if (Main.chest[i] == null)
return false;
}
return true;
}
}
}