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

◆ CrimStart()

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

Definition at line 65288 of file WorldGen.cs.

65289 {
65290 //IL_0072: Unknown result type (might be due to invalid IL or missing references)
65291 //IL_00f0: Unknown result type (might be due to invalid IL or missing references)
65292 //IL_0490: Unknown result type (might be due to invalid IL or missing references)
65293 //IL_04a9: Unknown result type (might be due to invalid IL or missing references)
65294 //IL_02e7: Unknown result type (might be due to invalid IL or missing references)
65295 //IL_010c: Unknown result type (might be due to invalid IL or missing references)
65296 //IL_0300: Unknown result type (might be due to invalid IL or missing references)
65297 //IL_068b: Unknown result type (might be due to invalid IL or missing references)
65298 //IL_0695: Unknown result type (might be due to invalid IL or missing references)
65299 //IL_02c5: Unknown result type (might be due to invalid IL or missing references)
65300 //IL_0312: Unknown result type (might be due to invalid IL or missing references)
65301 //IL_0835: Unknown result type (might be due to invalid IL or missing references)
65302 //IL_0837: Unknown result type (might be due to invalid IL or missing references)
65303 //IL_0842: Unknown result type (might be due to invalid IL or missing references)
65304 //IL_0847: Unknown result type (might be due to invalid IL or missing references)
65305 //IL_0252: Unknown result type (might be due to invalid IL or missing references)
65306 //IL_0262: Unknown result type (might be due to invalid IL or missing references)
65307 //IL_0134: Unknown result type (might be due to invalid IL or missing references)
65308 //IL_0144: Unknown result type (might be due to invalid IL or missing references)
65309 //IL_0754: Unknown result type (might be due to invalid IL or missing references)
65310 //IL_0760: Unknown result type (might be due to invalid IL or missing references)
65311 //IL_08de: Unknown result type (might be due to invalid IL or missing references)
65312 //IL_08f6: Unknown result type (might be due to invalid IL or missing references)
65313 //IL_0191: Unknown result type (might be due to invalid IL or missing references)
65314 //IL_01a1: Unknown result type (might be due to invalid IL or missing references)
65315 //IL_03c2: Unknown result type (might be due to invalid IL or missing references)
65316 //IL_0bcd: Unknown result type (might be due to invalid IL or missing references)
65317 //IL_03e4: Unknown result type (might be due to invalid IL or missing references)
65318 //IL_0209: Unknown result type (might be due to invalid IL or missing references)
65319 //IL_0219: Unknown result type (might be due to invalid IL or missing references)
65320 //IL_0406: Unknown result type (might be due to invalid IL or missing references)
65321 //IL_0783: Unknown result type (might be due to invalid IL or missing references)
65322 //IL_0428: Unknown result type (might be due to invalid IL or missing references)
65323 //IL_07a4: Unknown result type (might be due to invalid IL or missing references)
65324 //IL_044a: Unknown result type (might be due to invalid IL or missing references)
65325 //IL_044c: Unknown result type (might be due to invalid IL or missing references)
65326 //IL_044e: Unknown result type (might be due to invalid IL or missing references)
65327 //IL_0453: Unknown result type (might be due to invalid IL or missing references)
65328 //IL_0455: Unknown result type (might be due to invalid IL or missing references)
65329 //IL_07c5: Unknown result type (might be due to invalid IL or missing references)
65330 //IL_07e6: Unknown result type (might be due to invalid IL or missing references)
65331 int crimDir = 1;
65332 int k = j;
65333 if ((double)k > Main.worldSurface)
65334 {
65335 k = (int)Main.worldSurface;
65336 }
65337 for (; !SolidTile(i, k); k++)
65338 {
65339 }
65340 int num = k;
65341 Vector2D val = default(Vector2D);
65342 ((Vector2D)(ref val))._002Ector((double)i, (double)k);
65343 Vector2D val2 = default(Vector2D);
65344 ((Vector2D)(ref val2))._002Ector((double)genRand.Next(-20, 21) * 0.1, (double)genRand.Next(20, 201) * 0.01);
65345 if (val2.X < 0.0)
65346 {
65347 crimDir = -1;
65348 }
65349 double num2 = genRand.Next(15, 26);
65350 bool flag = true;
65351 int num3 = 0;
65352 while (flag)
65353 {
65354 num2 += (double)genRand.Next(-50, 51) * 0.01;
65355 if (num2 < 15.0)
65356 {
65357 num2 = 15.0;
65358 }
65359 if (num2 > 25.0)
65360 {
65361 num2 = 25.0;
65362 }
65363 for (int l = (int)(val.X - num2 / 2.0); (double)l < val.X + num2 / 2.0; l++)
65364 {
65365 for (int m = (int)(val.Y - num2 / 2.0); (double)m < val.Y + num2 / 2.0; m++)
65366 {
65367 if (m > num)
65368 {
65369 if (Math.Abs((double)l - val.X) + Math.Abs((double)m - val.Y) < num2 * 0.3)
65370 {
65371 Main.tile[l, m].active(active: false);
65372 Main.tile[l, m].wall = 83;
65373 }
65374 else if (Math.Abs((double)l - val.X) + Math.Abs((double)m - val.Y) < num2 * 0.8 && Main.tile[l, m].wall != 83)
65375 {
65376 Main.tile[l, m].active(active: true);
65377 Main.tile[l, m].type = 203;
65378 if (Math.Abs((double)l - val.X) + Math.Abs((double)m - val.Y) < num2 * 0.6)
65379 {
65380 Main.tile[l, m].wall = 83;
65381 }
65382 }
65383 }
65384 else if (Math.Abs((double)l - val.X) + Math.Abs((double)m - val.Y) < num2 * 0.3 && Main.tile[l, m].active())
65385 {
65386 Main.tile[l, m].active(active: false);
65387 Main.tile[l, m].wall = 83;
65388 }
65389 }
65390 }
65391 if (val.X > (double)(i + 50))
65392 {
65393 num3 = -100;
65394 }
65395 if (val.X < (double)(i - 50))
65396 {
65397 num3 = 100;
65398 }
65399 if (num3 < 0)
65400 {
65401 val2.X -= (double)genRand.Next(20, 51) * 0.01;
65402 }
65403 else if (num3 > 0)
65404 {
65405 val2.X += (double)genRand.Next(20, 51) * 0.01;
65406 }
65407 else
65408 {
65409 val2.X += (double)genRand.Next(-50, 51) * 0.01;
65410 }
65411 val2.Y += (double)genRand.Next(-50, 51) * 0.01;
65412 if (val2.Y < 0.25)
65413 {
65414 val2.Y = 0.25;
65415 }
65416 if (val2.Y > 2.0)
65417 {
65418 val2.Y = 2.0;
65419 }
65420 if (val2.X < -2.0)
65421 {
65422 val2.X = -2.0;
65423 }
65424 if (val2.X > 2.0)
65425 {
65426 val2.X = 2.0;
65427 }
65428 val += val2;
65429 if (val.Y > Main.worldSurface + 100.0)
65430 {
65431 flag = false;
65432 }
65433 }
65434 num2 = genRand.Next(40, 55);
65435 for (int n = 0; n < 50; n++)
65436 {
65437 int num4 = (int)val.X + genRand.Next(-20, 21);
65438 int num5 = (int)val.Y + genRand.Next(-20, 21);
65439 for (int num6 = (int)((double)num4 - num2 / 2.0); (double)num6 < (double)num4 + num2 / 2.0; num6++)
65440 {
65441 for (int num7 = (int)((double)num5 - num2 / 2.0); (double)num7 < (double)num5 + num2 / 2.0; num7++)
65442 {
65443 double num8 = Math.Abs(num6 - num4);
65444 double num9 = Math.Abs(num7 - num5);
65445 double num10 = 1.0 + (double)genRand.Next(-20, 21) * 0.01;
65446 double num11 = 1.0 + (double)genRand.Next(-20, 21) * 0.01;
65447 double num12 = num8 * num10;
65448 num9 *= num11;
65449 double num13 = Math.Sqrt(num12 * num12 + num9 * num9);
65450 if (num13 < num2 * 0.25)
65451 {
65452 Main.tile[num6, num7].active(active: false);
65453 Main.tile[num6, num7].wall = 83;
65454 }
65455 else if (num13 < num2 * 0.4 && Main.tile[num6, num7].wall != 83)
65456 {
65457 Main.tile[num6, num7].active(active: true);
65458 Main.tile[num6, num7].type = 203;
65459 if (num13 < num2 * 0.35)
65460 {
65461 Main.tile[num6, num7].wall = 83;
65462 }
65463 }
65464 }
65465 }
65466 }
65467 int num14 = genRand.Next(5, 9);
65468 Vector2D[] array = (Vector2D[])(object)new Vector2D[num14];
65469 Vector2D val3 = default(Vector2D);
65470 for (int num15 = 0; num15 < num14; num15++)
65471 {
65472 int num16 = (int)val.X;
65473 int num17 = (int)val.Y;
65474 int num18 = 0;
65475 bool flag2 = true;
65476 ((Vector2D)(ref val3))._002Ector((double)genRand.Next(-20, 21) * 0.15, (double)genRand.Next(0, 21) * 0.15);
65477 while (flag2)
65478 {
65479 ((Vector2D)(ref val3))._002Ector((double)genRand.Next(-20, 21) * 0.15, (double)genRand.Next(0, 21) * 0.15);
65480 while (Math.Abs(val3.X) + Math.Abs(val3.Y) < 1.5)
65481 {
65482 ((Vector2D)(ref val3))._002Ector((double)genRand.Next(-20, 21) * 0.15, (double)genRand.Next(0, 21) * 0.15);
65483 }
65484 flag2 = false;
65485 for (int num19 = 0; num19 < num15; num19++)
65486 {
65487 if (val2.X > array[num19].X - 0.75 && val2.X < array[num19].X + 0.75 && val2.Y > array[num19].Y - 0.75 && val2.Y < array[num19].Y + 0.75)
65488 {
65489 flag2 = true;
65490 num18++;
65491 break;
65492 }
65493 }
65494 if (num18 > 10000)
65495 {
65496 break;
65497 }
65498 }
65499 array[num15] = val3;
65500 CrimVein(new Vector2D((double)num16, (double)num17), val3);
65501 }
65502 int num20 = Main.maxTilesX;
65503 int num21 = 0;
65504 val.X = i;
65505 val.Y = num;
65506 num2 = genRand.Next(25, 35);
65507 double num22 = genRand.Next(0, 6);
65508 for (int num23 = 0; num23 < 50; num23++)
65509 {
65510 if (num22 > 0.0)
65511 {
65512 double num24 = (double)genRand.Next(10, 30) * 0.01;
65513 num22 -= num24;
65514 val.Y -= num24;
65515 }
65516 int num25 = (int)val.X + genRand.Next(-2, 3);
65517 int num26 = (int)val.Y + genRand.Next(-2, 3);
65518 for (int num27 = (int)((double)num25 - num2 / 2.0); (double)num27 < (double)num25 + num2 / 2.0; num27++)
65519 {
65520 for (int num28 = (int)((double)num26 - num2 / 2.0); (double)num28 < (double)num26 + num2 / 2.0; num28++)
65521 {
65522 double num29 = Math.Abs(num27 - num25);
65523 double num30 = Math.Abs(num28 - num26);
65524 double num31 = 1.0 + (double)genRand.Next(-20, 21) * 0.005;
65525 double num32 = 1.0 + (double)genRand.Next(-20, 21) * 0.005;
65526 double num33 = num29 * num31;
65527 num30 *= num32;
65528 double num34 = Math.Sqrt(num33 * num33 + num30 * num30);
65529 if (num34 < num2 * 0.2 * ((double)genRand.Next(90, 111) * 0.01))
65530 {
65531 Main.tile[num27, num28].active(active: false);
65532 Main.tile[num27, num28].wall = 83;
65533 }
65534 else
65535 {
65536 if (!(num34 < num2 * 0.45))
65537 {
65538 continue;
65539 }
65540 if (num27 < num20)
65541 {
65542 num20 = num27;
65543 }
65544 if (num27 > num21)
65545 {
65546 num21 = num27;
65547 }
65548 if (Main.tile[num27, num28].wall != 83)
65549 {
65550 Main.tile[num27, num28].active(active: true);
65551 Main.tile[num27, num28].type = 203;
65552 if (num34 < num2 * 0.35)
65553 {
65554 Main.tile[num27, num28].wall = 83;
65555 }
65556 }
65557 }
65558 }
65559 }
65560 }
65561 for (int num35 = num20; num35 <= num21; num35++)
65562 {
65563 int num36;
65564 for (num36 = num; (Main.tile[num35, num36].type == 203 && Main.tile[num35, num36].active()) || Main.tile[num35, num36].wall == 83; num36++)
65565 {
65566 }
65567 int num37 = genRand.Next(15, 20);
65568 for (; !Main.tile[num35, num36].active(); num36++)
65569 {
65570 if (num37 <= 0)
65571 {
65572 break;
65573 }
65574 if (Main.tile[num35, num36].wall == 83)
65575 {
65576 break;
65577 }
65578 num37--;
65579 Main.tile[num35, num36].type = 203;
65580 Main.tile[num35, num36].active(active: true);
65581 }
65582 }
65583 CrimEnt(val, crimDir);
65584 }
static double Sqrt(double d)
static double Abs(double value)
static void CrimEnt(Vector2D position, int crimDir)
static UnifiedRandom genRand
Definition WorldGen.cs:1215
static void CrimVein(Vector2D position, Vector2D velocity)

References System.Math.Abs(), System.array, Terraria.Main.maxTilesX, Terraria.Enums.SolidTile, System.Math.Sqrt(), Terraria.Main.tile, Terraria.Main.worldSurface, ReLogic.Utilities.Vector2D.X, and ReLogic.Utilities.Vector2D.Y.

Referenced by Terraria.WorldGen.GenerateWorld().