diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 599a27d8..ee5addd5 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -421,18 +421,18 @@ namespace TShockAPI public static void MaxSpawns(CommandArgs args) { int ply = args.PlayerID; - int amount = 4;//Convert.ToInt32(args.Message.Remove(0, 10)); + int amount = Convert.ToInt32(args.Message.Remove(0, 10)); int.TryParse(args.Message.Remove(0, 10), out amount); - NPC.maxSpawns = amount; + NPC.defaultSpawnRate = amount; Tools.Broadcast(Tools.FindPlayer(ply) + " changed the maximum spawns to: " + amount); } public static void SpawnRate(CommandArgs args) { int ply = args.PlayerID; - int amount = 700;//Convert.ToInt32(args.Message.Remove(0, 10)); + int amount = Convert.ToInt32(args.Message.Remove(0, 10)); int.TryParse(args.Message.Remove(0, 10), out amount); - NPC.spawnRate = amount; + NPC.defaultSpawnRate = amount; Tools.Broadcast(Tools.FindPlayer(ply) + " changed the spawn rate to: " + amount); } diff --git a/TShockAPI/ConfigurationManager.cs b/TShockAPI/ConfigurationManager.cs index 800d03a2..0edfdaa2 100644 --- a/TShockAPI/ConfigurationManager.cs +++ b/TShockAPI/ConfigurationManager.cs @@ -62,10 +62,16 @@ namespace TShockAPI kickBoom = cfg.KickExplosives; spawnProtect = cfg.SpawnProtection; spawnProtectRadius = cfg.SpawnProtectionRadius; + Terraria.NPC.maxSpawns = defaultMaxSpawns; + Terraria.NPC.defaultSpawnRate = defaultSpawnRate; } public static void WriteJsonConfiguration() { + if (!System.IO.Directory.Exists(FileTools.SaveDir)) + { + System.IO.Directory.CreateDirectory(FileTools.SaveDir); + } if (System.IO.File.Exists(FileTools.SaveDir + "config.json")) { return; diff --git a/TShockAPI/Log.cs b/TShockAPI/Log.cs index d2d6f354..de1ca59e 100644 --- a/TShockAPI/Log.cs +++ b/TShockAPI/Log.cs @@ -84,7 +84,7 @@ namespace TShockAPI String text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture) + " - " + caller + message; - Console.WriteLine(text); + //Console.WriteLine(text); if (!MayWriteType(level)) { diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 8571b9a1..d68dabdc 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -15,7 +15,7 @@ namespace TShockAPI public static string saveDir = "./tshock/"; - public static Version VersionNum = new Version(1, 5, 0, 1); + public static Version VersionNum = new Version(1, 6, 0, 0); public static bool shownVersion = false; @@ -103,6 +103,14 @@ namespace TShockAPI public override void Initialize() { + try + { + FileTools.SetupConfig(); + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + } Log.Initialize(FileTools.SaveDir + "log.txt", LogLevel.All, true); Log.Info("Starting..."); GameHooks.OnPreInitialize += OnPreInit; @@ -364,8 +372,11 @@ namespace TShockAPI } } } +<<<<<<< HEAD else if (e.MsgID == 0x22) // Client only KillTile e.Handled = true; // Client only uses it for chests, but sends regular 17 as well. +======= +>>>>>>> master } catch (Exception ex) { @@ -473,14 +484,6 @@ namespace TShockAPI void OnPreInit() { - try - { - FileTools.SetupConfig(); - } - catch (Exception ex) - { - Console.WriteLine(ex.ToString()); - } } void OnPostInit() diff --git a/release-docs/changes.txt b/release-docs/changes.txt index f7893fbb..bc454cba 100644 --- a/release-docs/changes.txt +++ b/release-docs/changes.txt @@ -1,6 +1,11 @@ For the full list of changes, please take a look at GitHub: https://github.com/TShock/TShock/commits/master +Changes in API release 1.6.0.0: + - Added spawn protection + - Fixed numerous bugs + - Added a few commands + Changes in API release 1.5.0.1: - Fixed cheat detection