public static void DelWater(int l)
{
int index1 = Main.liquid[l].x;
int index2 = Main.liquid[l].y;
Tile tile1 = Main.tile[index1 - 1, index2];
Tile tile2 = Main.tile[index1 + 1, index2];
Tile tile3 = Main.tile[index1, index2 + 1];
Tile tile4 = Main.tile[index1, index2];
byte num = (byte)2;
if ((int)tile4.liquid < (int)num)
{
tile4.liquid = (byte)0;
if ((int)tile1.liquid < (int)num)
tile1.liquid = (byte)0;
else
Liquid.AddWater(index1 - 1, index2);
if ((int)tile2.liquid < (int)num)
tile2.liquid = (byte)0;
else
Liquid.AddWater(index1 + 1, index2);
}
else if ((int)tile4.liquid < 20)
{
if ((int)tile1.liquid < (int)tile4.liquid && (!tile1.nactive() || !Main.tileSolid[(int)tile1.type] || Main.tileSolidTop[(int)tile1.type]) || (int)tile2.liquid < (int)tile4.liquid && (!tile2.nactive() || !Main.tileSolid[(int)tile2.type] || Main.tileSolidTop[(int)tile2.type]) || (int)tile3.liquid < (int)byte.MaxValue && (!tile3.nactive() || !Main.tileSolid[(int)tile3.type] || Main.tileSolidTop[(int)tile3.type]))
tile4.liquid = (byte)0;
}
else if ((int)tile3.liquid < (int)byte.MaxValue && (!tile3.nactive() || !Main.tileSolid[(int)tile3.type] || Main.tileSolidTop[(int)tile3.type]) && !Liquid.stuck)
{
Main.liquid[l].kill = 0;
return;
}
if ((int)tile4.liquid < 250 && (int)Main.tile[index1, index2 - 1].liquid > 0)
Liquid.AddWater(index1, index2 - 1);
if ((int)tile4.liquid == 0)
{
tile4.liquidType(0);
}
else
{
if ((int)tile2.liquid > 0 && (int)Main.tile[index1 + 1, index2 + 1].liquid < 250 && !Main.tile[index1 + 1, index2 + 1].active() || (int)tile1.liquid > 0 && (int)Main.tile[index1 - 1, index2 + 1].liquid < 250 && !Main.tile[index1 - 1, index2 + 1].active())
{
Liquid.AddWater(index1 - 1, index2);
Liquid.AddWater(index1 + 1, index2);
}
if (tile4.lava())
{
Liquid.LavaCheck(index1, index2);
for (int i = index1 - 1; i <= index1 + 1; ++i)
{
for (int j = index2 - 1; j <= index2 + 1; ++j)
{
Tile tile5 = Main.tile[i, j];
if (tile5.active())
{
if ((int)tile5.type == 2 || (int)tile5.type == 23 || ((int)tile5.type == 109 || (int)tile5.type == 199))
{
tile5.type = (ushort)0;
WorldGen.SquareTileFrame(i, j, true);
if (Main.netMode == 2)
NetMessage.SendTileSquare(-1, index1, index2, 3);
}
else if ((int)tile5.type == 60 || (int)tile5.type == 70)
{
tile5.type = (ushort)59;
WorldGen.SquareTileFrame(i, j, true);
if (Main.netMode == 2)
NetMessage.SendTileSquare(-1, index1, index2, 3);
}
}
}
}
}
else if (tile4.honey())
Liquid.HoneyCheck(index1, index2);
}
if (Main.netMode == 2)
Liquid.NetSendLiquid(index1, index2);
--Liquid.numLiquid;
Main.tile[Main.liquid[l].x, Main.liquid[l].y].checkingLiquid(false);
Main.liquid[l].x = Main.liquid[Liquid.numLiquid].x;
Main.liquid[l].y = Main.liquid[Liquid.numLiquid].y;
Main.liquid[l].kill = Main.liquid[Liquid.numLiquid].kill;
if (!Main.tileAlch[(int)tile4.type])
return;
WorldGen.CheckAlch(index1, index2);
}
}