public static void LavaCheck(int x, int y) { if ((((Main.tile[x - 1, y].liquid > 0) && !Main.tile[x - 1, y].lava) || ((Main.tile[x + 1, y].liquid > 0) && !Main.tile[x + 1, y].lava)) || ((Main.tile[x, y - 1].liquid > 0) && !Main.tile[x, y - 1].lava)) { int num = 0; if (!Main.tile[x - 1, y].lava) { num += Main.tile[x - 1, y].liquid; Main.tile[x - 1, y].liquid = 0; } if (!Main.tile[x + 1, y].lava) { num += Main.tile[x + 1, y].liquid; Main.tile[x + 1, y].liquid = 0; } if (!Main.tile[x, y - 1].lava) { num += Main.tile[x, y - 1].liquid; Main.tile[x, y - 1].liquid = 0; } if ((num >= 0x20) && !Main.tile[x, y].active) { Main.tile[x, y].liquid = 0; Main.tile[x, y].lava = false; WorldGen.PlaceTile(x, y, 0x38, true, true, -1, 0); WorldGen.SquareTileFrame(x, y, true); if (Main.netMode == 2) { NetMessage.SendTileSquare(-1, x - 1, y - 1, 3); } } } else if (((Main.tile[x, y + 1].liquid > 0) && !Main.tile[x, y + 1].lava) && !Main.tile[x, y + 1].active) { Main.tile[x, y].liquid = 0; Main.tile[x, y].lava = false; Main.tile[x, y + 1].liquid = 0; WorldGen.PlaceTile(x, y + 1, 0x38, true, true, -1, 0); WorldGen.SquareTileFrame(x, y + 1, true); if (Main.netMode == 2) { NetMessage.SendTileSquare(-1, x - 1, y, 3); } } }
public static void LavaCheck(int x, int y) { Tile tile = Main.tile[x - 1, y]; Tile tile2 = Main.tile[x + 1, y]; Tile tile3 = Main.tile[x, y - 1]; Tile tile4 = Main.tile[x, y + 1]; Tile tile5 = Main.tile[x, y]; if ((tile.liquid > 0 && !tile.lava()) || (tile2.liquid > 0 && !tile2.lava()) || (tile3.liquid > 0 && !tile3.lava())) { int num = 0; int type = 56; if (!tile.lava()) { num += tile.liquid; tile.liquid = 0; } if (!tile2.lava()) { num += tile2.liquid; tile2.liquid = 0; } if (!tile3.lava()) { num += tile3.liquid; tile3.liquid = 0; } if (tile.honey() || tile2.honey() || tile3.honey()) { type = 230; } if (num < 24) { return; } if (tile5.active() && Main.tileObsidianKill[tile5.type]) { WorldGen.KillTile(x, y); if (Main.netMode == 2) { NetMessage.SendData(17, -1, -1, "", 0, x, y); } } if (!tile5.active()) { tile5.liquid = 0; tile5.lava(false); WorldGen.PlaceTile(x, y, type, true, true); WorldGen.SquareTileFrame(x, y); if (Main.netMode == 2) { NetMessage.SendTileSquare(-1, x - 1, y - 1, 3); } } } else { if (tile4.liquid <= 0 || tile4.lava()) { return; } if (Main.tileCut[tile4.type]) { WorldGen.KillTile(x, y + 1); if (Main.netMode == 2) { NetMessage.SendData(17, -1, -1, "", 0, x, y + 1); } } else if (tile4.active() && Main.tileObsidianKill[tile4.type]) { WorldGen.KillTile(x, y + 1); if (Main.netMode == 2) { NetMessage.SendData(17, -1, -1, "", 0, x, y + 1); } } if (tile4.active()) { return; } if (tile5.liquid < 24) { tile5.liquid = 0; tile5.liquidType(0); if (Main.netMode == 2) { NetMessage.SendTileSquare(-1, x - 1, y, 3); } return; } int type2 = 56; if (tile4.honey()) { type2 = 230; } tile5.liquid = 0; tile5.lava(false); tile4.liquid = 0; WorldGen.PlaceTile(x, y + 1, type2, true, true); WorldGen.SquareTileFrame(x, y + 1); if (Main.netMode == 2) { NetMessage.SendTileSquare(-1, x - 1, y, 3); } } }
public static void DelWater(int l) { int num = Main.liquid[l].x; int num2 = Main.liquid[l].y; Tile tile = Main.tile[num - 1, num2]; Tile tile2 = Main.tile[num + 1, num2]; Tile tile3 = Main.tile[num, num2 + 1]; Tile tile4 = Main.tile[num, num2]; byte b = 2; if (tile4.liquid < b) { tile4.liquid = 0; if (tile.liquid < b) { tile.liquid = 0; } else { AddWater(num - 1, num2); } if (tile2.liquid < b) { tile2.liquid = 0; } else { AddWater(num + 1, num2); } } else if (tile4.liquid < 20) { if ((tile.liquid < tile4.liquid && (!tile.nactive() || !Main.tileSolid[tile.type] || Main.tileSolidTop[tile.type])) || (tile2.liquid < tile4.liquid && (!tile2.nactive() || !Main.tileSolid[tile2.type] || Main.tileSolidTop[tile2.type])) || (tile3.liquid < byte.MaxValue && (!tile3.nactive() || !Main.tileSolid[tile3.type] || Main.tileSolidTop[tile3.type]))) { tile4.liquid = 0; } } else if (tile3.liquid < byte.MaxValue && (!tile3.nactive() || !Main.tileSolid[tile3.type] || Main.tileSolidTop[tile3.type]) && !stuck) { Main.liquid[l].kill = 0; return; } if (tile4.liquid < 250 && Main.tile[num, num2 - 1].liquid > 0) { AddWater(num, num2 - 1); } if (tile4.liquid == 0) { tile4.liquidType(0); } else { if ((tile2.liquid > 0 && Main.tile[num + 1, num2 + 1].liquid < 250 && !Main.tile[num + 1, num2 + 1].active()) || (tile.liquid > 0 && Main.tile[num - 1, num2 + 1].liquid < 250 && !Main.tile[num - 1, num2 + 1].active())) { AddWater(num - 1, num2); AddWater(num + 1, num2); } if (tile4.lava()) { LavaCheck(num, num2); for (int i = num - 1; i <= num + 1; i++) { for (int j = num2 - 1; j <= num2 + 1; j++) { Tile tile5 = Main.tile[i, j]; if (!tile5.active()) { continue; } if (tile5.type == 2 || tile5.type == 23 || tile5.type == 109 || tile5.type == 199) { tile5.type = 0; WorldGen.SquareTileFrame(i, j); if (Main.netMode == 2) { NetMessage.SendTileSquare(-1, num, num2, 3); } } else if (tile5.type == 60 || tile5.type == 70) { tile5.type = 59; WorldGen.SquareTileFrame(i, j); if (Main.netMode == 2) { NetMessage.SendTileSquare(-1, num, num2, 3); } } } } } else if (tile4.honey()) { HoneyCheck(num, num2); } } if (Main.netMode == 2) { NetSendLiquid(num, num2); } numLiquid--; Main.tile[Main.liquid[l].x, Main.liquid[l].y].checkingLiquid(false); Main.liquid[l].x = Main.liquid[numLiquid].x; Main.liquid[l].y = Main.liquid[numLiquid].y; Main.liquid[l].kill = Main.liquid[numLiquid].kill; if (Main.tileAlch[tile4.type]) { WorldGen.CheckAlch(num, num2); } }
public static void HoneyCheck(int x, int y) { Tile tile = Main.tile[x - 1, y]; Tile tile2 = Main.tile[x + 1, y]; Tile tile3 = Main.tile[x, y - 1]; Tile tile4 = Main.tile[x, y + 1]; Tile tile5 = Main.tile[x, y]; if ((tile.liquid > 0 && tile.liquidType() == 0) || (tile2.liquid > 0 && tile2.liquidType() == 0) || (tile3.liquid > 0 && tile3.liquidType() == 0)) { int num = 0; if (tile.liquidType() == 0) { num += tile.liquid; tile.liquid = 0; } if (tile2.liquidType() == 0) { num += tile2.liquid; tile2.liquid = 0; } if (tile3.liquidType() == 0) { num += tile3.liquid; tile3.liquid = 0; } if (num < 32) { return; } if (tile5.active() && Main.tileObsidianKill[tile5.type]) { WorldGen.KillTile(x, y); if (Main.netMode == 2) { NetMessage.SendData(17, -1, -1, "", 0, x, y); } } if (!tile5.active()) { tile5.liquid = 0; tile5.liquidType(0); WorldGen.PlaceTile(x, y, 229, true, true); WorldGen.SquareTileFrame(x, y); if (Main.netMode == 2) { NetMessage.SendTileSquare(-1, x - 1, y - 1, 3); } } } else { if (tile4.liquid <= 0 || tile4.liquidType() != 0) { return; } if (Main.tileCut[tile4.type]) { WorldGen.KillTile(x, y + 1); if (Main.netMode == 2) { NetMessage.SendData(17, -1, -1, "", 0, x, y + 1); } } else if (tile4.active() && Main.tileObsidianKill[tile4.type]) { WorldGen.KillTile(x, y + 1); if (Main.netMode == 2) { NetMessage.SendData(17, -1, -1, "", 0, x, y + 1); } } if (tile4.active()) { return; } if (tile5.liquid < 32) { tile5.liquid = 0; tile5.liquidType(0); if (Main.netMode == 2) { NetMessage.SendTileSquare(-1, x - 1, y, 3); } return; } tile5.liquid = 0; tile5.liquidType(0); tile4.liquid = 0; tile4.liquidType(0); WorldGen.PlaceTile(x, y + 1, 229, true, true); WorldGen.SquareTileFrame(x, y + 1); if (Main.netMode == 2) { NetMessage.SendTileSquare(-1, x - 1, y, 3); } } }
public static void DelWater(int l) { int x = Main.liquid[l].x; int y = Main.liquid[l].y; if (Main.tile[x, y].liquid < 2) { Main.tile[x, y].liquid = 0; if (Main.tile[x - 1, y].liquid < 2) { Main.tile[x - 1, y].liquid = 0; } if (Main.tile[x + 1, y].liquid < 2) { Main.tile[x + 1, y].liquid = 0; } } else if (Main.tile[x, y].liquid < 20) { if ((((Main.tile[x - 1, y].liquid < Main.tile[x, y].liquid) && ((!Main.tile[x - 1, y].active || !Main.tileSolid[Main.tile[x - 1, y].type]) || Main.tileSolidTop[Main.tile[x - 1, y].type])) || ((Main.tile[x + 1, y].liquid < Main.tile[x, y].liquid) && ((!Main.tile[x + 1, y].active || !Main.tileSolid[Main.tile[x + 1, y].type]) || Main.tileSolidTop[Main.tile[x + 1, y].type]))) || ((Main.tile[x, y + 1].liquid < 0xff) && ((!Main.tile[x, y + 1].active || !Main.tileSolid[Main.tile[x, y + 1].type]) || Main.tileSolidTop[Main.tile[x, y + 1].type]))) { Main.tile[x, y].liquid = 0; } } else if (((Main.tile[x, y + 1].liquid < 0xff) && ((!Main.tile[x, y + 1].active || !Main.tileSolid[Main.tile[x, y + 1].type]) || Main.tileSolidTop[Main.tile[x, y + 1].type])) && !stuck) { Main.liquid[l].kill = 0; return; } if ((Main.tile[x, y].liquid < 250) && (Main.tile[x, y - 1].liquid > 0)) { AddWater(x, y - 1); } if (Main.tile[x, y].liquid == 0) { Main.tile[x, y].lava = false; } else { if ((((Main.tile[x + 1, y].liquid > 0) && (Main.tile[x + 1, y + 1].liquid < 250)) && !Main.tile[x + 1, y + 1].active) || (((Main.tile[x - 1, y].liquid > 0) && (Main.tile[x - 1, y + 1].liquid < 250)) && !Main.tile[x - 1, y + 1].active)) { AddWater(x - 1, y); AddWater(x + 1, y); } if (Main.tile[x, y].lava) { LavaCheck(x, y); for (int i = x - 1; i <= (x + 1); i++) { for (int j = y - 1; j <= (y + 1); j++) { if (Main.tile[i, j].active) { if (((Main.tile[i, j].type == 2) || (Main.tile[i, j].type == 0x17)) || (Main.tile[i, j].type == 0x6d)) { Main.tile[i, j].type = 0; WorldGen.SquareTileFrame(i, j, true); if (Main.netMode == 2) { NetMessage.SendTileSquare(-1, x, y, 3); } } else if ((Main.tile[i, j].type == 60) || (Main.tile[i, j].type == 70)) { Main.tile[i, j].type = 0x3b; WorldGen.SquareTileFrame(i, j, true); if (Main.netMode == 2) { NetMessage.SendTileSquare(-1, x, y, 3); } } } } } } } if (Main.netMode == 2) { NetMessage.sendWater(x, y); } numLiquid--; Main.tile[Main.liquid[l].x, Main.liquid[l].y].checkingLiquid = false; Main.liquid[l].x = Main.liquid[numLiquid].x; Main.liquid[l].y = Main.liquid[numLiquid].y; Main.liquid[l].kill = Main.liquid[numLiquid].kill; if (Main.tileAlch[Main.tile[x, y].type]) { WorldGen.CheckAlch(x, y); } }