Terraria.Chest.UpdateChestFrames C# (CSharp) Method

UpdateChestFrames() public static method

public static UpdateChestFrames ( ) : void
return void
        public static void UpdateChestFrames()
        {
            bool[] flagArray = new bool[1000];
            for (int index = 0; index < 255; ++index)
            {
                if (Main.player[index].active && Main.player[index].chest >= 0 && Main.player[index].chest < 1000)
                    flagArray[Main.player[index].chest] = true;
            }
            for (int index = 0; index < 1000; ++index)
            {
                Chest chest = Main.chest[index];
                if (chest != null)
                {
                    if (flagArray[index])
                        ++chest.frameCounter;
                    else
                        --chest.frameCounter;
                    if (chest.frameCounter < 0)
                        chest.frameCounter = 0;
                    if (chest.frameCounter > 10)
                        chest.frameCounter = 10;
                    chest.frame = chest.frameCounter != 0 ? (chest.frameCounter != 10 ? 1 : 2) : 0;
                }
            }
        }