Basic noclip detection (high chance of false positives, only text warning atm)

This commit is contained in:
Deathmax 2011-08-20 17:33:58 +08:00
parent fd26ed0fb1
commit eb88dc8924

View file

@ -383,6 +383,8 @@ namespace TShockAPI
player.TilesDestroyed.Clear();
}
}
if (CheckPlayerCollision(player.TileX, player.TileY))
player.SendMessage("You are currently nocliping!", Color.Red);
}
}
}
@ -806,6 +808,19 @@ namespace TShockAPI
(player.TPlayer.statLife > 400);
}
public static bool CheckPlayerCollision(int x, int y)
{
for (int i = x; i < x + 2; i++)
{
for (int h = y; h < y + 4; h++)
{
if (!Main.tile[i, h].active || Main.tile[i, h].type == 2)
return false;
}
}
return true;
}
public void OnConfigRead(ConfigFile file)
{
NPC.defaultMaxSpawns = file.DefaultMaximumSpawns;