Merge branch 'general-devel' into patch-18

This commit is contained in:
Chris 2020-06-24 15:08:52 +09:30 committed by GitHub
commit f1392cfa52
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 77 additions and 32 deletions

View file

@ -3,6 +3,11 @@
This is the rolling changelog for TShock for Terraria. Use past tense when adding new entries; sign your name off when you add or change something. This should primarily be things like user changes, not necessarily codebase changes unless it's really relevant or large. This is the rolling changelog for TShock for Terraria. Use past tense when adding new entries; sign your name off when you add or change something. This should primarily be things like user changes, not necessarily codebase changes unless it's really relevant or large.
## Upcoming changes ## Upcoming changes
* Fixed various bugs related to Snake Charmer's Flute. (@rustly)
* The entirety of the snake now places.
* The old snake now removes when placing a new snake.
* Players are no longer disabled for breaking TilePlace/TileKill thresholds when modifying snakes.
* Prevented players from seeing the npc spawnrate change permission error on join. (@rustly)
* Installed new sprinklers! * Installed new sprinklers!
* Organized parameters by category and relevance in the `config.json` file. (@kubedzero) * Organized parameters by category and relevance in the `config.json` file. (@kubedzero)
* Fix multiple holes in Bouncer OnTileData. (@Patrikkk, @hakusaro) * Fix multiple holes in Bouncer OnTileData. (@Patrikkk, @hakusaro)
@ -21,6 +26,11 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
* Remove checks that prevented people placing personal storage tiles in SSC as the personal storage is synced with the server.(@Patrikkk) * Remove checks that prevented people placing personal storage tiles in SSC as the personal storage is synced with the server.(@Patrikkk)
* Cleaned up a check in Bouner OnTileEdit where it checks for using the respective item when placing a tile to make it clearer. This change also fixed the issue in a previous commit where valid replace action was caught. Moved the check for max tile/wall types to the beginning of the method. (@Patrikkk) * Cleaned up a check in Bouner OnTileEdit where it checks for using the respective item when placing a tile to make it clearer. This change also fixed the issue in a previous commit where valid replace action was caught. Moved the check for max tile/wall types to the beginning of the method. (@Patrikkk)
* Improved clarity for insufficient permission related error messages. (@moisterrific) * Improved clarity for insufficient permission related error messages. (@moisterrific)
* Remove redundant Boulder placement check that prevented placing chests on them, as it is no longer possible to place a chest on a boulder, so nothing crashes the server. "1.2.3: Boulders with Chests on them no longer crash the game if the boulder is hit." (@kevzhao2, @Patrikkk)
* Multiple modifications in Command.cs (@Patrikkk)
* `/itemban` - `/projban` - `/tileban` - Added a `default:` case to the commands so an invalid subcommand promts the player to enter the help subcommand to get more information on valid subcommands. (@Patrikkk)
* `/world` - Renamed to /worldinfo to be more accurate to it's function. Command now displays the world's `Seed`. Reformatted the world information so each line isn't repeatedly starting with "World". (@Patrikkk)
* `/who` - Changed the display format of the online players when the `-i` flag is used. From `PlayerName (ID: 0, ID: 0)` to `PlayerName (Index: 0, Account ID: 0)` for clarification. (@Patrikkk)
## TShock 4.4.0 (Pre-release 11) ## TShock 4.4.0 (Pre-release 11)
* New permission `tshock.tp.pylon` to enable teleporting via Teleportation Pylons (@QuiCM) * New permission `tshock.tp.pylon` to enable teleporting via Teleportation Pylons (@QuiCM)

View file

