From e53b723bd89b8e0d16e07f899908e5d5ae82f4ff Mon Sep 17 00:00:00 2001 From: punchready <22683812+punchready@users.noreply.github.com> Date: Wed, 19 Oct 2022 04:43:27 +0200 Subject: [PATCH] Fix grass mowing keeping hanging vines intact Creating a long row of grass with vines below and then mowing it without breaking the vines below could cause a tile framing stack overflow due to all vines being cleared at once if one of them is being broken on the server or if the client simply loads the corresponding section. Warning: this does not fix eventual existing worlds that are already in such a state. --- TShockAPI/Handlers/SendTileRectHandler.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/TShockAPI/Handlers/SendTileRectHandler.cs b/TShockAPI/Handlers/SendTileRectHandler.cs index c68895ae..883eff51 100644 --- a/TShockAPI/Handlers/SendTileRectHandler.cs +++ b/TShockAPI/Handlers/SendTileRectHandler.cs @@ -350,9 +350,13 @@ namespace TShockAPI.Handlers )) { UpdateServerTileState(tile, newTile, TileDataType.Tile); + if (TileID.Sets.IsVine[Main.tile[realX, realY + 1].type]) // vanilla does in theory break the vines on its own, but we can't trust that + { + WorldGen.KillTile(realX, realY + 1); + } } - // Conversion: only sends a 1x1 rect + // Conversion: only sends a 1x1 rect; has to happen AFTER grass mowing as it would otherwise also let mowing through, but without fixing vines if (rectWidth == 1 && rectLength == 1) { ProcessConversionSpreads(tile, newTile);