From 0e051d1e80b8f6faf4652b7b1a5b0cae781c2abd Mon Sep 17 00:00:00 2001 From: Hussein Farran Date: Mon, 15 May 2017 14:43:20 -0400 Subject: [PATCH 1/2] Changed Slack references to Discord So Deathmax can sleep easy --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6382cc88..01735e16 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,7 +18,7 @@ Note: This includes the API by default. If you need only the API, you need to cd - Run ```msbuild TShock.sln``` in the root of the cloned folder on Windows in a 'Developer Command Prompt' OR - Run ```xbuild TShock.sln``` in the root of the cloned folder on Unix. -Need help? Drop by Slack and we'll be happy to explain it with more words, step by step. +Need help? Drop by Discord and we'll be happy to explain it with more words, step by step. ### TShock Additions @@ -26,7 +26,7 @@ If something is better suited to be a plugin for TShock, rather than a TShock co _If you are confused, make a suggestion. We will determine scope and relevance for you._ -_If a person makes a suggestion in Slack, capture the suggestion as a Github issue. If a suggestion crops up on the forums, make a Github issue to capture it. If you want, direct the user to make a suggestion on Github, but set an alarm/timer/reminder so that if they don't know how to use Github or they don't have an account, an issue is still made and discussed. Make it clear that the issue is a surrogate issue for a suggestion from Slack/the forums too._ +_If a person makes a suggestion in Discord, capture the suggestion as a Github issue. If a suggestion crops up on the forums, make a Github issue to capture it. If you want, direct the user to make a suggestion on Github, but set an alarm/timer/reminder so that if they don't know how to use Github or they don't have an account, an issue is still made and discussed. Make it clear that the issue is a surrogate issue for a suggestion from Discord/the forums too._ ### Pull Request Dev Guidelines From 81e21f31dc9f68d4db77f15dbb207d2b3373cb63 Mon Sep 17 00:00:00 2001 From: death Date: Tue, 16 May 2017 22:41:27 +1000 Subject: [PATCH 2/2] Submodule update and new grass creep checks Pulls through the latest OTAPI to make use of the new WorldGrassSpread hook which should allow corruption/crimsion/hallow creep config options work. --- TShockAPI/TShock.cs | 44 ++++++++++++++++++++++++++++++++++++-------- TerrariaServerAPI | 2 +- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 0d1c2bc7..42cd9ef1 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -349,6 +349,7 @@ namespace TShockAPI ServerApi.Hooks.WorldHalloweenCheck.Register(this, OnHalloweenCheck); ServerApi.Hooks.NetNameCollision.Register(this, NetHooks_NameCollision); ServerApi.Hooks.ItemForceIntoChest.Register(this, OnItemForceIntoChest); + ServerApi.Hooks.WorldGrassSpread.Register(this, OnWorldGrassSpread); Hooks.PlayerHooks.PlayerPreLogin += OnPlayerPreLogin; Hooks.PlayerHooks.PlayerPostLogin += OnPlayerLogin; Hooks.AccountHooks.AccountDelete += OnAccountDelete; @@ -419,6 +420,7 @@ namespace TShockAPI ServerApi.Hooks.WorldHalloweenCheck.Deregister(this, OnHalloweenCheck); ServerApi.Hooks.NetNameCollision.Deregister(this, NetHooks_NameCollision); ServerApi.Hooks.ItemForceIntoChest.Deregister(this, OnItemForceIntoChest); + ServerApi.Hooks.WorldGrassSpread.Deregister(this, OnWorldGrassSpread); TShockAPI.Hooks.PlayerHooks.PlayerPostLogin -= OnPlayerLogin; if (File.Exists(Path.Combine(SavePath, "tshock.pid"))) @@ -1208,24 +1210,50 @@ namespace TShockAPI if (args.Handled) return; - if (!Config.AllowCrimsonCreep && (args.Type == TileID.Dirt || args.Type == TileID.FleshWeeds - || TileID.Sets.Crimson[args.Type])) + if (!OnCreep(args.Type)) { args.Handled = true; + } + } + + /// OnWorldGrassSpread - Fired when grass is attempting to spread. + /// args - The GrassSpreadEventArgs object. + private void OnWorldGrassSpread(GrassSpreadEventArgs args) + { + if (args.Handled) return; + + if(!OnCreep(args.Grass)) + { + args.Handled = true; + } + } + + /// + /// Checks if the tile type is allowed to creep + /// + /// Tile id + /// True if allowed, otherwise false + private bool OnCreep(int tileType) + { + if (!Config.AllowCrimsonCreep && (tileType == TileID.Dirt || tileType == TileID.FleshWeeds + || TileID.Sets.Crimson[tileType])) + { + return false; } - if (!Config.AllowCorruptionCreep && (args.Type == TileID.Dirt || args.Type == TileID.CorruptThorns - || TileID.Sets.Corrupt[args.Type])) + if (!Config.AllowCorruptionCreep && (tileType == TileID.Dirt || tileType == TileID.CorruptThorns + || TileID.Sets.Corrupt[tileType])) { - args.Handled = true; - return; + return false; } - if (!Config.AllowHallowCreep && (TileID.Sets.Hallow[args.Type])) + if (!Config.AllowHallowCreep && (TileID.Sets.Hallow[tileType])) { - args.Handled = true; + return false; } + + return true; } /// OnStatueSpawn - Fired when a statue spawns. diff --git a/TerrariaServerAPI b/TerrariaServerAPI index a9d1b0e4..d3b7d9f4 160000 --- a/TerrariaServerAPI +++ b/TerrariaServerAPI @@ -1 +1 @@ -Subproject commit a9d1b0e4e096ecbd0b2033ce4ff636759c9448c3 +Subproject commit d3b7d9f4575602f468cf1e009ebc4bc5b79547c4