diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index e9c4b2df..8b3f63d2 100644 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -220,6 +220,15 @@ namespace TShockAPI [Description("Allows hallow to spread when a world is hardmode.")] public bool AllowHallowCreep = true; + [Description("How many things a statue can spawn within 200 pixels(?) before it stops spawning. Default = 3")] + public int StatueSpawn200 = 3; + + [Description("How many things a statue can spawn within 600 pixels(?) before it stops spawning. Default = 6")] + public int StatueSpawn600 = 6; + + [Description("How many things a statue spawns can exist in the world before it stops spawning. Default = 10")] + public int StatueSpawnWorld = 10; + public static ConfigFile Read(string path) { if (!File.Exists(path)) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 79e1378c..64de41a8 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -204,6 +204,7 @@ namespace TShockAPI GameHooks.PostInitialize += OnPostInit; GameHooks.Update += OnUpdate; GameHooks.HardUpdate += OnHardUpdate; + GameHooks.StatueSpawn += OnStatueSpawn; ServerHooks.Connect += OnConnect; ServerHooks.Join += OnJoin; ServerHooks.Leave += OnLeave; @@ -283,6 +284,7 @@ namespace TShockAPI GameHooks.PostInitialize -= OnPostInit; GameHooks.Update -= OnUpdate; GameHooks.HardUpdate -= OnHardUpdate; + GameHooks.StatueSpawn -= OnStatueSpawn; ServerHooks.Connect -= OnConnect; ServerHooks.Join -= OnJoin; ServerHooks.Leave -= OnLeave; @@ -643,6 +645,18 @@ namespace TShockAPI } } + private void OnStatueSpawn( StatueSpawnEventArgs args ) + { + if( args.Within200 < Config.StatueSpawn200 && args.Within600 < Config.StatueSpawn600 && args.WorldWide < Config.StatueSpawnWorld ) + { + args.Handled = true; + } + else + { + args.Handled = false; + } + } + private void OnConnect(int ply, HandledEventArgs handler) { var player = new TSPlayer(ply); diff --git a/TerrariaServerBins/TerrariaServer.exe b/TerrariaServerBins/TerrariaServer.exe index 54d442e2..635f8d33 100644 Binary files a/TerrariaServerBins/TerrariaServer.exe and b/TerrariaServerBins/TerrariaServer.exe differ