diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index 72ed278c..868bcb2b 100644 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -24,5 +24,6 @@ namespace TShockAPI public bool BanExplosives = true; public bool KickExplosives = true; public bool SpawnProtection = true; + public int SpawnProtectionRadius = 5; } } diff --git a/TShockAPI/ConfigurationManager.cs b/TShockAPI/ConfigurationManager.cs index a53db9de..800d03a2 100644 --- a/TShockAPI/ConfigurationManager.cs +++ b/TShockAPI/ConfigurationManager.cs @@ -30,6 +30,7 @@ namespace TShockAPI public static bool banBoom = true; public static bool kickBoom = true; public static bool spawnProtect = true; + public static int spawnProtectRadius = 5; public enum NPCList : int { @@ -60,6 +61,7 @@ namespace TShockAPI banBoom = cfg.BanExplosives; kickBoom = cfg.KickExplosives; spawnProtect = cfg.SpawnProtection; + spawnProtectRadius = cfg.SpawnProtectionRadius; } public static void WriteJsonConfiguration() @@ -90,6 +92,7 @@ namespace TShockAPI cfg.BanExplosives = true; cfg.KickExplosives = true; cfg.SpawnProtection = true; + cfg.SpawnProtectionRadius = 5; string json = JsonConvert.SerializeObject(cfg, Formatting.Indented); TextWriter tr = new StreamWriter(FileTools.SaveDir + "config.json"); diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index d5292119..351b0faf 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -721,7 +721,7 @@ namespace TShockAPI Vector2 tile = new Vector2((float)x, (float)y); Vector2 spawn = new Vector2((float)Main.spawnTileX, (float)Main.spawnTileY); var distance = Vector2.Distance(spawn, tile); - if (distance > 5) + if (distance > (float)ConfigurationManager.spawnProtectRadius) return false; else return true;