62063 {
62068 if (num < 10)
62069 {
62070 num = 10;
62071 }
62072 if (
num2 > Main.maxTilesX - 10)
62073 {
62074 num2 = Main.maxTilesX - 10;
62075 }
62077 {
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 {
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 {
62103 }
62105 {
62107 num5 -= (int)(
Math.
Abs(Main.windSpeedCurrent) * 1250f);
62108 if (Main.raining)
62109 {
62110 num5 -= (int)(1250f * Main.maxRaining);
62111 }
62113 {
62115 }
62117 {
62119 for (
k =
j; (double)
k < Main.worldSurface + 10.0 && !Main.tile[i,
k].active() &&
k -
j < 15;
k++)
62120 {
62121 }
62123 {
62129 {
62131 {
62132 if (Main.tile[
l,
m].active() && (Main.tile[
l,
m].type == 324 || Main.tile[
l,
m].type == 81))
62133 {
62135 }
62136 }
62137 }
62139 {
62140 if (
genRand.Next(2) == 0 && Main.tile[
i,
k].liquid >= 230)
62141 {
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 {
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 {
62177 if (Main.netMode == 2)
62178 {
62179 NetMessage.SendData(17, -1, -1,
null, 0, i,
j);
62180 }
62181 }
62182 else
62183 {
62185 }
62186 }
62187 else if (Main.tile[i,
j].type == 519)
62188 {
62190 if (Main.tile[i,
j].active() &&
genRand.Next(8) == 0)
62191 {
62194 }
62195 }
62196 else if (Main.tile[i,
j].liquid > 32)
62197 {
62198 if (Main.tile[i,
j].active())
62199 {
62201 {
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 {
62216 if (Main.netMode == 2)
62217 {
62218 NetMessage.SendTileSquare(-1, i,
j);
62219 }
62220 }
62221 else if (
genRand.Next(600) == 0)
62222 {
62224 if (Main.netMode == 2)
62225 {
62226 NetMessage.SendTileSquare(-1, i,
j);
62227 }
62228 }
62229 }
62230 else if (Main.tile[i,
j].nactive())
62231 {
62233 if (Main.rand.Next(3000) == 0)
62234 {
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 {
62240 }
62241 if (Main.tile[i,
j].type == 80)
62242 {
62244 {
62246 }
62247 }
62248 else if (Main.tile[i,
j].type == 529)
62249 {
62251 {
62253 }
62254 }
62256 {
62257 if (!Main.tile[i,
num3].active())
62258 {
62260 {
62262 if (Main.tile[i,
num3].type == 530 && Main.netMode == 2)
62263 {
62264 NetMessage.SendTileSquare(-1, i - 1,
num3 - 1, 3, 2);
62265 }
62266 }
62268 {
62270 {
62272 {
62277 {
62279 {
62280 if (Main.tile[
n,
num12].active() && Main.tile[
n,
num12].type == 81)
62281 {
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 {
62289 if (Main.netMode == 2 && Main.tile[i,
num3].active())
62290 {
62291 NetMessage.SendTileSquare(-1, i,
num3);
62292 }
62293 }
62294 }
62295 }
62297 {
62299 }
62300 }
62301 }
62302 }
62303 else if (Main.tile[i,
j].type == 530)
62304 {
62306 {
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 {
62322 {
62323 if (Main.tile[
num16,
j].type == 165 && Main.tile[
num16,
j].active())
62324 {
62326 }
62327 if (Main.tile[
num16,
j + 1].type == 165 && Main.tile[
num16,
j + 1].active())
62328 {
62330 }
62331 if (Main.tile[
num16,
j + 2].type == 165 && Main.tile[
num16,
j + 2].active())
62332 {
62334 }
62335 if (Main.tile[
num16,
j + 3].type == 165 && Main.tile[
num16,
j + 3].active())
62336 {
62338 }
62339 }
62341 {
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 {
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 {
62363 if (Main.netMode == 2 && Main.tile[i,
num3].active())
62364 {
62365 NetMessage.SendTileSquare(-1, i,
num3);
62366 }
62367 }
62368 }
62370 {
62372 int type = Main.tile[
i,
j].type;
62374 {
62376 {
62378 }
62379 else
62380 {
62382 }
62383 }
62384 }
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();
62393 {
62395 {
62397 {
62402 {
62404 flag = true;
62405 }
62406 }
62407 }
62408 }
62409 if (Main.netMode == 2 && flag)
62410 {
62411 NetMessage.SendTileSquare(-1, i,
j, 3);
62412 }
62414 {
62418 {
62419 case 0:
62421 break;
62422 case 1:
62424 break;
62425 case 2:
62427 break;
62428 default:
62430 break;
62431 }
62433 {
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 {
62449 {
62451 }
62452 }
62453 else if (Main.tile[i,
j].type == 595)
62454 {
62456 {
62458 }
62459 }
62460 else if (Main.tile[i,
j].type == 615)
62461 {
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 {
62492 }
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 {
62505 {
62506 bool flag2 =
false;
62508 {
62510 {
62512 {
62515 {
62517 break;
62518 }
62519 }
62520 }
62521 }
62523 {
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 {
62537 {
62538 bool flag3 =
false;
62540 {
62542 {
62544 {
62547 {
62549 break;
62550 }
62551 }
62552 }
62553 }
62555 {
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 {
62569 {
62570 bool flag4 =
false;
62572 {
62574 {
62576 {
62579 {
62581 break;
62582 }
62583 }
62584 }
62585 }
62587 {
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 {
62603 if (Main.tile[i,
j].type == 52 || Main.tile[i,
j].type == 382)
62604 {
62606 }
62609 {
62610 bool flag5 =
false;
62612 if (Main.tile[i,
j].type == 382)
62613 {
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 {
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 {
62625 }
62626 if (Main.remixWorld &&
genRand.Next(5) == 0)
62627 {
62629 }
62630 }
62632 {
62633 if (Main.tile[i,
num35].bottomSlope())
62634 {
62636 break;
62637 }
62638 if (Main.tile[i,
num35].active() && Main.tile[i,
num35].type == 2 && !Main.tile[i,
num35].bottomSlope())
62639 {
62641 break;
62642 }
62643 }
62645 {
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 {
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 {
62673 if (Main.tile[i,
j].type == 62)
62674 {
62676 }
62677 if (
genRand.Next(
maxValue) == 0 && !Main.tile[
i,
j + 1].active() && !Main.tile[
i,
j + 1].lava())
62678 {
62679 bool flag6 =
false;
62681 {
62682 if (Main.tile[i,
num37].bottomSlope())
62683 {
62685 break;
62686 }
62687 if (Main.tile[i,
num37].active() && Main.tile[
i,
num37].type == 60 && !Main.tile[
i,
num37].bottomSlope())
62688 {
62690 break;
62691 }
62692 }
62694 {
62696 Main.tile[
i,
num38].type = 62;
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 {
62710 if (Main.tile[i,
j].type == 528)
62711 {
62713 }
62714 if (
genRand.Next(
maxValue2) == 0 && !Main.tile[i,
j + 1].active() && !Main.tile[i,
j + 1].lava())
62715 {
62716 bool flag7 =
false;
62718 {
62719 if (Main.tile[i,
num39].bottomSlope())
62720 {
62722 break;
62723 }
62724 if (Main.tile[i,
num39].active() && Main.tile[i,
num39].type == 70 && !Main.tile[i,
num39].bottomSlope())
62725 {
62727 break;
62728 }
62729 }
62731 {
62733 Main.tile[
i,
num40].type = 528;
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 {
62747 if (Main.tile[i,
j].type == 115)
62748 {
62750 }
62751 if (
genRand.Next(
maxValue3) == 0 && !Main.tile[i,
j + 1].active() && !Main.tile[i,
j + 1].lava())
62752 {
62753 bool flag8 =
false;
62755 {
62756 if (Main.tile[i,
num41].bottomSlope())
62757 {
62759 break;
62760 }
62761 if (Main.tile[i,
num41].active() && Main.tile[i,
num41].type == 109 && !Main.tile[i,
num41].bottomSlope())
62762 {
62764 break;
62765 }
62766 }
62768 {
62770 Main.tile[
i,
num42].type = 115;
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 {
62784 if (Main.tile[i,
j].type == 636)
62785 {
62787 }
62788 if (
genRand.Next(
maxValue4) == 0 && !Main.tile[i,
j + 1].active() && !Main.tile[i,
j + 1].lava())
62789 {
62790 bool flag9 =
false;
62792 {
62793 if (Main.tile[i,
num43].bottomSlope())
62794 {
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 {
62801 break;
62802 }
62803 }
62805 {
62807 Main.tile[
i,
num44].type = 636;
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 {
62821 if (Main.tile[i,
j].type == 205)
62822 {
62824 }
62825 if (
genRand.Next(
maxValue5) == 0 && !Main.tile[i,
j + 1].active() && !Main.tile[i,
j + 1].lava())
62826 {
62829 {
62830 if (Main.tile[i,
num45].bottomSlope())
62831 {
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 {
62838 break;
62839 }
62840 }
62842 {
62844 Main.tile[
i,
num46].type = 205;
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 {
62858 if (Main.tile[i,
j].type == 638)
62859 {
62861 }
62862 if (
genRand.Next(
maxValue6) == 0 && !Main.tile[i,
j + 1].active() && !Main.tile[i,
j + 1].lava())
62863 {
62866 {
62867 if (Main.tile[i,
num47].bottomSlope())
62868 {
62870 break;
62871 }
62872 if (Main.tile[i,
num47].active() && Main.tile[i,
num47].type == 633 && !Main.tile[i,
num47].bottomSlope())
62873 {
62875 break;
62876 }
62877 }
62879 {
62881 Main.tile[
i,
num48].type = 638;
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
static bool[] tileMossBrick
static bool[] SlowlyDiesInWater
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
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
static readonly int oceanDistance
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
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)
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)