@ -295,7 +295,8 @@ namespace TShockAPI
} }
// If the tile is a pickaxe tile and they aren't selecting a pickaxe, they're hacking. // If the tile is a pickaxe tile and they aren't selecting a pickaxe, they're hacking.
// Item frames can be modified without pickaxe tile. // Item frames can be modified without pickaxe tile.
else if (tile.type != TileID.ItemFrame //also add an exception for snake coils, they can be removed when the player places a new one or after x amount of time
else if (tile.type != TileID.ItemFrame && tile.type != TileID.MysticSnakeRope
&& !Main.tileAxe[tile.type] && !Main.tileHammer[tile.type] && tile.wall == 0 && args.Player.TPlayer.mount.Type != 8 && selectedItem.pick == 0 && !ItemID.Sets.Explosives[selectedItem.netID] && args.Player.RecentFuse == 0) && !Main.tileAxe[tile.type] && !Main.tileHammer[tile.type] && tile.wall == 0 && args.Player.TPlayer.mount.Type != 8 && selectedItem.pick == 0 && !ItemID.Sets.Explosives[selectedItem.netID] && args.Player.RecentFuse == 0)
{ {
TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from (pick) {0} {1} {2}", args.Player.Name, action, editData); TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from (pick) {0} {1} {2}", args.Player.Name, action, editData);
@ -383,14 +384,6 @@ namespace TShockAPI
args.Handled = true; args.Handled = true;
return; return;
} }
if ((TShock.Utils.TilePlacementValid(tileX, tileY + 1) && Main.tile[tileX, tileY + 1].type == TileID.Boulder) ||
(TShock.Utils.TilePlacementValid(tileX + 1, tileY + 1) && Main.tile[tileX + 1, tileY + 1].type == TileID.Boulder))
{
TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from (validplacement) {0} {1} {2}", args.Player.Name, action, editData);
args.Player.SendTileSquare(tileX, tileY, 3);
args.Handled = true;
return;
}
} }
} }
else if (action == EditAction.PlaceWire || action == EditAction.PlaceWire2 || action == EditAction.PlaceWire3) else if (action == EditAction.PlaceWire || action == EditAction.PlaceWire2 || action == EditAction.PlaceWire3)
@ -465,9 +458,10 @@ namespace TShockAPI
return; return;
} }
if (!args.Player.IsInRange(tileX, tileY)) //make sure it isnt a snake coil related edit so it doesnt spam debug logs with range check failures
if ((action == EditAction.PlaceTile && editData != TileID.MysticSnakeRope) || (action == EditAction.KillTile && tile.type != TileID.MysticSnakeRope) && !args.Player.IsInRange(tileX, tileY))
{ {
if (action == EditAction.PlaceTile && (editData == TileID.Rope || editData == TileID.SilkRope || editData == TileID.VineRope || editData == TileID.WebRope)) if (action == EditAction.PlaceTile && (editData == TileID.Rope || editData == TileID.SilkRope || editData == TileID.VineRope || editData == TileID.WebRope || editData == TileID.MysticSnakeRope))
{ {
args.Handled = false; args.Handled = false;
return; return;
@ -536,6 +530,9 @@ namespace TShockAPI
return; return;
} }
//snake coil can allow massive amounts of tile edits so it gets an exception
if (!((action == EditAction.PlaceTile && editData == TileID.MysticSnakeRope) || (action == EditAction.KillTile && tile.type == TileID.MysticSnakeRope)))
{
if ((action == EditAction.PlaceTile || action == EditAction.ReplaceTile || action == EditAction.PlaceWall || action == EditAction.ReplaceWall) && !args.Player.HasPermission(Permissions.ignoreplacetiledetection)) if ((action == EditAction.PlaceTile || action == EditAction.ReplaceTile || action == EditAction.PlaceWall || action == EditAction.ReplaceWall) && !args.Player.HasPermission(Permissions.ignoreplacetiledetection))
{ {
args.Player.TilePlaceThreshold++; args.Player.TilePlaceThreshold++;
@ -554,6 +551,7 @@ namespace TShockAPI
if (!args.Player.TilesDestroyed.ContainsKey(coords)) if (!args.Player.TilesDestroyed.ContainsKey(coords))
args.Player.TilesDestroyed.Add(coords, Main.tile[tileX, tileY]); args.Player.TilesDestroyed.Add(coords, Main.tile[tileX, tileY]);
} }
}
args.Handled = false; args.Handled = false;
return; return;
} }
@ -1644,7 +1642,8 @@ namespace TShockAPI
if ((type != TileID.Rope if ((type != TileID.Rope
|| type != TileID.SilkRope || type != TileID.SilkRope
|| type != TileID.VineRope || type != TileID.VineRope
|| type != TileID.WebRope) || type != TileID.WebRope
|| type != TileID.MysticSnakeRope)
&& !args.Player.IsInRange(x, y)) && !args.Player.IsInRange(x, y))
{ {
TShock.Log.ConsoleDebug("Bouncer / OnPlaceObject rejected range checks from {0}", args.Player.Name); TShock.Log.ConsoleDebug("Bouncer / OnPlaceObject rejected range checks from {0}", args.Player.Name);

View file

@ -521,7 +521,7 @@ namespace TShockAPI
{ {
HelpText = "Changes the wind speed." HelpText = "Changes the wind speed."
}); });
add(new Command(Permissions.worldinfo, WorldInfo, "world") add(new Command(Permissions.worldinfo, WorldInfo, "worldinfo")
{ {
HelpText = "Shows information about the current world." HelpText = "Shows information about the current world."
}); });
@ -1155,9 +1155,11 @@ namespace TShockAPI
private static void WorldInfo(CommandArgs args) private static void WorldInfo(CommandArgs args)
{ {
args.Player.SendInfoMessage("World name: " + (TShock.Config.UseServerName ? TShock.Config.ServerName : Main.worldName)); args.Player.SendInfoMessage("Information of the currently running world");
args.Player.SendInfoMessage("World size: {0}x{1}", Main.maxTilesX, Main.maxTilesY); args.Player.SendInfoMessage("Name: " + (TShock.Config.UseServerName ? TShock.Config.ServerName : Main.worldName));
args.Player.SendInfoMessage("World ID: " + Main.worldID); args.Player.SendInfoMessage("Size: {0}x{1}", Main.maxTilesX, Main.maxTilesY);
args.Player.SendInfoMessage("ID: " + Main.worldID);
args.Player.SendInfoMessage("Seed: " + WorldGen.currentWorldSeed);
} }
#endregion #endregion
@ -3749,6 +3751,14 @@ namespace TShockAPI
} }
#endregion #endregion
return; return;
default:
#region Default
{
args.Player.SendErrorMessage("Invalid subcommand! Type {0}itemban help for more information on valid subcommands.", Specifier);
}
#endregion
return;
} }
} }
#endregion Item Management #endregion Item Management
@ -3919,6 +3929,13 @@ namespace TShockAPI
} }
#endregion #endregion
return; return;
default:
#region Default
{
args.Player.SendErrorMessage("Invalid subcommand! Type {0}projban help for more information on valid subcommands.", Specifier);
}
#endregion
return;
} }
} }
#endregion Projectile Management #endregion Projectile Management
@ -4088,6 +4105,13 @@ namespace TShockAPI
} }
#endregion #endregion
return; return;
default:
#region Default
{
args.Player.SendErrorMessage("Invalid subcommand! Type {0}tileban help for more information on valid subcommands.", Specifier);
}
#endregion
return;
} }
} }
#endregion Tile Management #endregion Tile Management
@ -5066,7 +5090,7 @@ namespace TShockAPI
{ {
if (displayIdsRequested) if (displayIdsRequested)
{ {
players.Add(String.Format("{0} (ID: {1}{2})", ply.Name, ply.Index, ply.Account != null ? ", ID: " + ply.Account.ID : "")); players.Add(String.Format("{0} (Index: {1}{2})", ply.Name, ply.Index, ply.Account != null ? ", Account ID: " + ply.Account.ID : ""));
} }
else else
{ {

View file

@ -56,6 +56,13 @@ namespace TShockAPI.Handlers.NetModules
string permission = PowerToPermissionMap[powerType]; string permission = PowerToPermissionMap[powerType];
//prevent being told about the spawnrate permission on join until relogic fixes
if (!player.HasReceivedNPCPermissionError && powerType == CreativePowerTypes.SetSpawnRate)
{
player.HasReceivedNPCPermissionError = true;
return false;
}
if (!player.HasPermission(permission)) if (!player.HasPermission(permission))
{ {
player.SendErrorMessage("You do not have permission to {0}.", PermissionToDescriptionMap[permission]); player.SendErrorMessage("You do not have permission to {0}.", PermissionToDescriptionMap[permission]);

View file

@ -111,6 +111,11 @@ namespace TShockAPI
return found; return found;
} }
/// <summary>
/// Used in preventing players from seeing the npc spawnrate permission error on join.
/// </summary>
internal bool HasReceivedNPCPermissionError { get; set; }
/// <summary> /// <summary>
/// The amount of tiles that the player has killed in the last second. /// The amount of tiles that the player has killed in the last second.
/// </summary> /// </summary>