From d610ab929b748713da393dc50cbfb153b5a51c5f Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sat, 23 May 2020 00:38:03 -0700 Subject: [PATCH] Support dirt bomb (fixes #1853, fixes #1865) This commits adds rudamentary support for dirt bombs. There's probably some edge cases in here but the entire handler really needs to be rewritten. This is total spaghetti and completely unreadable and unrecognizable. --- TShockAPI/Bouncer.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index 4beb9980..ee0671ce 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -440,7 +440,15 @@ namespace TShockAPI args.Handled = false; return; } - TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from explosives/fuses from {0}", args.Player.Name); + + // Dirt bomb makes dirt everywhere + if ((action == EditAction.PlaceTile || action == EditAction.SlopeTile) && editData == TileID.Dirt && args.Player.RecentFuse > 0) + { + args.Handled = false; + return; + } + + TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from explosives/fuses from {0} {1} {2}", args.Player.Name, action, editData); args.Player.SendTileSquare(tileX, tileY, 4); args.Handled = true; return; @@ -944,7 +952,8 @@ namespace TShockAPI || type == ProjectileID.Dynamite || type == ProjectileID.StickyBomb || type == ProjectileID.StickyDynamite - || type == ProjectileID.ScarabBomb)) + || type == ProjectileID.ScarabBomb + || type == ProjectileID.DirtBomb)) { // Denotes that the player has recently set a fuse - used for cheat detection. args.Player.RecentFuse = 10;