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

◆ GrowLivingTreePassageRoom()

static void Terraria.WorldGen.GrowLivingTreePassageRoom ( int minl,
int minr,
int Y )
inlinestaticprivate

Definition at line 21036 of file WorldGen.cs.

21037 {
21038 int num = genRand.Next(2);
21039 if (num == 0)
21040 {
21041 num = -1;
21042 }
21043 int num2 = Y - 2;
21044 int num3 = (minl + minr) / 2;
21045 if (num < 0)
21046 {
21047 num3--;
21048 }
21049 if (num > 0)
21050 {
21051 num3++;
21052 }
21053 int num4 = genRand.Next(15, 30);
21054 int num5 = num3 + num4;
21055 if (num < 0)
21056 {
21057 num5 = num3;
21058 num3 -= num4;
21059 }
21060 for (int i = num3; i < num5; i++)
21061 {
21062 for (int j = Y - 20; j < Y + 10; j++)
21063 {
21064 if (Main.tile[i, j].wall == 0 && !Main.tile[i, j].active() && (double)j < Main.worldSurface)
21065 {
21066 return;
21067 }
21068 }
21069 }
21070 GenVars.dMinX = num3;
21071 GenVars.dMaxX = num5;
21072 if (num < 0)
21073 {
21074 GenVars.dMinX -= 40;
21075 }
21076 else
21077 {
21078 GenVars.dMaxX += 40;
21079 }
21080 for (int k = num3; k <= num5; k++)
21081 {
21082 for (int l = num2 - 2; l <= Y + 2; l++)
21083 {
21084 if (Main.tile[k - 1, l].type == 40)
21085 {
21086 Main.tile[k - 1, l].type = 0;
21087 }
21088 if (Main.tile[k + 1, l].type == 40)
21089 {
21090 Main.tile[k + 1, l].type = 0;
21091 }
21092 if (Main.tile[k, l - 1].type == 40)
21093 {
21094 Main.tile[k, l - 1].type = 0;
21095 }
21096 if (Main.tile[k, l + 1].type == 40)
21097 {
21098 Main.tile[k, l + 1].type = 0;
21099 }
21100 if (Main.tile[k, l].wall != 244 && Main.tile[k, l].type != 19)
21101 {
21102 Main.tile[k, l].active(active: true);
21103 Main.tile[k, l].type = 191;
21104 Main.tile[k, l].halfBrick(halfBrick: false);
21105 }
21106 if (l >= num2 && l <= Y)
21107 {
21108 Main.tile[k, l].liquid = 0;
21109 Main.tile[k, l].wall = 244;
21110 Main.tile[k, l].active(active: false);
21111 }
21112 }
21113 }
21114 int i2 = (minl + minr) / 2 + 3 * num;
21115 PlaceTile(i2, Y, 10, mute: true, forced: false, -1, 7);
21116 int num6 = genRand.Next(5, 9);
21117 int num7 = genRand.Next(4, 6);
21118 if (num < 0)
21119 {
21120 num5 = num3 + num6;
21121 num3 -= num6;
21122 }
21123 else
21124 {
21125 num3 = num5 - num6;
21126 num5 += num6;
21127 }
21128 num2 = Y - num7;
21129 for (int m = num3 - 2; m <= num5 + 2; m++)
21130 {
21131 for (int n = num2 - 2; n <= Y + 2; n++)
21132 {
21133 if (Main.tile[m - 1, n].type == 40)
21134 {
21135 Main.tile[m - 1, n].type = 40;
21136 }
21137 if (Main.tile[m + 1, n].type == 40)
21138 {
21139 Main.tile[m + 1, n].type = 40;
21140 }
21141 if (Main.tile[m, n - 1].type == 40)
21142 {
21143 Main.tile[m, n - 1].type = 40;
21144 }
21145 if (Main.tile[m, n + 1].type == 40)
21146 {
21147 Main.tile[m, n + 1].type = 40;
21148 }
21149 if (Main.tile[m, n].wall != 244 && Main.tile[m, n].type != 19)
21150 {
21151 Main.tile[m, n].active(active: true);
21152 Main.tile[m, n].type = 191;
21153 Main.tile[m, n].halfBrick(halfBrick: false);
21154 }
21155 if (n >= num2 && n <= Y && m >= num3 && m <= num5)
21156 {
21157 Main.tile[m, n].liquid = 0;
21158 Main.tile[m, n].wall = 244;
21159 Main.tile[m, n].active(active: false);
21160 }
21161 }
21162 }
21163 i2 = num3 - 2;
21164 if (num < 0)
21165 {
21166 i2 = num5 + 2;
21167 }
21168 PlaceTile(i2, Y, 10, mute: true, forced: false, -1, 7);
21169 int num8 = num5;
21170 if (num < 0)
21171 {
21172 num8 = num3;
21173 }
21174 int num9 = 2;
21175 if (genRand.Next(num9) == 0)
21176 {
21177 num9 += 2;
21178 PlaceTile(num8, Y, 15, mute: true, forced: false, -1, 5);
21179 if (num < 0)
21180 {
21181 Main.tile[num8, Y - 1].frameX += 18;
21182 Main.tile[num8, Y].frameX += 18;
21183 }
21184 }
21185 num8 = num5 - 2;
21186 if (num < 0)
21187 {
21188 num8 = num3 + 2;
21189 }
21190 PlaceTile(num8, Y, 304, mute: true);
21191 num8 = num5 - 4;
21192 if (num < 0)
21193 {
21194 num8 = num3 + 4;
21195 }
21196 if (genRand.Next(num9) == 0)
21197 {
21198 PlaceTile(num8, Y, 15, mute: true, forced: false, -1, 5);
21199 if (num > 0)
21200 {
21201 Main.tile[num8, Y - 1].frameX += 18;
21202 Main.tile[num8, Y].frameX += 18;
21203 }
21204 }
21205 num8 = num5 - 7;
21206 if (num < 0)
21207 {
21208 num8 = num3 + 8;
21209 }
21210 int contain = 832;
21211 if (genRand.Next(3) == 0)
21212 {
21213 contain = 4281;
21214 }
21215 if (remixWorldGen)
21216 {
21217 int num10 = genRand.Next(1, 3);
21218 for (int num11 = 0; num11 < num10; num11++)
21219 {
21220 bool flag = false;
21221 while (!flag)
21222 {
21223 int num12 = genRand.Next(Main.maxTilesX / 8, Main.maxTilesX - Main.maxTilesX / 8);
21224 int num13 = genRand.Next((int)Main.rockLayer, Main.maxTilesY - 350);
21225 if (!IsTileNearby(num12, num13, 53, 20) && !IsTileNearby(num12, num13, 147, 20) && !IsTileNearby(num12, num13, 59, 20))
21226 {
21228 }
21229 }
21230 }
21231 if (crimson)
21232 {
21234 }
21235 else
21236 {
21238 }
21239 }
21240 else
21241 {
21243 }
21244 }
static bool remixWorldGen
Definition WorldGen.cs:1148
static bool PlaceTile(int i, int j, int Type, bool mute=false, bool forced=false, int plr=-1, int style=0)
static UnifiedRandom genRand
Definition WorldGen.cs:1215
static bool crimson
Definition WorldGen.cs:932
static bool AddBuriedChest(Point point, int contain=0, bool notNearOtherChests=false, int Style=-1)
static bool IsTileNearby(int x, int y, int type, int distance)
Definition WorldGen.cs:5117

References Terraria.Main.maxTilesX, Terraria.Main.rockLayer, Terraria.Main.tile, Terraria.Main.worldSurface, and System.Y.