beginning tile types in NetTile.cs

fix typo in GetDataHandlers.cs
This commit is contained in:
k0rd 2013-09-29 03:57:04 -04:00
parent a2fc066965
commit ef2af933c4
2 changed files with 41 additions and 9 deletions

View file

@ -499,7 +499,7 @@ namespace TShockAPI
{ {
for (int j = num3; j < num4; j++) for (int j = num3; j < num4; j++)
{ {
if (Main.tile[i, j] != null && Main.tile[i, j].active() && Main.tileSolid[(int)Main.tile[i, j].type] && !Main.tileSolidTop[(int)Main.tile[i, j].type] &&(((int)Main.tile[i,j].type !=53) && ((int)Main.tile[i,j].type !=112) && ((int)Main.tile[i,j].type !=116) && ((int)Main.tile[i,j].type !=123)) && !Main.tile[i,j].lava() && ((Main.tile[i,j].tileHeader2 & 16) != 16) && ((Main.tile[i,j].tileHeader2 & 32) != 32) && ((Main.tile[i,j].tileHeader & 32) != 32) && !Main.tile[i,j].honey() && Main.tileSolid[(int)Main.tile[i+1, j].type] && Main.tileSolid[(int)Main.tile[i - 1, j].type] && Main.tileSolid[(int)Main.tile[i, j +1 ].type] && Main.tileSolid[(int)Main.tile[i, j - 1].type] && Main.tileSolid[(int)Main.tile[i - 1, j - 1].type] && Main.tileSolid[(int)Main.tile[i - 1, j +1].type] && Main.tileSolid[(int)Main.tile[i + 1, j -1 ].type] && Main.tileSolid[(int)Main.tile[i + 1, j +2].type]) if (Main.tile[i, j] != null && Main.tile[i, j].active() && Main.tileSolid[(int)Main.tile[i, j].type] && !Main.tileSolidTop[(int)Main.tile[i, j].type] &&(((int)Main.tile[i,j].type !=53) && ((int)Main.tile[i,j].type !=112) && ((int)Main.tile[i,j].type !=116) && ((int)Main.tile[i,j].type !=123)) && !Main.tile[i,j].lava() && ((Main.tile[i,j].tileHeader2 & 16) != 16) && ((Main.tile[i,j].tileHeader2 & 32) != 32) && ((Main.tile[i,j].tileHeader & 32) != 32) && !Main.tile[i,j].honey() && Main.tileSolid[(int)Main.tile[i+1, j].type] && Main.tileSolid[(int)Main.tile[i - 1, j].type] && Main.tileSolid[(int)Main.tile[i, j +1 ].type] && Main.tileSolid[(int)Main.tile[i, j - 1].type] && Main.tileSolid[(int)Main.tile[i - 1, j - 1].type] && Main.tileSolid[(int)Main.tile[i - 1, j +1].type] && Main.tileSolid[(int)Main.tile[i + 1, j -1 ].type] && Main.tileSolid[(int)Main.tile[i + 1, j + 1].type])
{ {
Vector2 vector; Vector2 vector;
vector.X = (float)(i * 16); vector.X = (float)(i * 16);

View file

@ -31,9 +31,13 @@ namespace TShockAPI.Net
public short FrameY { get; set; } public short FrameY { get; set; }
public byte Wall { get; set; } public byte Wall { get; set; }
public byte Liquid { get; set; } public byte Liquid { get; set; }
public bool Lava { get; set; } public byte LiquidType { get; set; }
public bool Wire { get; set; } public bool Wire { get; set; }
public byte HalfBrick { get; set; }
public byte Actuator { get; set; }
public bool Inactive { get; set; }
public bool IsHalf { get; set; }
public bool IsActuator { get; set; }
public bool HasWall public bool HasWall
{ {
get { return Wall > 0; } get { return Wall > 0; }
@ -57,8 +61,10 @@ namespace TShockAPI.Net
FrameY = -1; FrameY = -1;
Wall = 0; Wall = 0;
Liquid = 0; Liquid = 0;
Lava = false;
Wire = false; Wire = false;
HalfBrick = 0;
Actuator = 0;
Inactive = false;
} }
public NetTile(Stream stream) public NetTile(Stream stream)
@ -71,7 +77,7 @@ namespace TShockAPI.Net
{ {
var flags = TileFlags.None; var flags = TileFlags.None;
if (Active) if ((Active) && (!Inactive))
flags |= TileFlags.Active; flags |= TileFlags.Active;
if (HasWall) if (HasWall)
@ -83,6 +89,17 @@ namespace TShockAPI.Net
if (Wire) if (Wire)
flags |= TileFlags.Wire; flags |= TileFlags.Wire;
if (IsHalf)
flags |= TileFlags.HalfBrick;
if (IsActuator)
flags |= TileFlags.Actuator;
if (Inactive)
{
flags |= TileFlags.Inactive;
}
stream.WriteInt8((byte) flags); stream.WriteInt8((byte) flags);
if (Active) if (Active)
@ -101,7 +118,7 @@ namespace TShockAPI.Net
if (HasLiquid) if (HasLiquid)
{ {
stream.WriteInt8(Liquid); stream.WriteInt8(Liquid);
stream.WriteBoolean(Lava); stream.WriteInt8(LiquidType);
} }
} }
@ -128,11 +145,23 @@ namespace TShockAPI.Net
if (flags.HasFlag(TileFlags.Liquid)) if (flags.HasFlag(TileFlags.Liquid))
{ {
Liquid = stream.ReadInt8(); Liquid = stream.ReadInt8();
Lava = stream.ReadBoolean(); LiquidType = stream.ReadInt8();
} }
if (flags.HasFlag(TileFlags.Wire)) if (flags.HasFlag(TileFlags.Wire))
Wire = true; Wire = true;
if (flags.HasFlag(TileFlags.HalfBrick))
IsHalf = true;
if (flags.HasFlag(TileFlags.Actuator))
IsActuator = true;
if (flags.HasFlag(TileFlags.Inactive))
{
Inactive = true;
Active = false;
}
} }
} }
@ -144,6 +173,9 @@ namespace TShockAPI.Net
Lighted = 2, Lighted = 2,
Wall = 4, Wall = 4,
Liquid = 8, Liquid = 8,
Wire = 16 Wire = 16,
HalfBrick = 32,
Actuator = 64,
Inactive = 128
} }
} }