Fixed impossibility check.

This commit is contained in:
Shank 2011-06-06 17:25:59 -06:00
parent b62fc02d94
commit b28e12ecf8

View file

@ -209,12 +209,12 @@ namespace TShockAPI
byte typetile = br.ReadByte(); byte typetile = br.ReadByte();
if (type == 1 || type == 3) if (type == 1 || type == 3)
{ {
int plyX = Math.Abs((int) Main.player[e.Msg.whoAmI].position.X); int plyX = Math.Abs((int) Main.player[e.Msg.whoAmI].position.X/16);
int plyY = Math.Abs((int) Main.player[e.Msg.whoAmI].position.Y); int plyY = Math.Abs((int) Main.player[e.Msg.whoAmI].position.Y/16);
int realX = Math.Abs(x*16); int tileX = Math.Abs(x/16);
int realY = Math.Abs(y*16); int tileY = Math.Abs(y/16);
if ((plyX - realX > 6) || (plyY - realY > 6)) if ((plyX - tileX > 6) || (plyY - tileY > 6))
TShock.Ban(e.Msg.whoAmI, "Placing impossible to place blocks."); TShock.Ban(e.Msg.whoAmI, "Placing impossible to place blocks.");
Tools.Broadcast(Main.player[e.Msg.whoAmI].name + " was banned for placing impossible to place blocks."); Tools.Broadcast(Main.player[e.Msg.whoAmI].name + " was banned for placing impossible to place blocks.");
e.Handled = true; e.Handled = true;
@ -420,10 +420,10 @@ namespace TShockAPI
byte liquid = br.ReadByte(); byte liquid = br.ReadByte();
bool lava = br.ReadBoolean(); bool lava = br.ReadBoolean();
int plyX = Math.Abs((int)Main.player[e.Msg.whoAmI].position.X); int plyX = Math.Abs((int)Main.player[e.Msg.whoAmI].position.X/16);
int plyY = Math.Abs((int)Main.player[e.Msg.whoAmI].position.Y); int plyY = Math.Abs((int)Main.player[e.Msg.whoAmI].position.Y/16);
int realX = Math.Abs(x * 16); int tileX = Math.Abs(x);
int realY = Math.Abs(y * 16); int tileY = Math.Abs(y);
for (int i = 0; i < 44; i++) for (int i = 0; i < 44; i++)
{ {
@ -443,7 +443,7 @@ namespace TShockAPI
TShock.Ban(e.Msg.whoAmI, "Placing water they didn't have."); TShock.Ban(e.Msg.whoAmI, "Placing water they didn't have.");
e.Handled = true; e.Handled = true;
} }
if ((plyX - realX > 6) || (plyY - realY > 6)) if ((plyX - tileX > 6) || (plyY - tileY > 6))
TShock.Ban(e.Msg.whoAmI, "Placing impossible to place liquid."); TShock.Ban(e.Msg.whoAmI, "Placing impossible to place liquid.");
Tools.Broadcast(Main.player[e.Msg.whoAmI].name + " was banned for placing impossible to place liquid."); Tools.Broadcast(Main.player[e.Msg.whoAmI].name + " was banned for placing impossible to place liquid.");
e.Handled = true; e.Handled = true;