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

◆ FinishGetGoodWorld()

static void Terraria.WorldGen.FinishGetGoodWorld ( )
inlinestaticprivate

Definition at line 17682 of file WorldGen.cs.

17683 {
17684 int num = 0;
17685 for (int i = 20; (double)i < Main.worldSurface; i++)
17686 {
17687 for (int j = 20; j < Main.maxTilesX - 20; j++)
17688 {
17689 if (Main.tile[j, i].active() && TileID.Sets.Clouds[Main.tile[j, i].type])
17690 {
17691 num = i;
17692 break;
17693 }
17694 }
17695 }
17696 byte b = (byte)genRand.Next(13, 25);
17697 for (int k = 0; k < Main.maxTilesX; k++)
17698 {
17699 bool flag = false;
17700 for (int l = 0; l < Main.maxTilesY; l++)
17701 {
17702 if (!Main.tile[k, l].active() || !Main.tileDungeon[Main.tile[k, l].type])
17703 {
17704 continue;
17705 }
17706 if (Main.tile[k, l].type == 44)
17707 {
17708 b = (byte)genRand.Next(13, 15);
17709 if (genRand.Next(2) == 0)
17710 {
17711 b = (byte)genRand.Next(23, 25);
17712 }
17713 }
17714 if (Main.tile[k, l].type == 43)
17715 {
17716 b = (byte)genRand.Next(15, 19);
17717 }
17718 if (Main.tile[k, l].type == 41)
17719 {
17720 b = (byte)genRand.Next(19, 23);
17721 }
17722 }
17723 if (flag)
17724 {
17725 break;
17726 }
17727 }
17728 for (int m = 0; m < Main.maxTilesX; m++)
17729 {
17730 for (int n = 5; n < Main.maxTilesY - 5; n++)
17731 {
17732 if (Main.tile[m, n].active() && (Main.tileDungeon[Main.tile[m, n].type] || TileID.Sets.CrackedBricks[Main.tile[m, n].type]))
17733 {
17734 Main.tile[m, n].color(b);
17735 }
17736 if (Main.wallDungeon[Main.tile[m, n].wall])
17737 {
17738 Main.tile[m, n].wallColor(b);
17739 }
17740 if (Main.tile[m, n].active())
17741 {
17742 bool flag2 = false;
17743 if (Main.tile[m, n].type == 226)
17744 {
17745 flag2 = true;
17746 }
17747 if (Main.tile[m, n].type == 137)
17748 {
17749 int num2 = Main.tile[m, n].frameY / 18;
17750 if (num2 >= 1 && num2 <= 4)
17751 {
17752 flag2 = true;
17753 }
17754 }
17755 if (flag2)
17756 {
17757 Main.tile[m, n].color(17);
17758 }
17759 }
17760 if (Main.tile[m, n].wall == 87)
17761 {
17762 Main.tile[m, n].wallColor(25);
17763 }
17764 if (!Main.tile[m, n].active())
17765 {
17766 continue;
17767 }
17768 if (!remixWorldGen && Main.tile[m, n].type == 57 && genRand.Next(15) == 0)
17769 {
17770 if (Main.tile[m, n - 1].type == 57)
17771 {
17772 Main.tile[m, n].active(active: false);
17773 }
17774 Main.tile[m, n].liquid = byte.MaxValue;
17775 Main.tile[m, n].lava(lava: true);
17776 }
17777 if (n < num && Main.tile[m, n].type == 2)
17778 {
17779 if (crimson)
17780 {
17781 Main.tile[m, n].type = 199;
17782 }
17783 else
17784 {
17785 Main.tile[m, n].type = 23;
17786 }
17787 if (Main.tile[m, n - 1].type == 3)
17788 {
17789 Main.tile[m, n - 1].active(active: false);
17790 }
17791 if (Main.tile[m, n - 1].type == 73)
17792 {
17793 Main.tile[m, n - 1].active(active: false);
17794 }
17795 if (Main.tile[m, n - 1].type == 27)
17796 {
17797 KillTile(m, n - 1);
17798 }
17799 if (Main.tile[m, n - 1].type == 596)
17800 {
17801 KillTile(m, n - 1);
17802 }
17803 if (Main.tile[m, n - 1].type == 616)
17804 {
17805 KillTile(m, n - 1);
17806 }
17807 if (Main.tile[m, n - 1].type == 82)
17808 {
17809 KillTile(m, n - 1);
17810 }
17811 if (Main.tile[m, n - 1].type == 83)
17812 {
17813 KillTile(m, n - 1);
17814 }
17815 if (Main.tile[m, n - 1].type == 186)
17816 {
17817 KillTile(m, n - 1);
17818 }
17819 if (Main.tile[m, n - 1].type == 187)
17820 {
17821 KillTile(m, n - 1);
17822 }
17823 if (Main.tile[m, n - 1].type == 185)
17824 {
17825 KillTile(m, n - 1);
17826 }
17827 if (Main.tile[m, n - 1].type == 227)
17828 {
17829 KillTile(m, n - 1);
17830 }
17831 }
17832 }
17833 }
17834 for (int num3 = 0; num3 < 8000 && Main.chest[num3] != null; num3++)
17835 {
17836 if (genRand.Next(10) != 0 || Main.chest[num3].item[1].stack == 0)
17837 {
17838 continue;
17839 }
17840 for (int num4 = 1; num4 < 40; num4++)
17841 {
17842 if (Main.chest[num3].item[num4].stack == 0)
17843 {
17844 Main.chest[num3].item[num4].SetDefaults(678);
17845 break;
17846 }
17847 }
17848 }
17849 }
static bool[] CrackedBricks
Definition TileID.cs:113
static bool[] Clouds
Definition TileID.cs:125
static bool remixWorldGen
Definition WorldGen.cs:1148
static void KillTile(int i, int j, bool fail=false, bool effectOnly=false, bool noItem=false)
static UnifiedRandom genRand
Definition WorldGen.cs:1215
static bool crimson
Definition WorldGen.cs:932

References Terraria.Main.chest, Terraria.ID.TileID.Sets.Clouds, Terraria.ID.TileID.Sets.CrackedBricks, Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.Main.tile, Terraria.Main.tileDungeon, Terraria.Main.wallDungeon, and Terraria.Main.worldSurface.