Basic noclip detection (high chance of false positives, only text warning atm)
This commit is contained in:
parent
fd26ed0fb1
commit
eb88dc8924
1 changed files with 15 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue