Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ HitWireSingle()

static void Terraria.Wiring.HitWireSingle ( int i,
int j )
inlinestaticprivate

Definition at line 970 of file Wiring.cs.

971 {
972 Tile tile = Main.tile[i, j];
973 bool? forcedStateWhereTrueIsOn = null;
974 bool doSkipWires = true;
975 int type = tile.type;
976 if (tile.actuator())
977 {
978 ActuateForced(i, j);
979 }
980 if (!tile.active())
981 {
982 return;
983 }
984 switch (type)
985 {
986 case 144:
987 HitSwitch(i, j);
988 WorldGen.SquareTileFrame(i, j);
989 NetMessage.SendTileSquare(-1, i, j);
990 break;
991 case 421:
992 if (!tile.actuator())
993 {
994 tile.type = 422;
995 WorldGen.SquareTileFrame(i, j);
996 NetMessage.SendTileSquare(-1, i, j);
997 }
998 break;
999 case 422:
1000 if (!tile.actuator())
1001 {
1002 tile.type = 421;
1003 WorldGen.SquareTileFrame(i, j);
1004 NetMessage.SendTileSquare(-1, i, j);
1005 }
1006 break;
1007 }
1008 if (type >= 255 && type <= 268)
1009 {
1010 if (!tile.actuator())
1011 {
1012 if (type >= 262)
1013 {
1014 tile.type -= 7;
1015 }
1016 else
1017 {
1018 tile.type += 7;
1019 }
1020 WorldGen.SquareTileFrame(i, j);
1021 NetMessage.SendTileSquare(-1, i, j);
1022 }
1023 return;
1024 }
1025 if (type == 419)
1026 {
1027 int num = 18;
1028 if (tile.frameX >= num)
1029 {
1030 num = -num;
1031 }
1032 if (tile.frameX == 36)
1033 {
1034 num = 0;
1035 }
1036 SkipWire(i, j);
1037 tile.frameX = (short)(tile.frameX + num);
1038 WorldGen.SquareTileFrame(i, j);
1039 NetMessage.SendTileSquare(-1, i, j);
1040 _LampsToCheck.Enqueue(new Point16(i, j));
1041 return;
1042 }
1043 if (type == 406)
1044 {
1045 int num2 = tile.frameX % 54 / 18;
1046 int num3 = tile.frameY % 54 / 18;
1047 int num4 = i - num2;
1048 int num5 = j - num3;
1049 int num6 = 54;
1050 if (Main.tile[num4, num5].frameY >= 108)
1051 {
1052 num6 = -108;
1053 }
1054 for (int k = num4; k < num4 + 3; k++)
1055 {
1056 for (int l = num5; l < num5 + 3; l++)
1057 {
1058 SkipWire(k, l);
1059 Main.tile[k, l].frameY = (short)(Main.tile[k, l].frameY + num6);
1060 }
1061 }
1062 NetMessage.SendTileSquare(-1, num4 + 1, num5 + 1, 3);
1063 return;
1064 }
1065 if (type == 452)
1066 {
1067 int num7 = tile.frameX % 54 / 18;
1068 int num8 = tile.frameY % 54 / 18;
1069 int num9 = i - num7;
1070 int num10 = j - num8;
1071 int num11 = 54;
1072 if (Main.tile[num9, num10].frameX >= 54)
1073 {
1074 num11 = -54;
1075 }
1076 for (int m = num9; m < num9 + 3; m++)
1077 {
1078 for (int n = num10; n < num10 + 3; n++)
1079 {
1080 SkipWire(m, n);
1081 Main.tile[m, n].frameX = (short)(Main.tile[m, n].frameX + num11);
1082 }
1083 }
1084 NetMessage.SendTileSquare(-1, num9 + 1, num10 + 1, 3);
1085 return;
1086 }
1087 if (type == 411)
1088 {
1089 int num12 = tile.frameX % 36 / 18;
1090 int num13 = tile.frameY % 36 / 18;
1091 int num14 = i - num12;
1092 int num15 = j - num13;
1093 int num16 = 36;
1094 if (Main.tile[num14, num15].frameX >= 36)
1095 {
1096 num16 = -36;
1097 }
1098 for (int num17 = num14; num17 < num14 + 2; num17++)
1099 {
1100 for (int num18 = num15; num18 < num15 + 2; num18++)
1101 {
1103 Main.tile[num17, num18].frameX = (short)(Main.tile[num17, num18].frameX + num16);
1104 }
1105 }
1106 NetMessage.SendTileSquare(-1, num14, num15, 2, 2);
1107 return;
1108 }
1109 if (type == 356)
1110 {
1111 int num19 = tile.frameX % 36 / 18;
1112 int num20 = tile.frameY % 54 / 18;
1113 int num21 = i - num19;
1114 int num22 = j - num20;
1115 for (int num23 = num21; num23 < num21 + 2; num23++)
1116 {
1117 for (int num24 = num22; num24 < num22 + 3; num24++)
1118 {
1120 }
1121 }
1122 if (!Main.fastForwardTimeToDawn && Main.sundialCooldown == 0)
1123 {
1124 Main.Sundialing();
1125 }
1126 NetMessage.SendTileSquare(-1, num21, num22, 2, 2);
1127 return;
1128 }
1129 if (type == 663)
1130 {
1131 int num25 = tile.frameX % 36 / 18;
1132 int num26 = tile.frameY % 54 / 18;
1133 int num27 = i - num25;
1134 int num28 = j - num26;
1135 for (int num29 = num27; num29 < num27 + 2; num29++)
1136 {
1137 for (int num30 = num28; num30 < num28 + 3; num30++)
1138 {
1140 }
1141 }
1142 if (!Main.fastForwardTimeToDusk && Main.moondialCooldown == 0)
1143 {
1144 Main.Moondialing();
1145 }
1146 NetMessage.SendTileSquare(-1, num27, num28, 2, 2);
1147 return;
1148 }
1149 if (type == 425)
1150 {
1151 int num31 = tile.frameX % 36 / 18;
1152 int num32 = tile.frameY % 36 / 18;
1153 int num33 = i - num31;
1154 int num34 = j - num32;
1155 for (int num35 = num33; num35 < num33 + 2; num35++)
1156 {
1157 for (int num36 = num34; num36 < num34 + 2; num36++)
1158 {
1160 }
1161 }
1162 if (Main.AnnouncementBoxDisabled)
1163 {
1164 return;
1165 }
1166 Color pink = Color.Pink;
1167 int num37 = Sign.ReadSign(num33, num34, CreateIfMissing: false);
1168 if (num37 == -1 || Main.sign[num37] == null || string.IsNullOrWhiteSpace(Main.sign[num37].text))
1169 {
1170 return;
1171 }
1172 if (Main.AnnouncementBoxRange == -1)
1173 {
1174 if (Main.netMode == 0)
1175 {
1176 Main.NewTextMultiline(Main.sign[num37].text, force: false, pink, 460);
1177 }
1178 else if (Main.netMode == 2)
1179 {
1180 NetMessage.SendData(107, -1, -1, NetworkText.FromLiteral(Main.sign[num37].text), 255, (int)pink.R, (int)pink.G, (int)pink.B, 460);
1181 }
1182 }
1183 else if (Main.netMode == 0)
1184 {
1185 if (Main.player[Main.myPlayer].Distance(new Vector2(num33 * 16 + 16, num34 * 16 + 16)) <= (float)Main.AnnouncementBoxRange)
1186 {
1187 Main.NewTextMultiline(Main.sign[num37].text, force: false, pink, 460);
1188 }
1189 }
1190 else
1191 {
1192 if (Main.netMode != 2)
1193 {
1194 return;
1195 }
1196 for (int num38 = 0; num38 < 255; num38++)
1197 {
1198 if (Main.player[num38].active && Main.player[num38].Distance(new Vector2(num33 * 16 + 16, num34 * 16 + 16)) <= (float)Main.AnnouncementBoxRange)
1199 {
1200 NetMessage.SendData(107, num38, -1, NetworkText.FromLiteral(Main.sign[num37].text), 255, (int)pink.R, (int)pink.G, (int)pink.B, 460);
1201 }
1202 }
1203 }
1204 return;
1205 }
1206 if (type == 405)
1207 {
1209 return;
1210 }
1211 if (type == 209)
1212 {
1213 int num39 = tile.frameX % 72 / 18;
1214 int num40 = tile.frameY % 54 / 18;
1215 int num41 = i - num39;
1216 int num42 = j - num40;
1217 int num43 = tile.frameY / 54;
1218 int num44 = tile.frameX / 72;
1219 int num45 = -1;
1220 if (num39 == 1 || num39 == 2)
1221 {
1222 num45 = num40;
1223 }
1224 int num46 = 0;
1225 if (num39 == 3)
1226 {
1227 num46 = -54;
1228 }
1229 if (num39 == 0)
1230 {
1231 num46 = 54;
1232 }
1233 if (num43 >= 8 && num46 > 0)
1234 {
1235 num46 = 0;
1236 }
1237 if (num43 == 0 && num46 < 0)
1238 {
1239 num46 = 0;
1240 }
1241 bool flag = false;
1242 if (num46 != 0)
1243 {
1244 for (int num47 = num41; num47 < num41 + 4; num47++)
1245 {
1246 for (int num48 = num42; num48 < num42 + 3; num48++)
1247 {
1249 Main.tile[num47, num48].frameY = (short)(Main.tile[num47, num48].frameY + num46);
1250 }
1251 }
1252 flag = true;
1253 }
1254 if ((num44 == 3 || num44 == 4) && (num45 == 0 || num45 == 1))
1255 {
1256 num46 = ((num44 == 3) ? 72 : (-72));
1257 for (int num49 = num41; num49 < num41 + 4; num49++)
1258 {
1259 for (int num50 = num42; num50 < num42 + 3; num50++)
1260 {
1262 Main.tile[num49, num50].frameX = (short)(Main.tile[num49, num50].frameX + num46);
1263 }
1264 }
1265 flag = true;
1266 }
1267 if (flag)
1268 {
1269 NetMessage.SendTileSquare(-1, num41, num42, 4, 3);
1270 }
1271 if (num45 != -1)
1272 {
1273 bool flag2 = true;
1274 if ((num44 == 3 || num44 == 4) && num45 < 2)
1275 {
1276 flag2 = false;
1277 }
1278 if (CheckMech(num41, num42, 30) && flag2)
1279 {
1280 WorldGen.ShootFromCannon(num41, num42, num43, num44 + 1, 0, 0f, CurrentUser, fromWire: true);
1281 }
1282 }
1283 return;
1284 }
1285 if (type == 212)
1286 {
1287 int num51 = tile.frameX % 54 / 18;
1288 int num52 = tile.frameY % 54 / 18;
1289 int num53 = i - num51;
1290 int num54 = j - num52;
1291 int num55 = tile.frameX / 54;
1292 int num56 = -1;
1293 if (num51 == 1)
1294 {
1295 num56 = num52;
1296 }
1297 int num57 = 0;
1298 if (num51 == 0)
1299 {
1300 num57 = -54;
1301 }
1302 if (num51 == 2)
1303 {
1304 num57 = 54;
1305 }
1306 if (num55 >= 1 && num57 > 0)
1307 {
1308 num57 = 0;
1309 }
1310 if (num55 == 0 && num57 < 0)
1311 {
1312 num57 = 0;
1313 }
1314 bool flag3 = false;
1315 if (num57 != 0)
1316 {
1317 for (int num58 = num53; num58 < num53 + 3; num58++)
1318 {
1319 for (int num59 = num54; num59 < num54 + 3; num59++)
1320 {
1322 Main.tile[num58, num59].frameX = (short)(Main.tile[num58, num59].frameX + num57);
1323 }
1324 }
1325 flag3 = true;
1326 }
1327 if (flag3)
1328 {
1329 NetMessage.SendTileSquare(-1, num53, num54, 3, 3);
1330 }
1331 if (num56 != -1 && CheckMech(num53, num54, 10))
1332 {
1333 float num60 = 12f + (float)Main.rand.Next(450) * 0.01f;
1334 float num61 = Main.rand.Next(85, 105);
1335 float num62 = Main.rand.Next(-35, 11);
1336 int type2 = 166;
1337 int damage = 0;
1338 float knockBack = 0f;
1339 Vector2 vector = new Vector2((num53 + 2) * 16 - 8, (num54 + 2) * 16 - 8);
1340 if (tile.frameX / 54 == 0)
1341 {
1342 num61 *= -1f;
1343 vector.X -= 12f;
1344 }
1345 else
1346 {
1347 vector.X += 12f;
1348 }
1349 float num63 = num61;
1350 float num64 = num62;
1351 float num65 = (float)Math.Sqrt(num63 * num63 + num64 * num64);
1352 num65 = num60 / num65;
1353 num63 *= num65;
1354 num64 *= num65;
1355 Projectile.NewProjectile(GetProjectileSource(num53, num54), vector.X, vector.Y, num63, num64, type2, damage, knockBack, CurrentUser);
1356 }
1357 return;
1358 }
1359 if (type == 215)
1360 {
1362 return;
1363 }
1364 if (type == 130)
1365 {
1366 if (Main.tile[i, j - 1] == null || !Main.tile[i, j - 1].active() || (!TileID.Sets.BasicChest[Main.tile[i, j - 1].type] && !TileID.Sets.BasicChestFake[Main.tile[i, j - 1].type] && Main.tile[i, j - 1].type != 88))
1367 {
1368 tile.type = 131;
1369 WorldGen.SquareTileFrame(i, j);
1370 NetMessage.SendTileSquare(-1, i, j);
1371 }
1372 return;
1373 }
1374 if (type == 131)
1375 {
1376 tile.type = 130;
1377 WorldGen.SquareTileFrame(i, j);
1378 NetMessage.SendTileSquare(-1, i, j);
1379 return;
1380 }
1381 if (type == 387 || type == 386)
1382 {
1383 bool value = type == 387;
1384 int num66 = WorldGen.ShiftTrapdoor(i, j, playerAbove: true).ToInt();
1385 if (num66 == 0)
1386 {
1387 num66 = -WorldGen.ShiftTrapdoor(i, j, playerAbove: false).ToInt();
1388 }
1389 if (num66 != 0)
1390 {
1391 NetMessage.SendData(19, -1, -1, null, 3 - value.ToInt(), i, j, num66);
1392 }
1393 return;
1394 }
1395 if (type == 389 || type == 388)
1396 {
1397 bool flag4 = type == 389;
1398 WorldGen.ShiftTallGate(i, j, flag4);
1399 NetMessage.SendData(19, -1, -1, null, 4 + flag4.ToInt(), i, j);
1400 return;
1401 }
1402 if (type == 11)
1403 {
1404 if (WorldGen.CloseDoor(i, j, forced: true))
1405 {
1406 NetMessage.SendData(19, -1, -1, null, 1, i, j);
1407 }
1408 return;
1409 }
1410 if (type == 10)
1411 {
1412 int num67 = 1;
1413 if (Main.rand.Next(2) == 0)
1414 {
1415 num67 = -1;
1416 }
1417 if (!WorldGen.OpenDoor(i, j, num67))
1418 {
1419 if (WorldGen.OpenDoor(i, j, -num67))
1420 {
1421 NetMessage.SendData(19, -1, -1, null, 0, i, j, -num67);
1422 }
1423 }
1424 else
1425 {
1426 NetMessage.SendData(19, -1, -1, null, 0, i, j, num67);
1427 }
1428 return;
1429 }
1430 if (type == 216)
1431 {
1432 WorldGen.LaunchRocket(i, j, fromWiring: true);
1433 SkipWire(i, j);
1434 return;
1435 }
1436 if (type == 497 || (type == 15 && tile.frameY / 40 == 1) || (type == 15 && tile.frameY / 40 == 20))
1437 {
1438 int num68 = j - tile.frameY % 40 / 18;
1439 SkipWire(i, num68);
1440 SkipWire(i, num68 + 1);
1441 if (CheckMech(i, num68, 60))
1442 {
1443 Projectile.NewProjectile(GetProjectileSource(i, num68), i * 16 + 8, num68 * 16 + 12, 0f, 0f, 733, 0, 0f, Main.myPlayer);
1444 }
1445 return;
1446 }
1447 switch (type)
1448 {
1449 case 335:
1450 {
1451 int num156 = j - tile.frameY / 18;
1452 int num157 = i - tile.frameX / 18;
1454 SkipWire(num157, num156 + 1);
1455 SkipWire(num157 + 1, num156);
1456 SkipWire(num157 + 1, num156 + 1);
1457 if (CheckMech(num157, num156, 30))
1458 {
1459 WorldGen.LaunchRocketSmall(num157, num156, fromWiring: true);
1460 }
1461 break;
1462 }
1463 case 338:
1464 {
1465 int num75 = j - tile.frameY / 18;
1466 int num76 = i - tile.frameX / 18;
1468 SkipWire(num76, num75 + 1);
1469 if (!CheckMech(num76, num75, 30))
1470 {
1471 break;
1472 }
1473 bool flag5 = false;
1474 for (int num77 = 0; num77 < 1000; num77++)
1475 {
1476 if (Main.projectile[num77].active && Main.projectile[num77].aiStyle == 73 && Main.projectile[num77].ai[0] == (float)num76 && Main.projectile[num77].ai[1] == (float)num75)
1477 {
1478 flag5 = true;
1479 break;
1480 }
1481 }
1482 if (!flag5)
1483 {
1484 int type3 = 419 + Main.rand.Next(4);
1485 Projectile.NewProjectile(GetProjectileSource(num76, num75), num76 * 16 + 8, num75 * 16 + 2, 0f, 0f, type3, 0, 0f, Main.myPlayer, num76, num75);
1486 }
1487 break;
1488 }
1489 case 235:
1490 {
1491 int num107 = i - tile.frameX / 18;
1492 if (tile.wall == 87 && (double)j > Main.worldSurface && !NPC.downedPlantBoss)
1493 {
1494 break;
1495 }
1496 if (_teleport[0].X == -1f)
1497 {
1498 _teleport[0].X = num107;
1499 _teleport[0].Y = j;
1500 if (tile.halfBrick())
1501 {
1502 _teleport[0].Y += 0.5f;
1503 }
1504 }
1505 else if (_teleport[0].X != (float)num107 || _teleport[0].Y != (float)j)
1506 {
1507 _teleport[1].X = num107;
1508 _teleport[1].Y = j;
1509 if (tile.halfBrick())
1510 {
1511 _teleport[1].Y += 0.5f;
1512 }
1513 }
1514 break;
1515 }
1516 case 4:
1518 break;
1519 case 429:
1520 {
1521 int num78 = Main.tile[i, j].frameX / 18;
1522 bool flag6 = num78 % 2 >= 1;
1523 bool flag7 = num78 % 4 >= 2;
1524 bool flag8 = num78 % 8 >= 4;
1525 bool flag9 = num78 % 16 >= 8;
1526 bool flag10 = false;
1527 short num79 = 0;
1528 switch (_currentWireColor)
1529 {
1530 case 1:
1531 num79 = 18;
1532 flag10 = !flag6;
1533 break;
1534 case 2:
1535 num79 = 72;
1536 flag10 = !flag8;
1537 break;
1538 case 3:
1539 num79 = 36;
1540 flag10 = !flag7;
1541 break;
1542 case 4:
1543 num79 = 144;
1544 flag10 = !flag9;
1545 break;
1546 }
1547 if (flag10)
1548 {
1549 tile.frameX += num79;
1550 }
1551 else
1552 {
1553 tile.frameX -= num79;
1554 }
1555 NetMessage.SendTileSquare(-1, i, j);
1556 break;
1557 }
1558 case 149:
1560 break;
1561 case 244:
1562 {
1563 int num131;
1564 for (num131 = tile.frameX / 18; num131 >= 3; num131 -= 3)
1565 {
1566 }
1567 int num132;
1568 for (num132 = tile.frameY / 18; num132 >= 3; num132 -= 3)
1569 {
1570 }
1571 int num133 = i - num131;
1572 int num134 = j - num132;
1573 int num135 = 54;
1574 if (Main.tile[num133, num134].frameX >= 54)
1575 {
1576 num135 = -54;
1577 }
1578 for (int num136 = num133; num136 < num133 + 3; num136++)
1579 {
1580 for (int num137 = num134; num137 < num134 + 2; num137++)
1581 {
1583 Main.tile[num136, num137].frameX = (short)(Main.tile[num136, num137].frameX + num135);
1584 }
1585 }
1586 NetMessage.SendTileSquare(-1, num133, num134, 3, 2);
1587 break;
1588 }
1589 case 565:
1590 {
1591 int num98;
1592 for (num98 = tile.frameX / 18; num98 >= 2; num98 -= 2)
1593 {
1594 }
1595 int num99;
1596 for (num99 = tile.frameY / 18; num99 >= 2; num99 -= 2)
1597 {
1598 }
1599 int num100 = i - num98;
1600 int num101 = j - num99;
1601 int num102 = 36;
1602 if (Main.tile[num100, num101].frameX >= 36)
1603 {
1604 num102 = -36;
1605 }
1606 for (int num103 = num100; num103 < num100 + 2; num103++)
1607 {
1608 for (int num104 = num101; num104 < num101 + 2; num104++)
1609 {
1611 Main.tile[num103, num104].frameX = (short)(Main.tile[num103, num104].frameX + num102);
1612 }
1613 }
1614 NetMessage.SendTileSquare(-1, num100, num101, 2, 2);
1615 break;
1616 }
1617 case 42:
1619 break;
1620 case 93:
1622 break;
1623 case 95:
1624 case 100:
1625 case 126:
1626 case 173:
1627 case 564:
1629 break;
1630 case 593:
1631 {
1632 SkipWire(i, j);
1633 short num105 = (short)((Main.tile[i, j].frameX != 0) ? (-18) : 18);
1634 Main.tile[i, j].frameX += num105;
1635 if (Main.netMode == 2)
1636 {
1637 NetMessage.SendTileSquare(-1, i, j, 1, 1);
1638 }
1639 int num106 = ((num105 > 0) ? 4 : 3);
1640 Animation.NewTemporaryAnimation(num106, 593, i, j);
1641 NetMessage.SendTemporaryAnimation(-1, num106, 593, i, j);
1642 break;
1643 }
1644 case 594:
1645 {
1646 int num80;
1647 for (num80 = tile.frameY / 18; num80 >= 2; num80 -= 2)
1648 {
1649 }
1650 num80 = j - num80;
1651 int num81 = tile.frameX / 18;
1652 if (num81 > 1)
1653 {
1654 num81 -= 2;
1655 }
1656 num81 = i - num81;
1658 SkipWire(num81, num80 + 1);
1659 SkipWire(num81 + 1, num80);
1660 SkipWire(num81 + 1, num80 + 1);
1661 short num82 = (short)((Main.tile[num81, num80].frameX != 0) ? (-36) : 36);
1662 for (int num83 = 0; num83 < 2; num83++)
1663 {
1664 for (int num84 = 0; num84 < 2; num84++)
1665 {
1666 Main.tile[num81 + num83, num80 + num84].frameX += num82;
1667 }
1668 }
1669 if (Main.netMode == 2)
1670 {
1671 NetMessage.SendTileSquare(-1, num81, num80, 2, 2);
1672 }
1673 int num85 = ((num82 > 0) ? 4 : 3);
1674 Animation.NewTemporaryAnimation(num85, 594, num81, num80);
1675 NetMessage.SendTemporaryAnimation(-1, num85, 594, num81, num80);
1676 break;
1677 }
1678 case 34:
1680 break;
1681 case 314:
1682 if (CheckMech(i, j, 5))
1683 {
1684 Minecart.FlipSwitchTrack(i, j);
1685 }
1686 break;
1687 case 33:
1688 case 49:
1689 case 174:
1690 case 372:
1691 case 646:
1693 break;
1694 case 92:
1696 break;
1697 case 137:
1698 {
1699 int num138 = tile.frameY / 18;
1701 float speedX = 0f;
1702 float speedY = 0f;
1703 int num139 = 0;
1704 int damage3 = 0;
1705 switch (num138)
1706 {
1707 case 0:
1708 case 1:
1709 case 2:
1710 case 5:
1711 if (CheckMech(i, j, 200))
1712 {
1713 int num147 = ((tile.frameX == 0) ? (-1) : ((tile.frameX == 18) ? 1 : 0));
1714 int num148 = ((tile.frameX >= 36) ? ((tile.frameX >= 72) ? 1 : (-1)) : 0);
1715 vector3 = new Vector2(i * 16 + 8 + 10 * num147, j * 16 + 8 + 10 * num148);
1716 float num149 = 3f;
1717 if (num138 == 0)
1718 {
1719 num139 = 98;
1720 damage3 = 20;
1721 num149 = 12f;
1722 }
1723 if (num138 == 1)
1724 {
1725 num139 = 184;
1726 damage3 = 40;
1727 num149 = 12f;
1728 }
1729 if (num138 == 2)
1730 {
1731 num139 = 187;
1732 damage3 = 40;
1733 num149 = 5f;
1734 }
1735 if (num138 == 5)
1736 {
1737 num139 = 980;
1738 damage3 = 30;
1739 num149 = 12f;
1740 }
1741 speedX = (float)num147 * num149;
1742 speedY = (float)num148 * num149;
1743 }
1744 break;
1745 case 3:
1746 {
1747 if (!CheckMech(i, j, 300))
1748 {
1749 break;
1750 }
1751 int num142 = 200;
1752 for (int num143 = 0; num143 < 1000; num143++)
1753 {
1754 if (Main.projectile[num143].active && Main.projectile[num143].type == num139)
1755 {
1756 float num144 = (new Vector2(i * 16 + 8, j * 18 + 8) - Main.projectile[num143].Center).Length();
1757 num142 = ((!(num144 < 50f)) ? ((!(num144 < 100f)) ? ((!(num144 < 200f)) ? ((!(num144 < 300f)) ? ((!(num144 < 400f)) ? ((!(num144 < 500f)) ? ((!(num144 < 700f)) ? ((!(num144 < 900f)) ? ((!(num144 < 1200f)) ? (num142 - 1) : (num142 - 2)) : (num142 - 3)) : (num142 - 4)) : (num142 - 5)) : (num142 - 6)) : (num142 - 8)) : (num142 - 10)) : (num142 - 15)) : (num142 - 50));
1758 }
1759 }
1760 if (num142 > 0)
1761 {
1762 num139 = 185;
1763 damage3 = 40;
1764 int num145 = 0;
1765 int num146 = 0;
1766 switch (tile.frameX / 18)
1767 {
1768 case 0:
1769 case 1:
1770 num145 = 0;
1771 num146 = 1;
1772 break;
1773 case 2:
1774 num145 = 0;
1775 num146 = -1;
1776 break;
1777 case 3:
1778 num145 = -1;
1779 num146 = 0;
1780 break;
1781 case 4:
1782 num145 = 1;
1783 num146 = 0;
1784 break;
1785 }
1786 speedX = (float)(4 * num145) + (float)Main.rand.Next(-20 + ((num145 == 1) ? 20 : 0), 21 - ((num145 == -1) ? 20 : 0)) * 0.05f;
1787 speedY = (float)(4 * num146) + (float)Main.rand.Next(-20 + ((num146 == 1) ? 20 : 0), 21 - ((num146 == -1) ? 20 : 0)) * 0.05f;
1788 vector3 = new Vector2(i * 16 + 8 + 14 * num145, j * 16 + 8 + 14 * num146);
1789 }
1790 break;
1791 }
1792 case 4:
1793 if (CheckMech(i, j, 90))
1794 {
1795 int num140 = 0;
1796 int num141 = 0;
1797 switch (tile.frameX / 18)
1798 {
1799 case 0:
1800 case 1:
1801 num140 = 0;
1802 num141 = 1;
1803 break;
1804 case 2:
1805 num140 = 0;
1806 num141 = -1;
1807 break;
1808 case 3:
1809 num140 = -1;
1810 num141 = 0;
1811 break;
1812 case 4:
1813 num140 = 1;
1814 num141 = 0;
1815 break;
1816 }
1817 speedX = 8 * num140;
1818 speedY = 8 * num141;
1819 damage3 = 60;
1820 num139 = 186;
1821 vector3 = new Vector2(i * 16 + 8 + 18 * num140, j * 16 + 8 + 18 * num141);
1822 }
1823 break;
1824 }
1825 switch (num138)
1826 {
1827 case -10:
1828 if (CheckMech(i, j, 200))
1829 {
1830 int num154 = -1;
1831 if (tile.frameX != 0)
1832 {
1833 num154 = 1;
1834 }
1835 speedX = 12 * num154;
1836 damage3 = 20;
1837 num139 = 98;
1838 vector3 = new Vector2(i * 16 + 8, j * 16 + 7);
1839 vector3.X += 10 * num154;
1840 vector3.Y += 2f;
1841 }
1842 break;
1843 case -9:
1844 if (CheckMech(i, j, 200))
1845 {
1846 int num150 = -1;
1847 if (tile.frameX != 0)
1848 {
1849 num150 = 1;
1850 }
1851 speedX = 12 * num150;
1852 damage3 = 40;
1853 num139 = 184;
1854 vector3 = new Vector2(i * 16 + 8, j * 16 + 7);
1855 vector3.X += 10 * num150;
1856 vector3.Y += 2f;
1857 }
1858 break;
1859 case -8:
1860 if (CheckMech(i, j, 200))
1861 {
1862 int num155 = -1;
1863 if (tile.frameX != 0)
1864 {
1865 num155 = 1;
1866 }
1867 speedX = 5 * num155;
1868 damage3 = 40;
1869 num139 = 187;
1870 vector3 = new Vector2(i * 16 + 8, j * 16 + 7);
1871 vector3.X += 10 * num155;
1872 vector3.Y += 2f;
1873 }
1874 break;
1875 case -7:
1876 {
1877 if (!CheckMech(i, j, 300))
1878 {
1879 break;
1880 }
1881 num139 = 185;
1882 int num151 = 200;
1883 for (int num152 = 0; num152 < 1000; num152++)
1884 {
1885 if (Main.projectile[num152].active && Main.projectile[num152].type == num139)
1886 {
1887 float num153 = (new Vector2(i * 16 + 8, j * 18 + 8) - Main.projectile[num152].Center).Length();
1888 num151 = ((!(num153 < 50f)) ? ((!(num153 < 100f)) ? ((!(num153 < 200f)) ? ((!(num153 < 300f)) ? ((!(num153 < 400f)) ? ((!(num153 < 500f)) ? ((!(num153 < 700f)) ? ((!(num153 < 900f)) ? ((!(num153 < 1200f)) ? (num151 - 1) : (num151 - 2)) : (num151 - 3)) : (num151 - 4)) : (num151 - 5)) : (num151 - 6)) : (num151 - 8)) : (num151 - 10)) : (num151 - 15)) : (num151 - 50));
1889 }
1890 }
1891 if (num151 > 0)
1892 {
1893 speedX = (float)Main.rand.Next(-20, 21) * 0.05f;
1894 speedY = 4f + (float)Main.rand.Next(0, 21) * 0.05f;
1895 damage3 = 40;
1896 vector3 = new Vector2(i * 16 + 8, j * 16 + 16);
1897 vector3.Y += 6f;
1898 Projectile.NewProjectile(GetProjectileSource(i, j), (int)vector3.X, (int)vector3.Y, speedX, speedY, num139, damage3, 2f, Main.myPlayer);
1899 }
1900 break;
1901 }
1902 case -6:
1903 if (CheckMech(i, j, 90))
1904 {
1905 speedX = 0f;
1906 speedY = 8f;
1907 damage3 = 60;
1908 num139 = 186;
1909 vector3 = new Vector2(i * 16 + 8, j * 16 + 16);
1910 vector3.Y += 10f;
1911 }
1912 break;
1913 }
1914 if (num139 != 0)
1915 {
1916 Projectile.NewProjectile(GetProjectileSource(i, j), (int)vector3.X, (int)vector3.Y, speedX, speedY, num139, damage3, 2f, Main.myPlayer);
1917 }
1918 break;
1919 }
1920 case 443:
1921 GeyserTrap(i, j);
1922 break;
1923 case 531:
1924 {
1925 int num126 = tile.frameX / 36;
1926 int num127 = tile.frameY / 54;
1927 int num128 = i - (tile.frameX - num126 * 36) / 18;
1928 int num129 = j - (tile.frameY - num127 * 54) / 18;
1929 if (CheckMech(num128, num129, 900))
1930 {
1931 Vector2 vector2 = new Vector2(num128 + 1, num129) * 16f;
1932 vector2.Y += 28f;
1933 int num130 = 99;
1934 int damage2 = 70;
1935 float knockBack2 = 10f;
1936 if (num130 != 0)
1937 {
1938 Projectile.NewProjectile(GetProjectileSource(num128, num129), (int)vector2.X, (int)vector2.Y, 0f, 0f, num130, damage2, knockBack2, Main.myPlayer);
1939 }
1940 }
1941 break;
1942 }
1943 case 35:
1944 case 139:
1945 WorldGen.SwitchMB(i, j);
1946 break;
1947 case 207:
1948 WorldGen.SwitchFountain(i, j);
1949 break;
1950 case 410:
1951 case 480:
1952 case 509:
1953 case 657:
1954 case 658:
1955 WorldGen.SwitchMonolith(i, j);
1956 break;
1957 case 455:
1959 break;
1960 case 141:
1961 WorldGen.KillTile(i, j, fail: false, effectOnly: false, noItem: true);
1962 NetMessage.SendTileSquare(-1, i, j);
1963 Projectile.NewProjectile(GetProjectileSource(i, j), i * 16 + 8, j * 16 + 8, 0f, 0f, 108, 500, 10f, Main.myPlayer);
1964 break;
1965 case 210:
1966 WorldGen.ExplodeMine(i, j, fromWiring: true);
1967 break;
1968 case 142:
1969 case 143:
1970 {
1971 int num92 = j - tile.frameY / 18;
1972 int num93 = tile.frameX / 18;
1973 if (num93 > 1)
1974 {
1975 num93 -= 2;
1976 }
1977 num93 = i - num93;
1979 SkipWire(num93, num92 + 1);
1980 SkipWire(num93 + 1, num92);
1981 SkipWire(num93 + 1, num92 + 1);
1982 if (type == 142)
1983 {
1984 for (int num94 = 0; num94 < 4; num94++)
1985 {
1986 if (_numInPump >= 19)
1987 {
1988 break;
1989 }
1990 int num95;
1991 int num96;
1992 switch (num94)
1993 {
1994 case 0:
1995 num95 = num93;
1996 num96 = num92 + 1;
1997 break;
1998 case 1:
1999 num95 = num93 + 1;
2000 num96 = num92 + 1;
2001 break;
2002 case 2:
2003 num95 = num93;
2004 num96 = num92;
2005 break;
2006 default:
2007 num95 = num93 + 1;
2008 num96 = num92;
2009 break;
2010 }
2013 _numInPump++;
2014 }
2015 break;
2016 }
2017 for (int num97 = 0; num97 < 4; num97++)
2018 {
2019 if (_numOutPump >= 19)
2020 {
2021 break;
2022 }
2023 int num95;
2024 int num96;
2025 switch (num97)
2026 {
2027 case 0:
2028 num95 = num93;
2029 num96 = num92 + 1;
2030 break;
2031 case 1:
2032 num95 = num93 + 1;
2033 num96 = num92 + 1;
2034 break;
2035 case 2:
2036 num95 = num93;
2037 num96 = num92;
2038 break;
2039 default:
2040 num95 = num93 + 1;
2041 num96 = num92;
2042 break;
2043 }
2046 _numOutPump++;
2047 }
2048 break;
2049 }
2050 case 105:
2051 {
2052 int num108 = j - tile.frameY / 18;
2053 int num109 = tile.frameX / 18;
2054 int num110 = 0;
2055 while (num109 >= 2)
2056 {
2057 num109 -= 2;
2058 num110++;
2059 }
2060 num109 = i - num109;
2061 num109 = i - tile.frameX % 36 / 18;
2062 num108 = j - tile.frameY % 54 / 18;
2063 int num111 = tile.frameY / 54;
2064 num111 %= 3;
2065 num110 = tile.frameX / 36 + num111 * 55;
2067 SkipWire(num109, num108 + 1);
2068 SkipWire(num109, num108 + 2);
2069 SkipWire(num109 + 1, num108);
2070 SkipWire(num109 + 1, num108 + 1);
2071 SkipWire(num109 + 1, num108 + 2);
2072 int num112 = num109 * 16 + 16;
2073 int num113 = (num108 + 3) * 16;
2074 int num114 = -1;
2075 int num115 = -1;
2076 bool flag11 = true;
2077 bool flag12 = false;
2078 switch (num110)
2079 {
2080 case 5:
2081 num115 = 73;
2082 break;
2083 case 13:
2084 num115 = 24;
2085 break;
2086 case 30:
2087 num115 = 6;
2088 break;
2089 case 35:
2090 num115 = 2;
2091 break;
2092 case 51:
2093 num115 = Utils.SelectRandom(Main.rand, new short[2] { 299, 538 });
2094 break;
2095 case 52:
2096 num115 = 356;
2097 break;
2098 case 53:
2099 num115 = 357;
2100 break;
2101 case 54:
2102 num115 = Utils.SelectRandom(Main.rand, new short[2] { 355, 358 });
2103 break;
2104 case 55:
2105 num115 = Utils.SelectRandom(Main.rand, new short[2] { 367, 366 });
2106 break;
2107 case 56:
2108 num115 = Utils.SelectRandom(Main.rand, new short[5] { 359, 359, 359, 359, 360 });
2109 break;
2110 case 57:
2111 num115 = 377;
2112 break;
2113 case 58:
2114 num115 = 300;
2115 break;
2116 case 59:
2117 num115 = Utils.SelectRandom(Main.rand, new short[2] { 364, 362 });
2118 break;
2119 case 60:
2120 num115 = 148;
2121 break;
2122 case 61:
2123 num115 = 361;
2124 break;
2125 case 62:
2126 num115 = Utils.SelectRandom(Main.rand, new short[3] { 487, 486, 485 });
2127 break;
2128 case 63:
2129 num115 = 164;
2130 flag11 &= NPC.MechSpawn(num112, num113, 165);
2131 break;
2132 case 64:
2133 num115 = 86;
2134 flag12 = true;
2135 break;
2136 case 65:
2137 num115 = 490;
2138 break;
2139 case 66:
2140 num115 = 82;
2141 break;
2142 case 67:
2143 num115 = 449;
2144 break;
2145 case 68:
2146 num115 = 167;
2147 break;
2148 case 69:
2149 num115 = 480;
2150 break;
2151 case 70:
2152 num115 = 48;
2153 break;
2154 case 71:
2155 num115 = Utils.SelectRandom(Main.rand, new short[3] { 170, 180, 171 });
2156 flag12 = true;
2157 break;
2158 case 72:
2159 num115 = 481;
2160 break;
2161 case 73:
2162 num115 = 482;
2163 break;
2164 case 74:
2165 num115 = 430;
2166 break;
2167 case 75:
2168 num115 = 489;
2169 break;
2170 case 76:
2171 num115 = 611;
2172 break;
2173 case 77:
2174 num115 = 602;
2175 break;
2176 case 78:
2177 num115 = Utils.SelectRandom(Main.rand, new short[6] { 595, 596, 599, 597, 600, 598 });
2178 break;
2179 case 79:
2180 num115 = Utils.SelectRandom(Main.rand, new short[2] { 616, 617 });
2181 break;
2182 case 80:
2183 num115 = Utils.SelectRandom(Main.rand, new short[2] { 671, 672 });
2184 break;
2185 case 81:
2186 num115 = 673;
2187 break;
2188 case 82:
2189 num115 = Utils.SelectRandom(Main.rand, new short[2] { 674, 675 });
2190 break;
2191 }
2192 if (num115 != -1 && CheckMech(num109, num108, 30) && NPC.MechSpawn(num112, num113, num115) && flag11)
2193 {
2194 if (!flag12 || !Collision.SolidTiles(num109 - 2, num109 + 3, num108, num108 + 2))
2195 {
2197 }
2198 else
2199 {
2200 Vector2 position = new Vector2(num112 - 4, num113 - 22) - new Vector2(10f);
2201 Utils.PoofOfSmoke(position);
2202 NetMessage.SendData(106, -1, -1, null, (int)position.X, position.Y);
2203 }
2204 }
2205 if (num114 <= -1)
2206 {
2207 switch (num110)
2208 {
2209 case 4:
2210 if (CheckMech(num109, num108, 30) && NPC.MechSpawn(num112, num113, 1))
2211 {
2212 num114 = NPC.NewNPC(GetNPCSource(num109, num108), num112, num113 - 12, 1);
2213 }
2214 break;
2215 case 7:
2216 if (CheckMech(num109, num108, 30) && NPC.MechSpawn(num112, num113, 49))
2217 {
2218 num114 = NPC.NewNPC(GetNPCSource(num109, num108), num112 - 4, num113 - 6, 49);
2219 }
2220 break;
2221 case 8:
2222 if (CheckMech(num109, num108, 30) && NPC.MechSpawn(num112, num113, 55))
2223 {
2224 num114 = NPC.NewNPC(GetNPCSource(num109, num108), num112, num113 - 12, 55);
2225 }
2226 break;
2227 case 9:
2228 {
2229 int type4 = 46;
2231 {
2232 type4 = 540;
2233 }
2234 if (CheckMech(num109, num108, 30) && NPC.MechSpawn(num112, num113, type4))
2235 {
2236 num114 = NPC.NewNPC(GetNPCSource(num109, num108), num112, num113 - 12, type4);
2237 }
2238 break;
2239 }
2240 case 10:
2241 if (CheckMech(num109, num108, 30) && NPC.MechSpawn(num112, num113, 21))
2242 {
2243 num114 = NPC.NewNPC(GetNPCSource(num109, num108), num112, num113, 21);
2244 }
2245 break;
2246 case 16:
2247 if (CheckMech(num109, num108, 30) && NPC.MechSpawn(num112, num113, 42))
2248 {
2249 if (!Collision.SolidTiles(num109 - 1, num109 + 1, num108, num108 + 1))
2250 {
2251 num114 = NPC.NewNPC(GetNPCSource(num109, num108), num112, num113 - 12, 42);
2252 break;
2253 }
2254 Vector2 position3 = new Vector2(num112 - 4, num113 - 22) - new Vector2(10f);
2255 Utils.PoofOfSmoke(position3);
2256 NetMessage.SendData(106, -1, -1, null, (int)position3.X, position3.Y);
2257 }
2258 break;
2259 case 18:
2260 if (CheckMech(num109, num108, 30) && NPC.MechSpawn(num112, num113, 67))
2261 {
2262 num114 = NPC.NewNPC(GetNPCSource(num109, num108), num112, num113 - 12, 67);
2263 }
2264 break;
2265 case 23:
2266 if (CheckMech(num109, num108, 30) && NPC.MechSpawn(num112, num113, 63))
2267 {
2268 num114 = NPC.NewNPC(GetNPCSource(num109, num108), num112, num113 - 12, 63);
2269 }
2270 break;
2271 case 27:
2272 if (CheckMech(num109, num108, 30) && NPC.MechSpawn(num112, num113, 85))
2273 {
2274 num114 = NPC.NewNPC(GetNPCSource(num109, num108), num112 - 9, num113, 85);
2275 }
2276 break;
2277 case 28:
2278 if (CheckMech(num109, num108, 30) && NPC.MechSpawn(num112, num113, 74))
2279 {
2280 num114 = NPC.NewNPC(GetNPCSource(num109, num108), num112, num113 - 12, Utils.SelectRandom(Main.rand, new short[3] { 74, 297, 298 }));
2281 }
2282 break;
2283 case 34:
2284 {
2285 for (int num124 = 0; num124 < 2; num124++)
2286 {
2287 for (int num125 = 0; num125 < 3; num125++)
2288 {
2289 Tile tile2 = Main.tile[num109 + num124, num108 + num125];
2290 tile2.type = 349;
2291 tile2.frameX = (short)(num124 * 18 + 216);
2292 tile2.frameY = (short)(num125 * 18);
2293 }
2294 }
2295 Animation.NewTemporaryAnimation(0, 349, num109, num108);
2296 if (Main.netMode == 2)
2297 {
2298 NetMessage.SendTileSquare(-1, num109, num108, 2, 3);
2299 }
2300 break;
2301 }
2302 case 42:
2303 if (CheckMech(num109, num108, 30) && NPC.MechSpawn(num112, num113, 58))
2304 {
2305 num114 = NPC.NewNPC(GetNPCSource(num109, num108), num112, num113 - 12, 58);
2306 }
2307 break;
2308 case 37:
2309 if (CheckMech(num109, num108, 600) && Item.MechSpawn(num112, num113, 58) && Item.MechSpawn(num112, num113, 1734) && Item.MechSpawn(num112, num113, 1867))
2310 {
2311 Item.NewItem(GetItemSource(num112, num113), num112, num113 - 16, 0, 0, 58);
2312 }
2313 break;
2314 case 50:
2315 if (CheckMech(num109, num108, 30) && NPC.MechSpawn(num112, num113, 65))
2316 {
2317 if (!Collision.SolidTiles(num109 - 2, num109 + 3, num108, num108 + 2))
2318 {
2319 num114 = NPC.NewNPC(GetNPCSource(num109, num108), num112, num113 - 12, 65);
2320 break;
2321 }
2322 Vector2 position2 = new Vector2(num112 - 4, num113 - 22) - new Vector2(10f);
2323 Utils.PoofOfSmoke(position2);
2324 NetMessage.SendData(106, -1, -1, null, (int)position2.X, position2.Y);
2325 }
2326 break;
2327 case 2:
2328 if (CheckMech(num109, num108, 600) && Item.MechSpawn(num112, num113, 184) && Item.MechSpawn(num112, num113, 1735) && Item.MechSpawn(num112, num113, 1868))
2329 {
2330 Item.NewItem(GetItemSource(num112, num113), num112, num113 - 16, 0, 0, 184);
2331 }
2332 break;
2333 case 17:
2334 if (CheckMech(num109, num108, 600) && Item.MechSpawn(num112, num113, 166))
2335 {
2336 Item.NewItem(GetItemSource(num112, num113), num112, num113 - 20, 0, 0, 166);
2337 }
2338 break;
2339 case 40:
2340 {
2341 if (!CheckMech(num109, num108, 300))
2342 {
2343 break;
2344 }
2345 int num120 = 50;
2346 int[] array2 = new int[num120];
2347 int num121 = 0;
2348 for (int num122 = 0; num122 < 200; num122++)
2349 {
2350 if (Main.npc[num122].active && (Main.npc[num122].type == 17 || Main.npc[num122].type == 19 || Main.npc[num122].type == 22 || Main.npc[num122].type == 38 || Main.npc[num122].type == 54 || Main.npc[num122].type == 107 || Main.npc[num122].type == 108 || Main.npc[num122].type == 142 || Main.npc[num122].type == 160 || Main.npc[num122].type == 207 || Main.npc[num122].type == 209 || Main.npc[num122].type == 227 || Main.npc[num122].type == 228 || Main.npc[num122].type == 229 || Main.npc[num122].type == 368 || Main.npc[num122].type == 369 || Main.npc[num122].type == 550 || Main.npc[num122].type == 441 || Main.npc[num122].type == 588))
2351 {
2352 array2[num121] = num122;
2353 num121++;
2354 if (num121 >= num120)
2355 {
2356 break;
2357 }
2358 }
2359 }
2360 if (num121 > 0)
2361 {
2362 int num123 = array2[Main.rand.Next(num121)];
2363 Main.npc[num123].position.X = num112 - Main.npc[num123].width / 2;
2364 Main.npc[num123].position.Y = num113 - Main.npc[num123].height - 1;
2365 NetMessage.SendData(23, -1, -1, null, num123);
2366 }
2367 break;
2368 }
2369 case 41:
2370 {
2371 if (!CheckMech(num109, num108, 300))
2372 {
2373 break;
2374 }
2375 int num116 = 50;
2376 int[] array = new int[num116];
2377 int num117 = 0;
2378 for (int num118 = 0; num118 < 200; num118++)
2379 {
2380 if (Main.npc[num118].active && (Main.npc[num118].type == 18 || Main.npc[num118].type == 20 || Main.npc[num118].type == 124 || Main.npc[num118].type == 178 || Main.npc[num118].type == 208 || Main.npc[num118].type == 353 || Main.npc[num118].type == 633 || Main.npc[num118].type == 663))
2381 {
2382 array[num117] = num118;
2383 num117++;
2384 if (num117 >= num116)
2385 {
2386 break;
2387 }
2388 }
2389 }
2390 if (num117 > 0)
2391 {
2392 int num119 = array[Main.rand.Next(num117)];
2393 Main.npc[num119].position.X = num112 - Main.npc[num119].width / 2;
2394 Main.npc[num119].position.Y = num113 - Main.npc[num119].height - 1;
2395 NetMessage.SendData(23, -1, -1, null, num119);
2396 }
2397 break;
2398 }
2399 }
2400 }
2401 if (num114 >= 0)
2402 {
2403 Main.npc[num114].value = 0f;
2404 Main.npc[num114].npcSlots = 0f;
2405 Main.npc[num114].SpawnedFromStatue = true;
2406 Main.npc[num114].CanBeReplacedByOtherNPCs = true;
2407 }
2408 break;
2409 }
2410 case 349:
2411 {
2412 int num86 = tile.frameY / 18;
2413 num86 %= 3;
2414 int num87 = j - num86;
2415 int num88;
2416 for (num88 = tile.frameX / 18; num88 >= 2; num88 -= 2)
2417 {
2418 }
2419 num88 = i - num88;
2421 SkipWire(num88, num87 + 1);
2422 SkipWire(num88, num87 + 2);
2423 SkipWire(num88 + 1, num87);
2424 SkipWire(num88 + 1, num87 + 1);
2425 SkipWire(num88 + 1, num87 + 2);
2426 short num89 = (short)((Main.tile[num88, num87].frameX != 0) ? (-216) : 216);
2427 for (int num90 = 0; num90 < 2; num90++)
2428 {
2429 for (int num91 = 0; num91 < 3; num91++)
2430 {
2431 Main.tile[num88 + num90, num87 + num91].frameX += num89;
2432 }
2433 }
2434 if (Main.netMode == 2)
2435 {
2436 NetMessage.SendTileSquare(-1, num88, num87, 2, 3);
2437 }
2438 Animation.NewTemporaryAnimation((num89 <= 0) ? 1 : 0, 349, num88, num87);
2439 break;
2440 }
2441 case 506:
2442 {
2443 int num69 = tile.frameY / 18;
2444 num69 %= 3;
2445 int num70 = j - num69;
2446 int num71;
2447 for (num71 = tile.frameX / 18; num71 >= 2; num71 -= 2)
2448 {
2449 }
2450 num71 = i - num71;
2452 SkipWire(num71, num70 + 1);
2453 SkipWire(num71, num70 + 2);
2454 SkipWire(num71 + 1, num70);
2455 SkipWire(num71 + 1, num70 + 1);
2456 SkipWire(num71 + 1, num70 + 2);
2457 short num72 = (short)((Main.tile[num71, num70].frameX >= 72) ? (-72) : 72);
2458 for (int num73 = 0; num73 < 2; num73++)
2459 {
2460 for (int num74 = 0; num74 < 3; num74++)
2461 {
2462 Main.tile[num71 + num73, num70 + num74].frameX += num72;
2463 }
2464 }
2465 if (Main.netMode == 2)
2466 {
2467 NetMessage.SendTileSquare(-1, num71, num70, 2, 3);
2468 }
2469 break;
2470 }
2471 case 546:
2472 tile.type = 557;
2473 WorldGen.SquareTileFrame(i, j);
2474 NetMessage.SendTileSquare(-1, i, j);
2475 break;
2476 case 557:
2477 tile.type = 546;
2478 WorldGen.SquareTileFrame(i, j);
2479 NetMessage.SendTileSquare(-1, i, j);
2480 break;
2481 }
2482 }
static double Sqrt(double d)
static bool[] BasicChest
Definition TileID.cs:223
static bool[] BasicChestFake
Definition TileID.cs:225
static NetworkText FromLiteral(string text)
static void ToggleCampFire(int i, int j, Tile tileCache, bool? forcedStateWhereTrueIsOn, bool doSkipWires)
Definition Wiring.cs:2684
static void Toggle2x2Light(int i, int j, Tile tileCache, bool? forcedStateWhereTrueIsOn, bool doSkipWires)
Definition Wiring.cs:2527
static Queue< Point16 > _LampsToCheck
Definition Wiring.cs:29
static void ToggleLampPost(int i, int j, Tile tileCache, bool? forcedStateWhereTrueIsOn, bool doSkipWires)
Definition Wiring.cs:2563
static void ToggleLamp(int i, int j, Tile tileCache, bool? forcedStateWhereTrueIsOn, bool doSkipWires)
Definition Wiring.cs:2619
static void ToggleTorch(int i, int j, Tile tileCache, bool? forcedStateWhereTrueIsOn)
Definition Wiring.cs:2587
static int[] _inPumpY
Definition Wiring.cs:43
static int[] _inPumpX
Definition Wiring.cs:41
static void ToggleFirePlace(int i, int j, Tile theBlock, bool? forcedStateWhereTrueIsOn, bool doSkipWires)
Definition Wiring.cs:2714
static int[] _outPumpX
Definition Wiring.cs:47
static int _numInPump
Definition Wiring.cs:45
static bool CheckMech(int i, int j, int time)
Definition Wiring.cs:429
static IEntitySource GetProjectileSource(int sourceTileX, int sourceTileY)
Definition Wiring.cs:955
static void ToggleCandle(int i, int j, Tile tileCache, bool? forcedStateWhereTrueIsOn)
Definition Wiring.cs:2604
static Vector2[] _teleport
Definition Wiring.cs:37
static void ToggleHolidayLight(int i, int j, Tile tileCache, bool? forcedStateWhereTrueIsOn)
Definition Wiring.cs:2484
static void ActuateForced(int i, int j)
Definition Wiring.cs:381
static void ToggleHangingLantern(int i, int j, Tile tileCache, bool? forcedStateWhereTrueIsOn, bool doSkipWires)
Definition Wiring.cs:2501
static IEntitySource GetItemSource(int sourceTileX, int sourceTileY)
Definition Wiring.cs:965
static void ToggleChandelier(int i, int j, Tile tileCache, bool? forcedStateWhereTrueIsOn, bool doSkipWires)
Definition Wiring.cs:2647
static void SkipWire(int x, int y)
Definition Wiring.cs:105
static int CurrentUser
Definition Wiring.cs:65
static void HitSwitch(int i, int j)
Definition Wiring.cs:237
static int _numOutPump
Definition Wiring.cs:51
static void GeyserTrap(int i, int j)
Definition Wiring.cs:2744
static int _currentWireColor
Definition Wiring.cs:63
static int[] _outPumpY
Definition Wiring.cs:49
static IEntitySource GetNPCSource(int sourceTileX, int sourceTileY)
Definition Wiring.cs:960

