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

◆ CloudIsland()

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

Definition at line 68175 of file WorldGen.cs.

68176 {
68177 //IL_0089: Unknown result type (might be due to invalid IL or missing references)
68178 //IL_009a: Unknown result type (might be due to invalid IL or missing references)
68179 //IL_00ef: Unknown result type (might be due to invalid IL or missing references)
68180 //IL_0104: Unknown result type (might be due to invalid IL or missing references)
68181 //IL_011a: Unknown result type (might be due to invalid IL or missing references)
68182 //IL_012f: Unknown result type (might be due to invalid IL or missing references)
68183 //IL_0563: Unknown result type (might be due to invalid IL or missing references)
68184 //IL_0574: Unknown result type (might be due to invalid IL or missing references)
68185 //IL_018f: Unknown result type (might be due to invalid IL or missing references)
68186 //IL_05c9: Unknown result type (might be due to invalid IL or missing references)
68187 //IL_05de: Unknown result type (might be due to invalid IL or missing references)
68188 //IL_05f9: Unknown result type (might be due to invalid IL or missing references)
68189 //IL_02d3: Unknown result type (might be due to invalid IL or missing references)
68190 //IL_02d4: Unknown result type (might be due to invalid IL or missing references)
68191 //IL_02d5: Unknown result type (might be due to invalid IL or missing references)
68192 //IL_02da: Unknown result type (might be due to invalid IL or missing references)
68193 //IL_02ff: Unknown result type (might be due to invalid IL or missing references)
68194 //IL_01ca: Unknown result type (might be due to invalid IL or missing references)
68195 //IL_0320: Unknown result type (might be due to invalid IL or missing references)
68196 //IL_01dc: Unknown result type (might be due to invalid IL or missing references)
68197 //IL_01d2: Unknown result type (might be due to invalid IL or missing references)
68198 //IL_0341: Unknown result type (might be due to invalid IL or missing references)
68199 //IL_01ee: Unknown result type (might be due to invalid IL or missing references)
68200 //IL_0362: Unknown result type (might be due to invalid IL or missing references)
68201 //IL_0659: Unknown result type (might be due to invalid IL or missing references)
68202 //IL_0774: Unknown result type (might be due to invalid IL or missing references)
68203 //IL_0775: Unknown result type (might be due to invalid IL or missing references)
68204 //IL_0776: Unknown result type (might be due to invalid IL or missing references)
68205 //IL_077b: Unknown result type (might be due to invalid IL or missing references)
68206 //IL_07a0: Unknown result type (might be due to invalid IL or missing references)
68207 //IL_0215: Unknown result type (might be due to invalid IL or missing references)
68208 //IL_0224: Unknown result type (might be due to invalid IL or missing references)
68209 //IL_0694: Unknown result type (might be due to invalid IL or missing references)
68210 //IL_07c1: Unknown result type (might be due to invalid IL or missing references)
68211 //IL_06a6: Unknown result type (might be due to invalid IL or missing references)
68212 //IL_069c: Unknown result type (might be due to invalid IL or missing references)
68213 //IL_07e2: Unknown result type (might be due to invalid IL or missing references)
68214 //IL_06b8: Unknown result type (might be due to invalid IL or missing references)
68215 //IL_0803: Unknown result type (might be due to invalid IL or missing references)
68216 //IL_06dc: Unknown result type (might be due to invalid IL or missing references)
68217 //IL_06eb: Unknown result type (might be due to invalid IL or missing references)
68218 double num = genRand.Next(100, 150);
68219 double num2 = num;
68220 double num3 = genRand.Next(20, 30);
68221 int num4 = i;
68222 int num5 = i;
68223 int num6 = i;
68224 int num7 = j;
68225 Vector2D val = default(Vector2D);
68226 val.X = i;
68227 val.Y = j;
68228 Vector2D val2 = default(Vector2D);
68229 val2.X = (double)genRand.Next(-20, 21) * 0.2;
68230 while (val2.X > -2.0 && val2.X < 2.0)
68231 {
68232 val2.X = (double)genRand.Next(-20, 21) * 0.2;
68233 }
68234 val2.Y = (double)genRand.Next(-20, -10) * 0.02;
68235 while (num > 0.0 && num3 > 0.0)
68236 {
68237 num -= (double)genRand.Next(4);
68238 num3 -= 1.0;
68239 int num8 = (int)(val.X - num * 0.5);
68240 int num9 = (int)(val.X + num * 0.5);
68241 int num10 = (int)(val.Y - num * 0.5);
68242 int num11 = (int)(val.Y + num * 0.5);
68243 if (num8 < 0)
68244 {
68245 num8 = 0;
68246 }
68247 if (num9 > Main.maxTilesX)
68248 {
68249 num9 = Main.maxTilesX;
68250 }
68251 if (num10 < 0)
68252 {
68253 num10 = 0;
68254 }
68255 if (num11 > Main.maxTilesY)
68256 {
68257 num11 = Main.maxTilesY;
68258 }
68259 num2 = num * (double)genRand.Next(80, 120) * 0.01;
68260 double num12 = val.Y + 1.0;
68261 for (int k = num8; k < num9; k++)
68262 {
68263 if (genRand.Next(2) == 0)
68264 {
68265 num12 += (double)genRand.Next(-1, 2);
68266 }
68267 if (num12 < val.Y)
68268 {
68269 num12 = val.Y;
68270 }
68271 if (num12 > val.Y + 2.0)
68272 {
68273 num12 = val.Y + 2.0;
68274 }
68275 for (int l = num10; l < num11; l++)
68276 {
68277 if (!((double)l > num12))
68278 {
68279 continue;
68280 }
68281 double num13 = Math.Abs((double)k - val.X);
68282 double num14 = Math.Abs((double)l - val.Y) * 3.0;
68283 if (Math.Sqrt(num13 * num13 + num14 * num14) < num2 * 0.4)
68284 {
68285 if (k < num4)
68286 {
68287 num4 = k;
68288 }
68289 if (k > num5)
68290 {
68291 num5 = k;
68292 }
68293 if (l < num6)
68294 {
68295 num6 = l;
68296 }
68297 if (l > num7)
68298 {
68299 num7 = l;
68300 }
68301 Main.tile[k, l].active(active: true);
68302 Main.tile[k, l].type = 189;
68304 }
68305 }
68306 }
68307 val += val2;
68308 val2.X += (double)genRand.Next(-20, 21) * 0.05;
68309 if (val2.X > 1.0)
68310 {
68311 val2.X = 1.0;
68312 }
68313 if (val2.X < -1.0)
68314 {
68315 val2.X = -1.0;
68316 }
68317 if (val2.Y > 0.2)
68318 {
68319 val2.Y = -0.2;
68320 }
68321 if (val2.Y < -0.2)
68322 {
68323 val2.Y = -0.2;
68324 }
68325 }
68326 int num15 = num4;
68327 int num17;
68328 for (num15 += genRand.Next(5); num15 < num5; num15 += genRand.Next(num17, (int)((double)num17 * 1.5)))
68329 {
68330 int num16 = num7;
68331 while (!Main.tile[num15, num16].active())
68332 {
68333 num16--;
68334 }
68335 num16 += genRand.Next(-3, 4);
68336 num17 = genRand.Next(4, 8);
68337 int num18 = 189;
68338 if (genRand.Next(4) == 0)
68339 {
68340 num18 = 196;
68341 }
68342 for (int m = num15 - num17; m <= num15 + num17; m++)
68343 {
68344 for (int n = num16 - num17; n <= num16 + num17; n++)
68345 {
68346 if (n > num6)
68347 {
68348 double num19 = Math.Abs(m - num15);
68349 double num20 = Math.Abs(n - num16) * 2;
68350 if (Math.Sqrt(num19 * num19 + num20 * num20) < (double)(num17 + genRand.Next(2)))
68351 {
68352 Main.tile[m, n].active(active: true);
68353 Main.tile[m, n].type = (ushort)num18;
68355 }
68356 }
68357 }
68358 }
68359 }
68360 num = genRand.Next(80, 95);
68361 num2 = num;
68362 num3 = genRand.Next(10, 15);
68363 val.X = i;
68364 val.Y = num6;
68365 val2.X = (double)genRand.Next(-20, 21) * 0.2;
68366 while (val2.X > -2.0 && val2.X < 2.0)
68367 {
68368 val2.X = (double)genRand.Next(-20, 21) * 0.2;
68369 }
68370 val2.Y = (double)genRand.Next(-20, -10) * 0.02;
68371 while (num > 0.0 && num3 > 0.0)
68372 {
68373 num -= (double)genRand.Next(4);
68374 num3 -= 1.0;
68375 int num8 = (int)(val.X - num * 0.5);
68376 int num9 = (int)(val.X + num * 0.5);
68377 int num10 = num6 - 1;
68378 int num11 = (int)(val.Y + num * 0.5);
68379 if (num8 < 0)
68380 {
68381 num8 = 0;
68382 }
68383 if (num9 > Main.maxTilesX)
68384 {
68385 num9 = Main.maxTilesX;
68386 }
68387 if (num10 < 0)
68388 {
68389 num10 = 0;
68390 }
68391 if (num11 > Main.maxTilesY)
68392 {
68393 num11 = Main.maxTilesY;
68394 }
68395 num2 = num * (double)genRand.Next(80, 120) * 0.01;
68396 double num21 = val.Y + 1.0;
68397 for (int num22 = num8; num22 < num9; num22++)
68398 {
68399 if (genRand.Next(2) == 0)
68400 {
68401 num21 += (double)genRand.Next(-1, 2);
68402 }
68403 if (num21 < val.Y)
68404 {
68405 num21 = val.Y;
68406 }
68407 if (num21 > val.Y + 2.0)
68408 {
68409 num21 = val.Y + 2.0;
68410 }
68411 for (int num23 = num10; num23 < num11; num23++)
68412 {
68413 if ((double)num23 > num21)
68414 {
68415 double num24 = Math.Abs((double)num22 - val.X);
68416 double num25 = Math.Abs((double)num23 - val.Y) * 3.0;
68417 if (Math.Sqrt(num24 * num24 + num25 * num25) < num2 * 0.4 && Main.tile[num22, num23].type == 189)
68418 {
68419 Main.tile[num22, num23].type = 0;
68421 }
68422 }
68423 }
68424 }
68425 val += val2;
68426 val2.X += (double)genRand.Next(-20, 21) * 0.05;
68427 if (val2.X > 1.0)
68428 {
68429 val2.X = 1.0;
68430 }
68431 if (val2.X < -1.0)
68432 {
68433 val2.X = -1.0;
68434 }
68435 if (val2.Y > 0.2)
68436 {
68437 val2.Y = -0.2;
68438 }
68439 if (val2.Y < -0.2)
68440 {
68441 val2.Y = -0.2;
68442 }
68443 }
68444 int num26 = num4;
68445 num26 += genRand.Next(5);
68446 while (num26 < num5)
68447 {
68448 int num27 = num7;
68449 while ((!Main.tile[num26, num27].active() || Main.tile[num26, num27].type != 0) && num26 < num5)
68450 {
68451 num27--;
68452 if (num27 < num6)
68453 {
68454 num27 = num7;
68455 num26 += genRand.Next(1, 4);
68456 }
68457 }
68458 if (num26 >= num5)
68459 {
68460 continue;
68461 }
68462 num27 += genRand.Next(0, 4);
68463 int num28 = genRand.Next(2, 5);
68464 int num29 = 189;
68465 for (int num30 = num26 - num28; num30 <= num26 + num28; num30++)
68466 {
68467 for (int num31 = num27 - num28; num31 <= num27 + num28; num31++)
68468 {
68469 if (num31 > num6)
68470 {
68471 double num32 = Math.Abs(num30 - num26);
68472 double num33 = Math.Abs(num31 - num27) * 2;
68473 if (Math.Sqrt(num32 * num32 + num33 * num33) < (double)num28)
68474 {
68475 Main.tile[num30, num31].type = (ushort)num29;
68477 }
68478 }
68479 }
68480 }
68481 num26 += genRand.Next(num28, (int)((double)num28 * 1.5));
68482 }
68483 for (int num34 = num4 - 20; num34 <= num5 + 20; num34++)
68484 {
68485 for (int num35 = num6 - 20; num35 <= num7 + 20; num35++)
68486 {
68487 bool flag = true;
68488 for (int num36 = num34 - 1; num36 <= num34 + 1; num36++)
68489 {
68490 for (int num37 = num35 - 1; num37 <= num35 + 1; num37++)
68491 {
68492 if (!Main.tile[num36, num37].active())
68493 {
68494 flag = false;
68495 }
68496 }
68497 }
68498 if (flag)
68499 {
68500 Main.tile[num34, num35].wall = 73;
68502 }
68503 }
68504 }
68505 for (int num38 = num4; num38 <= num5; num38++)
68506 {
68507 int num39;
68508 for (num39 = num6 - 10; !Main.tile[num38, num39 + 1].active(); num39++)
68509 {
68510 }
68511 if (num39 >= num7 || Main.tile[num38, num39 + 1].type != 189)
68512 {
68513 continue;
68514 }
68515 if (genRand.Next(10) == 0)
68516 {
68517 int num40 = genRand.Next(1, 3);
68518 for (int num41 = num38 - num40; num41 <= num38 + num40; num41++)
68519 {
68520 if (Main.tile[num41, num39].type == 189 && WillWaterPlacedHereStayPut(num41, num39))
68521 {
68522 Main.tile[num41, num39].active(active: false);
68523 Main.tile[num41, num39].liquid = byte.MaxValue;
68524 Main.tile[num41, num39].lava(lava: false);
68526 }
68527 if (Main.tile[num41, num39 + 1].type == 189 && WillWaterPlacedHereStayPut(num41, num39 + 1))
68528 {
68529 Main.tile[num41, num39 + 1].active(active: false);
68530 Main.tile[num41, num39 + 1].liquid = byte.MaxValue;
68531 Main.tile[num41, num39 + 1].lava(lava: false);
68533 }
68534 if (num41 > num38 - num40 && num41 < num38 + 2 && Main.tile[num41, num39 + 2].type == 189 && WillWaterPlacedHereStayPut(num41, num39 + 2))
68535 {
68536 Main.tile[num41, num39 + 2].active(active: false);
68537 Main.tile[num41, num39 + 2].liquid = byte.MaxValue;
68538 Main.tile[num41, num39 + 2].lava(lava: false);
68540 }
68541 }
68542 }
68543 if (genRand.Next(5) == 0 && WillWaterPlacedHereStayPut(num38, num39))
68544 {
68545 Main.tile[num38, num39].liquid = byte.MaxValue;
68546 }
68547 Main.tile[num38, num39].lava(lava: false);
68549 }
68550 int num42 = genRand.Next(4);
68551 for (int num43 = 0; num43 <= num42; num43++)
68552 {
68553 int num44 = genRand.Next(num4 - 5, num5 + 5);
68554 int num45 = num6 - genRand.Next(20, 40);
68555 int num46 = genRand.Next(4, 8);
68556 int num47 = 189;
68557 if (genRand.Next(2) == 0)
68558 {
68559 num47 = 196;
68560 }
68561 for (int num48 = num44 - num46; num48 <= num44 + num46; num48++)
68562 {
68563 for (int num49 = num45 - num46; num49 <= num45 + num46; num49++)
68564 {
68565 double num50 = Math.Abs(num48 - num44);
68566 double num51 = Math.Abs(num49 - num45) * 2;
68567 if (Math.Sqrt(num50 * num50 + num51 * num51) < (double)(num46 + genRand.Next(-1, 2)))
68568 {
68569 Main.tile[num48, num49].active(active: true);
68570 Main.tile[num48, num49].type = (ushort)num47;
68572 }
68573 }
68574 }
68575 for (int num52 = num44 - num46 + 2; num52 <= num44 + num46 - 2; num52++)
68576 {
68577 int num53;
68578 for (num53 = num45 - num46; !Main.tile[num52, num53].active(); num53++)
68579 {
68580 }
68582 {
68583 Main.tile[num52, num53].active(active: false);
68584 Main.tile[num52, num53].liquid = byte.MaxValue;
68586 }
68587 }
68588 }
68589 }
static double Sqrt(double d)
static double Abs(double value)
static UnifiedRandom genRand
Definition WorldGen.cs:1215
static void SquareWallFrame(int i, int j, bool resetFrame=true)
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().