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

◆ StonePatch()

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

Definition at line 7056 of file WorldGen.cs.

7057 {
7058 int num = Y;
7059 while (!SolidTile(X, num))
7060 {
7061 num++;
7062 if ((double)num > Main.worldSurface)
7063 {
7064 return false;
7065 }
7066 }
7067 if (!TileID.Sets.Conversion.Grass[Main.tile[X, num].type] || !TileID.Sets.Conversion.Grass[Main.tile[X - 1, num].type] || !TileID.Sets.Conversion.Grass[Main.tile[X + 1, num].type])
7068 {
7069 return false;
7070 }
7071 if (Main.tile[X, num].wall > 0)
7072 {
7073 return false;
7074 }
7075 for (int i = X - 10; i <= X + 10; i++)
7076 {
7077 for (int j = num + 7; j <= num + 30; j++)
7078 {
7079 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 || Main.tile[i, j].type == 199 || Main.tile[i, j].type == 23)
7080 {
7081 return false;
7082 }
7083 }
7084 }
7085 Vector2D vector2D = new Vector2D(X, num);
7086 Vector2D vector2D2 = default(Vector2D);
7087 vector2D2.X = genRand.NextDouble() * 0.6 - 0.3;
7088 vector2D2.Y = genRand.NextDouble() * 0.5 + 0.5;
7089 double num2 = genRand.Next(13, 18);
7090 int num3 = genRand.Next(13, 19);
7091 if (genRand.Next(3) == 0)
7092 {
7093 num2 += (double)genRand.Next(3);
7094 }
7095 if (genRand.Next(3) == 0)
7096 {
7097 num3 += genRand.Next(3);
7098 }
7099 while (num3 > 0)
7100 {
7101 num3--;
7102 for (int k = X - (int)num2 * 4; (double)k <= (double)X + num2 * 4.0; k++)
7103 {
7104 for (int l = num - (int)num2 * 4; (double)l <= (double)num + num2 * 4.0; l++)
7105 {
7106 double num4 = num2 * (0.7 + genRand.NextDouble() * 0.6) * 0.3;
7107 if (genRand.Next(8) == 0)
7108 {
7109 num4 *= 2.0;
7110 }
7111 Vector2D vector2D3 = vector2D - new Vector2D(k, l);
7112 if (vector2D3.Length() < num4 * 2.0 && !Main.tile[k, l].active() && Main.tile[k, l + 1].active() && Main.tile[k, l + 1].type == 1 && genRand.Next(7) == 0 && SolidTile(k - 1, l + 1) && SolidTile(k + 1, l + 1))
7113 {
7114 if (genRand.Next(3) != 0)
7115 {
7116 PlaceTile(k, l, 186, mute: true, forced: false, -1, genRand.Next(7, 13));
7117 }
7118 if (genRand.Next(3) != 0)
7119 {
7120 PlaceSmallPile(k, l, genRand.Next(6), 1, 185);
7121 }
7122 PlaceSmallPile(k, l, genRand.Next(6), 0, 185);
7123 }
7124 if (vector2D3.Length() < num4)
7125 {
7126 if (Main.tileSolid[Main.tile[k, l].type])
7127 {
7128 Main.tile[k, l].type = 1;
7129 }
7130 if (!gen)
7131 {
7133 }
7134 }
7135 }
7136 }
7138 vector2D2.X += genRand.NextDouble() * 0.2 - 0.1;
7139 vector2D2.Y += genRand.NextDouble() * 0.2 - 0.1;
7140 Utils.Clamp(vector2D2.X, -0.3, 0.3);
7141 Utils.Clamp(vector2D2.Y, 0.5, 1.0);
7142 }
7143 return true;
7144 }
static bool[] Clouds
Definition TileID.cs:173
static volatile bool gen
Definition WorldGen.cs:1210
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:1455
static void SquareTileFrame(int i, int j, bool resetFrame=true)

References Terraria.ID.TileID.Sets.Clouds, Terraria.WorldGen.gen, Terraria.WorldGen.genRand, Terraria.ID.TileID.Sets.Conversion.Grass, Terraria.WorldGen.PlaceSmallPile(), Terraria.WorldGen.PlaceTile(), Terraria.ID.TileID.Sets.Conversion.Sand, Terraria.Enums.SolidTile, Terraria.WorldGen.SquareTileFrame(), Terraria.Main.tile, Terraria.Main.tileDungeon, Terraria.Main.tileSolid, and Terraria.Main.worldSurface.

+ Here is the call graph for this function: