honey() public method

public honey ( ) : bool
return bool
コード例 #1
0
ファイル: Tile.cs プロジェクト: jfort/TerrariaAPI-Server
 public bool isTheSameAs(Tile compTile)
 {
     if (compTile == null)
     {
         return false;
     }
     if (this.active() != compTile.active())
     {
         return false;
     }
     if (this.active())
     {
         if (this.type != compTile.type)
         {
             return false;
         }
         if (Main.tileFrameImportant[(int)this.type])
         {
             if (this.frameX != compTile.frameX)
             {
                 return false;
             }
             if (this.frameY != compTile.frameY)
             {
                 return false;
             }
         }
     }
     if (this.wall != compTile.wall)
     {
         return false;
     }
     if (this.liquid != compTile.liquid)
     {
         return false;
     }
     if (this.liquid > 0)
     {
         if (this.lava() != compTile.lava())
         {
             return false;
         }
         if (this.honey() != compTile.honey())
         {
             return false;
         }
     }
     return this.wire() == compTile.wire() && this.wire2() == compTile.wire2() && this.wire3() == compTile.wire3() && this.halfBrick() == compTile.halfBrick() && this.actuator() == compTile.actuator() && this.inActive() == compTile.inActive() && this.wallColor() == compTile.wallColor() && this.color() == compTile.color() && this.slope() == compTile.slope();
 }
