diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 09c26f16..7daa087a 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -764,15 +764,11 @@ namespace TShockAPI return true; } - if(!args.Player.Group.HasPermission(Permissions.ignorenoclipdetection) && TShock.CheckPlayerCollision((int)(pos.X / 16f), (int)(pos.Y / 16f))) + if (!args.Player.Group.HasPermission(Permissions.ignorenoclipdetection) && Collision.SolidCollision(pos, args.TPlayer.width, args.TPlayer.height)) { int lastTileX = (int)(args.Player.LastNetPosition.X / 16f); int lastTileY = (int)(args.Player.LastNetPosition.Y / 16f); - if(args.Player.Teleport(lastTileX, lastTileY)) - { - args.Player.SendMessage("You got stuck in a solid object, Sent to last good position."); - } - else + if (!args.Player.Teleport(lastTileX, lastTileY + 3)) { args.Player.SendMessage("You got stuck in a solid object, Sent to spawn point."); args.Player.Spawn(); diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 52402204..51247319 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1251,25 +1251,6 @@ namespace TShockAPI return check; } - public static bool CheckPlayerCollision(int x, int y) - { - if (x + 2 <= Main.maxTilesX && y <= Main.maxTilesY - && x >= 1 && y >= 3) - { - for (int i = x - 1; i < x + 2; i++) - { - for (int h = y - 3; h < y; h++) - { - if (!Main.tile[i, h].active || !Main.tileSolid[Main.tile[i, h].type] || Main.tileSolidTop[Main.tile[i, h].type]) - return false; - } - } - } - else - return false; - return true; - } - public void OnConfigRead(ConfigFile file) { NPC.defaultMaxSpawns = file.DefaultMaximumSpawns;