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

◆ OrePatch()

static bool Terraria.WorldGen.OrePatch ( int X,
int Y )
inlinestatic

Definition at line 6741 of file WorldGen.cs.

6742 {
6743 //IL_04b1: Unknown result type (might be due to invalid IL or missing references)
6744 //IL_04b3: Unknown result type (might be due to invalid IL or missing references)
6745 //IL_04b5: Unknown result type (might be due to invalid IL or missing references)
6746 //IL_04ba: Unknown result type (might be due to invalid IL or missing references)
6747 //IL_050e: Unknown result type (might be due to invalid IL or missing references)
6748 //IL_052d: Unknown result type (might be due to invalid IL or missing references)
6749 //IL_03e6: Unknown result type (might be due to invalid IL or missing references)
6750 //IL_03ee: Unknown result type (might be due to invalid IL or missing references)
6751 //IL_03f3: Unknown result type (might be due to invalid IL or missing references)
6752 //IL_03f8: Unknown result type (might be due to invalid IL or missing references)
6753 ushort type = (ushort)SavedOreTiers.Copper;
6754 if (genRand.Next(3) == 0)
6755 {
6756 type = (ushort)SavedOreTiers.Iron;
6757 }
6758 int num = X;
6759 int num2 = Y;
6760 while (!SolidTile(num, num2))
6761 {
6762 num2++;
6763 if ((double)num2 > Main.worldSurface)
6764 {
6765 return false;
6766 }
6767 }
6768 if (!TileID.Sets.Conversion.Grass[Main.tile[num, num2].type] || !TileID.Sets.Conversion.Grass[Main.tile[num - 1, num2].type] || !TileID.Sets.Conversion.Grass[Main.tile[num + 1, num2].type])
6769 {
6770 return false;
6771 }
6772 if (Main.tile[num, num2].wall > 0)
6773 {
6774 return false;
6775 }
6776 for (int i = num - 10; i <= num + 10; i++)
6777 {
6778 for (int j = num2 + 7; j <= num2 + 30; j++)
6779 {
6780 if (!Main.tile[i, j].active() || Main.tileDungeon[Main.tile[i, j].type] || TileID.Sets.Clouds[Main.tile[i, j].type] || TileID.Sets.Conversion.Sand[Main.tile[i, j].type] || Main.tile[i, j].wall == 0)
6781 {
6782 return false;
6783 }
6784 }
6785 }
6786 num2 += genRand.Next(2);
6787 Main.tile[num, num2].type = type;
6788 Main.tile[num, num2].active(active: true);
6789 OreHelper(num, num2);
6790 if (!gen)
6791 {
6792 SquareTileFrame(num, num2);
6793 }
6794 int num3 = num2;
6795 while (num2 < num3 + genRand.Next(8, 13))
6796 {
6797 num += genRand.Next(-1, 2);
6798 num2 += genRand.Next(1, 3);
6799 if (genRand.Next(3) == 0)
6800 {
6801 num2++;
6802 }
6803 Main.tile[num, num2].type = type;
6804 Main.tile[num, num2].active(active: true);
6805 OreHelper(num, num2);
6806 if (!gen)
6807 {
6808 SquareTileFrame(num, num2);
6809 }
6810 if (genRand.Next(4) == 0)
6811 {
6812 int num4 = num + genRand.Next(-2, 3);
6813 int num5 = num2 + genRand.Next(2);
6814 Main.tile[num4, num5].type = type;
6815 Main.tile[num4, num5].active(active: true);
6817 if (!gen)
6818 {
6820 }
6821 }
6822 }
6823 Vector2D val = default(Vector2D);
6824 ((Vector2D)(ref val))._002Ector((double)num, (double)num2);
6825 Vector2D val2 = default(Vector2D);
6826 val2.X = genRand.NextDouble() * 0.6 - 0.3;
6827 val2.Y = genRand.NextDouble() * 0.5 + 0.5;
6828 double num6 = genRand.Next(5, 9);
6829 int num7 = genRand.Next(9, 14);
6830 if (genRand.Next(3) == 0)
6831 {
6832 num6 += (double)genRand.Next(2);
6833 }
6834 if (genRand.Next(3) == 0)
6835 {
6836 num7 += genRand.Next(2);
6837 }
6838 while (num7 > 0)
6839 {
6840 num7--;
6841 for (int k = num - (int)num6 * 4; (double)k <= (double)num + num6 * 4.0; k++)
6842 {
6843 for (int l = num2 - (int)num6 * 4; (double)l <= (double)num2 + num6 * 4.0; l++)
6844 {
6845 double num8 = num6 * (0.5 + genRand.NextDouble() * 0.5) * 0.1;
6846 double num9 = num6 * (0.7 + genRand.NextDouble() * 0.6) * 0.3;
6847 if (genRand.Next(8) == 0)
6848 {
6849 num9 *= 2.0;
6850 }
6851 Vector2D val3 = val - new Vector2D((double)k, (double)l);
6852 if (((Vector2D)(ref val3)).Length() < num8)
6853 {
6854 Main.tile[k, l].active(active: false);
6855 }
6856 else if (((Vector2D)(ref val3)).Length() < num9)
6857 {
6858 Main.tile[k, l].type = type;
6859 if (genRand.Next(4) == 0)
6860 {
6861 Main.tile[k, l].active(active: true);
6862 }
6863 OreHelper(k, l);
6864 if (!gen)
6865 {
6867 }
6868 }
6869 }
6870 }
6871 val += val2;
6872 val2.X += genRand.NextDouble() * 0.2 - 0.1;
6873 val2.Y += genRand.NextDouble() * 0.2 - 0.1;
6874 Utils.Clamp(val2.X, -0.3, 0.3);
6875 Utils.Clamp(val2.Y, 0.5, 1.0);
6876 }
6877 return true;
6878 }
static bool[] Clouds
Definition TileID.cs:125
static volatile bool gen
Definition WorldGen.cs:972
static void OreHelper(int X, int Y)
Definition WorldGen.cs:6360
static UnifiedRandom genRand
Definition WorldGen.cs:1215
static void SquareTileFrame(int i, int j, bool resetFrame=true)

References Terraria.ID.TileID.Sets.Clouds, Terraria.WorldGen.SavedOreTiers.Copper, Terraria.WorldGen.gen, Terraria.WorldGen.genRand, Terraria.ID.TileID.Sets.Conversion.Grass, Terraria.WorldGen.SavedOreTiers.Iron, Terraria.WorldGen.OreHelper(), Terraria.ID.TileID.Sets.Conversion.Sand, Terraria.Enums.SolidTile, Terraria.WorldGen.SquareTileFrame(), Terraria.Main.tile, Terraria.Main.tileDungeon, System.type, Terraria.Main.worldSurface, System.X, and System.Y.