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

◆ UpdateWorld_OvergroundTile()

static void Terraria.WorldGen.UpdateWorld_OvergroundTile ( int i,
int j,
bool checkNPCSpawns,
int wallDist )
inlinestaticprivate

Definition at line 62062 of file WorldGen.cs.

62063 {
62064 int num = i - 1;
62065 int num2 = i + 2;
62066 int num3 = j - 1;
62067 int num4 = j + 2;
62068 if (num < 10)
62069 {
62070 num = 10;
62071 }
62072 if (num2 > Main.maxTilesX - 10)
62073 {
62074 num2 = Main.maxTilesX - 10;
62075 }
62076 if (num3 < 10)
62077 {
62078 num3 = 10;
62079 }
62080 if (num4 > Main.maxTilesY - 10)
62081 {
62082 num4 = Main.maxTilesY - 10;
62083 }
62084 if (Main.tile[i, j] == null)
62085 {
62086 return;
62087 }
62088 if (Main.tile[i, j].type == 655 && !NPC.AnyNPCs(262))
62089 {
62090 KillTile(i, j);
62091 if (Main.netMode == 2)
62092 {
62093 NetMessage.SendData(17, -1, -1, null, 0, i, j);
62094 }
62095 }
62096 if (Main.tile[i, j].type == 85)
62097 {
62099 }
62100 else if (Main.tileAlch[Main.tile[i, j].type])
62101 {
62102 GrowAlch(i, j);
62103 }
62104 else if ((double)j < Main.worldSurface + 10.0 && (i < beachDistance || i > Main.maxTilesX - beachDistance) && !Main.tile[i, j].active())
62105 {
62106 int num5 = 3000;
62107 num5 -= (int)(Math.Abs(Main.windSpeedCurrent) * 1250f);
62108 if (Main.raining)
62109 {
62110 num5 -= (int)(1250f * Main.maxRaining);
62111 }
62112 if (num5 < 300)
62113 {
62114 num5 = 300;
62115 }
62116 if (genRand.Next(num5) == 0)
62117 {
62118 int k;
62119 for (k = j; (double)k < Main.worldSurface + 10.0 && !Main.tile[i, k].active() && k - j < 15; k++)
62120 {
62121 }
62122 if (Main.tile[i, k].active() && Main.tile[i, k].type == 53 && SolidTileAllowBottomSlope(i, k))
62123 {
62124 k--;
62125 int num6 = genRand.Next(2, 5);
62126 int num7 = genRand.Next(8, 11);
62127 int num8 = 0;
62128 for (int l = i - num7; l <= i + num7; l++)
62129 {
62130 for (int m = k - num7; m <= k + num7; m++)
62131 {
62132 if (Main.tile[l, m].active() && (Main.tile[l, m].type == 324 || Main.tile[l, m].type == 81))
62133 {
62134 num8++;
62135 }
62136 }
62137 }
62138 if (num8 < num6)
62139 {
62140 if (genRand.Next(2) == 0 && Main.tile[i, k].liquid >= 230)
62141 {
62142 PlaceTile(i, k, 81, mute: true);
62143 if (Main.netMode == 2 && Main.tile[i, k].active())
62144 {
62145 NetMessage.SendTileSquare(-1, i, k);
62146 }
62147 }
62148 else
62149 {
62151 if (Main.netMode == 2 && Main.tile[i, k].active())
62152 {
62153 NetMessage.SendTileSquare(-1, i, k);
62154 }
62155 }
62156 }
62157 }
62158 }
62159 }
62160 if ((Main.tile[i, j].type == 596 || Main.tile[i, j].type == 616 || Main.tile[i, j].type == 595 || Main.tile[i, j].type == 615) && (Main.tile[i, j + 1].type == 199 || Main.tile[i, j + 1].type == 23))
62161 {
62162 KillTile(i, j);
62163 if (Main.netMode == 2)
62164 {
62165 NetMessage.SendTileSquare(-1, i, j);
62166 }
62167 }
62168 if ((Main.tile[i, j].type == 571 || (Main.tile[i, j].type == 60 && Main.tile[i, j - 1].liquid > 0)) && genRand.Next(5) == 0 && (!Main.tile[i, j - 1].active() || Main.tile[i, j - 1].type == 61 || Main.tile[i, j - 1].type == 74 || Main.tile[i, j - 1].type == 518) && (Main.tile[i, j].type != 60 || genRand.Next(30) == 0) && PlaceBamboo(i, j - 1))
62169 {
62170 NetMessage.SendTileSquare(-1, i, j - 1, 1, 2);
62171 }
62172 if (Main.tile[i, j].type == 518)
62173 {
62174 if (Main.tile[i, j].liquid == 0 || (Main.tile[i, j].liquid / 16 >= 9 && SolidTile(i, j - 1)) || (Main.tile[i, j - 1].liquid > 0 && Main.tile[i, j - 1].active()))
62175 {
62176 KillTile(i, j);
62177 if (Main.netMode == 2)
62178 {
62179 NetMessage.SendData(17, -1, -1, null, 0, i, j);
62180 }
62181 }
62182 else
62183 {
62184 CheckLilyPad(i, j);
62185 }
62186 }
62187 else if (Main.tile[i, j].type == 519)
62188 {
62189 CheckCatTail(i, j);
62190 if (Main.tile[i, j].active() && genRand.Next(8) == 0)
62191 {
62192 GrowCatTail(i, j);
62193 CheckCatTail(i, j);
62194 }
62195 }
62196 else if (Main.tile[i, j].liquid > 32)
62197 {
62198 if (Main.tile[i, j].active())
62199 {
62200 if (TileID.Sets.SlowlyDiesInWater[Main.tile[i, j].type])
62201 {
62202 KillTile(i, j);
62203 if (Main.netMode == 2)
62204 {
62205 NetMessage.SendData(17, -1, -1, null, 0, i, j);
62206 }
62207 }
62208 else if (Main.tile[i, j].type == 60)
62209 {
62211 }
62212 }
62213 else if (genRand.Next(600) == 0)
62214 {
62215 PlaceTile(i, j, 518, mute: true);
62216 if (Main.netMode == 2)
62217 {
62218 NetMessage.SendTileSquare(-1, i, j);
62219 }
62220 }
62221 else if (genRand.Next(600) == 0)
62222 {
62223 PlaceTile(i, j, 519, mute: true);
62224 if (Main.netMode == 2)
62225 {
62226 NetMessage.SendTileSquare(-1, i, j);
62227 }
62228 }
62229 }
62230 else if (Main.tile[i, j].nactive())
62231 {
62232 hardUpdateWorld(i, j);
62233 if (Main.rand.Next(3000) == 0)
62234 {
62235 plantDye(i, j);
62236 }
62237 else if (Main.hardMode && ((double)i < (double)Main.maxTilesX * 0.4 || (double)i > (double)Main.maxTilesX * 0.6) && Main.rand.Next(15000) == 0)
62238 {
62239 plantDye(i, j, exoticPlant: true);
62240 }
62241 if (Main.tile[i, j].type == 80)
62242 {
62243 if (genRand.Next(15) == 0)
62244 {
62245 GrowCactus(i, j);
62246 }
62247 }
62248 else if (Main.tile[i, j].type == 529)
62249 {
62250 if (CheckSeaOat(i, j) && genRand.Next(20) == 0)
62251 {
62252 GrowSeaOat(i, j);
62253 }
62254 }
62255 else if (TileID.Sets.Conversion.Sand[Main.tile[i, j].type])
62256 {
62257 if (!Main.tile[i, num3].active())
62258 {
62259 if (genRand.Next(25) == 0)
62260 {
62261 PlaceOasisPlant(i, num3, 530);
62262 if (Main.tile[i, num3].type == 530 && Main.netMode == 2)
62263 {
62264 NetMessage.SendTileSquare(-1, i - 1, num3 - 1, 3, 2);
62265 }
62266 }
62267 if (genRand.Next(20) != 0 || !PlantSeaOat(i, num3))
62268 {
62269 if (i < oceanDistance || i > Main.maxTilesX - oceanDistance)
62270 {
62271 if (genRand.Next(500) == 0)
62272 {
62273 int num9 = 7;
62274 int num10 = 6;
62275 int num11 = 0;
62276 for (int n = i - num9; n <= i + num9; n++)
62277 {
62278 for (int num12 = num3 - num9; num12 <= num3 + num9; num12++)
62279 {
62280 if (Main.tile[n, num12].active() && Main.tile[n, num12].type == 81)
62281 {
62282 num11++;
62283 }
62284 }
62285 }
62286 if (num11 < num10 && Main.tile[i, num3].liquid == byte.MaxValue && Main.tile[i, num3 - 1].liquid == byte.MaxValue && Main.tile[i, num3 - 2].liquid == byte.MaxValue && Main.tile[i, num3 - 3].liquid == byte.MaxValue && Main.tile[i, num3 - 4].liquid == byte.MaxValue)
62287 {
62288 PlaceTile(i, num3, 81, mute: true);
62289 if (Main.netMode == 2 && Main.tile[i, num3].active())
62290 {
62291 NetMessage.SendTileSquare(-1, i, num3);
62292 }
62293 }
62294 }
62295 }
62296 else if (i > beachDistance + 20 && i < Main.maxTilesX - beachDistance - 20 && genRand.Next(300) == 0)
62297 {
62298 GrowCactus(i, j);
62299 }
62300 }
62301 }
62302 }
62303 else if (Main.tile[i, j].type == 530)
62304 {
62305 if (!OasisPlantWaterCheck(i, j, boost: true))
62306 {
62307 KillTile(i, j);
62308 if (Main.netMode == 2)
62309 {
62310 NetMessage.SendData(17, -1, -1, null, 0, i, j);
62311 }
62312 }
62313 }
62314 else if (Main.tile[i, j].type == 147 || Main.tile[i, j].type == 161 || Main.tile[i, j].type == 163 || Main.tile[i, j].type == 164 || Main.tile[i, j].type == 200)
62315 {
62316 if (Main.rand.Next(10) == 0 && !Main.tile[i, j + 1].active() && !Main.tile[i, j + 2].active())
62317 {
62318 int num13 = i - 3;
62319 int num14 = i + 4;
62320 int num15 = 0;
62321 for (int num16 = num13; num16 < num14; num16++)
62322 {
62323 if (Main.tile[num16, j].type == 165 && Main.tile[num16, j].active())
62324 {
62325 num15++;
62326 }
62327 if (Main.tile[num16, j + 1].type == 165 && Main.tile[num16, j + 1].active())
62328 {
62329 num15++;
62330 }
62331 if (Main.tile[num16, j + 2].type == 165 && Main.tile[num16, j + 2].active())
62332 {
62333 num15++;
62334 }
62335 if (Main.tile[num16, j + 3].type == 165 && Main.tile[num16, j + 3].active())
62336 {
62337 num15++;
62338 }
62339 }
62340 if (num15 < 2)
62341 {
62342 PlaceTight(i, j + 1);
62343 SquareTileFrame(i, j + 1);
62344 if (Main.netMode == 2 && Main.tile[i, j + 1].active())
62345 {
62346 NetMessage.SendTileSquare(-1, i, j + 1, 1, 2);
62347 }
62348 }
62349 }
62350 }
62351 else if (Main.tile[i, j].type == 254)
62352 {
62353 if (Main.rand.Next((Main.tile[i, j].frameX + 10) / 10) == 0)
62354 {
62355 GrowPumpkin(i, j, 254);
62356 }
62357 }
62358 else if (Main.tile[i, j].type == 78 || Main.tile[i, j].type == 380 || Main.tile[i, j].type == 579)
62359 {
62360 if (!Main.tile[i, num3].active() && genRand.Next(2) == 0)
62361 {
62362 PlaceTile(i, num3, 3, mute: true);
62363 if (Main.netMode == 2 && Main.tile[i, num3].active())
62364 {
62365 NetMessage.SendTileSquare(-1, i, num3);
62366 }
62367 }
62368 }
62369 else if (TileID.Sets.SpreadOverground[Main.tile[i, j].type])
62370 {
62372 int type = Main.tile[i, j].type;
62373 if ((type == 32 || type == 352) && genRand.Next(3) == 0)
62374 {
62375 if (type == 32)
62376 {
62377 GrowSpike(i, j, 32, 23);
62378 }
62379 else
62380 {
62381 GrowSpike(i, j, 352, 199);
62382 }
62383 }
62384 }
62385 else if (Main.tileMoss[Main.tile[i, j].type] || TileID.Sets.tileMossBrick[Main.tile[i, j].type])
62386 {
62387 if (genRand.NextDouble() < 0.5)
62388 {
62389 int type2 = Main.tile[i, j].type;
62390 bool flag = false;
62391 TileColorCache color = Main.tile[i, j].BlockColorAndCoating();
62392 for (int num17 = num; num17 < num2; num17++)
62393 {
62394 for (int num18 = num3; num18 < num4; num18++)
62395 {
62396 if ((i != num17 || j != num18) && Main.tile[num17, num18].active() && (Main.tile[num17, num18].type == 1 || Main.tile[num17, num18].type == 38))
62397 {
62398 int type3 = Main.tile[num17, num18].type;
62400 SpreadGrass(num17, num18, Main.tile[num17, num18].type, num19, repeat: false, color);
62401 if (Main.tile[num17, num18].type == num19)
62402 {
62404 flag = true;
62405 }
62406 }
62407 }
62408 }
62409 if (Main.netMode == 2 && flag)
62410 {
62411 NetMessage.SendTileSquare(-1, i, j, 3);
62412 }
62413 if (genRand.Next(6) == 0)
62414 {
62415 int num20 = i;
62416 int num21 = j;
62417 switch (genRand.Next(4))
62418 {
62419 case 0:
62420 num20--;
62421 break;
62422 case 1:
62423 num20++;
62424 break;
62425 case 2:
62426 num21--;
62427 break;
62428 default:
62429 num21++;
62430 break;
62431 }
62432 if (!Main.tile[num20, num21].active())
62433 {
62434 if (PlaceTile(num20, num21, 184, mute: true))
62435 {
62436 Main.tile[num20, num21].CopyPaintAndCoating(Main.tile[i, j]);
62437 }
62438 if (Main.netMode == 2 && Main.tile[num20, num21].active())
62439 {
62440 NetMessage.SendTileSquare(-1, num20, num21);
62441 }
62442 }
62443 }
62444 }
62445 }
62446 else if (Main.tile[i, j].type == 20)
62447 {
62448 if (genRand.Next(20) == 0)
62449 {
62451 }
62452 }
62453 else if (Main.tile[i, j].type == 595)
62454 {
62455 if (genRand.Next(5) == 0)
62456 {
62458 }
62459 }
62460 else if (Main.tile[i, j].type == 615)
62461 {
62462 if (genRand.Next(5) == 0)
62463 {
62465 }
62466 }
62467 else if (Main.tile[i, j].type == 3 && genRand.Next(20) == 0)
62468 {
62469 if (Main.tile[i, j].frameX != 144)
62470 {
62471 Main.tile[i, j].type = 73;
62472 if (Main.netMode == 2)
62473 {
62474 NetMessage.SendTileSquare(-1, i, j);
62475 }
62476 }
62477 }
62478 else if (Main.tile[i, j].type == 110 && genRand.Next(20) == 0 && Main.tile[i, j].frameX < 144)
62479 {
62480 Main.tile[i, j].type = 113;
62481 if (Main.netMode == 2)
62482 {
62483 NetMessage.SendTileSquare(-1, i, j);
62484 }
62485 }
62486 }
62487 else
62488 {
62489 if (Main.tile[i, j].wall == 62 && Main.tile[i, j].liquid == 0)
62490 {
62491 GrowWeb(i, j);
62492 }
62493 if (checkNPCSpawns)
62494 {
62496 }
62497 }
62499 {
62500 if (Main.tile[i, j].wall == 81 || Main.tile[i, j].wall == 83 || (Main.tile[i, j].type == 199 && Main.tile[i, j].active()))
62501 {
62502 int num22 = i + genRand.Next(-2, 3);
62503 int num23 = j + genRand.Next(-2, 3);
62504 if (InWorld(num22, num23, 10) && Main.tile[num22, num23].wall >= 63 && Main.tile[num22, num23].wall <= 68)
62505 {
62506 bool flag2 = false;
62507 for (int num24 = i - wallDist; num24 < i + wallDist; num24++)
62508 {
62509 for (int num25 = j - wallDist; num25 < j + wallDist; num25++)
62510 {
62511 if (Main.tile[num24, num25].active())
62512 {
62513 int type4 = Main.tile[num24, num25].type;
62514 if (type4 == 199 || type4 == 200 || type4 == 201 || type4 == 203 || type4 == 205 || type4 == 234 || type4 == 352 || type4 == 662)
62515 {
62516 flag2 = true;
62517 break;
62518 }
62519 }
62520 }
62521 }
62522 if (flag2)
62523 {
62524 Main.tile[num22, num23].wall = 81;
62525 if (Main.netMode == 2)
62526 {
62527 NetMessage.SendTileSquare(-1, num22, num23);
62528 }
62529 }
62530 }
62531 }
62532 else if (Main.tile[i, j].wall == 69 || Main.tile[i, j].wall == 3 || (Main.tile[i, j].type == 23 && Main.tile[i, j].active()))
62533 {
62534 int num26 = i + genRand.Next(-2, 3);
62535 int num27 = j + genRand.Next(-2, 3);
62536 if (InWorld(num26, num27, 10) && Main.tile[num26, num27].wall >= 63 && Main.tile[num26, num27].wall <= 68)
62537 {
62538 bool flag3 = false;
62539 for (int num28 = i - wallDist; num28 < i + wallDist; num28++)
62540 {
62541 for (int num29 = j - wallDist; num29 < j + wallDist; num29++)
62542 {
62543 if (Main.tile[num28, num29].active())
62544 {
62545 int type5 = Main.tile[num28, num29].type;
62546 if (type5 == 22 || type5 == 23 || type5 == 24 || type5 == 25 || type5 == 32 || type5 == 112 || type5 == 163 || type5 == 636 || type5 == 661)
62547 {
62548 flag3 = true;
62549 break;
62550 }
62551 }
62552 }
62553 }
62554 if (flag3)
62555 {
62556 Main.tile[num26, num27].wall = 69;
62557 if (Main.netMode == 2)
62558 {
62559 NetMessage.SendTileSquare(-1, num26, num27);
62560 }
62561 }
62562 }
62563 }
62564 else if (Main.tile[i, j].wall == 70 || (Main.tile[i, j].type == 109 && Main.tile[i, j].active()))
62565 {
62566 int num30 = i + genRand.Next(-2, 3);
62567 int num31 = j + genRand.Next(-2, 3);
62568 if ((InWorld(num30, num31, 10) && Main.tile[num30, num31].wall == 63) || Main.tile[num30, num31].wall == 65 || Main.tile[num30, num31].wall == 66 || Main.tile[num30, num31].wall == 68)
62569 {
62570 bool flag4 = false;
62571 for (int num32 = i - wallDist; num32 < i + wallDist; num32++)
62572 {
62573 for (int num33 = j - wallDist; num33 < j + wallDist; num33++)
62574 {
62575 if (Main.tile[num32, num33].active())
62576 {
62577 int type6 = Main.tile[num32, num33].type;
62578 if (type6 == 109 || type6 == 110 || type6 == 113 || type6 == 115 || type6 == 116 || type6 == 117 || type6 == 164)
62579 {
62580 flag4 = true;
62581 break;
62582 }
62583 }
62584 }
62585 }
62586 if (flag4)
62587 {
62588 Main.tile[num30, num31].wall = 70;
62589 if (Main.netMode == 2)
62590 {
62591 NetMessage.SendTileSquare(-1, num30, num31);
62592 }
62593 }
62594 }
62595 }
62597 }
62598 if (Main.tile[i, j].nactive())
62599 {
62600 if (Main.tile[i, j].type == 2 || Main.tile[i, j].type == 52 || Main.tile[i, j].type == 382 || (Main.tile[i, j].type == 192 && genRand.Next(10) == 0))
62601 {
62602 int num34 = 60;
62603 if (Main.tile[i, j].type == 52 || Main.tile[i, j].type == 382)
62604 {
62605 num34 = 20;
62606 }
62607 num34 = 1;
62608 if (genRand.Next(num34) == 0 && GrowMoreVines(i, j) && !Main.tile[i, j + 1].active() && !Main.tile[i, j + 1].lava())
62609 {
62610 bool flag5 = false;
62611 ushort type7 = 52;
62612 if (Main.tile[i, j].type == 382)
62613 {
62614 type7 = 382;
62615 }
62616 else if (Main.tile[i, j].type != 52)
62617 {
62618 if (Main.tile[i, j].wall == 68 || Main.tile[i, j].wall == 65 || Main.tile[i, j].wall == 66 || Main.tile[i, j].wall == 63)
62619 {
62620 type7 = 382;
62621 }
62622 else if (Main.tile[i, j + 1].wall == 68 || Main.tile[i, j + 1].wall == 65 || Main.tile[i, j + 1].wall == 66 || Main.tile[i, j + 1].wall == 63)
62623 {
62624 type7 = 382;
62625 }
62626 if (Main.remixWorld && genRand.Next(5) == 0)
62627 {
62628 type7 = 382;
62629 }
62630 }
62631 for (int num35 = j; num35 > j - 10; num35--)
62632 {
62633 if (Main.tile[i, num35].bottomSlope())
62634 {
62635 flag5 = false;
62636 break;
62637 }
62638 if (Main.tile[i, num35].active() && Main.tile[i, num35].type == 2 && !Main.tile[i, num35].bottomSlope())
62639 {
62640 flag5 = true;
62641 break;
62642 }
62643 }
62644 if (flag5)
62645 {
62646 int num36 = j + 1;
62647 Main.tile[i, num36].type = type7;
62648 Main.tile[i, num36].active(active: true);
62649 Main.tile[i, num36].CopyPaintAndCoating(Main.tile[i, j]);
62651 if (Main.netMode == 2)
62652 {
62653 NetMessage.SendTileSquare(-1, i, num36);
62654 }
62655 }
62656 }
62657 }
62658 else if (Main.tile[i, j].type == 61 && genRand.Next(3) == 0 && Main.tile[i, j].frameX < 144)
62659 {
62660 if (Main.rand.Next(4) == 0)
62661 {
62662 Main.tile[i, j].frameX = (short)(162 + genRand.Next(8) * 18);
62663 }
62664 Main.tile[i, j].type = 74;
62665 if (Main.netMode == 2)
62666 {
62667 NetMessage.SendTileSquare(-1, i, j);
62668 }
62669 }
62670 if ((Main.tile[i, j].type == 60 || Main.tile[i, j].type == 62) && GrowMoreVines(i, j))
62671 {
62672 int maxValue = 30;
62673 if (Main.tile[i, j].type == 62)
62674 {
62675 maxValue = 10;
62676 }
62677 if (genRand.Next(maxValue) == 0 && !Main.tile[i, j + 1].active() && !Main.tile[i, j + 1].lava())
62678 {
62679 bool flag6 = false;
62680 for (int num37 = j; num37 > j - 10; num37--)
62681 {
62682 if (Main.tile[i, num37].bottomSlope())
62683 {
62684 flag6 = false;
62685 break;
62686 }
62687 if (Main.tile[i, num37].active() && Main.tile[i, num37].type == 60 && !Main.tile[i, num37].bottomSlope())
62688 {
62689 flag6 = true;
62690 break;
62691 }
62692 }
62693 if (flag6)
62694 {
62695 int num38 = j + 1;
62696 Main.tile[i, num38].type = 62;
62697 Main.tile[i, num38].active(active: true);
62698 Main.tile[i, num38].CopyPaintAndCoating(Main.tile[i, j]);
62700 if (Main.netMode == 2)
62701 {
62702 NetMessage.SendTileSquare(-1, i, num38);
62703 }
62704 }
62705 }
62706 }
62707 else if ((Main.tile[i, j].type == 70 || Main.tile[i, j].type == 528) && GrowMoreVines(i, j))
62708 {
62709 int maxValue2 = 70;
62710 if (Main.tile[i, j].type == 528)
62711 {
62712 maxValue2 = 7;
62713 }
62714 if (genRand.Next(maxValue2) == 0 && !Main.tile[i, j + 1].active() && !Main.tile[i, j + 1].lava())
62715 {
62716 bool flag7 = false;
62717 for (int num39 = j; num39 > j - 10; num39--)
62718 {
62719 if (Main.tile[i, num39].bottomSlope())
62720 {
62721 flag7 = false;
62722 break;
62723 }
62724 if (Main.tile[i, num39].active() && Main.tile[i, num39].type == 70 && !Main.tile[i, num39].bottomSlope())
62725 {
62726 flag7 = true;
62727 break;
62728 }
62729 }
62730 if (flag7)
62731 {
62732 int num40 = j + 1;
62733 Main.tile[i, num40].type = 528;
62734 Main.tile[i, num40].active(active: true);
62735 Main.tile[i, num40].CopyPaintAndCoating(Main.tile[i, j]);
62737 if (Main.netMode == 2)
62738 {
62739 NetMessage.SendTileSquare(-1, i, num40);
62740 }
62741 }
62742 }
62743 }
62744 else if ((Main.tile[i, j].type == 109 || Main.tile[i, j].type == 115) && GrowMoreVines(i, j))
62745 {
62746 int maxValue3 = 60;
62747 if (Main.tile[i, j].type == 115)
62748 {
62749 maxValue3 = 20;
62750 }
62751 if (genRand.Next(maxValue3) == 0 && !Main.tile[i, j + 1].active() && !Main.tile[i, j + 1].lava())
62752 {
62753 bool flag8 = false;
62754 for (int num41 = j; num41 > j - 10; num41--)
62755 {
62756 if (Main.tile[i, num41].bottomSlope())
62757 {
62758 flag8 = false;
62759 break;
62760 }
62761 if (Main.tile[i, num41].active() && Main.tile[i, num41].type == 109 && !Main.tile[i, num41].bottomSlope())
62762 {
62763 flag8 = true;
62764 break;
62765 }
62766 }
62767 if (flag8)
62768 {
62769 int num42 = j + 1;
62770 Main.tile[i, num42].type = 115;
62771 Main.tile[i, num42].active(active: true);
62772 Main.tile[i, num42].CopyPaintAndCoating(Main.tile[i, j]);
62774 if (Main.netMode == 2)
62775 {
62776 NetMessage.SendTileSquare(-1, i, num42);
62777 }
62778 }
62779 }
62780 }
62781 else if ((Main.tile[i, j].type == 23 || Main.tile[i, j].type == 661 || Main.tile[i, j].type == 636) && GrowMoreVines(i, j))
62782 {
62783 int maxValue4 = 60;
62784 if (Main.tile[i, j].type == 636)
62785 {
62786 maxValue4 = 20;
62787 }
62788 if (genRand.Next(maxValue4) == 0 && !Main.tile[i, j + 1].active() && !Main.tile[i, j + 1].lava())
62789 {
62790 bool flag9 = false;
62791 for (int num43 = j; num43 > j - 10; num43--)
62792 {
62793 if (Main.tile[i, num43].bottomSlope())
62794 {
62795 flag9 = false;
62796 break;
62797 }
62798 if (Main.tile[i, num43].active() && (Main.tile[i, num43].type == 23 || Main.tile[i, num43].type == 661) && !Main.tile[i, num43].bottomSlope())
62799 {
62800 flag9 = true;
62801 break;
62802 }
62803 }
62804 if (flag9)
62805 {
62806 int num44 = j + 1;
62807 Main.tile[i, num44].type = 636;
62808 Main.tile[i, num44].active(active: true);
62809 Main.tile[i, num44].CopyPaintAndCoating(Main.tile[i, j]);
62811 if (Main.netMode == 2)
62812 {
62813 NetMessage.SendTileSquare(-1, i, num44);
62814 }
62815 }
62816 }
62817 }
62818 else if ((Main.tile[i, j].type == 199 || Main.tile[i, j].type == 662 || Main.tile[i, j].type == 205) && GrowMoreVines(i, j))
62819 {
62820 int maxValue5 = 60;
62821 if (Main.tile[i, j].type == 205)
62822 {
62823 maxValue5 = 20;
62824 }
62825 if (genRand.Next(maxValue5) == 0 && !Main.tile[i, j + 1].active() && !Main.tile[i, j + 1].lava())
62826 {
62827 bool flag10 = false;
62828 for (int num45 = j; num45 > j - 10; num45--)
62829 {
62830 if (Main.tile[i, num45].bottomSlope())
62831 {
62832 flag10 = false;
62833 break;
62834 }
62835 if (Main.tile[i, num45].active() && (Main.tile[i, num45].type == 199 || Main.tile[i, num45].type == 662) && !Main.tile[i, num45].bottomSlope())
62836 {
62837 flag10 = true;
62838 break;
62839 }
62840 }
62841 if (flag10)
62842 {
62843 int num46 = j + 1;
62844 Main.tile[i, num46].type = 205;
62845 Main.tile[i, num46].active(active: true);
62846 Main.tile[i, num46].CopyPaintAndCoating(Main.tile[i, j]);
62848 if (Main.netMode == 2)
62849 {
62850 NetMessage.SendTileSquare(-1, i, num46);
62851 }
62852 }
62853 }
62854 }
62855 else if ((Main.tile[i, j].type == 633 || Main.tile[i, j].type == 638) && GrowMoreVines(i, j))
62856 {
62857 int maxValue6 = 70;
62858 if (Main.tile[i, j].type == 638)
62859 {
62860 maxValue6 = 7;
62861 }
62862 if (genRand.Next(maxValue6) == 0 && !Main.tile[i, j + 1].active() && !Main.tile[i, j + 1].lava())
62863 {
62864 bool flag11 = false;
62865 for (int num47 = j; num47 > j - 10; num47--)
62866 {
62867 if (Main.tile[i, num47].bottomSlope())
62868 {
62869 flag11 = false;
62870 break;
62871 }
62872 if (Main.tile[i, num47].active() && Main.tile[i, num47].type == 633 && !Main.tile[i, num47].bottomSlope())
62873 {
62874 flag11 = true;
62875 break;
62876 }
62877 }
62878 if (flag11)
62879 {
62880 int num48 = j + 1;
62881 Main.tile[i, num48].type = 638;
62882 Main.tile[i, num48].active(active: true);
62883 Main.tile[i, num48].CopyPaintAndCoating(Main.tile[i, j]);
62885 if (Main.netMode == 2)
62886 {
62887 NetMessage.SendTileSquare(-1, i, num48);
62888 }
62889 }
62890 }
62891 }
62892 }
62893 if (!Main.remixWorld && Main.dontStarveWorld && (float)Main.rand.Next(200) < 100f * Main.maxRaining && Main.maxRaining >= 0.2f)
62894 {
62896 }
62897 }
static double Abs(double value)
static bool[] SpreadOverground
Definition TileID.cs:307
static bool[] tileMossBrick
Definition TileID.cs:219
static bool[] SlowlyDiesInWater
Definition TileID.cs:169
static void GrowAlch(int x, int y)
static void UpdateWorld_GrassGrowth(int i, int j, int minI, int maxI, int minJ, int maxJ, bool underground)
static bool AttemptToGrowTreeFromSapling(int x, int y, bool underground)
static void PlaceOasisPlant(int X, int Y, ushort type=530)
static bool AllowedToSpreadInfections
Definition WorldGen.cs:1008
static void CheckLilyPad(int x, int y)
static void KillTile(int i, int j, bool fail=false, bool effectOnly=false, bool noItem=false)
static void GrowCactus(int i, int j)
static bool PlaceTile(int i, int j, int Type, bool mute=false, bool forced=false, int plr=-1, int style=0)
static bool OasisPlantWaterCheck(int x, int y, bool boost=false)
static UnifiedRandom genRand
Definition WorldGen.cs:1215
static readonly int oceanDistance
Definition WorldGen.cs:926
static void SpreadDesertWalls(int wallDist, int i, int j)
static void GrowSpike(int i, int j, ushort spikeType, ushort landType)
static int RollRandomSeaShellStyle()
static void GrowPumpkin(int i, int j, int type)
static readonly int beachDistance
Definition WorldGen.cs:928
static void plantDye(int i, int j, bool exoticPlant=false)
static bool TryGrowingAbigailsFlower(int i, int j)
static bool GrowMoreVines(int x, int y)
static bool GrowSeaOat(int x, int y)
static void TrySpawningTownNPC(int x, int y)
static bool PlaceBamboo(int x, int y)
static int MossConversion(int thisType, int otherType)
static void hardUpdateWorld(int i, int j)
static bool PlantSeaOat(int x, int y)
static void GrowWeb(int i, int j)
static bool SolidTileAllowBottomSlope(int i, int j)
static void SpreadGrass(int i, int j, int dirt=0, int grass=2, bool repeat=true, TileColorCache color=default(TileColorCache))
static void DontStarveTryWateringTile(int x, int y)
static bool InWorld(int x, int y, int fluff=0)
Definition WorldGen.cs:5816
static void SquareTileFrame(int i, int j, bool resetFrame=true)
static bool CheckSeaOat(int x, int y)
static void CheckCatTail(int x, int j)
static void PlaceTight(int x, int y, bool spiders=false)
static void GrowCatTail(int x, int j)

References System.Math.Abs(), Terraria.NPC.AnyNPCs(), Terraria.Main.dontStarveWorld, Terraria.Main.hardMode, Terraria.Main.maxRaining, Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.Main.netMode, Terraria.Main.raining, Terraria.Main.rand, Terraria.Main.remixWorld, Terraria.ID.TileID.Sets.Conversion.Sand, Terraria.NetMessage.SendData(), Terraria.NetMessage.SendTileSquare(), Terraria.ID.TileID.Sets.SlowlyDiesInWater, Terraria.Enums.SolidTile, Terraria.ID.TileID.Sets.SpreadOverground, Terraria.Main.tile, Terraria.Main.tileAlch, Terraria.Main.tileMoss, Terraria.ID.TileID.Sets.tileMossBrick, System.type, Terraria.Main.windSpeedCurrent, and Terraria.Main.worldSurface.