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

◆ CloudLake()

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

Definition at line 68600 of file WorldGen.cs.

68601 {
68602 //IL_0089: Unknown result type (might be due to invalid IL or missing references)
68603 //IL_009a: Unknown result type (might be due to invalid IL or missing references)
68604 //IL_00ef: Unknown result type (might be due to invalid IL or missing references)
68605 //IL_0104: Unknown result type (might be due to invalid IL or missing references)
68606 //IL_011a: Unknown result type (might be due to invalid IL or missing references)
68607 //IL_012f: Unknown result type (might be due to invalid IL or missing references)
68608 //IL_0563: Unknown result type (might be due to invalid IL or missing references)
68609 //IL_0574: Unknown result type (might be due to invalid IL or missing references)
68610 //IL_018f: Unknown result type (might be due to invalid IL or missing references)
68611 //IL_05c9: Unknown result type (might be due to invalid IL or missing references)
68612 //IL_05de: Unknown result type (might be due to invalid IL or missing references)
68613 //IL_05f9: Unknown result type (might be due to invalid IL or missing references)
68614 //IL_02d3: Unknown result type (might be due to invalid IL or missing references)
68615 //IL_02d4: Unknown result type (might be due to invalid IL or missing references)
68616 //IL_02d5: Unknown result type (might be due to invalid IL or missing references)
68617 //IL_02da: Unknown result type (might be due to invalid IL or missing references)
68618 //IL_02ff: Unknown result type (might be due to invalid IL or missing references)
68619 //IL_01ca: Unknown result type (might be due to invalid IL or missing references)
68620 //IL_0320: Unknown result type (might be due to invalid IL or missing references)
68621 //IL_01dc: Unknown result type (might be due to invalid IL or missing references)
68622 //IL_01d2: Unknown result type (might be due to invalid IL or missing references)
68623 //IL_0341: Unknown result type (might be due to invalid IL or missing references)
68624 //IL_01ee: Unknown result type (might be due to invalid IL or missing references)
68625 //IL_0362: Unknown result type (might be due to invalid IL or missing references)
68626 //IL_0659: Unknown result type (might be due to invalid IL or missing references)
68627 //IL_07d6: Unknown result type (might be due to invalid IL or missing references)
68628 //IL_07d7: Unknown result type (might be due to invalid IL or missing references)
68629 //IL_07d8: Unknown result type (might be due to invalid IL or missing references)
68630 //IL_07dd: Unknown result type (might be due to invalid IL or missing references)
68631 //IL_0802: Unknown result type (might be due to invalid IL or missing references)
68632 //IL_0215: Unknown result type (might be due to invalid IL or missing references)
68633 //IL_0224: Unknown result type (might be due to invalid IL or missing references)
68634 //IL_0694: Unknown result type (might be due to invalid IL or missing references)
68635 //IL_0823: Unknown result type (might be due to invalid IL or missing references)
68636 //IL_06a6: Unknown result type (might be due to invalid IL or missing references)
68637 //IL_069c: Unknown result type (might be due to invalid IL or missing references)
68638 //IL_0844: Unknown result type (might be due to invalid IL or missing references)
68639 //IL_06b8: Unknown result type (might be due to invalid IL or missing references)
68640 //IL_0865: Unknown result type (might be due to invalid IL or missing references)
68641 //IL_06e9: Unknown result type (might be due to invalid IL or missing references)
68642 //IL_06f8: Unknown result type (might be due to invalid IL or missing references)
68643 double num = genRand.Next(100, 150);
68644 double num2 = num;
68645 double num3 = genRand.Next(20, 30);
68646 int num4 = i;
68647 int num5 = i;
68648 int num6 = i;
68649 int num7 = j;
68650 Vector2D val = default(Vector2D);
68651 val.X = i;
68652 val.Y = j;
68653 Vector2D val2 = default(Vector2D);
68654 val2.X = (double)genRand.Next(-20, 21) * 0.2;
68655 while (val2.X > -2.0 && val2.X < 2.0)
68656 {
68657 val2.X = (double)genRand.Next(-20, 21) * 0.2;
68658 }
68659 val2.Y = (double)genRand.Next(-20, -10) * 0.02;
68660 while (num > 0.0 && num3 > 0.0)
68661 {
68662 num -= (double)genRand.Next(4);
68663 num3 -= 1.0;
68664 int num8 = (int)(val.X - num * 0.5);
68665 int num9 = (int)(val.X + num * 0.5);
68666 int num10 = (int)(val.Y - num * 0.5);
68667 int num11 = (int)(val.Y + num * 0.5);
68668 if (num8 < 0)
68669 {
68670 num8 = 0;
68671 }
68672 if (num9 > Main.maxTilesX)
68673 {
68674 num9 = Main.maxTilesX;
68675 }
68676 if (num10 < 0)
68677 {
68678 num10 = 0;
68679 }
68680 if (num11 > Main.maxTilesY)
68681 {
68682 num11 = Main.maxTilesY;
68683 }
68684 num2 = num * (double)genRand.Next(80, 120) * 0.01;
68685 double num12 = val.Y + 1.0;
68686 for (int k = num8; k < num9; k++)
68687 {
68688 if (genRand.Next(2) == 0)
68689 {
68690 num12 += (double)genRand.Next(-1, 2);
68691 }
68692 if (num12 < val.Y)
68693 {
68694 num12 = val.Y;
68695 }
68696 if (num12 > val.Y + 2.0)
68697 {
68698 num12 = val.Y + 2.0;
68699 }
68700 for (int l = num10; l < num11; l++)
68701 {
68702 if (!((double)l > num12))
68703 {
68704 continue;
68705 }
68706 double num13 = Math.Abs((double)k - val.X);
68707 double num14 = Math.Abs((double)l - val.Y) * 3.0;
68708 if (Math.Sqrt(num13 * num13 + num14 * num14) < num2 * 0.4)
68709 {
68710 if (k < num4)
68711 {
68712 num4 = k;
68713 }
68714 if (k > num5)
68715 {
68716 num5 = k;
68717 }
68718 if (l < num6)
68719 {
68720 num6 = l;
68721 }
68722 if (l > num7)
68723 {
68724 num7 = l;
68725 }
68726 Main.tile[k, l].active(active: true);
68727 Main.tile[k, l].type = 189;
68729 }
68730 }
68731 }
68732 val += val2;
68733 val2.X += (double)genRand.Next(-20, 21) * 0.05;
68734 if (val2.X > 1.0)
68735 {
68736 val2.X = 1.0;
68737 }
68738 if (val2.X < -1.0)
68739 {
68740 val2.X = -1.0;
68741 }
68742 if (val2.Y > 0.2)
68743 {
68744 val2.Y = -0.2;
68745 }
68746 if (val2.Y < -0.2)
68747 {
68748 val2.Y = -0.2;
68749 }
68750 }
68751 int num15 = num4;
68752 int num17;
68753 for (num15 += genRand.Next(5); num15 < num5; num15 += genRand.Next(num17, (int)((double)num17 * 1.5)))
68754 {
68755 int num16 = num7;
68756 while (!Main.tile[num15, num16].active())
68757 {
68758 num16--;
68759 }
68760 num16 += genRand.Next(-3, 4);
68761 num17 = genRand.Next(4, 8);
68762 int num18 = 189;
68763 if (genRand.Next(4) == 0)
68764 {
68765 num18 = 196;
68766 }
68767 for (int m = num15 - num17; m <= num15 + num17; m++)
68768 {
68769 for (int n = num16 - num17; n <= num16 + num17; n++)
68770 {
68771 if (n > num6)
68772 {
68773 double num19 = Math.Abs(m - num15);
68774 double num20 = Math.Abs(n - num16) * 2;
68775 if (Math.Sqrt(num19 * num19 + num20 * num20) < (double)(num17 + genRand.Next(2)))
68776 {
68777 Main.tile[m, n].active(active: true);
68778 Main.tile[m, n].type = (ushort)num18;
68780 }
68781 }
68782 }
68783 }
68784 }
68785 num = genRand.Next(80, 95);
68786 num2 = num;
68787 num3 = genRand.Next(10, 15);
68788 val.X = i;
68789 val.Y = num6;
68790 val2.X = (double)genRand.Next(-20, 21) * 0.2;
68791 while (val2.X > -2.0 && val2.X < 2.0)
68792 {
68793 val2.X = (double)genRand.Next(-20, 21) * 0.2;
68794 }
68795 val2.Y = (double)genRand.Next(-20, -10) * 0.02;
68796 while (num > 0.0 && num3 > 0.0)
68797 {
68798 num -= (double)genRand.Next(4);
68799 num3 -= 1.0;
68800 int num8 = (int)(val.X - num * 0.5);
68801 int num9 = (int)(val.X + num * 0.5);
68802 int num10 = num6 - 1;
68803 int num11 = (int)(val.Y + num * 0.5);
68804 if (num8 < 0)
68805 {
68806 num8 = 0;
68807 }
68808 if (num9 > Main.maxTilesX)
68809 {
68810 num9 = Main.maxTilesX;
68811 }
68812 if (num10 < 0)
68813 {
68814 num10 = 0;
68815 }
68816 if (num11 > Main.maxTilesY)
68817 {
68818 num11 = Main.maxTilesY;
68819 }
68820 num2 = num * (double)genRand.Next(80, 120) * 0.01;
68821 double num21 = val.Y + 1.0;
68822 for (int num22 = num8; num22 < num9; num22++)
68823 {
68824 if (genRand.Next(2) == 0)
68825 {
68826 num21 += (double)genRand.Next(-1, 2);
68827 }
68828 if (num21 < val.Y)
68829 {
68830 num21 = val.Y;
68831 }
68832 if (num21 > val.Y + 2.0)
68833 {
68834 num21 = val.Y + 2.0;
68835 }
68836 for (int num23 = num10; num23 < num11; num23++)
68837 {
68838 if (!((double)num23 > num21 - 2.0))
68839 {
68840 continue;
68841 }
68842 double num24 = Math.Abs((double)num22 - val.X);
68843 double num25 = Math.Abs((double)num23 - val.Y) * 3.0;
68844 if (!(Math.Sqrt(num24 * num24 + num25 * num25) < num2 * 0.4) || Main.tile[num22, num23].type != 189)
68845 {
68846 continue;
68847 }
68848 Main.tile[num22, num23].active(active: false);
68849 if ((double)num23 > num21 + 1.0)
68850 {
68852 {
68853 Main.tile[num22, num23].liquid = byte.MaxValue;
68854 }
68855 Main.tile[num22, num23].honey(honey: false);
68856 Main.tile[num22, num23].lava(lava: false);
68857 }
68858 }
68859 }
68860 val += val2;
68861 val2.X += (double)genRand.Next(-20, 21) * 0.05;
68862 if (val2.X > 1.0)
68863 {
68864 val2.X = 1.0;
68865 }
68866 if (val2.X < -1.0)
68867 {
68868 val2.X = -1.0;
68869 }
68870 if (val2.Y > 0.2)
68871 {
68872 val2.Y = -0.2;
68873 }
68874 if (val2.Y < 0.0)
68875 {
68876 val2.Y = 0.0;
68877 }
68878 }
68879 for (int num26 = num4 - 20; num26 <= num5 + 20; num26++)
68880 {
68881 for (int num27 = num6 - 20; num27 <= num7 + 20; num27++)
68882 {
68883 bool flag = true;
68884 for (int num28 = num26 - 1; num28 <= num26 + 1; num28++)
68885 {
68886 for (int num29 = num27 - 1; num29 <= num27 + 1; num29++)
68887 {
68888 if (!Main.tile[num28, num29].active())
68889 {
68890 flag = false;
68891 }
68892 }
68893 }
68894 if (flag)
68895 {
68896 Main.tile[num26, num27].wall = 73;
68897 }
68898 }
68899 }
68900 for (int num30 = num4; num30 <= num5; num30++)
68901 {
68902 int num31;
68903 for (num31 = num6 - 10; !Main.tile[num30, num31 + 1].active(); num31++)
68904 {
68905 }
68906 if (num31 >= num7 || Main.tile[num30, num31 + 1].type != 189)
68907 {
68908 continue;
68909 }
68910 if (genRand.Next(10) == 0)
68911 {
68912 int num32 = genRand.Next(1, 3);
68913 for (int num33 = num30 - num32; num33 <= num30 + num32; num33++)
68914 {
68915 if (Main.tile[num33, num31].type == 189 && WillWaterPlacedHereStayPut(num33, num31))
68916 {
68917 Main.tile[num33, num31].active(active: false);
68918 Main.tile[num33, num31].liquid = byte.MaxValue;
68919 Main.tile[num33, num31].lava(lava: false);
68921 }
68922 if (Main.tile[num33, num31 + 1].type == 189 && WillWaterPlacedHereStayPut(num33, num31 + 1))
68923 {
68924 Main.tile[num33, num31 + 1].active(active: false);
68925 Main.tile[num33, num31 + 1].liquid = byte.MaxValue;
68926 Main.tile[num33, num31 + 1].lava(lava: false);
68928 }
68929 if (num33 > num30 - num32 && num33 < num30 + 2 && Main.tile[num33, num31 + 2].type == 189 && WillWaterPlacedHereStayPut(num33, num31 + 2))
68930 {
68931 Main.tile[num33, num31 + 2].active(active: false);
68932 Main.tile[num33, num31 + 2].liquid = byte.MaxValue;
68933 Main.tile[num33, num31 + 2].lava(lava: false);
68935 }
68936 }
68937 }
68938 if (genRand.Next(5) == 0 && WillWaterPlacedHereStayPut(num30, num31))
68939 {
68940 Main.tile[num30, num31].liquid = byte.MaxValue;
68941 }
68942 Main.tile[num30, num31].lava(lava: false);
68944 }
68945 int num34 = genRand.Next(1, 4);
68946 for (int num35 = 0; num35 <= num34; num35++)
68947 {
68948 int num36 = genRand.Next(num4 - 5, num5 + 5);
68949 int num37 = num6 - genRand.Next(20, 40);
68950 int num38 = genRand.Next(4, 8);
68951 int num39 = 189;
68952 if (genRand.Next(4) != 0)
68953 {
68954 num39 = 196;
68955 }
68956 for (int num40 = num36 - num38; num40 <= num36 + num38; num40++)
68957 {
68958 for (int num41 = num37 - num38; num41 <= num37 + num38; num41++)
68959 {
68960 double num42 = Math.Abs(num40 - num36);
68961 double num43 = Math.Abs(num41 - num37) * 2;
68962 if (Math.Sqrt(num42 * num42 + num43 * num43) < (double)(num38 + genRand.Next(-1, 2)))
68963 {
68964 Main.tile[num40, num41].active(active: true);
68965 Main.tile[num40, num41].type = (ushort)num39;
68967 }
68968 }
68969 }
68970 for (int num44 = num36 - num38 + 2; num44 <= num36 + num38 - 2; num44++)
68971 {
68972 int num45;
68973 for (num45 = num37 - num38; !Main.tile[num44, num45].active(); num45++)
68974 {
68975 }
68977 {
68978 Main.tile[num44, num45].active(active: false);
68979 Main.tile[num44, num45].liquid = byte.MaxValue;
68981 }
68982 }
68983 }
68984 }
static double Sqrt(double d)
static double Abs(double value)
static UnifiedRandom genRand
Definition WorldGen.cs:1215
static bool WillWaterPlacedHereStayPut(int x, int y)
static void SquareTileFrame(int i, int j, bool resetFrame=true)

References System.Math.Abs(), Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, System.Math.Sqrt(), Terraria.Main.tile, ReLogic.Utilities.Vector2D.X, and ReLogic.Utilities.Vector2D.Y.

Referenced by Terraria.WorldGen.GenerateWorld().