From 4bfdcb7daba6fd6f2942862f905fae17e17bf52a Mon Sep 17 00:00:00 2001 From: k0rd Date: Mon, 12 Mar 2012 13:58:51 -0400 Subject: [PATCH 1/3] Add checks for invalid positions when the server does not report the correct player position values to the RememberPosManager system. --- TShockAPI/DB/RememberPosManager.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/TShockAPI/DB/RememberPosManager.cs b/TShockAPI/DB/RememberPosManager.cs index 429437ea..d7485511 100644 --- a/TShockAPI/DB/RememberPosManager.cs +++ b/TShockAPI/DB/RememberPosManager.cs @@ -52,7 +52,14 @@ namespace TShockAPI.DB { if (reader.Read()) { - return new Vector2(reader.Get("X"), reader.Get("Y")); + int checkX=reader.Get("X"); + int checkY=reader.Get("Y"); + //fix leftover inconsistancies + if (checkX==0) + checkX++; + if (checkY==0) + checkY++; + return new Vector2(checkX, checkY); } } } @@ -92,6 +99,7 @@ namespace TShockAPI.DB { try { + if ((X != 0) && ( Y !=0)) //invalid pos! database.Query("INSERT INTO RememberedPos (Name, IP, X, Y, WorldID) VALUES (@0, @1, @2, @3, @4);", name, IP, X, Y , Main.worldID.ToString()); } catch (Exception ex) @@ -103,6 +111,7 @@ namespace TShockAPI.DB { try { + if ((X != 0) && ( Y !=0)) //invalid pos! database.Query("UPDATE RememberedPos SET X = @0, Y = @1, IP = @2 WHERE Name = @3 AND WorldID = @4;", X, Y, IP, name, Main.worldID.ToString()); } catch (Exception ex) From 83fae7e4f3b90462b0a0d6d31a4fa4e18f0616c4 Mon Sep 17 00:00:00 2001 From: k0rd Date: Mon, 12 Mar 2012 19:46:36 -0400 Subject: [PATCH 2/3] workaround for buggy noclip detection when player is wet --- TShockAPI/GetDataHandlers.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index bb595a5c..67fa75be 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -472,6 +472,16 @@ namespace TShockAPI { num4 = Main.maxTilesY; } + for (int c = num; c < num2; c++) + { + for (int d = num3; d< num4; d++) + { + if (Main.tile[c,d].liquid != 0) + return false; + } + } + + for (int i = num; i < num2; i++) { for (int j = num3; j < num4; j++) From d9b0d656a5ced3f9e78c98169e0a7958c210e4be Mon Sep 17 00:00:00 2001 From: k0rd Date: Tue, 13 Mar 2012 12:58:31 -0400 Subject: [PATCH 3/3] cleanup --- TShockAPI/GetDataHandlers.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 67fa75be..b9e9e251 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -480,13 +480,11 @@ namespace TShockAPI return false; } } - - for (int i = num; i < num2; i++) { for (int j = num3; j < num4; j++) { - if (Main.tile[i, j] != null && Main.tile[i, j].active && Main.tileSolid[(int)Main.tile[i, j].type] && !Main.tileSolidTop[(int)Main.tile[i, j].type] &&(((int)Main.tile[i,j].type !=53) && ((int)Main.tile[i,j].type !=112) && ((int)Main.tile[i,j].type !=116) && ((int)Main.tile[i,j].type !=123)) && ((Main.tile[i,j].liquid == 0 )&& !Main.tile[i,j].lava)) + if (Main.tile[i, j] != null && Main.tile[i, j].active && Main.tileSolid[(int)Main.tile[i, j].type] && !Main.tileSolidTop[(int)Main.tile[i, j].type] &&(((int)Main.tile[i,j].type !=53) && ((int)Main.tile[i,j].type !=112) && ((int)Main.tile[i,j].type !=116) && ((int)Main.tile[i,j].type !=123)) && !Main.tile[i,j].lava) { Vector2 vector; vector.X = (float)(i * 16);