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

◆ CheckSuper()

static void Terraria.WorldGen.CheckSuper ( int x,
int y,
int type )
inlinestatic

Definition at line 39350 of file WorldGen.cs.

39351 {
39352 if (destroyObject)
39353 {
39354 return;
39355 }
39356 Tile tile = Main.tile[x, y];
39357 int num = 0;
39358 if (type == 376)
39359 {
39360 num = tile.frameX / 36;
39361 }
39362 if (type == 443)
39363 {
39364 num = tile.frameX / 36;
39365 }
39366 if (type == 485)
39367 {
39368 num = tile.frameX / 36;
39369 }
39370 bool flag = type == 376;
39371 bool flag2 = type == 443;
39372 bool flag3 = type == 444;
39373 bool flag4 = type == 485;
39375 bool styleHorizontal = tileData.StyleHorizontal;
39376 int width = tileData.Width;
39377 int height = tileData.Height;
39378 int num2 = x;
39379 int num3 = y;
39380 num2 -= tile.frameX / 18 % width;
39381 num3 -= tile.frameY / 18 % height;
39382 int num4 = 0;
39383 int num5 = 0;
39384 if (styleHorizontal)
39385 {
39386 num4 = tile.frameX / tileData.CoordinateFullWidth;
39387 }
39388 else
39389 {
39390 num5 = tile.frameY / tileData.CoordinateFullHeight;
39391 }
39392 bool flag5 = false;
39393 bool flag6 = false;
39394 for (int i = 0; i < width; i++)
39395 {
39396 for (int j = 0; j < height; j++)
39397 {
39398 Tile tileSafely = Framing.GetTileSafely(num2 + i, num3 + j);
39399 if (!tileSafely.active() || tileSafely.type != type || tileSafely.frameX != num4 * tileData.CoordinateFullWidth + i * (tileData.CoordinateWidth + 2) || tileSafely.frameY != num5 * tileData.CoordinateFullHeight + j * (tileData.CoordinateHeights[0] + 2))
39400 {
39401 flag5 = true;
39402 }
39403 }
39404 }
39405 if (flag)
39406 {
39407 for (int k = 0; k < width; k++)
39408 {
39409 Tile tileSafely = Framing.GetTileSafely(num2 + k, num3 + height);
39410 if (!tileSafely.active() || (!Main.tileSolid[tileSafely.type] && !Main.tileTable[tileSafely.type]))
39411 {
39412 flag5 = true;
39413 }
39414 if (tileSafely.halfBrick())
39415 {
39416 flag5 = true;
39417 }
39418 }
39419 }
39420 if (flag2)
39421 {
39422 bool flag7 = true;
39423 bool flag8 = true;
39424 for (int l = 0; l < width; l++)
39425 {
39426 if (!AnchorValid(Framing.GetTileSafely(num2 + l, num3 + height), AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide))
39427 {
39428 flag8 = false;
39429 }
39430 if (!AnchorValid(Framing.GetTileSafely(num2 + l, num3 - 1), AnchorType.SolidBottom))
39431 {
39432 flag7 = false;
39433 }
39434 }
39435 if (!flag7 && !flag8)
39436 {
39437 flag5 = true;
39438 }
39439 if (!flag5)
39440 {
39441 int num6 = 0;
39442 if (flag8)
39443 {
39444 for (int m = 0; m < width; m++)
39445 {
39446 Framing.GetTileSafely(num2 + m, num3).frameX = (short)(m * 18 + num / 2 * 36 + num6 * 36);
39447 }
39448 }
39449 else
39450 {
39451 for (int n = 0; n < width; n++)
39452 {
39453 Framing.GetTileSafely(num2 + n, num3).frameX = (short)(n * 18 + (num - 2) / 2 * 36 + 72 + num6 * 36);
39454 }
39455 }
39456 }
39457 }
39458 if (flag3)
39459 {
39460 bool flag9 = true;
39461 for (int num7 = 0; num7 < width; num7++)
39462 {
39463 if (!AnchorValid(Framing.GetTileSafely(num2 + num7, num3 - 1), AnchorType.SolidTile))
39464 {
39465 flag9 = false;
39466 }
39467 }
39468 if (!flag9)
39469 {
39470 flag5 = true;
39471 }
39472 for (int num8 = 0; num8 < width; num8++)
39473 {
39474 for (int num9 = 0; num9 < height; num9++)
39475 {
39476 Tile tileSafely = Framing.GetTileSafely(num2 + num8, num3 + num9);
39477 if (tileSafely.liquid > 0)
39478 {
39479 flag5 = true;
39480 flag6 = true;
39481 }
39482 }
39483 }
39484 }
39485 if (flag4)
39486 {
39487 bool flag10 = true;
39488 for (int num10 = 0; num10 < width; num10++)
39489 {
39490 if (!AnchorValid(Framing.GetTileSafely(num2 + num10, num3 + height), AnchorType.SolidTile))
39491 {
39492 flag10 = false;
39493 }
39494 }
39495 if (!flag10)
39496 {
39497 flag5 = true;
39498 }
39499 }
39500 if (!flag5)
39501 {
39502 return;
39503 }
39504 destroyObject = true;
39505 for (int num11 = 0; num11 < width; num11++)
39506 {
39507 for (int num12 = 0; num12 < height; num12++)
39508 {
39509 if (Main.tile[num2 + num11, num3 + num12].type == type && Main.tile[num2 + num11, num3 + num12].active())
39510 {
39512 }
39513 }
39514 }
39515 int num13 = 0;
39516 if (type == 376)
39517 {
39518 switch (num)
39519 {
39520 case 0:
39521 num13 = 2334;
39522 break;
39523 case 1:
39524 num13 = 2335;
39525 break;
39526 case 2:
39527 num13 = 2336;
39528 break;
39529 case 3:
39530 num13 = 3203;
39531 break;
39532 case 4:
39533 num13 = 3204;
39534 break;
39535 case 5:
39536 num13 = 3205;
39537 break;
39538 case 6:
39539 num13 = 3206;
39540 break;
39541 case 7:
39542 num13 = 3207;
39543 break;
39544 case 8:
39545 num13 = 3208;
39546 break;
39547 case 9:
39548 num13 = 3979;
39549 break;
39550 case 10:
39551 num13 = 3980;
39552 break;
39553 case 11:
39554 num13 = 3981;
39555 break;
39556 case 12:
39557 num13 = 3982;
39558 break;
39559 case 13:
39560 num13 = 3983;
39561 break;
39562 case 14:
39563 num13 = 3984;
39564 break;
39565 case 15:
39566 num13 = 3985;
39567 break;
39568 case 16:
39569 num13 = 3986;
39570 break;
39571 case 17:
39572 num13 = 3987;
39573 break;
39574 case 18:
39575 num13 = 4405;
39576 break;
39577 case 19:
39578 num13 = 4406;
39579 break;
39580 case 20:
39581 num13 = 4407;
39582 break;
39583 case 21:
39584 num13 = 4408;
39585 break;
39586 case 22:
39587 num13 = 4877;
39588 break;
39589 case 23:
39590 num13 = 4878;
39591 break;
39592 case 24:
39593 num13 = 5002;
39594 break;
39595 case 25:
39596 num13 = 5003;
39597 break;
39598 }
39599 }
39600 if (type == 443)
39601 {
39602 num13 = 3722;
39603 }
39604 if (type == 485 && !gen && Main.netMode != 1)
39605 {
39606 int availableAmountOfNPCsToSpawnUpToSlot = NPC.GetAvailableAmountOfNPCsToSpawnUpToSlot(1);
39608 {
39609 int num15 = NPC.NewNPC(GetNPCSource_TileBreak(num2, num3), num2 * 16, num3 * 16 + 32, 582);
39610 Main.npc[num15].TargetClosest();
39611 Main.npc[num15].velocity = new Vector2((float)Main.npc[num15].direction * 1.5f, -5f);
39612 NetMessage.SendData(23, -1, -1, null, num15);
39613 int num16 = 20;
39614 int num17 = -1;
39615 Main.npc[num15].GetImmuneTime(num17, num16);
39616 NetMessage.SendData(131, -1, -1, null, num15, 1f, num17, num16);
39617 }
39618 }
39619 if (type == 444 && Main.netMode != 1 && !flag6)
39620 {
39621 Projectile.NewProjectile(GetProjectileSource_TileBreak(num2, num3), num2 * 16 + 16, num3 * 16 + 16, 0f, 0f, 655, 0, 0f, Main.myPlayer);
39622 }
39623 if (num13 != 0)
39624 {
39625 Item.NewItem(GetItemSource_FromTileBreak(num2, num3), num2 * 16, num3 * 16, tileData.CoordinateFullWidth, tileData.CoordinateFullHeight, num13);
39626 }
39627 destroyObject = false;
39628 for (int num18 = -1; num18 < width + 1; num18++)
39629 {
39630 for (int num19 = -1; num19 < height + 1; num19++)
39631 {
39633 }
39634 }
39635 }
static TileObjectData GetTileData(int type, int style, int alternate=0)
static bool destroyObject
Definition WorldGen.cs:1020
static volatile bool gen
Definition WorldGen.cs:972
static EntitySource_TileBreak GetNPCSource_TileBreak(int x, int y)
Definition WorldGen.cs:1313
static void KillTile(int i, int j, bool fail=false, bool effectOnly=false, bool noItem=false)
static void TileFrame(int i, int j, bool resetFrame=false, bool noBreak=false)
static EntitySource_TileBreak GetProjectileSource_TileBreak(int x, int y)
Definition WorldGen.cs:1308
static bool AnchorValid(Tile tileCache, AnchorType anchor)
static IEntitySource GetItemSource_FromTileBreak(int x, int y)

References Terraria.NPC.GetAvailableAmountOfNPCsToSpawnUpToSlot(), Terraria.ObjectData.TileObjectData.GetTileData(), Terraria.Framing.GetTileSafely(), Terraria.Main.myPlayer, Terraria.Main.netMode, Terraria.Item.NewItem(), Terraria.NPC.NewNPC(), Terraria.Projectile.NewProjectile(), Terraria.Main.npc, Terraria.NetMessage.SendData(), Terraria.Main.tile, Terraria.Main.tileSolid, Terraria.Main.tileTable, and System.type.