bounds check for noclip detection

This commit is contained in:
Deathmax 2011-08-21 00:47:39 +08:00
parent 96ea583264
commit 05f0e9d717

View file

@ -815,14 +815,20 @@ namespace TShockAPI
public static bool CheckPlayerCollision(int x, int y) public static bool CheckPlayerCollision(int x, int y)
{ {
for (int i = x; i < x + 2; i++) if (x + 1 <= Main.maxTilesX && y + 3 <= Main.maxTilesY
&& x >= 0 && y >= 0)
{ {
for (int h = y; h < y + 4; h++) for (int i = x; i < x + 2; i++)
{ {
if (!Main.tile[i, h].active || !GetDataHandlers.BlacklistTiles[Main.tile[i, h].type]) for (int h = y; h < y + 4; h++)
return false; {
if (!Main.tile[i, h].active || !GetDataHandlers.BlacklistTiles[Main.tile[i, h].type])
return false;
}
} }
} }
else
return false;
return true; return true;
} }