diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index 5e301589..e9c4b2df 100644 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -216,7 +216,11 @@ namespace TShockAPI [Description("Allow Ice placement even when user does not have canbuild")] public bool AllowIce = false; - public static ConfigFile Read(string path) + [Description("Allows corrutption to spread when a world is hardmode.")] public bool AllowCorruptionCreep = true; + + [Description("Allows hallow to spread when a world is hardmode.")] public bool AllowHallowCreep = true; + + public static ConfigFile Read(string path) { if (!File.Exists(path)) return new ConfigFile(); diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 97727cfb..4fefea9c 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -203,6 +203,7 @@ namespace TShockAPI GameHooks.PostInitialize += OnPostInit; GameHooks.Update += OnUpdate; + GameHooks.HardUpdate += OnHardUpdate; ServerHooks.Connect += OnConnect; ServerHooks.Join += OnJoin; ServerHooks.Leave += OnLeave; @@ -281,6 +282,7 @@ namespace TShockAPI GameHooks.PostInitialize -= OnPostInit; GameHooks.Update -= OnUpdate; + GameHooks.HardUpdate -= OnHardUpdate; ServerHooks.Connect -= OnConnect; ServerHooks.Join -= OnJoin; ServerHooks.Leave -= OnLeave; @@ -623,6 +625,29 @@ namespace TShockAPI Config.MaxSlots, Netplay.serverListenIP, Config.ServerPort, Version); } + private void OnHardUpdate( HardUpdateEventArgs args ) + { + if (args.Handled) + return; + + if (!Config.AllowCorruptionCreep && ( args.Type == 23 || args.Type == 25 || args.Type == 0 || + args.Type == 112 || args.Type == 23 || args.Type == 32 ) ) + { + args.Handled = true; + Console.WriteLine("{0} has been prevented from creeping to {1}, {2}", args.Type, args.X, args.Y); + return; + } + + if (!Config.AllowHallowCreep && (args.Type == 109 || args.Type == 117 || args.Type == 116 ) ) + { + args.Handled = true; + Console.WriteLine("{0} has been prevented from creeping to {1}, {2}", args.Type, args.X, args.Y); + return; + } + + Console.WriteLine("{0} has creeped to {1}, {2}", args.Type, args.X, args.Y); + } + private void OnConnect(int ply, HandledEventArgs handler) { var player = new TSPlayer(ply); diff --git a/TerrariaServerBins/TerrariaServer.exe b/TerrariaServerBins/TerrariaServer.exe index 253a7e1f..54d442e2 100644 Binary files a/TerrariaServerBins/TerrariaServer.exe and b/TerrariaServerBins/TerrariaServer.exe differ