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

◆ CreateHiveTunnel()

static Vector2D Terraria.GameContent.Biomes.HiveBiome.CreateHiveTunnel ( int i,
int j,
UnifiedRandom random )
inlinestaticprivate

Definition at line 151 of file HiveBiome.cs.

152 {
153 //IL_052f: Unknown result type (might be due to invalid IL or missing references)
154 //IL_00cf: Unknown result type (might be due to invalid IL or missing references)
155 //IL_011b: Unknown result type (might be due to invalid IL or missing references)
156 //IL_0126: Unknown result type (might be due to invalid IL or missing references)
157 //IL_0131: Unknown result type (might be due to invalid IL or missing references)
158 //IL_013c: Unknown result type (might be due to invalid IL or missing references)
159 //IL_04bf: Unknown result type (might be due to invalid IL or missing references)
160 //IL_04c0: Unknown result type (might be due to invalid IL or missing references)
161 //IL_04c2: Unknown result type (might be due to invalid IL or missing references)
162 //IL_04c7: Unknown result type (might be due to invalid IL or missing references)
163 //IL_026b: Unknown result type (might be due to invalid IL or missing references)
164 //IL_027a: Unknown result type (might be due to invalid IL or missing references)
165 double num = random.Next(12, 21);
166 double num2 = random.Next(10, 21);
167 if (WorldGen.drunkWorldGen)
168 {
169 num = random.Next(8, 26);
170 num2 = random.Next(10, 41);
171 double num3 = (double)Main.maxTilesX / 4200.0;
172 num3 = (num3 + 1.0) / 2.0;
173 num *= num3;
174 num2 *= num3;
175 }
176 else if (WorldGen.remixWorldGen)
177 {
178 num += (double)random.Next(3);
179 }
180 double num4 = num;
181 Vector2D val = default(Vector2D);
182 val.X = i;
183 val.Y = j;
184 Vector2D val2 = default(Vector2D);
185 val2.X = (double)random.Next(-10, 11) * 0.2;
186 val2.Y = (double)random.Next(-10, 11) * 0.2;
187 while (num > 0.0 && num2 > 0.0)
188 {
189 if (val.Y > (double)(Main.maxTilesY - 250))
190 {
191 num2 = 0.0;
192 }
193 num = num4 * (1.0 + (double)random.Next(-20, 20) * 0.01);
194 num2 -= 1.0;
195 int num5 = (int)(val.X - num);
196 int num6 = (int)(val.X + num);
197 int num7 = (int)(val.Y - num);
198 int num8 = (int)(val.Y + num);
199 if (num5 < 1)
200 {
201 num5 = 1;
202 }
203 if (num6 > Main.maxTilesX - 1)
204 {
205 num6 = Main.maxTilesX - 1;
206 }
207 if (num7 < 1)
208 {
209 num7 = 1;
210 }
211 if (num8 > Main.maxTilesY - 1)
212 {
213 num8 = Main.maxTilesY - 1;
214 }
215 for (int k = num5; k < num6; k++)
216 {
217 for (int l = num7; l < num8; l++)
218 {
219 if (!WorldGen.InWorld(k, l, 50))
220 {
221 num2 = 0.0;
222 }
223 else
224 {
225 if (Main.tile[k - 10, l].wall == 87)
226 {
227 num2 = 0.0;
228 }
229 if (Main.tile[k + 10, l].wall == 87)
230 {
231 num2 = 0.0;
232 }
233 if (Main.tile[k, l - 10].wall == 87)
234 {
235 num2 = 0.0;
236 }
237 if (Main.tile[k, l + 10].wall == 87)
238 {
239 num2 = 0.0;
240 }
241 }
242 if ((double)l < Main.worldSurface && Main.tile[k, l - 5].wall == 0)
243 {
244 num2 = 0.0;
245 }
246 double num9 = Math.Abs((double)k - val.X);
247 double num10 = Math.Abs((double)l - val.Y);
248 double num11 = Math.Sqrt(num9 * num9 + num10 * num10);
249 if (num11 < num4 * 0.4 * (1.0 + (double)random.Next(-10, 11) * 0.005))
250 {
251 if (random.Next(3) == 0)
252 {
253 Main.tile[k, l].liquid = byte.MaxValue;
254 }
255 if (WorldGen.drunkWorldGen)
256 {
257 Main.tile[k, l].liquid = byte.MaxValue;
258 }
259 Main.tile[k, l].honey(honey: true);
260 Main.tile[k, l].wall = 86;
261 Main.tile[k, l].active(active: false);
262 Main.tile[k, l].halfBrick(halfBrick: false);
263 Main.tile[k, l].slope(0);
264 }
265 else if (num11 < num4 * 0.75 * (1.0 + (double)random.Next(-10, 11) * 0.005))
266 {
267 Main.tile[k, l].liquid = 0;
268 if (Main.tile[k, l].wall != 86)
269 {
270 Main.tile[k, l].active(active: true);
271 Main.tile[k, l].halfBrick(halfBrick: false);
272 Main.tile[k, l].slope(0);
273 Main.tile[k, l].type = 225;
274 }
275 }
276 if (num11 < num4 * 0.6 * (1.0 + (double)random.Next(-10, 11) * 0.005))
277 {
278 Main.tile[k, l].wall = 86;
279 if (WorldGen.drunkWorldGen && random.Next(2) == 0)
280 {
281 Main.tile[k, l].liquid = byte.MaxValue;
282 Main.tile[k, l].honey(honey: true);
283 }
284 }
285 }
286 }
287 val += val2;
288 num2 -= 1.0;
289 val2.Y += (double)random.Next(-10, 11) * 0.05;
290 val2.X += (double)random.Next(-10, 11) * 0.05;
291 }
292 return val;
293 }
static double Sqrt(double d)
static double Abs(double value)

References System.Math.Abs(), Terraria.WorldGen.drunkWorldGen, Terraria.WorldGen.InWorld(), Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.Utilities.UnifiedRandom.Next(), Terraria.WorldGen.remixWorldGen, System.Math.Sqrt(), Terraria.Main.tile, Terraria.Main.worldSurface, ReLogic.Utilities.Vector2D.X, and ReLogic.Utilities.Vector2D.Y.

Referenced by Terraria.GameContent.Biomes.HiveBiome.Place().