Add config option for the bomb radius.

This commit is contained in:
Olink 2020-05-24 04:33:03 -04:00
parent b73088306d
commit 8edca72919
2 changed files with 7 additions and 4 deletions

View file

@ -1295,10 +1295,10 @@ namespace TShockAPI
{
var keys = projectileCreatesLiquid.Where(k => k.Value == type).Select(k => k.Key);
var recentBombs = args.Player.RecentlyCreatedProjectiles.Where(p => keys.Contains(Main.projectile[p.Index].type));
wasThereABombNearby = recentBombs.Any(r => (args.TileX > (Main.projectile[r.Index].position.X / 16.0f) - 16
&& args.TileX < (Main.projectile[r.Index].position.X / 16.0f) + 16)
&& (args.TileY > (Main.projectile[r.Index].position.Y / 16.0f) - 16
&& args.TileY < (Main.projectile[r.Index].position.Y / 16.0f) + 16));
wasThereABombNearby = recentBombs.Any(r => (args.TileX > (Main.projectile[r.Index].position.X / 16.0f) - TShock.Config.BombExplosionRadius
&& args.TileX < (Main.projectile[r.Index].position.X / 16.0f) + TShock.Config.BombExplosionRadius)
&& (args.TileY > (Main.projectile[r.Index].position.Y / 16.0f) - TShock.Config.BombExplosionRadius
&& args.TileY < (Main.projectile[r.Index].position.Y / 16.0f) + TShock.Config.BombExplosionRadius));
}
// Liquid anti-cheat

View file

@ -527,6 +527,9 @@ namespace TShockAPI
[Description("Whether or not the server should output debug level messages related to system operation.")]
public bool DebugLogs = false;
[Description("Determines the range in tiles that a bomb can affect tiles.")]
public int BombExplosionRadius = 5;
/// <summary>
/// Reads a configuration file from a given path
/// </summary>