From 6266b47fb35e136a3da8db67f10847715fceaa20 Mon Sep 17 00:00:00 2001 From: Ziteng Wang Date: Sun, 18 Feb 2018 16:35:26 -0800 Subject: [PATCH] Fix tile entity placing --- CHANGELOG.md | 1 + TShockAPI/Bouncer.cs | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd2292ea..1bb5cefb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,6 +79,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Removed `Utils.GetGroup()` also have you seen `Groups.GetGroupByName()`? (@hakusaro) * `Utils.MaxChests()` is now `Utils.HasWorldReachedMaxChests()`. (@hakusaro) * `Utils.GetIPv4Address()` is now `Utils.GetIPv4AddressFromHostname()`. (@hakusaro) +* Fixed the disappearing problem when placing tile entities. (@mistzzt) ## TShock 4.3.25 * Fixed a critical exploit in the Terraria protocol that could cause massive unpreventable world corruption as well as a number of other problems. Thanks to @bartico6 for reporting. Fixed by the efforts of @QuiCM, @hakusaro, and tips in the right directioon from @bartico6. diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index 8a971d70..0c2c0f3e 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -1709,14 +1709,20 @@ namespace TShockAPI Main.tile[realx, realy].frameY = newtile.FrameY; changed = true; } + // Landmine if (tile.type == TileID.LandMine && !newtile.Active) { Main.tile[realx, realy].active(false); changed = true; } - // Sensors - if(newtile.Type == TileID.LogicSensor && !Main.tile[realx, realy].active()) + + // Tile entities: sensors, item frames, training dummies + // here it handles all tile entities listed in `TileEntityID` + if ((newtile.Type == TileID.LogicSensor || + newtile.Type == TileID.ItemFrame || + newtile.Type == TileID.TargetDummy) && + !Main.tile[realx, realy].active()) { Main.tile[realx, realy].type = newtile.Type; Main.tile[realx, realy].frameX = newtile.FrameX; @@ -1748,6 +1754,7 @@ namespace TShockAPI changed = true; } } + // Stone wall <-> Stone wall if (((tile.wall == 1 || tile.wall == 3 || tile.wall == 28 || tile.wall == 83) && (newtile.Wall == 1 || newtile.Wall == 3 || newtile.Wall == 28 || newtile.Wall == 83)) || @@ -1786,8 +1793,8 @@ namespace TShockAPI { args.Player.SendTileSquare(tileX, tileY, size); } + args.Handled = true; - return; } ///