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

◆ DesertCloudIsland()

static void Terraria.WorldGen.DesertCloudIsland ( int i,
int j )
inlinestatic

Definition at line 71532 of file WorldGen.cs.

71533 {
71534 double num = genRand.Next(100, 150);
71535 double num12 = num;
71536 double num22 = genRand.Next(20, 30);
71537 int num32 = i;
71538 int num43 = i;
71539 int num47 = i;
71540 int num48 = j;
71541 Vector2D vector2D = default(Vector2D);
71542 vector2D.X = i;
71543 vector2D.Y = j;
71544 Vector2D vector2D2 = default(Vector2D);
71545 vector2D2.X = (double)genRand.Next(-20, 21) * 0.2;
71546 while (vector2D2.X > -2.0 && vector2D2.X < 2.0)
71547 {
71548 vector2D2.X = (double)genRand.Next(-20, 21) * 0.2;
71549 }
71550 vector2D2.Y = (double)genRand.Next(-20, -10) * 0.02;
71551 while (num > 0.0 && num22 > 0.0)
71552 {
71553 num -= (double)genRand.Next(4);
71554 num22 -= 1.0;
71555 int num49 = (int)(vector2D.X - num * 0.5);
71556 int num51 = (int)(vector2D.X + num * 0.5);
71557 int num2 = (int)(vector2D.Y - num * 0.5);
71558 int num4 = (int)(vector2D.Y + num * 0.5);
71559 if (num49 < 0)
71560 {
71561 num49 = 0;
71562 }
71563 if (num51 > Main.maxTilesX)
71564 {
71565 num51 = Main.maxTilesX;
71566 }
71567 if (num2 < 0)
71568 {
71569 num2 = 0;
71570 }
71571 if (num4 > Main.maxTilesY)
71572 {
71573 num4 = Main.maxTilesY;
71574 }
71575 num12 = num * (double)genRand.Next(80, 120) * 0.01;
71576 double num6 = vector2D.Y + 1.0;
71577 for (int k = num49; k < num51; k++)
71578 {
71579 if (genRand.Next(2) == 0)
71580 {
71581 num6 += (double)genRand.Next(-1, 2);
71582 }
71583 if (num6 < vector2D.Y)
71584 {
71585 num6 = vector2D.Y;
71586 }
71587 if (num6 > vector2D.Y + 2.0)
71588 {
71589 num6 = vector2D.Y + 2.0;
71590 }
71591 for (int l = num2; l < num4; l++)
71592 {
71593 if (!((double)l > num6))
71594 {
71595 continue;
71596 }
71597 double num53 = Math.Abs((double)k - vector2D.X);
71598 double num7 = Math.Abs((double)l - vector2D.Y) * 3.0;
71599 if (Math.Sqrt(num53 * num53 + num7 * num7) < num12 * 0.4)
71600 {
71601 if (k < num32)
71602 {
71603 num32 = k;
71604 }
71605 if (k > num43)
71606 {
71607 num43 = k;
71608 }
71609 if (l < num47)
71610 {
71611 num47 = l;
71612 }
71613 if (l > num48)
71614 {
71615 num48 = l;
71616 }
71617 Main.tile[k, l].active(active: true);
71618 Main.tile[k, l].type = 189;
71620 }
71621 }
71622 }
71624 vector2D2.X += (double)genRand.Next(-20, 21) * 0.05;
71625 if (vector2D2.X > 1.0)
71626 {
71627 vector2D2.X = 1.0;
71628 }
71629 if (vector2D2.X < -1.0)
71630 {
71631 vector2D2.X = -1.0;
71632 }
71633 if (vector2D2.Y > 0.2)
71634 {
71635 vector2D2.Y = -0.2;
71636 }
71637 if (vector2D2.Y < -0.2)
71638 {
71639 vector2D2.Y = -0.2;
71640 }
71641 }
71642 int num8 = num32;
71643 int num10;
71644 for (num8 += genRand.Next(5); num8 < num43; num8 += genRand.Next(num10, (int)((double)num10 * 1.5)))
71645 {
71646 int num9 = num48;
71647 while (!Main.tile[num8, num9].active())
71648 {
71649 num9--;
71650 }
71651 num9 += genRand.Next(-3, 4);
71652 num10 = genRand.Next(4, 8);
71653 int num11 = 189;
71654 if (genRand.Next(4) == 0)
71655 {
71656 num11 = 196;
71657 }
71658 for (int m = num8 - num10; m <= num8 + num10; m++)
71659 {
71660 for (int n = num9 - num10; n <= num9 + num10; n++)
71661 {
71662 if (n > num47)
71663 {
71664 double num54 = Math.Abs(m - num8);
71665 double num13 = Math.Abs(n - num9) * 2;
71666 if (Math.Sqrt(num54 * num54 + num13 * num13) < (double)(num10 + genRand.Next(2)))
71667 {
71668 Main.tile[m, n].active(active: true);
71669 Main.tile[m, n].type = (ushort)num11;
71671 }
71672 }
71673 }
71674 }
71675 }
71676 num = genRand.Next(80, 95);
71677 num12 = num;
71678 num22 = genRand.Next(10, 15);
71679 vector2D.X = i;
71680 vector2D.Y = num47;
71681 vector2D2.X = (double)genRand.Next(-20, 21) * 0.2;
71682 while (vector2D2.X > -2.0 && vector2D2.X < 2.0)
71683 {
71684 vector2D2.X = (double)genRand.Next(-20, 21) * 0.2;
71685 }
71686 vector2D2.Y = (double)genRand.Next(-20, -10) * 0.02;
71687 while (num > 0.0 && num22 > 0.0)
71688 {
71689 num -= (double)genRand.Next(4);
71690 num22 -= 1.0;
71691 int num50 = (int)(vector2D.X - num * 0.5);
71692 int num52 = (int)(vector2D.X + num * 0.5);
71693 int num3 = num47 - 1;
71694 int num5 = (int)(vector2D.Y + num * 0.5);
71695 if (num50 < 0)
71696 {
71697 num50 = 0;
71698 }
71699 if (num52 > Main.maxTilesX)
71700 {
71701 num52 = Main.maxTilesX;
71702 }
71703 if (num3 < 0)
71704 {
71705 num3 = 0;
71706 }
71707 if (num5 > Main.maxTilesY)
71708 {
71709 num5 = Main.maxTilesY;
71710 }
71711 num12 = num * (double)genRand.Next(80, 120) * 0.01;
71712 double num14 = vector2D.Y + 1.0;
71713 for (int num15 = num50; num15 < num52; num15++)
71714 {
71715 if (genRand.Next(2) == 0)
71716 {
71717 num14 += (double)genRand.Next(-1, 2);
71718 }
71719 if (num14 < vector2D.Y)
71720 {
71721 num14 = vector2D.Y;
71722 }
71723 if (num14 > vector2D.Y + 2.0)
71724 {
71725 num14 = vector2D.Y + 2.0;
71726 }
71727 for (int num16 = num3; num16 < num5; num16++)
71728 {
71729 if ((double)num16 > num14)
71730 {
71731 double num55 = Math.Abs((double)num15 - vector2D.X);
71732 double num17 = Math.Abs((double)num16 - vector2D.Y) * 3.0;
71733 if (Math.Sqrt(num55 * num55 + num17 * num17) < num12 * 0.4 && Main.tile[num15, num16].type == 189)
71734 {
71735 Main.tile[num15, num16].type = 53;
71737 }
71738 }
71739 }
71740 }
71742 vector2D2.X += (double)genRand.Next(-20, 21) * 0.05;
71743 if (vector2D2.X > 1.0)
71744 {
71745 vector2D2.X = 1.0;
71746 }
71747 if (vector2D2.X < -1.0)
71748 {
71749 vector2D2.X = -1.0;
71750 }
71751 if (vector2D2.Y > 0.2)
71752 {
71753 vector2D2.Y = -0.2;
71754 }
71755 if (vector2D2.Y < -0.2)
71756 {
71757 vector2D2.Y = -0.2;
71758 }
71759 }
71760 int num18 = num32;
71761 num18 += genRand.Next(5);
71762 while (num18 < num43)
71763 {
71764 int num19 = num48;
71765 while ((!Main.tile[num18, num19].active() || Main.tile[num18, num19].type != 0) && num18 < num43)
71766 {
71767 num19--;
71768 if (num19 < num47)
71769 {
71770 num19 = num48;
71771 num18 += genRand.Next(1, 4);
71772 }
71773 }
71774 if (num18 >= num43)
71775 {
71776 continue;
71777 }
71778 num19 += genRand.Next(0, 4);
71779 int num20 = genRand.Next(2, 5);
71780 int num21 = 189;
71781 for (int num23 = num18 - num20; num23 <= num18 + num20; num23++)
71782 {
71783 for (int num24 = num19 - num20; num24 <= num19 + num20; num24++)
71784 {
71785 if (num24 > num47)
71786 {
71787 double num56 = Math.Abs(num23 - num18);
71788 double num25 = Math.Abs(num24 - num19) * 2;
71789 if (Math.Sqrt(num56 * num56 + num25 * num25) < (double)num20)
71790 {
71791 Main.tile[num23, num24].type = (ushort)num21;
71793 }
71794 }
71795 }
71796 }
71797 num18 += genRand.Next(num20, (int)((double)num20 * 1.5));
71798 }
71799 for (int num26 = num32 - 20; num26 <= num43 + 20; num26++)
71800 {
71801 for (int num27 = num47 - 20; num27 <= num48 + 20; num27++)
71802 {
71803 bool flag = true;
71804 for (int num28 = num26 - 1; num28 <= num26 + 1; num28++)
71805 {
71806 for (int num29 = num27 - 1; num29 <= num27 + 1; num29++)
71807 {
71808 if (!Main.tile[num28, num29].active())
71809 {
71810 flag = false;
71811 }
71812 }
71813 }
71814 if (flag)
71815 {
71816 Main.tile[num26, num27].wall = 73;
71818 }
71819 }
71820 }
71821 for (int num30 = num32; num30 <= num43; num30++)
71822 {
71823 int num31;
71824 for (num31 = num47 - 10; !Main.tile[num30, num31 + 1].active(); num31++)
71825 {
71826 }
71827 if (num31 >= num48 || Main.tile[num30, num31 + 1].type != 189)
71828 {
71829 continue;
71830 }
71831 if (genRand.Next(10) == 0)
71832 {
71833 int num33 = genRand.Next(1, 3);
71834 for (int num34 = num30 - num33; num34 <= num30 + num33; num34++)
71835 {
71836 if (Main.tile[num34, num31].type == 189 && WillWaterPlacedHereStayPut(num34, num31))
71837 {
71838 Main.tile[num34, num31].active(active: false);
71839 Main.tile[num34, num31].liquid = byte.MaxValue;
71840 Main.tile[num34, num31].lava(lava: false);
71842 }
71843 if (Main.tile[num34, num31 + 1].type == 189 && WillWaterPlacedHereStayPut(num34, num31 + 1))
71844 {
71845 Main.tile[num34, num31 + 1].active(active: false);
71846 Main.tile[num34, num31 + 1].liquid = byte.MaxValue;
71847 Main.tile[num34, num31 + 1].lava(lava: false);
71849 }
71850 if (num34 > num30 - num33 && num34 < num30 + 2 && Main.tile[num34, num31 + 2].type == 189 && WillWaterPlacedHereStayPut(num34, num31 + 2))
71851 {
71852 Main.tile[num34, num31 + 2].active(active: false);
71853 Main.tile[num34, num31 + 2].liquid = byte.MaxValue;
71854 Main.tile[num34, num31 + 2].lava(lava: false);
71856 }
71857 }
71858 }
71859 if (genRand.Next(5) == 0 && WillWaterPlacedHereStayPut(num30, num31))
71860 {
71861 Main.tile[num30, num31].liquid = byte.MaxValue;
71862 }
71863 Main.tile[num30, num31].lava(lava: false);
71865 }
71866 int num35 = genRand.Next(4);
71867 for (int num36 = 0; num36 <= num35; num36++)
71868 {
71869 int num37 = genRand.Next(num32 - 5, num43 + 5);
71870 int num38 = num47 - genRand.Next(20, 40);
71871 int num39 = genRand.Next(4, 8);
71872 int num40 = 189;
71873 if (genRand.Next(2) == 0)
71874 {
71875 num40 = 196;
71876 }
71877 for (int num41 = num37 - num39; num41 <= num37 + num39; num41++)
71878 {
71879 for (int num42 = num38 - num39; num42 <= num38 + num39; num42++)
71880 {
71881 double num57 = Math.Abs(num41 - num37);
71882 double num44 = Math.Abs(num42 - num38) * 2;
71883 if (Math.Sqrt(num57 * num57 + num44 * num44) < (double)(num39 + genRand.Next(-1, 2)))
71884 {
71885 Main.tile[num41, num42].active(active: true);
71886 Main.tile[num41, num42].type = (ushort)num40;
71888 }
71889 }
71890 }
71891 for (int num45 = num37 - num39 + 2; num45 <= num37 + num39 - 2; num45++)
71892 {
71893 int num46;
71894 for (num46 = num38 - num39; !Main.tile[num45, num46].active(); num46++)
71895 {
71896 }
71898 {
71899 Main.tile[num45, num46].active(active: false);
71900 Main.tile[num45, num46].liquid = byte.MaxValue;
71902 }
71903 }
71904 }
71905 }
static UnifiedRandom genRand
Definition WorldGen.cs:1455
static void SquareWallFrame(int i, int j, bool resetFrame=true)
static bool WillWaterPlacedHereStayPut(int x, int y)
static void SquareTileFrame(int i, int j, bool resetFrame=true)

References Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, and Terraria.Main.tile.

Referenced by Terraria.WorldGen.AddGenPasses().

+ Here is the caller graph for this function: