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

◆ FinishDrunkGen()

static void Terraria.WorldGen.FinishDrunkGen ( )
inlinestaticprivate

Definition at line 19107 of file WorldGen.cs.

19108 {
19109 byte color = (byte)genRand.Next(13, 25);
19110 byte b = 16;
19111 for (int i = 0; i < Main.maxTilesX; i++)
19112 {
19113 bool flag = false;
19114 for (int j = 0; j < Main.maxTilesY; j++)
19115 {
19116 if (!Main.tile[i, j].active() || !Main.tileDungeon[Main.tile[i, j].type])
19117 {
19118 continue;
19119 }
19120 if (Main.tile[i, j].type == 44)
19121 {
19122 color = (byte)genRand.Next(13, 15);
19123 if (genRand.Next(2) == 0)
19124 {
19125 color = (byte)genRand.Next(23, 25);
19126 }
19127 }
19128 if (Main.tile[i, j].type == 43)
19129 {
19130 color = (byte)genRand.Next(15, 19);
19131 }
19132 if (Main.tile[i, j].type == 41)
19133 {
19134 color = (byte)genRand.Next(19, 23);
19135 }
19136 }
19137 if (flag)
19138 {
19139 break;
19140 }
19141 }
19142 for (int k = 10; k < Main.maxTilesX - 10; k++)
19143 {
19144 for (int l = 10; l < Main.maxTilesY - 10; l++)
19145 {
19146 if (Main.tile[k, l].active() && (Main.tileDungeon[Main.tile[k, l].type] || TileID.Sets.CrackedBricks[Main.tile[k, l].type]))
19147 {
19148 Main.tile[k, l].color(color);
19149 }
19150 if (Main.wallDungeon[Main.tile[k, l].wall])
19151 {
19152 Main.tile[k, l].wallColor(25);
19153 }
19154 if (Main.tile[k, l].active())
19155 {
19156 if (Main.tile[k, l].type == 60)
19157 {
19158 int num = 1;
19159 for (int m = k - num; m <= k + num; m++)
19160 {
19161 for (int n = l - num; n <= l + num; n++)
19162 {
19163 if (Main.tile[m, n].type == 147 || Main.tile[m, n].type == 161)
19164 {
19165 Main.tile[m, n].type = 59;
19166 }
19167 }
19168 }
19169 }
19170 bool flag2 = false;
19171 if (Main.tile[k, l].type == 226)
19172 {
19173 flag2 = true;
19174 }
19175 if (Main.tile[k, l].type == 137)
19176 {
19177 int num2 = Main.tile[k, l].frameY / 18;
19178 if (num2 >= 1 && num2 <= 4)
19179 {
19180 flag2 = true;
19181 }
19182 }
19183 if (flag2)
19184 {
19185 Main.tile[k, l].color(b);
19186 }
19187 }
19188 if (Main.tile[k, l].wall == 87)
19189 {
19190 Main.tile[k, l].wallColor(b);
19191 }
19192 }
19193 }
19194 for (int num3 = 0; num3 < 8000 && Main.chest[num3] != null; num3++)
19195 {
19196 if (genRand.Next(15) == 0 && Main.chest[num3].item[1].stack != 0)
19197 {
19198 for (int num4 = 1; num4 < 40; num4++)
19199 {
19200 if (Main.chest[num3].item[num4].stack == 0)
19201 {
19202 Main.chest[num3].item[num4].SetDefaults(5001);
19203 break;
19204 }
19205 }
19206 }
19207 if (genRand.Next(30) != 0 || Main.chest[num3].item[1].stack == 0)
19208 {
19209 continue;
19210 }
19211 for (int num5 = 1; num5 < 40; num5++)
19212 {
19213 if (Main.chest[num3].item[num5].stack == 0)
19214 {
19215 Main.chest[num3].item[num5].SetDefaults(678);
19216 break;
19217 }
19218 }
19219 }
19220 }
static bool[] CrackedBricks
Definition TileID.cs:161
static UnifiedRandom genRand
Definition WorldGen.cs:1455

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