Add verbose debug log for rangechecks

This commit is contained in:
Lucas Nicodemus 2020-05-22 22:16:41 -07:00
parent b87f5d0a1b
commit dbc4bd4747
No known key found for this signature in database
GPG key ID: A07BD9023D1664DB

View file

@ -601,8 +601,11 @@ namespace TShockAPI
/// <returns>True if the player is in range of a tile or if range checks are off. False if not.</returns>
public bool IsInRange(int x, int y, int range = 32)
{
if (TShock.Config.RangeChecks && ((Math.Abs(TileX - x) > range) || (Math.Abs(TileY - y) > range)))
int rgX = Math.Abs(TileX - x);
int rgY = Math.Abs(TileY - y);
if (TShock.Config.RangeChecks && ((rgX > range) || (rgY > range)))
{
TShock.Log.ConsoleDebug("Rangecheck failed for {0} ({1}, {2}) (rg: {3}/{5}, {4}/{5})", Name, x, y, rgX, rgY, range);
return false;
}
return true;