コード例 #2
0
 public static bool validateWorld(string validatePath)
 {
     Stopwatch stopwatch = new Stopwatch();
     stopwatch.Start();
     if (WorldGen.genRand == null)
     {
         WorldGen.genRand = new Random((int)DateTime.Now.Ticks);
     }
     bool result;
     using (FileStream fileStream = new FileStream(validatePath, FileMode.Open))
     {
         using (BinaryReader binaryReader = new BinaryReader(fileStream))
         {
             try
             {
                 int num = binaryReader.ReadInt32();
                 if (num > Main.curRelease)
                 {
                     try
                     {
                         binaryReader.Close();
                         fileStream.Close();
                     }
                     catch
                     {
                     }
                     result = false;
                 }
                 else
                 {
                     string b = binaryReader.ReadString();
                     int num2 = binaryReader.ReadInt32();
                     binaryReader.ReadInt32();
                     binaryReader.ReadInt32();
                     binaryReader.ReadInt32();
                     binaryReader.ReadInt32();
                     int num3 = binaryReader.ReadInt32();
                     int num4 = binaryReader.ReadInt32();
                     if (num >= 63)
                     {
                         binaryReader.ReadByte();
                     }
                     if (num >= 44)
                     {
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                     }
                     if (num >= 60)
                     {
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         if (num >= 61)
                         {
                             binaryReader.ReadInt32();
                             binaryReader.ReadInt32();
                         }
                     }
                     binaryReader.ReadInt32();
                     binaryReader.ReadInt32();
                     binaryReader.ReadDouble();
                     binaryReader.ReadDouble();
                     binaryReader.ReadDouble();
                     binaryReader.ReadBoolean();
                     binaryReader.ReadInt32();
                     binaryReader.ReadBoolean();
                     if (num >= 70)
                     {
                         binaryReader.ReadBoolean();
                     }
                     binaryReader.ReadInt32();
                     binaryReader.ReadInt32();
                     if (num >= 56)
                     {
                         binaryReader.ReadBoolean();
                     }
                     binaryReader.ReadBoolean();
                     binaryReader.ReadBoolean();
                     binaryReader.ReadBoolean();
                     if (num >= 66)
                     {
                         binaryReader.ReadBoolean();
                     }
                     if (num >= 44)
                     {
                         binaryReader.ReadBoolean();
                         binaryReader.ReadBoolean();
                         binaryReader.ReadBoolean();
                         binaryReader.ReadBoolean();
                     }
                     if (num >= 64)
                     {
                         binaryReader.ReadBoolean();
                         binaryReader.ReadBoolean();
                     }
                     if (num >= 29)
                     {
                         binaryReader.ReadBoolean();
                         binaryReader.ReadBoolean();
                         if (num >= 34)
                         {
                             binaryReader.ReadBoolean();
                         }
                         binaryReader.ReadBoolean();
                     }
                     if (num >= 32)
                     {
                         binaryReader.ReadBoolean();
                     }
                     if (num >= 37)
                     {
                         binaryReader.ReadBoolean();
                     }
                     if (num >= 56)
                     {
                         binaryReader.ReadBoolean();
                     }
                     binaryReader.ReadBoolean();
                     binaryReader.ReadBoolean();
                     binaryReader.ReadByte();
                     if (num >= 23)
                     {
                         binaryReader.ReadInt32();
                         binaryReader.ReadBoolean();
                     }
                     binaryReader.ReadInt32();
                     binaryReader.ReadInt32();
                     binaryReader.ReadInt32();
                     binaryReader.ReadDouble();
                     if (num >= 53)
                     {
                         binaryReader.ReadBoolean();
                         binaryReader.ReadInt32();
                         binaryReader.ReadSingle();
                     }
                     if (num >= 54)
                     {
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                     }
                     if (num >= 55)
                     {
                         binaryReader.ReadByte();
                         binaryReader.ReadByte();
                         binaryReader.ReadByte();
                     }
                     if (num >= 60)
                     {
                         binaryReader.ReadByte();
                         binaryReader.ReadByte();
                         binaryReader.ReadByte();
                         binaryReader.ReadByte();
                         binaryReader.ReadByte();
                     }
                     if (num >= 60)
                     {
                         binaryReader.ReadInt32();
                     }
                     if (num >= 62)
                     {
                         binaryReader.ReadInt16();
                         binaryReader.ReadSingle();
                     }
                     for (int i = 0; i < num4; i++)
                     {
                         float num5 = (float)i / (float)Main.maxTilesX;
                         Main.statusText = string.Concat(new object[]
                         {
                             Lang.gen[73],
                             " ",
                             (int)(num5 * 100f + 1f),
                             "%"
                         });
                         for (int j = 0; j < num3; j++)
                         {
                             Tile tile = new Tile();
                             tile.active(binaryReader.ReadBoolean());
                             if (tile.active())
                             {
                                 tile.type = binaryReader.ReadByte();
                                 if (tile.type == 127)
                                 {
                                     tile.active(false);
                                 }
                                 if (num < 72 && (tile.type == 35 || tile.type == 36 || tile.type == 170 || tile.type == 171 || tile.type == 172))
                                 {
                                     tile.frameX = binaryReader.ReadInt16();
                                     tile.frameY = binaryReader.ReadInt16();
                                 }
                                 else if (Main.tileFrameImportant[(int)tile.type])
                                 {
                                     if (num < 28 && tile.type == 4)
                                     {
                                         tile.frameX = 0;
                                         tile.frameY = 0;
                                     }
                                     else if (num < 40 && tile.type == 19)
                                     {
                                         tile.frameX = 0;
                                         tile.frameY = 0;
                                     }
                                     else
                                     {
                                         tile.frameX = binaryReader.ReadInt16();
                                         tile.frameY = binaryReader.ReadInt16();
                                         if (tile.type == 144)
                                         {
                                             tile.frameY = 0;
                                         }
                                     }
                                 }
                                 else
                                 {
                                     tile.frameX = -1;
                                     tile.frameY = -1;
                                 }
                                 if (num >= 48 && binaryReader.ReadBoolean())
                                 {
                                     tile.color(binaryReader.ReadByte());
                                 }
                             }
                             if (num <= 25)
                             {
                                 binaryReader.ReadBoolean();
                             }
                             if (binaryReader.ReadBoolean())
                             {
                                 tile.wall = binaryReader.ReadByte();
                                 if (num >= 48 && binaryReader.ReadBoolean())
                                 {
                                     tile.wallColor(binaryReader.ReadByte());
                                 }
                             }
                             if (binaryReader.ReadBoolean())
                             {
                                 tile.liquid = binaryReader.ReadByte();
                                 tile.lava(binaryReader.ReadBoolean());
                                 if (num >= 51)
                                 {
                                     tile.honey(binaryReader.ReadBoolean());
                                 }
                             }
                             if (num >= 33)
                             {
                                 tile.wire(binaryReader.ReadBoolean());
                             }
                             if (num >= 43)
                             {
                                 tile.wire2(binaryReader.ReadBoolean());
                                 tile.wire3(binaryReader.ReadBoolean());
                             }
                             if (num >= 41)
                             {
                                 tile.halfBrick(binaryReader.ReadBoolean());
                                 if (!Main.tileSolid[(int)tile.type])
                                 {
                                     tile.halfBrick(false);
                                 }
                                 if (num >= 49)
                                 {
                                     tile.slope(binaryReader.ReadByte());
                                     if (!Main.tileSolid[(int)tile.type])
                                     {
                                         tile.slope(0);
                                     }
                                 }
                             }
                             if (num >= 42)
                             {
                                 tile.actuator(binaryReader.ReadBoolean());
                                 tile.inActive(binaryReader.ReadBoolean());
                             }
                             if (num >= 25)
                             {
                                 int num6 = (int)binaryReader.ReadInt16();
                                 j += num6;
                             }
                         }
                     }
                     int num7 = 40;
                     if (num < 58)
                     {
                         num7 = 20;
                     }
                     for (int k = 0; k < 1000; k++)
                     {
                         if (binaryReader.ReadBoolean())
                         {
                             binaryReader.ReadInt32();
                             binaryReader.ReadInt32();
                             for (int l = 0; l < 40; l++)
                             {
                                 if (l < num7)
                                 {
                                     int num8;
                                     if (num >= 59)
                                     {
                                         num8 = (int)binaryReader.ReadInt16();
                                     }
                                     else
                                     {
                                         num8 = (int)binaryReader.ReadByte();
                                     }
                                     if (num8 > 0)
                                     {
                                         if (num >= 38)
                                         {
                                             binaryReader.ReadInt32();
                                         }
                                         else
                                         {
                                             binaryReader.ReadString();
                                         }
                                         binaryReader.ReadByte();
                                     }
                                 }
                             }
                         }
                     }
                     for (int m = 0; m < 1000; m++)
                     {
                         if (binaryReader.ReadBoolean())
                         {
                             binaryReader.ReadString();
                             binaryReader.ReadInt32();
                             binaryReader.ReadInt32();
                         }
                     }
                     bool flag = binaryReader.ReadBoolean();
                     int num9 = 0;
                     while (flag)
                     {
                         binaryReader.ReadString();
                         binaryReader.ReadSingle();
                         binaryReader.ReadSingle();
                         binaryReader.ReadBoolean();
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         flag = binaryReader.ReadBoolean();
                         num9++;
                     }
                     if (num >= 31)
                     {
                         binaryReader.ReadString();
                         binaryReader.ReadString();
                         binaryReader.ReadString();
                         binaryReader.ReadString();
                         binaryReader.ReadString();
                         binaryReader.ReadString();
                         binaryReader.ReadString();
                         binaryReader.ReadString();
                         binaryReader.ReadString();
                         if (num >= 35)
                         {
                             binaryReader.ReadString();
                             if (num >= 65)
                             {
                                 binaryReader.ReadString();
                                 binaryReader.ReadString();
                                 binaryReader.ReadString();
                                 binaryReader.ReadString();
                                 binaryReader.ReadString();
                                 binaryReader.ReadString();
                                 binaryReader.ReadString();
                                 binaryReader.ReadString();
                             }
                         }
                     }
                     if (num >= 7)
                     {
                         bool flag2 = binaryReader.ReadBoolean();
                         string text = binaryReader.ReadString();
                         int num10 = binaryReader.ReadInt32();
                         if (!flag2 || (!(text == b) && num10 != num2))
                         {
                             binaryReader.Close();
                             fileStream.Close();
                             result = false;
                             return result;
                         }
                     }
                     binaryReader.Close();
                     fileStream.Close();
                     result = true;
                 }
             }
             catch
             {
                 try
                 {
                     binaryReader.Close();
                     fileStream.Close();
                 }
                 catch
                 {
                 }
                 result = false;
             }
         }
     }
     return result;
 }
コード例 #3
0
        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(lava: false);
                    WorldGen.PlaceTile(x, y, type, mute: true, forced: 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(lava: false);
                tile4.liquid = 0;
                WorldGen.PlaceTile(x, y + 1, type2, mute: true, forced: true);
                WorldGen.SquareTileFrame(x, y + 1);
                if (Main.netMode == 2)
                {
                    NetMessage.SendTileSquare(-1, x - 1, y, 3);
                }
            }
        }
コード例 #4
0
        public static double QuickWater(int verbose = 0, int minY = -1, int maxY = -1)
        {
            Main.tileSolid[379] = true;
            int num = 0;

            if (minY == -1)
            {
                minY = 3;
            }
            if (maxY == -1)
            {
                maxY = Main.maxTilesY - 3;
            }
            for (int num2 = maxY; num2 >= minY; num2--)
            {
                if (verbose > 0)
                {
                    float num3 = (float)(maxY - num2) / (float)(maxY - minY + 1);
                    num3           /= (float)verbose;
                    Main.statusText = Lang.gen[27] + " " + (int)(num3 * 100f + 1f) + "%";
                }
                else if (verbose < 0)
                {
                    float num4 = (float)(maxY - num2) / (float)(maxY - minY + 1);
                    num4           /= (float)(-verbose);
                    Main.statusText = Lang.gen[18] + " " + (int)(num4 * 100f + 1f) + "%";
                }
                for (int i = 0; i < 2; i++)
                {
                    int num5 = 2;
                    int num6 = Main.maxTilesX - 2;
                    int num7 = 1;
                    if (i == 1)
                    {
                        num5 = Main.maxTilesX - 2;
                        num6 = 2;
                        num7 = -1;
                    }
                    for (int j = num5; j != num6; j += num7)
                    {
                        Tile tile = Main.tile[j, num2];
                        if (tile.liquid <= 0)
                        {
                            continue;
                        }
                        int  num8  = -num7;
                        bool flag  = false;
                        int  num9  = j;
                        int  num10 = num2;
                        byte b     = tile.liquidType();
                        bool flag2 = tile.lava();
                        bool flag3 = tile.honey();
                        byte b2    = tile.liquid;
                        tile.liquid = 0;
                        bool flag4 = true;
                        int  num11 = 0;
                        while (flag4 && num9 > 3 && num9 < Main.maxTilesX - 3 && num10 < Main.maxTilesY - 3)
                        {
                            flag4 = false;
                            while (Main.tile[num9, num10 + 1].liquid == 0 && num10 < Main.maxTilesY - 5 && (!Main.tile[num9, num10 + 1].nactive() || !Main.tileSolid[Main.tile[num9, num10 + 1].type] || Main.tileSolidTop[Main.tile[num9, num10 + 1].type]))
                            {
                                flag  = true;
                                num8  = num7;
                                num11 = 0;
                                flag4 = true;
                                num10++;
                                if (num10 > WorldGen.waterLine && WorldGen.gen && !flag3)
                                {
                                    b = 1;
                                }
                            }
                            if (Main.tile[num9, num10 + 1].liquid > 0 && Main.tile[num9, num10 + 1].liquid < byte.MaxValue && Main.tile[num9, num10 + 1].liquidType() == b)
                            {
                                int num12 = 255 - Main.tile[num9, num10 + 1].liquid;
                                if (num12 > b2)
                                {
                                    num12 = b2;
                                }
                                Main.tile[num9, num10 + 1].liquid += (byte)num12;
                                b2 = (byte)(b2 - (byte)num12);
                                if (b2 <= 0)
                                {
                                    num++;
                                    break;
                                }
                            }
                            if (num11 == 0)
                            {
                                if (Main.tile[num9 + num8, num10].liquid == 0 && (!Main.tile[num9 + num8, num10].nactive() || !Main.tileSolid[Main.tile[num9 + num8, num10].type] || Main.tileSolidTop[Main.tile[num9 + num8, num10].type]))
                                {
                                    num11 = num8;
                                }
                                else if (Main.tile[num9 - num8, num10].liquid == 0 && (!Main.tile[num9 - num8, num10].nactive() || !Main.tileSolid[Main.tile[num9 - num8, num10].type] || Main.tileSolidTop[Main.tile[num9 - num8, num10].type]))
                                {
                                    num11 = -num8;
                                }
                            }
                            if (num11 != 0 && Main.tile[num9 + num11, num10].liquid == 0 && (!Main.tile[num9 + num11, num10].nactive() || !Main.tileSolid[Main.tile[num9 + num11, num10].type] || Main.tileSolidTop[Main.tile[num9 + num11, num10].type]))
                            {
                                flag4 = true;
                                num9 += num11;
                            }
                            if (flag && !flag4)
                            {
                                flag  = false;
                                flag4 = true;
                                num8  = -num7;
                                num11 = 0;
                            }
                        }
                        if (j != num9 && num2 != num10)
                        {
                            num++;
                        }
                        Main.tile[num9, num10].liquid = b2;
                        Main.tile[num9, num10].liquidType(b);
                        if (Main.tile[num9 - 1, num10].liquid > 0 && Main.tile[num9 - 1, num10].lava() != flag2)
                        {
                            if (flag2)
                            {
                                LavaCheck(num9, num10);
                            }
                            else
                            {
                                LavaCheck(num9 - 1, num10);
                            }
                        }
                        else if (Main.tile[num9 + 1, num10].liquid > 0 && Main.tile[num9 + 1, num10].lava() != flag2)
                        {
                            if (flag2)
                            {
                                LavaCheck(num9, num10);
                            }
                            else
                            {
                                LavaCheck(num9 + 1, num10);
                            }
                        }
                        else if (Main.tile[num9, num10 - 1].liquid > 0 && Main.tile[num9, num10 - 1].lava() != flag2)
                        {
                            if (flag2)
                            {
                                LavaCheck(num9, num10);
                            }
                            else
                            {
                                LavaCheck(num9, num10 - 1);
                            }
                        }
                        else if (Main.tile[num9, num10 + 1].liquid > 0 && Main.tile[num9, num10 + 1].lava() != flag2)
                        {
                            if (flag2)
                            {
                                LavaCheck(num9, num10);
                            }
                            else
                            {
                                LavaCheck(num9, num10 + 1);
                            }
                        }
                        if (Main.tile[num9, num10].liquid <= 0)
                        {
                            continue;
                        }
                        if (Main.tile[num9 - 1, num10].liquid > 0 && Main.tile[num9 - 1, num10].honey() != flag3)
                        {
                            if (flag3)
                            {
                                HoneyCheck(num9, num10);
                            }
                            else
                            {
                                HoneyCheck(num9 - 1, num10);
                            }
                        }
                        else if (Main.tile[num9 + 1, num10].liquid > 0 && Main.tile[num9 + 1, num10].honey() != flag3)
                        {
                            if (flag3)
                            {
                                HoneyCheck(num9, num10);
                            }
                            else
                            {
                                HoneyCheck(num9 + 1, num10);
                            }
                        }
                        else if (Main.tile[num9, num10 - 1].liquid > 0 && Main.tile[num9, num10 - 1].honey() != flag3)
                        {
                            if (flag3)
                            {
                                HoneyCheck(num9, num10);
                            }
                            else
                            {
                                HoneyCheck(num9, num10 - 1);
                            }
                        }
                        else if (Main.tile[num9, num10 + 1].liquid > 0 && Main.tile[num9, num10 + 1].honey() != flag3)
                        {
                            if (flag3)
                            {
                                HoneyCheck(num9, num10);
                            }
                            else
                            {
                                HoneyCheck(num9, num10 + 1);
                            }
                        }
                    }
                }
            }
            return(num);
        }
