Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Pryaxis/TShock
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: f98fc7d4b3905c88b1aec9710ec342c462499759
Choose a base ref
..
head repository: Pryaxis/TShock
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b96c6e585485c5d4b4cd97844ee1ac240d931f70
Choose a head ref
Showing with 46 additions and 31 deletions.
  1. +44 −25 TShockAPI/Handlers/SendTileRectHandler.cs
  2. +1 −4 TShockLauncher/Program.cs
  3. +1 −2 docs/changelog.md
69 changes: 44 additions & 25 deletions TShockAPI/Handlers/SendTileRectHandler.cs
Original file line number Diff line number Diff line change
@@ -390,44 +390,63 @@ internal void ProcessFlowerBoots(int realX, int realY, NetTile newTile)
}
}

// Moss and MossBrick are not used in conversion
private static List<bool[]> _convertibleTiles = typeof(TileID.Sets.Conversion)
.GetFields()
.ExceptBy(new[] { nameof(TileID.Sets.Conversion.Moss), nameof(TileID.Sets.Conversion.MossBrick) }, f => f.Name)
.Select(f => (bool[])f.GetValue(null))
.ToList();
// PureSand is only used in WorldGen.SpreadDesertWalls, which is server side
private static List<bool[]> _convertibleWalls = typeof(WallID.Sets.Conversion)
.GetFields()
.ExceptBy(new[] { nameof(WallID.Sets.Conversion.PureSand) }, f => f.Name)
.Select(f => (bool[])f.GetValue(null))
.ToList();

/// <summary>
/// Updates a single tile on the server if it is a valid conversion from one tile or wall type to another (eg stone -> corrupt stone)
/// </summary>
/// <param name="tile">The tile to update</param>
/// <param name="newTile">The NetTile containing new tile properties</param>
internal void ProcessConversionSpreads(ITile tile, NetTile newTile)
{
// Update if the existing tile or wall is convertible and the new tile or wall is a valid conversion
if (
((TileID.Sets.Conversion.Stone[tile.type] || Main.tileMoss[tile.type]) && (TileID.Sets.Conversion.Stone[newTile.Type] || Main.tileMoss[newTile.Type])) ||
((tile.type == 0 || tile.type == 59) && (newTile.Type == 0 || newTile.Type == 59)) ||
TileID.Sets.Conversion.Grass[tile.type] && TileID.Sets.Conversion.Grass[newTile.Type] ||
TileID.Sets.Conversion.Ice[tile.type] && TileID.Sets.Conversion.Ice[newTile.Type] ||
TileID.Sets.Conversion.Sand[tile.type] && TileID.Sets.Conversion.Sand[newTile.Type] ||
TileID.Sets.Conversion.Sandstone[tile.type] && TileID.Sets.Conversion.Sandstone[newTile.Type] ||
TileID.Sets.Conversion.HardenedSand[tile.type] && TileID.Sets.Conversion.HardenedSand[newTile.Type] ||
TileID.Sets.Conversion.Thorn[tile.type] && TileID.Sets.Conversion.Thorn[newTile.Type] ||
TileID.Sets.Conversion.Moss[tile.type] && TileID.Sets.Conversion.Moss[newTile.Type] ||
TileID.Sets.Conversion.MossBrick[tile.type] && TileID.Sets.Conversion.MossBrick[newTile.Type]
)
var allowTile = false;
if (Main.tileMoss[tile.type] && TileID.Sets.Conversion.Stone[newTile.Type])
{
allowTile = true;
}
else if ((Main.tileMoss[tile.type] || TileID.Sets.Conversion.Stone[tile.type] || TileID.Sets.Conversion.Ice[tile.type] || TileID.Sets.Conversion.Sandstone[tile.type]) &&
(newTile.Type == TileID.Sandstone || newTile.Type == TileID.IceBlock))
{
// ProjectileID.SandSpray and ProjectileID.SnowSpray
allowTile = true;
}
else
{
foreach (var tileType in _convertibleTiles)
{
if (tileType[tile.type] && tileType[newTile.Type])
{
allowTile = true;
break;
}
}
}

if (allowTile)
{
TShock.Log.ConsoleDebug(GetString($"Bouncer / SendTileRect processing a tile conversion update - [{tile.type}] -> [{newTile.Type}]"));
UpdateServerTileState(tile, newTile, TileDataType.Tile);
}

if (WallID.Sets.Conversion.Stone[tile.wall] && WallID.Sets.Conversion.Stone[newTile.Wall] ||
WallID.Sets.Conversion.Grass[tile.wall] && WallID.Sets.Conversion.Grass[newTile.Wall] ||
WallID.Sets.Conversion.Sandstone[tile.wall] && WallID.Sets.Conversion.Sandstone[newTile.Wall] ||
WallID.Sets.Conversion.HardenedSand[tile.wall] && WallID.Sets.Conversion.HardenedSand[newTile.Wall] ||
WallID.Sets.Conversion.PureSand[tile.wall] && WallID.Sets.Conversion.PureSand[newTile.Wall] ||
WallID.Sets.Conversion.NewWall1[tile.wall] && WallID.Sets.Conversion.NewWall1[newTile.Wall] ||
WallID.Sets.Conversion.NewWall2[tile.wall] && WallID.Sets.Conversion.NewWall2[newTile.Wall] ||
WallID.Sets.Conversion.NewWall3[tile.wall] && WallID.Sets.Conversion.NewWall3[newTile.Wall] ||
WallID.Sets.Conversion.NewWall4[tile.wall] && WallID.Sets.Conversion.NewWall4[newTile.Wall]
)
foreach (var wallType in _convertibleWalls)
{
TShock.Log.ConsoleDebug(GetString($"Bouncer / SendTileRect processing a wall conversion update - [{tile.wall}] -> [{newTile.Wall}]"));
UpdateServerTileState(tile, newTile, TileDataType.Wall);
if (wallType[tile.wall] && wallType[newTile.Wall])
{
TShock.Log.ConsoleDebug(GetString($"Bouncer / SendTileRect processing a wall conversion update - [{tile.wall}] -> [{newTile.Wall}]"));
UpdateServerTileState(tile, newTile, TileDataType.Wall);
break;
}
}
}

5 changes: 1 addition & 4 deletions TShockLauncher/Program.cs
Original file line number Diff line number Diff line change
@@ -36,10 +36,7 @@ You should have received a copy of the GNU General Public License
await NugetCLI.Main(items);
return;
}
else
{
Start();
}


Dictionary<string, Assembly> _cache = new Dictionary<string, Assembly>();

3 changes: 1 addition & 2 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -101,11 +101,10 @@ Use past tense when adding new entries; sign your name off when you add or chang
* Fixed Super Sponge unable to absorb shimmer. (@sgkoishi, #2833)
* Increased whitelisted duration of the Mighty Wind (`WindPushed`) buff (from sandstorms). (@drunderscore)
* Allowed the Hellfire (`OnFire3`) buff. (@drunderscore)


* Allowed Digging Molecart and bomb fish to break tiles and place tracks (@sgkoishi)
* Initialized achievements and the `AchievementManager` on the server. This ensures that players cannot cause exceptions to be thrown, chat messages are always logged, and allows achievement names to be localized in the console. Also added a test case for this. (@drunderscore)
* Allowed multiple test cases to be in TShock's test suite. (@drunderscore)
* Fixed unable to use Purification/Evil Powder in jungle. (@sgkoishi)

## TShock 5.1.3
* Added support for Terraria 1.4.4.9 via OTAPI 3.1.20. (@SignatureBeef)