diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs
index c8466053..b0685fe1 100755
--- a/TShockAPI/GetDataHandlers.cs
+++ b/TShockAPI/GetDataHandlers.cs
@@ -1755,6 +1755,10 @@ namespace TShockAPI
/// Tiles that can be broken without any tools.
///
private static byte[] breakableTiles = new byte[] { 4, 13, 33, 49, 50, 127, 128, 162 };
+ ///
+ /// The maximum place styles for each tile.
+ ///
+ public static Dictionary MaxPlaceStyles = new Dictionary();
private static bool HandleTile(GetDataHandlerArgs args)
{
@@ -1884,14 +1888,8 @@ namespace TShockAPI
}
else if (action == EditAction.PlaceTile || action == EditAction.PlaceWall)
{
- if (action == EditAction.PlaceTile && TShock.Config.PreventInvalidPlaceStyle && ((editData == 4 && style > 11) ||
- (editData == 13 && style > 4) || (editData == 15 && style > 25) || (editData == 21 && style > 22) ||
- (editData == 82 && style > 5) || (editData == 91 && style > 108) || (editData == 105 && style > 49) ||
- (editData == 135 && style > 6) || (editData == 139 && style > 27) || (editData == 144 && style > 2) ||
- (editData == 149 && style > 2) || (editData == 137 && style > 4) || (editData == 79 && style > 12) ||
- (editData == 10 && style > 25) || (editData == 14 && style > 22) || (editData == 18 && style > 17) ||
- (editData == 19 && style > 16) || (editData == 34 && style > 6) || (editData == 42 && style > 10) ||
- (editData == 96 && style > 1)))
+ if (action == EditAction.PlaceTile && TShock.Config.PreventInvalidPlaceStyle &&
+ MaxPlaceStyles.ContainsKey(editData) && style > MaxPlaceStyles[editData])
{
args.Player.SendTileSquare(tileX, tileY, 4);
return true;
diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs
index 8dfcd078..9b8dbfc7 100755
--- a/TShockAPI/TShock.cs
+++ b/TShockAPI/TShock.cs
@@ -593,13 +593,29 @@ namespace TShockAPI
AuthToken = 0;
}
- Regions.ReloadAllRegions();
-
Lighting.lightMode = 2;
+
+ ComputeMaxStyles();
+
FixChestStacks();
StatTracker = new StatTracker();
}
+ private void ComputeMaxStyles()
+ {
+ var item = new Item();
+ for (int i = 0; i < Main.maxItemTypes; i++)
+ {
+ item.netDefaults(i);
+ if (GetDataHandlers.MaxPlaceStyles.ContainsKey(item.createTile))
+ {
+ if (item.placeStyle > GetDataHandlers.MaxPlaceStyles[item.createTile])
+ GetDataHandlers.MaxPlaceStyles[item.createTile] = item.placeStyle;
+ }
+ else
+ GetDataHandlers.MaxPlaceStyles.Add(item.createTile, item.placeStyle);
+ }
+ }
private void FixChestStacks()
{
if (Config.IgnoreChestStacksOnLoad)
diff --git a/TerrariaServerBins/TerrariaServer.exe b/TerrariaServerBins/TerrariaServer.exe
index 0127042c..f4cb8f2c 100644
Binary files a/TerrariaServerBins/TerrariaServer.exe and b/TerrariaServerBins/TerrariaServer.exe differ