From 079541d4c949387fff36f7a9fe8ca282478949ce Mon Sep 17 00:00:00 2001 From: Olink Date: Wed, 27 May 2020 23:05:45 -0400 Subject: [PATCH] Initial working commit. --- TShockAPI/Bouncer.cs | 13 +++++++++++++ TShockAPI/PlayerData.cs | 2 +- TShockAPI/TShock.cs | 3 ++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index ad6e516a..0ea594e7 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -295,6 +295,19 @@ namespace TShockAPI { args.Player.LastKilledProjectile = 0; } + else if (editData == TileID.MysticSnakeRope) + { + //projectile should be the same X coordinate as all tile places + if (!args.Player.RecentlyCreatedProjectiles.Any(p => Main.projectile[p.Index].type == ProjectileID.MysticSnakeCoil && + Math.Abs((int)(Main.projectile[p.Index].position.X / 16f) - tileX) <= Math.Abs(Main.projectile[p.Index].velocity.X))) + { + TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from (inconceivable mystic snake rope) {0} {1} {2}", args.Player.Name, action, editData); + Console.WriteLine("Bouncer / OnTileEdit rejected from (inconceivable mystic snake rope) {0} {1} {2}", args.Player.Name, action, editData); + args.Player.SendTileSquare(tileX, tileY, 1); + args.Handled = true; + return; + } + } else if (action == EditAction.PlaceTile || action == EditAction.PlaceWall) { if ((action == EditAction.PlaceTile && TShock.Config.PreventInvalidPlaceStyle) && diff --git a/TShockAPI/PlayerData.cs b/TShockAPI/PlayerData.cs index 562dea80..d6540e34 100644 --- a/TShockAPI/PlayerData.cs +++ b/TShockAPI/PlayerData.cs @@ -496,7 +496,7 @@ namespace TShockAPI } var response = NetCreativeUnlocksModule.SerializeItemSacrifice(i, amount); - NetManager.Instance.SendToClient(response, player.TPlayer.whoAmI); + NetManager.Instance.SendToClient(response, player.Index); } } } diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 0d19a6fb..84c12dab 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1640,7 +1640,8 @@ namespace TShockAPI if (e.number >= 0 && e.number < Main.projectile.Length) { var projectile = Main.projectile[e.number]; - if (projectile.active && projectile.owner >= 0 && GetDataHandlers.projectileCreatesLiquid.ContainsKey(projectile.type)) + if (projectile.active && projectile.owner >= 0 && + (GetDataHandlers.projectileCreatesLiquid.ContainsKey(projectile.type) || GetDataHandlers.projectileCreatesTile.ContainsKey(projectile.type))) { var player = Players[projectile.owner]; if (player != null)