Added RangeChecks config to disable the range part of the grief checks

This commit is contained in:
high 2011-06-08 13:44:25 -04:00
parent 11f5d9a116
commit 4ae6733f81
3 changed files with 8 additions and 4 deletions

View file

@ -21,5 +21,6 @@
public int SpawnProtectionRadius = 5; public int SpawnProtectionRadius = 5;
public string DistributationAgent = "facepunch"; public string DistributationAgent = "facepunch";
public int MaxSlots = 8; public int MaxSlots = 8;
public bool RangeChecks = true;
} }
} }

View file

@ -26,6 +26,7 @@ namespace TShockAPI
public static bool banBoom = true; public static bool banBoom = true;
public static bool kickBoom = true; public static bool kickBoom = true;
public static bool spawnProtect = true; public static bool spawnProtect = true;
public static bool rangeChecks = true;
public static int spawnProtectRadius = 5; public static int spawnProtectRadius = 5;
public static string distributationAgent = "facepunch"; public static string distributationAgent = "facepunch";
public static int authToken; public static int authToken;
@ -63,6 +64,7 @@ namespace TShockAPI
spawnProtectRadius = cfg.SpawnProtectionRadius; spawnProtectRadius = cfg.SpawnProtectionRadius;
distributationAgent = cfg.DistributationAgent; distributationAgent = cfg.DistributationAgent;
maxSlots = cfg.MaxSlots; maxSlots = cfg.MaxSlots;
rangeChecks = cfg.RangeChecks;
NPC.maxSpawns = defaultMaxSpawns; NPC.maxSpawns = defaultMaxSpawns;
NPC.defaultSpawnRate = defaultSpawnRate; NPC.defaultSpawnRate = defaultSpawnRate;
} }
@ -97,6 +99,7 @@ namespace TShockAPI
cfg.SpawnProtection = true; cfg.SpawnProtection = true;
cfg.SpawnProtectionRadius = 5; cfg.SpawnProtectionRadius = 5;
cfg.MaxSlots = maxSlots; cfg.MaxSlots = maxSlots;
cfg.RangeChecks = rangeChecks;
string json = JsonConvert.SerializeObject(cfg, Formatting.Indented); string json = JsonConvert.SerializeObject(cfg, Formatting.Indented);
TextWriter tr = new StreamWriter(FileTools.SaveDir + "config.json"); TextWriter tr = new StreamWriter(FileTools.SaveDir + "config.json");

View file

@ -19,7 +19,7 @@ namespace TShockAPI
public static string saveDir = "./tshock/"; public static string saveDir = "./tshock/";
public static Version VersionNum = new Version(2, 0, 0, 5); public static Version VersionNum = new Version(2, 0, 0, 6);
public static string VersionCodename = "UnrealIRCd ftw (irc.shankshock.com #terraria)"; public static string VersionCodename = "UnrealIRCd ftw (irc.shankshock.com #terraria)";
@ -280,7 +280,7 @@ namespace TShockAPI
int plyY = Math.Abs((int)Main.player[e.Msg.whoAmI].position.Y / 16); int plyY = Math.Abs((int)Main.player[e.Msg.whoAmI].position.Y / 16);
int tileX = Math.Abs(x); int tileX = Math.Abs(x);
int tileY = Math.Abs(y); int tileY = Math.Abs(y);
if (size > 5 || Math.Abs(plyX - tileX) > 32 || Math.Abs(plyY - tileY) > 32) if (size > 5 || (ConfigurationManager.rangeChecks && (Math.Abs(plyX - tileX) > 32 || Math.Abs(plyY - tileY) > 32)))
{ {
Log.Debug(string.Format("SendTileSquare(PlyXY:{0}_{1}, TileXY:{2}_{3}, Result:{4}_{5}, Size:{6})", Log.Debug(string.Format("SendTileSquare(PlyXY:{0}_{1}, TileXY:{2}_{3}, Result:{4}_{5}, Size:{6})",
plyX, plyY, plyX, plyY,
@ -316,7 +316,7 @@ namespace TShockAPI
return Tools.Kick(e.Msg.whoAmI, "Using dirt rod"); return Tools.Kick(e.Msg.whoAmI, "Using dirt rod");
} }
if ((Math.Abs(plyX - tileX) > 32) || (Math.Abs(plyY - tileY) > 32)) if (ConfigurationManager.rangeChecks && ((Math.Abs(plyX - tileX) > 32) || (Math.Abs(plyY - tileY) > 32)))
{ {
Log.Debug(string.Format("TilePlaced(PlyXY:{0}_{1}, TileXY:{2}_{3}, Result:{4}_{5}, Type:{6})", Log.Debug(string.Format("TilePlaced(PlyXY:{0}_{1}, TileXY:{2}_{3}, Result:{4}_{5}, Type:{6})",
plyX, plyY, plyX, plyY,
@ -503,7 +503,7 @@ namespace TShockAPI
)); ));
return Tools.HandleGriefer(e.Msg.whoAmI, "Manipulating liquid without bucket."); ; return Tools.HandleGriefer(e.Msg.whoAmI, "Manipulating liquid without bucket."); ;
} }
if ((Math.Abs(plyX - tileX) > 32) || (Math.Abs(plyY - tileY) > 32)) if (ConfigurationManager.rangeChecks && ((Math.Abs(plyX - tileX) > 32) || (Math.Abs(plyY - tileY) > 32)))
{ {
Log.Debug(string.Format("Liquid(PlyXY:{0}_{1}, TileXY:{2}_{3}, Result:{4}_{5}, Amount:{6})", Log.Debug(string.Format("Liquid(PlyXY:{0}_{1}, TileXY:{2}_{3}, Result:{4}_{5}, Amount:{6})",
plyX, plyY, plyX, plyY,