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

◆ GenerateTunnelToSurface()

void Terraria.GameContent.Biomes.JunglePass.GenerateTunnelToSurface ( int i,
int j )
inlineprivate

Definition at line 88 of file JunglePass.cs.

89 {
90 //IL_006d: Unknown result type (might be due to invalid IL or missing references)
91 //IL_01ec: Unknown result type (might be due to invalid IL or missing references)
92 //IL_0087: Unknown result type (might be due to invalid IL or missing references)
93 //IL_0090: Unknown result type (might be due to invalid IL or missing references)
94 //IL_0246: Unknown result type (might be due to invalid IL or missing references)
95 //IL_025a: Unknown result type (might be due to invalid IL or missing references)
96 //IL_026f: Unknown result type (might be due to invalid IL or missing references)
97 //IL_0284: Unknown result type (might be due to invalid IL or missing references)
98 //IL_03ce: Unknown result type (might be due to invalid IL or missing references)
99 //IL_03cf: Unknown result type (might be due to invalid IL or missing references)
100 //IL_03d0: Unknown result type (might be due to invalid IL or missing references)
101 //IL_03d5: Unknown result type (might be due to invalid IL or missing references)
102 //IL_03fa: Unknown result type (might be due to invalid IL or missing references)
103 //IL_02ea: Unknown result type (might be due to invalid IL or missing references)
104 //IL_02f9: Unknown result type (might be due to invalid IL or missing references)
105 //IL_041b: Unknown result type (might be due to invalid IL or missing references)
106 //IL_0460: Unknown result type (might be due to invalid IL or missing references)
107 //IL_038e: Unknown result type (might be due to invalid IL or missing references)
108 //IL_0395: Unknown result type (might be due to invalid IL or missing references)
109 //IL_0493: Unknown result type (might be due to invalid IL or missing references)
110 //IL_04c6: Unknown result type (might be due to invalid IL or missing references)
111 //IL_04e7: Unknown result type (might be due to invalid IL or missing references)
112 double num = GenBase._random.Next(5, 11);
113 Vector2D val = default(Vector2D);
114 val.X = i;
115 val.Y = j;
116 Vector2D val2 = default(Vector2D);
117 val2.X = (double)GenBase._random.Next(-10, 11) * 0.1;
118 val2.Y = (double)GenBase._random.Next(10, 20) * 0.1;
119 int num2 = 0;
120 bool flag = true;
121 while (flag)
122 {
123 if (val.Y < Main.worldSurface)
124 {
125 if (WorldGen.drunkWorldGen)
126 {
127 flag = false;
128 }
129 int value = (int)val.X;
130 int value2 = (int)val.Y;
131 value = Utils.Clamp(value, 10, Main.maxTilesX - 10);
132 value2 = Utils.Clamp(value2, 10, Main.maxTilesY - 10);
133 if (value2 < 5)
134 {
135 value2 = 5;
136 }
137 if (Main.tile[value, value2].wall == 0 && !Main.tile[value, value2].active() && Main.tile[value, value2 - 3].wall == 0 && !Main.tile[value, value2 - 3].active() && Main.tile[value, value2 - 1].wall == 0 && !Main.tile[value, value2 - 1].active() && Main.tile[value, value2 - 4].wall == 0 && !Main.tile[value, value2 - 4].active() && Main.tile[value, value2 - 2].wall == 0 && !Main.tile[value, value2 - 2].active() && Main.tile[value, value2 - 5].wall == 0 && !Main.tile[value, value2 - 5].active())
138 {
139 flag = false;
140 }
141 }
142 GenVars.JungleX = (int)val.X;
143 num += (double)GenBase._random.Next(-20, 21) * 0.1;
144 if (num < 5.0)
145 {
146 num = 5.0;
147 }
148 if (num > 10.0)
149 {
150 num = 10.0;
151 }
152 int value3 = (int)(val.X - num * 0.5);
153 int value4 = (int)(val.X + num * 0.5);
154 int value5 = (int)(val.Y - num * 0.5);
155 int value6 = (int)(val.Y + num * 0.5);
156 int num3 = Utils.Clamp(value3, 10, Main.maxTilesX - 10);
157 value4 = Utils.Clamp(value4, 10, Main.maxTilesX - 10);
158 value5 = Utils.Clamp(value5, 10, Main.maxTilesY - 10);
159 value6 = Utils.Clamp(value6, 10, Main.maxTilesY - 10);
160 for (int k = num3; k < value4; k++)
161 {
162 for (int l = value5; l < value6; l++)
163 {
164 if (Math.Abs((double)k - val.X) + Math.Abs((double)l - val.Y) < num * 0.5 * (1.0 + (double)GenBase._random.Next(-10, 11) * 0.015))
165 {
166 WorldGen.KillTile(k, l);
167 }
168 }
169 }
170 num2++;
171 if (num2 > 10 && GenBase._random.Next(50) < num2)
172 {
173 num2 = 0;
174 int num4 = -2;
175 if (GenBase._random.Next(2) == 0)
176 {
177 num4 = 2;
178 }
179 WorldGen.TileRunner((int)val.X, (int)val.Y, GenBase._random.Next(3, 20), GenBase._random.Next(10, 100), -1, addTile: false, num4);
180 }
181 val += val2;
182 val2.Y += (double)GenBase._random.Next(-10, 11) * 0.01;
183 if (val2.Y > 0.0)
184 {
185 val2.Y = 0.0;
186 }
187 if (val2.Y < -2.0)
188 {
189 val2.Y = -2.0;
190 }
191 val2.X += (double)GenBase._random.Next(-10, 11) * 0.1;
192 if (val.X < (double)(i - 200))
193 {
194 val2.X += (double)GenBase._random.Next(5, 21) * 0.1;
195 }
196 if (val.X > (double)(i + 200))
197 {
198 val2.X -= (double)GenBase._random.Next(5, 21) * 0.1;
199 }
200 if (val2.X > 1.5)
201 {
202 val2.X = 1.5;
203 }
204 if (val2.X < -1.5)
205 {
206 val2.X = -1.5;
207 }
208 }
209 }
static double Abs(double value)
static UnifiedRandom _random
Definition GenBase.cs:9

References Terraria.WorldBuilding.GenBase._random, System.Math.Abs(), Terraria.WorldGen.drunkWorldGen, Terraria.WorldGen.KillTile(), Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.Main.tile, Terraria.WorldGen.TileRunner(), System.value, Terraria.Main.worldSurface, ReLogic.Utilities.Vector2D.X, and ReLogic.Utilities.Vector2D.Y.

Referenced by Terraria.GameContent.Biomes.JunglePass.ApplyPass().