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

◆ Pyramid()

static bool Terraria.WorldGen.Pyramid ( int i,
int j )
inlinestatic

Definition at line 19340 of file WorldGen.cs.

19341 {
19342 ushort num = 151;
19343 if (Main.tile[i, j].type == 151 || Main.tile[i, j].wall == 151)
19344 {
19345 return false;
19346 }
19347 int num2 = j - genRand.Next(0, 7);
19348 int num3 = genRand.Next(9, 13);
19349 int num4 = 1;
19350 int num5 = j + genRand.Next(75, 125);
19351 for (int k = num2; k < num5; k++)
19352 {
19353 for (int l = i - num4; l < i + num4 - 1; l++)
19354 {
19355 Main.tile[l, k].type = num;
19356 Main.tile[l, k].active(active: true);
19357 Main.tile[l, k].halfBrick(halfBrick: false);
19358 Main.tile[l, k].slope(0);
19359 }
19360 num4++;
19361 }
19362 for (int m = i - num4 - 5; m <= i + num4 + 5; m++)
19363 {
19364 for (int n = j - 1; n <= num5 + 1; n++)
19365 {
19366 bool flag = true;
19367 for (int num6 = m - 1; num6 <= m + 1; num6++)
19368 {
19369 for (int num7 = n - 1; num7 <= n + 1; num7++)
19370 {
19371 if (Main.tile[num6, num7].type != num)
19372 {
19373 flag = false;
19374 }
19375 }
19376 }
19377 if (flag)
19378 {
19379 Main.tile[m, n].wall = 34;
19381 }
19382 }
19383 }
19384 int num8 = 1;
19385 if (genRand.Next(2) == 0)
19386 {
19387 num8 = -1;
19388 }
19389 int num9 = i - num3 * num8;
19390 int num10 = j + num3;
19391 int num11 = genRand.Next(5, 8);
19392 bool flag2 = true;
19393 int num12 = genRand.Next(20, 30);
19394 while (flag2)
19395 {
19396 flag2 = false;
19397 bool flag3 = false;
19398 for (int num13 = num10; num13 <= num10 + num11; num13++)
19399 {
19400 int num14 = num9;
19401 if (Main.tile[num14, num13 - 1].type == 53)
19402 {
19403 flag3 = true;
19404 }
19405 if (Main.tile[num14, num13].type == num)
19406 {
19407 Main.tile[num14, num13 + 1].wall = 34;
19408 Main.tile[num14 + num8, num13].wall = 34;
19409 Main.tile[num14, num13].active(active: false);
19410 flag2 = true;
19411 }
19412 if (flag3)
19413 {
19414 Main.tile[num14, num13].type = 53;
19415 Main.tile[num14, num13].active(active: true);
19416 Main.tile[num14, num13].halfBrick(halfBrick: false);
19417 Main.tile[num14, num13].slope(0);
19418 }
19419 }
19420 num9 -= num8;
19421 }
19422 num9 = i - num3 * num8;
19423 bool flag4 = true;
19424 bool flag5 = false;
19425 flag2 = true;
19426 while (flag2)
19427 {
19428 for (int num15 = num10; num15 <= num10 + num11; num15++)
19429 {
19430 int num16 = num9;
19431 Main.tile[num16, num15].active(active: false);
19432 }
19433 num9 += num8;
19434 num10++;
19435 num12--;
19436 if (num10 >= num5 - num11 * 2)
19437 {
19438 num12 = 10;
19439 }
19440 if (num12 <= 0)
19441 {
19442 bool flag6 = false;
19443 if (!flag4 && !flag5)
19444 {
19445 flag5 = true;
19446 flag6 = true;
19447 int num17 = genRand.Next(7, 13);
19448 int num18 = genRand.Next(23, 28);
19449 int num19 = num18;
19450 int num20 = num9;
19451 while (num18 > 0)
19452 {
19453 for (int num21 = num10 - num17 + num11; num21 <= num10 + num11; num21++)
19454 {
19455 if (num18 == num19 || num18 == 1)
19456 {
19457 if (num21 >= num10 - num17 + num11 + 2)
19458 {
19459 Main.tile[num9, num21].active(active: false);
19460 }
19461 }
19462 else if (num18 == num19 - 1 || num18 == 2 || num18 == num19 - 2 || num18 == 3)
19463 {
19464 if (num21 >= num10 - num17 + num11 + 1)
19465 {
19466 Main.tile[num9, num21].active(active: false);
19467 }
19468 }
19469 else
19470 {
19471 Main.tile[num9, num21].active(active: false);
19472 }
19473 }
19474 num18--;
19475 num9 += num8;
19476 }
19477 int num22 = num9 - num8;
19478 int num23 = num22;
19479 int num24 = num20;
19480 if (num22 > num20)
19481 {
19482 num23 = num20;
19483 num24 = num22;
19484 }
19485 int num25 = genRand.Next(3);
19486 if (num25 == 0)
19487 {
19488 num25 = genRand.Next(3);
19489 }
19490 if (Main.tenthAnniversaryWorld && num25 == 0)
19491 {
19492 num25 = 1;
19493 }
19494 switch (num25)
19495 {
19496 case 0:
19497 num25 = 848;
19498 break;
19499 case 1:
19500 num25 = 857;
19501 break;
19502 case 2:
19503 num25 = 934;
19504 break;
19505 }
19507 int num26 = genRand.Next(1, 10);
19508 for (int num27 = 0; num27 < num26; num27++)
19509 {
19510 int i2 = genRand.Next(num23, num24);
19511 int j2 = num10 + num11;
19512 PlaceSmallPile(i2, j2, genRand.Next(16, 19), 1, 185);
19513 }
19514 PlaceTile(num23 + 2, num10 - num17 + num11 + 1, 91, mute: true, forced: false, -1, genRand.Next(4, 7));
19515 PlaceTile(num23 + 3, num10 - num17 + num11, 91, mute: true, forced: false, -1, genRand.Next(4, 7));
19516 PlaceTile(num24 - 2, num10 - num17 + num11 + 1, 91, mute: true, forced: false, -1, genRand.Next(4, 7));
19517 PlaceTile(num24 - 3, num10 - num17 + num11, 91, mute: true, forced: false, -1, genRand.Next(4, 7));
19518 for (int num28 = num23; num28 <= num24; num28++)
19519 {
19520 PlacePot(num28, num10 + num11, 28, genRand.Next(25, 28));
19521 }
19522 }
19523 if (flag4)
19524 {
19525 flag4 = false;
19526 num8 *= -1;
19527 num12 = genRand.Next(15, 20);
19528 }
19529 else if (flag6)
19530 {
19531 num12 = genRand.Next(10, 15);
19532 }
19533 else
19534 {
19535 num8 *= -1;
19536 num12 = genRand.Next(20, 40);
19537 }
19538 }
19539 if (num10 >= num5 - num11)
19540 {
19541 flag2 = false;
19542 }
19543 }
19544 int num29 = genRand.Next(100, 200);
19545 int num30 = genRand.Next(500, 800);
19546 flag2 = true;
19547 int num31 = num11;
19548 num12 = genRand.Next(10, 50);
19549 if (num8 == 1)
19550 {
19551 num9 -= num31;
19552 }
19553 int num32 = genRand.Next(5, 10);
19554 while (flag2)
19555 {
19556 num29--;
19557 num30--;
19558 num12--;
19559 for (int num33 = num9 - num32 - genRand.Next(0, 2); num33 <= num9 + num31 + num32 + genRand.Next(0, 2); num33++)
19560 {
19561 int num34 = num10;
19562 if (num33 >= num9 && num33 <= num9 + num31)
19563 {
19564 Main.tile[num33, num34].active(active: false);
19565 }
19566 else
19567 {
19568 Main.tile[num33, num34].type = num;
19569 Main.tile[num33, num34].active(active: true);
19570 Main.tile[num33, num34].halfBrick(halfBrick: false);
19571 Main.tile[num33, num34].slope(0);
19572 }
19573 if (num33 >= num9 - 1 && num33 <= num9 + 1 + num31)
19574 {
19575 Main.tile[num33, num34].wall = 34;
19576 }
19577 }
19578 num10++;
19579 num9 += num8;
19580 if (num29 <= 0)
19581 {
19582 flag2 = false;
19583 for (int num35 = num9 + 1; num35 <= num9 + num31 - 1; num35++)
19584 {
19585 if (Main.tile[num35, num10].active())
19586 {
19587 flag2 = true;
19588 }
19589 }
19590 }
19591 if (num12 < 0)
19592 {
19593 num12 = genRand.Next(10, 50);
19594 num8 *= -1;
19595 }
19596 if (num30 <= 0)
19597 {
19598 flag2 = false;
19599 }
19600 }
19601 return true;
19602 }
static bool PlaceSmallPile(int i, int j, int X, int Y, ushort type=185)
static bool PlaceTile(int i, int j, int Type, bool mute=false, bool forced=false, int plr=-1, int style=0)
static UnifiedRandom genRand
Definition WorldGen.cs:1215
static void SquareWallFrame(int i, int j, bool resetFrame=true)
static bool AddBuriedChest(Point point, int contain=0, bool notNearOtherChests=false, int Style=-1)
static bool PlacePot(int x, int y, ushort type=28, int style=0)

References Terraria.Main.tenthAnniversaryWorld, and Terraria.Main.tile.