Merge pull request #1946 from Pryaxis/fix-tile-read-bugs

Fixes some bugs with reading tiles via NetTile & SendTileSquare
This commit is contained in:
Chris 2020-05-29 17:23:19 +09:30 committed by GitHub
commit 4e5533ff64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View file

@ -16,6 +16,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
* Fixed kick on hardcore death / kick on mediumcore death / ban on either from taking action against journey mode players. (@hakusaro) * Fixed kick on hardcore death / kick on mediumcore death / ban on either from taking action against journey mode players. (@hakusaro)
* Attempted to fix the problem with the magic mirror spawn problems. You should be able to remove your spawn point in SSC by right clicking on a bed now. (@hakusaro, @AxeelAnder) * Attempted to fix the problem with the magic mirror spawn problems. You should be able to remove your spawn point in SSC by right clicking on a bed now. (@hakusaro, @AxeelAnder)
* Add HandleFoodPlatterTryPlacing event, which is called whenever a player places a food in a plate. Add antihack to bouncer, to prevent removing food from plates if the region is protected; To prevent placement if they are not in range; To prevent placement if the item is not placed from player hand. (@Patrikkk) * Add HandleFoodPlatterTryPlacing event, which is called whenever a player places a food in a plate. Add antihack to bouncer, to prevent removing food from plates if the region is protected; To prevent placement if they are not in range; To prevent placement if the item is not placed from player hand. (@Patrikkk)
* Fixed an offset error in NetTile that impacted SendTileSquare
## TShock 4.4.0 (Pre-release 8) ## TShock 4.4.0 (Pre-release 8)
* Update for OTAPI 2.0.0.36 and Terraria 1.4.0.4. (@hakusaro, @Patrikkk, @DeathCradle) * Update for OTAPI 2.0.0.36 and Terraria 1.4.0.4. (@hakusaro, @Patrikkk, @DeathCradle)

View file

@ -2316,6 +2316,14 @@ namespace TShockAPI
{ {
var player = args.Player; var player = args.Player;
var size = args.Data.ReadInt16(); var size = args.Data.ReadInt16();
var changeType = TileChangeType.None;
bool hasChangeType = ((size & 0x7FFF) & 0x8000) != 0;
if (hasChangeType)
{
changeType = (TileChangeType)args.Data.ReadInt8();
}
var tileX = args.Data.ReadInt16(); var tileX = args.Data.ReadInt16();
var tileY = args.Data.ReadInt16(); var tileY = args.Data.ReadInt16();
var data = args.Data; var data = args.Data;

View file

@ -30,7 +30,7 @@ namespace TShockAPI.Net
public short FrameX { get; set; } public short FrameX { get; set; }
public short FrameY { get; set; } public short FrameY { get; set; }
public bool Lighted { get; set; } public bool Lighted { get; set; }
public byte Wall { get; set; } public ushort Wall { get; set; }
public byte Liquid { get; set; } public byte Liquid { get; set; }
public byte LiquidType { get; set; } public byte LiquidType { get; set; }
public bool Wire { get; set; } public bool Wire { get; set; }
@ -175,7 +175,7 @@ namespace TShockAPI.Net
} }
if (HasWall) if (HasWall)
stream.WriteInt8(Wall); stream.WriteInt16((short)Wall);;
if (HasLiquid) if (HasLiquid)
{ {
@ -218,7 +218,7 @@ namespace TShockAPI.Net
if (flags[2]) if (flags[2])
{ {
Wall = stream.ReadInt8(); Wall = stream.ReadUInt16();
} }
if (flags[3]) if (flags[3])