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.
This commit is contained in:
punchready 2022-10-19 04:43:27 +02:00 committed by GitHub
parent 699dbf9403
commit e53b723bd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);