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

◆ PlaceClustersArea()

static void Terraria.GameContent.Biomes.Desert.DesertHive.PlaceClustersArea ( DesertDescription description,
ClusterGroup clusters,
Rectangle area,
PostPlacementEffect postEffectMap[,],
Point postEffectMapOffset )
inlinestaticprivate

Definition at line 232 of file DesertHive.cs.

233 {
234 //IL_0054: Unknown result type (might be due to invalid IL or missing references)
235 //IL_0062: Unknown result type (might be due to invalid IL or missing references)
236 //IL_0067: Unknown result type (might be due to invalid IL or missing references)
237 //IL_00fc: Unknown result type (might be due to invalid IL or missing references)
238 //IL_0101: Unknown result type (might be due to invalid IL or missing references)
239 //IL_0102: Unknown result type (might be due to invalid IL or missing references)
240 //IL_0107: Unknown result type (might be due to invalid IL or missing references)
241 //IL_0108: Unknown result type (might be due to invalid IL or missing references)
242 //IL_010d: Unknown result type (might be due to invalid IL or missing references)
243 //IL_010e: Unknown result type (might be due to invalid IL or missing references)
244 //IL_0113: Unknown result type (might be due to invalid IL or missing references)
245 //IL_012f: Unknown result type (might be due to invalid IL or missing references)
246 //IL_0139: Unknown result type (might be due to invalid IL or missing references)
247 //IL_0227: Unknown result type (might be due to invalid IL or missing references)
248 //IL_022c: Unknown result type (might be due to invalid IL or missing references)
249 //IL_022d: Unknown result type (might be due to invalid IL or missing references)
250 //IL_0232: Unknown result type (might be due to invalid IL or missing references)
251 //IL_0233: Unknown result type (might be due to invalid IL or missing references)
252 //IL_0241: Unknown result type (might be due to invalid IL or missing references)
253 //IL_0246: Unknown result type (might be due to invalid IL or missing references)
254 //IL_024b: Unknown result type (might be due to invalid IL or missing references)
255 //IL_0250: Unknown result type (might be due to invalid IL or missing references)
256 //IL_015c: Unknown result type (might be due to invalid IL or missing references)
257 //IL_0166: Unknown result type (might be due to invalid IL or missing references)
258 //IL_01aa: Unknown result type (might be due to invalid IL or missing references)
259 //IL_01af: Unknown result type (might be due to invalid IL or missing references)
260 FastRandom fastRandom = new FastRandom(Main.ActiveWorldFileData.Seed).WithModifier(57005uL);
261 Vector2D val = default(Vector2D);
262 ((Vector2D)(ref val))._002Ector((double)description.Hive.Width, (double)description.Hive.Height);
263 Vector2D val2 = default(Vector2D);
264 ((Vector2D)(ref val2))._002Ector((double)clusters.Width, (double)clusters.Height);
265 Vector2D val3 = description.BlockScale / 2.0;
266 for (int i = area.Left; i < area.Right; i++)
267 {
268 for (int j = area.Top; j < area.Bottom; j++)
269 {
270 byte liquid = Main.tile[i, j].liquid;
271 if (!WorldGen.InWorld(i, j, 1))
272 {
273 continue;
274 }
275 double num = 0.0;
276 int num2 = -1;
277 double num3 = 0.0;
278 ushort type = 53;
279 if (fastRandom.Next(3) == 0)
280 {
281 type = 397;
282 }
283 int num4 = i - description.Hive.X;
284 int num5 = j - description.Hive.Y;
285 Vector2D val4 = (new Vector2D((double)num4, (double)num5) - val3) / val * val2;
286 for (int k = 0; k < clusters.Count; k++)
287 {
289 if (Math.Abs(cluster[0].Position.X - val4.X) > 10.0 || Math.Abs(cluster[0].Position.Y - val4.Y) > 10.0)
290 {
291 continue;
292 }
293 double num6 = 0.0;
294 foreach (Block item in cluster)
295 {
296 num6 += 1.0 / Vector2D.DistanceSquared(item.Position, val4);
297 }
298 if (num6 > num)
299 {
300 if (num > num3)
301 {
302 num3 = num;
303 }
304 num = num6;
305 num2 = k;
306 }
307 else if (num6 > num3)
308 {
309 num3 = num6;
310 }
311 }
312 double num7 = num + num3;
313 Tile tile = Main.tile[i, j];
314 Vector2D val5 = (new Vector2D((double)num4, (double)num5) - val3) / val * 2.0 - Vector2D.One;
315 bool flag = ((Vector2D)(ref val5)).Length() >= 0.8;
317 bool flag2 = true;
318 if (num7 > 3.5)
319 {
321 tile.ClearEverything();
322 if (!WorldGen.remixWorldGen || !((double)j > Main.rockLayer + (double)WorldGen.genRand.Next(-1, 2)))
323 {
324 tile.wall = 187;
325 if (num2 % 15 == 2)
326 {
327 tile.ResetToType(404);
328 }
329 }
330 }
331 else if (num7 > 1.8)
332 {
333 if (!WorldGen.remixWorldGen || !((double)j > Main.rockLayer + (double)WorldGen.genRand.Next(-1, 2)))
334 {
335 tile.wall = 187;
336 }
337 if ((double)j < Main.worldSurface)
338 {
339 tile.liquid = 0;
340 }
341 else if (!WorldGen.remixWorldGen)
342 {
343 tile.lava(lava: true);
344 }
345 if (!flag || tile.active())
346 {
347 tile.ResetToType(396);
349 }
350 }
351 else if (num7 > 0.7 || !flag)
352 {
353 if (!WorldGen.remixWorldGen || !((double)j > Main.rockLayer + (double)WorldGen.genRand.Next(-1, 2)))
354 {
355 tile.wall = 216;
356 tile.liquid = 0;
357 }
358 if (!flag || tile.active())
359 {
360 tile.ResetToType(type);
362 }
363 }
364 else if (num7 > 0.25)
365 {
366 FastRandom fastRandom2 = fastRandom.WithModifier(num4, num5);
367 double num8 = (num7 - 0.25) / 0.45;
368 if (fastRandom2.NextDouble() < num8)
369 {
370 if (!WorldGen.remixWorldGen || !((double)j > Main.rockLayer + (double)WorldGen.genRand.Next(-1, 2)))
371 {
372 tile.wall = 187;
373 }
374 if ((double)j < Main.worldSurface)
375 {
376 tile.liquid = 0;
377 }
378 else if (!WorldGen.remixWorldGen)
379 {
380 tile.lava(lava: true);
381 }
382 if (tile.active())
383 {
384 tile.ResetToType(type);
386 }
387 }
388 }
389 else
390 {
391 flag2 = false;
392 }
393 if (flag2)
394 {
395 WorldGen.UpdateDesertHiveBounds(i, j);
396 }
398 if (WorldGen.remixWorldGen)
399 {
400 Main.tile[i, j].liquid = liquid;
401 }
402 }
403 }
404 }
static double Abs(double value)
static double DistanceSquared(Vector2D value1, Vector2D value2)
Definition Vector2D.cs:151
static Vector2D One
Definition Vector2D.cs:26
FastRandom WithModifier(ulong modifier)
Definition FastRandom.cs:27

References System.Math.Abs(), Terraria.Tile.active(), Terraria.Main.ActiveWorldFileData, Terraria.Tile.ClearEverything(), System.Collections.Generic.Dictionary< TKey, TValue >.Count, ReLogic.Utilities.Vector2D.DistanceSquared(), Terraria.WorldGen.genRand, Microsoft.Xna.Framework.Rectangle.Height, Terraria.GameContent.Biomes.Desert.DesertDescription.Hive, Terraria.WorldGen.InWorld(), System.item, Terraria.Tile.lava(), ReLogic.Utilities.Vector2D.One, Terraria.WorldGen.remixWorldGen, Terraria.Tile.ResetToType(), Terraria.Main.rockLayer, Terraria.Main.tile, System.type, Terraria.WorldGen.UpdateDesertHiveBounds(), Microsoft.Xna.Framework.Rectangle.Width, Terraria.Utilities.FastRandom.WithModifier(), Terraria.Main.worldSurface, Microsoft.Xna.Framework.Rectangle.X, and Microsoft.Xna.Framework.Rectangle.Y.

Referenced by Terraria.GameContent.Biomes.Desert.DesertHive.PlaceClusters().