public static void UpdateMech()
{
for (int index1 = Wiring._numMechs - 1; index1 >= 0; --index1)
{
--Wiring._mechTime[index1];
if (Main.tile[Wiring._mechX[index1], Wiring._mechY[index1]].active() && (int)Main.tile[Wiring._mechX[index1], Wiring._mechY[index1]].type == 144)
{
if ((int)Main.tile[Wiring._mechX[index1], Wiring._mechY[index1]].frameY == 0)
{
Wiring._mechTime[index1] = 0;
}
else
{
int num = (int)Main.tile[Wiring._mechX[index1], Wiring._mechY[index1]].frameX / 18;
switch (num)
{
case 0:
num = 60;
break;
case 1:
num = 180;
break;
case 2:
num = 300;
break;
}
if (Math.IEEERemainder((double)Wiring._mechTime[index1], (double)num) == 0.0)
{
Wiring._mechTime[index1] = 18000;
Wiring.TripWire(Wiring._mechX[index1], Wiring._mechY[index1], 1, 1);
}
}
}
if (Wiring._mechTime[index1] <= 0)
{
if (Main.tile[Wiring._mechX[index1], Wiring._mechY[index1]].active() && (int)Main.tile[Wiring._mechX[index1], Wiring._mechY[index1]].type == 144)
{
Main.tile[Wiring._mechX[index1], Wiring._mechY[index1]].frameY = (short)0;
NetMessage.SendTileSquare(-1, Wiring._mechX[index1], Wiring._mechY[index1], 1);
}
if (Main.tile[Wiring._mechX[index1], Wiring._mechY[index1]].active() && (int)Main.tile[Wiring._mechX[index1], Wiring._mechY[index1]].type == 411)
{
Tile tile = Main.tile[Wiring._mechX[index1], Wiring._mechY[index1]];
int num1 = (int)tile.frameX % 36 / 18;
int num2 = (int)tile.frameY % 36 / 18;
int tileX = Wiring._mechX[index1] - num1;
int tileY = Wiring._mechY[index1] - num2;
int num3 = 36;
if ((int)Main.tile[tileX, tileY].frameX >= 36)
num3 = -36;
for (int index2 = tileX; index2 < tileX + 2; ++index2)
{
for (int index3 = tileY; index3 < tileY + 2; ++index3)
Main.tile[index2, index3].frameX = (short)((int)Main.tile[index2, index3].frameX + num3);
}
NetMessage.SendTileSquare(-1, tileX, tileY, 2);
}
for (int index2 = index1; index2 < Wiring._numMechs; ++index2)
{
Wiring._mechX[index2] = Wiring._mechX[index2 + 1];
Wiring._mechY[index2] = Wiring._mechY[index2 + 1];
Wiring._mechTime[index2] = Wiring._mechTime[index2 + 1];
}
--Wiring._numMechs;
}
}
}