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

◆ StonePatch()

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

Definition at line 6374 of file WorldGen.cs.

6375 {
6376 //IL_042f: Unknown result type (might be due to invalid IL or missing references)
6377 //IL_0430: Unknown result type (might be due to invalid IL or missing references)
6378 //IL_0431: Unknown result type (might be due to invalid IL or missing references)
6379 //IL_0436: Unknown result type (might be due to invalid IL or missing references)
6380 //IL_0489: Unknown result type (might be due to invalid IL or missing references)
6381 //IL_04a7: Unknown result type (might be due to invalid IL or missing references)
6382 //IL_0291: Unknown result type (might be due to invalid IL or missing references)
6383 //IL_0298: Unknown result type (might be due to invalid IL or missing references)
6384 //IL_029d: Unknown result type (might be due to invalid IL or missing references)
6385 //IL_02a2: Unknown result type (might be due to invalid IL or missing references)
6386 int num = Y;
6387 while (!SolidTile(X, num))
6388 {
6389 num++;
6390 if ((double)num > Main.worldSurface)
6391 {
6392 return false;
6393 }
6394 }
6395 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])
6396 {
6397 return false;
6398 }
6399 if (Main.tile[X, num].wall > 0)
6400 {
6401 return false;
6402 }
6403 for (int i = X - 10; i <= X + 10; i++)
6404 {
6405 for (int j = num + 7; j <= num + 30; j++)
6406 {
6407 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)
6408 {
6409 return false;
6410 }
6411 }
6412 }
6413 Vector2D val = default(Vector2D);
6414 ((Vector2D)(ref val))._002Ector((double)X, (double)num);
6415 Vector2D val2 = default(Vector2D);
6416 val2.X = genRand.NextDouble() * 0.6 - 0.3;
6417 val2.Y = genRand.NextDouble() * 0.5 + 0.5;
6418 double num2 = genRand.Next(13, 18);
6419 int num3 = genRand.Next(13, 19);
6420 if (genRand.Next(3) == 0)
6421 {
6422 num2 += (double)genRand.Next(3);
6423 }
6424 if (genRand.Next(3) == 0)
6425 {
6426 num3 += genRand.Next(3);
6427 }
6428 while (num3 > 0)
6429 {
6430 num3--;
6431 for (int k = X - (int)num2 * 4; (double)k <= (double)X + num2 * 4.0; k++)
6432 {
6433 for (int l = num - (int)num2 * 4; (double)l <= (double)num + num2 * 4.0; l++)
6434 {
6435 double num4 = num2 * (0.7 + genRand.NextDouble() * 0.6) * 0.3;
6436 if (genRand.Next(8) == 0)
6437 {
6438 num4 *= 2.0;
6439 }
6440 Vector2D val3 = val - new Vector2D((double)k, (double)l);
6441 if (((Vector2D)(ref val3)).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))
6442 {
6443 if (genRand.Next(3) != 0)
6444 {
6445 PlaceTile(k, l, 186, mute: true, forced: false, -1, genRand.Next(7, 13));
6446 }
6447 if (genRand.Next(3) != 0)
6448 {
6449 PlaceSmallPile(k, l, genRand.Next(6), 1, 185);
6450 }
6451 PlaceSmallPile(k, l, genRand.Next(6), 0, 185);
6452 }
6453 if (((Vector2D)(ref val3)).Length() < num4)
6454 {
6455 if (Main.tileSolid[Main.tile[k, l].type])
6456 {
6457 Main.tile[k, l].type = 1;
6458 }
6459 if (!gen)
6460 {
6462 }
6463 }
6464 }
6465 }
6466 val += val2;
6467 val2.X += genRand.NextDouble() * 0.2 - 0.1;
6468 val2.Y += genRand.NextDouble() * 0.2 - 0.1;
6469 Utils.Clamp(val2.X, -0.3, 0.3);
6470 Utils.Clamp(val2.Y, 0.5, 1.0);
6471 }
6472 return true;
6473 }
static bool[] Clouds
Definition TileID.cs:125
static volatile bool gen
Definition WorldGen.cs:972
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 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, Terraria.Main.worldSurface, System.X, and System.Y.