コード例 #5
0
        public void Update()
        {
            Main.tileSolid[379] = true;
            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 (tile5.nactive() && Main.tileSolid[tile5.type] && !Main.tileSolidTop[tile5.type])
            {
                _    = tile5.type;
                _    = 10;
                kill = 9;
                return;
            }
            byte  liquid = tile5.liquid;
            float num    = 0f;

            if (y > Main.maxTilesY - 200 && tile5.liquidType() == 0 && tile5.liquid > 0)
            {
                byte b = 2;
                if (tile5.liquid < b)
                {
                    b = tile5.liquid;
                }
                tile5.liquid -= b;
            }
            if (tile5.liquid == 0)
            {
                kill = 9;
                return;
            }
            if (tile5.lava())
            {
                LavaCheck(x, y);
                if (!quickFall)
                {
                    if (delay < 5)
                    {
                        delay++;
                        return;
                    }
                    delay = 0;
                }
            }
            else
            {
                if (tile.lava())
                {
                    AddWater(x - 1, y);
                }
                if (tile2.lava())
                {
                    AddWater(x + 1, y);
                }
                if (tile3.lava())
                {
                    AddWater(x, y - 1);
                }
                if (tile4.lava())
                {
                    AddWater(x, y + 1);
                }
                if (tile5.honey())
                {
                    HoneyCheck(x, y);
                    if (!quickFall)
                    {
                        if (delay < 10)
                        {
                            delay++;
                            return;
                        }
                        delay = 0;
                    }
                }
                else
                {
                    if (tile.honey())
                    {
                        AddWater(x - 1, y);
                    }
                    if (tile2.honey())
                    {
                        AddWater(x + 1, y);
                    }
                    if (tile3.honey())
                    {
                        AddWater(x, y - 1);
                    }
                    if (tile4.honey())
                    {
                        AddWater(x, y + 1);
                    }
                }
            }
            if ((!tile4.nactive() || !Main.tileSolid[tile4.type] || Main.tileSolidTop[tile4.type]) && (tile4.liquid <= 0 || tile4.liquidType() == tile5.liquidType()) && tile4.liquid < byte.MaxValue)
            {
                num = 255 - tile4.liquid;
                if (num > (float)(int)tile5.liquid)
                {
                    num = (int)tile5.liquid;
                }
                tile5.liquid -= (byte)num;
                tile4.liquid += (byte)num;
                tile4.liquidType(tile5.liquidType());
                AddWater(x, y + 1);
                tile4.skipLiquid(skipLiquid: true);
                tile5.skipLiquid(skipLiquid: true);
                if (tile5.liquid > 250)
                {
                    tile5.liquid = byte.MaxValue;
                }
                else
                {
                    AddWater(x - 1, y);
                    AddWater(x + 1, y);
                }
            }
            if (tile5.liquid > 0)
            {
                bool flag  = true;
                bool flag2 = true;
                bool flag3 = true;
                bool flag4 = true;
                if (tile.nactive() && Main.tileSolid[tile.type] && !Main.tileSolidTop[tile.type])
                {
                    flag = false;
                }
                else if (tile.liquid > 0 && tile.liquidType() != tile5.liquidType())
                {
                    flag = false;
                }
                else if (Main.tile[x - 2, y].nactive() && Main.tileSolid[Main.tile[x - 2, y].type] && !Main.tileSolidTop[Main.tile[x - 2, y].type])
                {
                    flag3 = false;
                }
                else if (Main.tile[x - 2, y].liquid == 0)
                {
                    flag3 = false;
                }
                else if (Main.tile[x - 2, y].liquid > 0 && Main.tile[x - 2, y].liquidType() != tile5.liquidType())
                {
                    flag3 = false;
                }
                if (tile2.nactive() && Main.tileSolid[tile2.type] && !Main.tileSolidTop[tile2.type])
                {
                    flag2 = false;
                }
                else if (tile2.liquid > 0 && tile2.liquidType() != tile5.liquidType())
                {
                    flag2 = false;
                }
                else if (Main.tile[x + 2, y].nactive() && Main.tileSolid[Main.tile[x + 2, y].type] && !Main.tileSolidTop[Main.tile[x + 2, y].type])
                {
                    flag4 = false;
                }
                else if (Main.tile[x + 2, y].liquid == 0)
                {
                    flag4 = false;
                }
                else if (Main.tile[x + 2, y].liquid > 0 && Main.tile[x + 2, y].liquidType() != tile5.liquidType())
                {
                    flag4 = false;
                }
                int num2 = 0;
                if (tile5.liquid < 3)
                {
                    num2 = -1;
                }
                if (flag && flag2)
                {
                    if (flag3 && flag4)
                    {
                        bool flag5 = true;
                        bool flag6 = true;
                        if (Main.tile[x - 3, y].nactive() && Main.tileSolid[Main.tile[x - 3, y].type] && !Main.tileSolidTop[Main.tile[x - 3, y].type])
                        {
                            flag5 = false;
                        }
                        else if (Main.tile[x - 3, y].liquid == 0)
                        {
                            flag5 = false;
                        }
                        else if (Main.tile[x - 3, y].liquidType() != tile5.liquidType())
                        {
                            flag5 = false;
                        }
                        if (Main.tile[x + 3, y].nactive() && Main.tileSolid[Main.tile[x + 3, y].type] && !Main.tileSolidTop[Main.tile[x + 3, y].type])
                        {
                            flag6 = false;
                        }
                        else if (Main.tile[x + 3, y].liquid == 0)
                        {
                            flag6 = false;
                        }
                        else if (Main.tile[x + 3, y].liquidType() != tile5.liquidType())
                        {
                            flag6 = false;
                        }
                        if (flag5 && flag6)
                        {
                            num = tile.liquid + tile2.liquid + Main.tile[x - 2, y].liquid + Main.tile[x + 2, y].liquid + Main.tile[x - 3, y].liquid + Main.tile[x + 3, y].liquid + tile5.liquid + num2;
                            num = (float)Math.Round(num / 7f);
                            int num3 = 0;
                            tile.liquidType(tile5.liquidType());
                            if (tile.liquid != (byte)num)
                            {
                                tile.liquid = (byte)num;
                                AddWater(x - 1, y);
                            }
                            else
                            {
                                num3++;
                            }
                            tile2.liquidType(tile5.liquidType());
                            if (tile2.liquid != (byte)num)
                            {
                                tile2.liquid = (byte)num;
                                AddWater(x + 1, y);
                            }
                            else
                            {
                                num3++;
                            }
                            Main.tile[x - 2, y].liquidType(tile5.liquidType());
                            if (Main.tile[x - 2, y].liquid != (byte)num)
                            {
                                Main.tile[x - 2, y].liquid = (byte)num;
                                AddWater(x - 2, y);
                            }
                            else
                            {
                                num3++;
                            }
                            Main.tile[x + 2, y].liquidType(tile5.liquidType());
                            if (Main.tile[x + 2, y].liquid != (byte)num)
                            {
                                Main.tile[x + 2, y].liquid = (byte)num;
                                AddWater(x + 2, y);
                            }
                            else
                            {
                                num3++;
                            }
                            Main.tile[x - 3, y].liquidType(tile5.liquidType());
                            if (Main.tile[x - 3, y].liquid != (byte)num)
                            {
                                Main.tile[x - 3, y].liquid = (byte)num;
                                AddWater(x - 3, y);
                            }
                            else
                            {
                                num3++;
                            }
                            Main.tile[x + 3, y].liquidType(tile5.liquidType());
                            if (Main.tile[x + 3, y].liquid != (byte)num)
                            {
                                Main.tile[x + 3, y].liquid = (byte)num;
                                AddWater(x + 3, y);
                            }
                            else
                            {
                                num3++;
                            }
                            if (tile.liquid != (byte)num || tile5.liquid != (byte)num)
                            {
                                AddWater(x - 1, y);
                            }
                            if (tile2.liquid != (byte)num || tile5.liquid != (byte)num)
                            {
                                AddWater(x + 1, y);
                            }
                            if (Main.tile[x - 2, y].liquid != (byte)num || tile5.liquid != (byte)num)
                            {
                                AddWater(x - 2, y);
                            }
                            if (Main.tile[x + 2, y].liquid != (byte)num || tile5.liquid != (byte)num)
                            {
                                AddWater(x + 2, y);
                            }
                            if (Main.tile[x - 3, y].liquid != (byte)num || tile5.liquid != (byte)num)
                            {
                                AddWater(x - 3, y);
                            }
                            if (Main.tile[x + 3, y].liquid != (byte)num || tile5.liquid != (byte)num)
                            {
                                AddWater(x + 3, y);
                            }
                            if (num3 != 6 || tile3.liquid <= 0)
                            {
                                tile5.liquid = (byte)num;
                            }
                        }
                        else
                        {
                            int num4 = 0;
                            num = tile.liquid + tile2.liquid + Main.tile[x - 2, y].liquid + Main.tile[x + 2, y].liquid + tile5.liquid + num2;
                            num = (float)Math.Round(num / 5f);
                            tile.liquidType(tile5.liquidType());
                            if (tile.liquid != (byte)num)
                            {
                                tile.liquid = (byte)num;
                                AddWater(x - 1, y);
                            }
                            else
                            {
                                num4++;
                            }
                            tile2.liquidType(tile5.liquidType());
                            if (tile2.liquid != (byte)num)
                            {
                                tile2.liquid = (byte)num;
                                AddWater(x + 1, y);
                            }
                            else
                            {
                                num4++;
                            }
                            Main.tile[x - 2, y].liquidType(tile5.liquidType());
                            if (Main.tile[x - 2, y].liquid != (byte)num)
                            {
                                Main.tile[x - 2, y].liquid = (byte)num;
                                AddWater(x - 2, y);
                            }
                            else
                            {
                                num4++;
                            }
                            Main.tile[x + 2, y].liquidType(tile5.liquidType());
                            if (Main.tile[x + 2, y].liquid != (byte)num)
                            {
                                Main.tile[x + 2, y].liquid = (byte)num;
                                AddWater(x + 2, y);
                            }
                            else
                            {
                                num4++;
                            }
                            if (tile.liquid != (byte)num || tile5.liquid != (byte)num)
                            {
                                AddWater(x - 1, y);
                            }
                            if (tile2.liquid != (byte)num || tile5.liquid != (byte)num)
                            {
                                AddWater(x + 1, y);
                            }
                            if (Main.tile[x - 2, y].liquid != (byte)num || tile5.liquid != (byte)num)
                            {
                                AddWater(x - 2, y);
                            }
                            if (Main.tile[x + 2, y].liquid != (byte)num || tile5.liquid != (byte)num)
                            {
                                AddWater(x + 2, y);
                            }
                            if (num4 != 4 || tile3.liquid <= 0)
                            {
                                tile5.liquid = (byte)num;
                            }
                        }
                    }
                    else if (flag3)
                    {
                        num = tile.liquid + tile2.liquid + Main.tile[x - 2, y].liquid + tile5.liquid + num2;
                        num = (float)Math.Round((double)(num / 4f) + 0.001);
                        tile.liquidType(tile5.liquidType());
                        if (tile.liquid != (byte)num || tile5.liquid != (byte)num)
                        {
                            tile.liquid = (byte)num;
                            AddWater(x - 1, y);
                        }
                        tile2.liquidType(tile5.liquidType());
                        if (tile2.liquid != (byte)num || tile5.liquid != (byte)num)
                        {
                            tile2.liquid = (byte)num;
                            AddWater(x + 1, y);
                        }
                        Main.tile[x - 2, y].liquidType(tile5.liquidType());
                        if (Main.tile[x - 2, y].liquid != (byte)num || tile5.liquid != (byte)num)
                        {
                            Main.tile[x - 2, y].liquid = (byte)num;
                            AddWater(x - 2, y);
                        }
                        tile5.liquid = (byte)num;
                    }
                    else if (flag4)
                    {
                        num = tile.liquid + tile2.liquid + Main.tile[x + 2, y].liquid + tile5.liquid + num2;
                        num = (float)Math.Round((double)(num / 4f) + 0.001);
                        tile.liquidType(tile5.liquidType());
                        if (tile.liquid != (byte)num || tile5.liquid != (byte)num)
                        {
                            tile.liquid = (byte)num;
                            AddWater(x - 1, y);
                        }
                        tile2.liquidType(tile5.liquidType());
                        if (tile2.liquid != (byte)num || tile5.liquid != (byte)num)
                        {
                            tile2.liquid = (byte)num;
                            AddWater(x + 1, y);
                        }
                        Main.tile[x + 2, y].liquidType(tile5.liquidType());
                        if (Main.tile[x + 2, y].liquid != (byte)num || tile5.liquid != (byte)num)
                        {
                            Main.tile[x + 2, y].liquid = (byte)num;
                            AddWater(x + 2, y);
                        }
                        tile5.liquid = (byte)num;
                    }
                    else
                    {
                        num = tile.liquid + tile2.liquid + tile5.liquid + num2;
                        num = (float)Math.Round((double)(num / 3f) + 0.001);
                        tile.liquidType(tile5.liquidType());
                        if (tile.liquid != (byte)num)
                        {
                            tile.liquid = (byte)num;
                        }
                        if (tile5.liquid != (byte)num || tile.liquid != (byte)num)
                        {
                            AddWater(x - 1, y);
                        }
                        tile2.liquidType(tile5.liquidType());
                        if (tile2.liquid != (byte)num)
                        {
                            tile2.liquid = (byte)num;
                        }
                        if (tile5.liquid != (byte)num || tile2.liquid != (byte)num)
                        {
                            AddWater(x + 1, y);
                        }
                        tile5.liquid = (byte)num;
                    }
                }
                else if (flag)
                {
                    num = tile.liquid + tile5.liquid + num2;
                    num = (float)Math.Round((double)(num / 2f) + 0.001);
                    if (tile.liquid != (byte)num)
                    {
                        tile.liquid = (byte)num;
                    }
                    tile.liquidType(tile5.liquidType());
                    if (tile5.liquid != (byte)num || tile.liquid != (byte)num)
                    {
                        AddWater(x - 1, y);
                    }
                    tile5.liquid = (byte)num;
                }
                else if (flag2)
                {
                    num = tile2.liquid + tile5.liquid + num2;
                    num = (float)Math.Round((double)(num / 2f) + 0.001);
                    if (tile2.liquid != (byte)num)
                    {
                        tile2.liquid = (byte)num;
                    }
                    tile2.liquidType(tile5.liquidType());
                    if (tile5.liquid != (byte)num || tile2.liquid != (byte)num)
                    {
                        AddWater(x + 1, y);
                    }
                    tile5.liquid = (byte)num;
                }
            }
            if (tile5.liquid != liquid)
            {
                if (tile5.liquid == 254 && liquid == byte.MaxValue)
                {
                    tile5.liquid = byte.MaxValue;
                    kill++;
                }
                else
                {
                    AddWater(x, y - 1);
                    kill = 0;
                }
            }
            else
            {
                kill++;
            }
        }
コード例 #6
0
        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(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);
            }
        }