Update TSPlayer to allow sending tile rectangles

This commit is contained in:
Chris 2020-11-13 17:44:27 +10:30
parent 7ea1b8c482
commit 7122e5fb9a

View file

@ -1275,10 +1275,24 @@ namespace TShockAPI
/// <param name="size">The size square set of tiles to send.</param>
/// <returns>true if the tile square was sent successfully, else false</returns>
public virtual bool SendTileSquare(int x, int y, int size = 10)
{
return SendTileRect((short)x, (short)y, (byte)size, (byte)size);
}
/// <summary>
/// Sends a rectangle of tiles at a location with the given length and width.
/// </summary>
/// <param name="x">The x coordinate the rectangle will begin at</param>
/// <param name="y">The y coordinate the rectangle will begin at</param>
/// <param name="width">The width of the rectangle</param>
/// <param name="length">The length of the rectangle</param>
/// <param name="changeType">Optional change type. Default None</param>
/// <returns></returns>
public virtual bool SendTileRect(short x, short y, byte width = 10, byte length = 10, TileChangeType changeType = TileChangeType.None)
{
try
{
SendData(PacketTypes.TileSendSquare, "", size, x, y);
NetMessage.SendTileSquare(Index, x, y, width, length, changeType);
return true;
}
catch (Exception ex)
@ -1711,7 +1725,7 @@ namespace TShockAPI
if (RealPlayer && !ConnectionAlive)
return;
NetMessage.SendData((int)msgType, Index, -1, NetworkText.FromLiteral(text), number, number2, number3, number4, number5);
NetMessage.SendData((int)msgType, Index, -1, text == null ? null : NetworkText.FromLiteral(text), number, number2, number3, number4, number5);
}
/// <summary>