Пример #1
0
        private void RefreshStations()
        {
            Player player = Main.player[Main.myPlayer];

            if (adjTiles.Length != player.adjTile.Length)
            {
                adjTiles = new bool[player.adjTile.Length];
            }
            else
            {
                Array.Clear(adjTiles, 0, adjTiles.Length);
            }

            adjWater     = false;
            adjLava      = false;
            adjHoney     = false;
            zoneSnow     = false;
            alchemyTable = false;

            foreach (Item item in access.stations)
            {
                if (item.createTile >= 0)
                {
                    adjTiles[item.createTile] = true;
                    if (item.createTile == TileID.GlassKiln || item.createTile == TileID.Hellforge || item.createTile == TileID.AdamantiteForge)
                    {
                        adjTiles[TileID.Furnaces] = true;
                    }
                    else if (item.createTile == TileID.AdamantiteForge)
                    {
                        adjTiles[TileID.Hellforge] = true;
                    }
                    else if (item.createTile == TileID.MythrilAnvil)
                    {
                        adjTiles[TileID.Anvils] = true;
                    }
                    else if (item.createTile == TileID.BewitchingTable || item.createTile == TileID.Tables2)
                    {
                        adjTiles[TileID.Tables] = true;
                    }
                    else if (item.createTile == TileID.AlchemyTable)
                    {
                        adjTiles[TileID.Bottles] = true;
                        adjTiles[TileID.Tables]  = true;
                        alchemyTable             = true;
                    }

                    bool[] oldAdjTile      = player.adjTile;
                    bool   oldAdjWater     = adjWater;
                    bool   oldAdjLava      = adjLava;
                    bool   oldAdjHoney     = adjHoney;
                    bool   oldAlchemyTable = alchemyTable;

                    player.adjTile      = adjTiles;
                    player.adjWater     = false;
                    player.adjLava      = false;
                    player.adjHoney     = false;
                    player.alchemyTable = false;

                    TileLoader.AdjTiles(player, item.createTile);

                    if (player.adjWater)
                    {
                        adjWater = true;
                    }
                    if (player.adjLava)
                    {
                        adjLava = true;
                    }
                    if (player.adjHoney)
                    {
                        adjHoney = true;
                    }
                    if (player.alchemyTable)
                    {
                        alchemyTable = true;
                    }

                    player.adjTile      = oldAdjTile;
                    player.adjWater     = oldAdjWater;
                    player.adjLava      = oldAdjLava;
                    player.adjHoney     = oldAdjHoney;
                    player.alchemyTable = oldAlchemyTable;
                }
                if (item.type == ItemID.WaterBucket || item.type == ItemID.BottomlessBucket)
                {
                    adjWater = true;
                }
                else if (item.type == ItemID.LavaBucket)
                {
                    adjLava = true;
                }
                else if (item.type == ItemID.HoneyBucket)
                {
                    adjHoney = true;
                }
                else if (item.type == MagicStorage.Instance.ItemType("SnowBiomeEmulator"))
                {
                    zoneSnow = true;
                }
            }

            adjTiles[MagicStorage.Instance.TileType("CraftingAccess")] = true;
        }