References Terraria.Wiring._currentWireColor, Terraria.Wiring._inPumpX, Terraria.Wiring._inPumpY, Terraria.Wiring._LampsToCheck, Terraria.Wiring._numInPump, Terraria.Wiring._numOutPump, Terraria.Wiring._outPumpX, Terraria.Wiring._outPumpY, Terraria.Wiring._teleport, Terraria.Tile.active(), Terraria.Wiring.ActuateForced(), Terraria.Tile.actuator(), Terraria.Main.AnnouncementBoxDisabled, Terraria.Main.AnnouncementBoxRange, Terraria.ID.TileID.Sets.BasicChest, Terraria.ID.TileID.Sets.BasicChestFake, Terraria.Wiring.CheckMech(), Terraria.WorldGen.CloseDoor(), Terraria.Wiring.CurrentUser, Terraria.NPC.downedPlantBoss, Terraria.WorldGen.ExplodeMine(), Terraria.Main.fastForwardTimeToDawn, Terraria.Main.fastForwardTimeToDusk, Terraria.Minecart.FlipSwitchTrack(), Terraria.Tile.frameX, Terraria.Tile.frameY, Terraria.Localization.NetworkText.FromLiteral(), Terraria.Wiring.GetProjectileSource(), Terraria.Wiring.GeyserTrap(), Terraria.Tile.halfBrick(), Terraria.Wiring.HitSwitch(), Terraria.WorldGen.KillTile(), Terraria.WorldGen.LaunchRocket(), Terraria.WorldGen.LaunchRocketSmall(), Terraria.Main.moondialCooldown, Terraria.Main.Moondialing(), Terraria.Main.myPlayer, Terraria.Main.netMode, Terraria.Projectile.NewProjectile(), Terraria.Animation.NewTemporaryAnimation(), Terraria.Main.NewTextMultiline(), Terraria.WorldGen.OpenDoor(), Microsoft.Xna.Framework.Color.Pink, Terraria.Main.player, Terraria.Main.projectile, Terraria.Main.rand, Terraria.Sign.ReadSign(), Terraria.NetMessage.SendData(), Terraria.NetMessage.SendTemporaryAnimation(), Terraria.NetMessage.SendTileSquare(), Terraria.WorldGen.ShiftTallGate(), Terraria.WorldGen.ShiftTrapdoor(), Terraria.WorldGen.ShootFromCannon(), Terraria.Main.sign, Terraria.Wiring.SkipWire(), System.Math.Sqrt(), Terraria.WorldGen.SquareTileFrame(), Terraria.Main.sundialCooldown, Terraria.Main.Sundialing(), Terraria.WorldGen.SwitchFountain(), Terraria.WorldGen.SwitchMB(), Terraria.WorldGen.SwitchMonolith(), Terraria.Main.tile, Terraria.Wiring.Toggle2x2Light(), Terraria.Wiring.ToggleCampFire(), Terraria.Wiring.ToggleCandle(), Terraria.Wiring.ToggleChandelier(), Terraria.Wiring.ToggleFirePlace(), Terraria.Wiring.ToggleHangingLantern(), Terraria.Wiring.ToggleHolidayLight(), Terraria.Wiring.ToggleLamp(), Terraria.Wiring.ToggleLampPost(), Terraria.GameContent.Events.BirthdayParty.ToggleManualParty(), Terraria.Wiring.ToggleTorch(), System.type, Terraria.Tile.type, System.value, Terraria.Tile.wall, Terraria.Main.worldSurface, System.X, System.Y, and Microsoft.Xna.Framework.Vector2.Zero.

Referenced by Terraria.Wiring.HitWire().