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

◆ TriggerLunarApocalypse()

static void Terraria.WorldGen.TriggerLunarApocalypse ( )
inlinestatic

Definition at line 80337 of file WorldGen.cs.

80338 {
80339 List<int> list = new List<int> { 517, 422, 507, 493 };
80340 int[] array = new int[4];
80341 for (int i = 0; i < 4; i++)
80342 {
80343 array[i] = list[Main.rand.Next(list.Count)];
80344 list.Remove(array[i]);
80345 }
80346 int num = Main.maxTilesX / 5;
80347 int num2 = (int)Main.worldSurface;
80348 for (int j = 0; j < 4; j++)
80349 {
80350 int num3 = num * (1 + j);
80351 bool flag = false;
80352 for (int k = 0; k < 30; k++)
80353 {
80354 int num4 = Main.rand.Next(-100, 101);
80355 if (Main.remixWorld && Main.getGoodWorld)
80356 {
80357 int num5 = Main.rand.Next((int)Main.worldSurface, Main.maxTilesY - 350);
80358 if (!PlayerLOS(num3 + num4 - 10, num5) && !PlayerLOS(num3 + num4 + 10, num5) && !PlayerLOS(num3 + num4 - 10, num5 - 20) && !PlayerLOS(num3 + num4 + 10, num5 - 20))
80359 {
80360 int num6 = NPC.NewNPC(new EntitySource_WorldEvent(), (num3 + num4) * 16, num5 * 16, array[j]);
80361 if (Main.netMode == 2 && num6 < 200)
80362 {
80363 NetMessage.SendData(23, -1, -1, null, num6);
80364 }
80365 flag = true;
80366 break;
80367 }
80368 continue;
80369 }
80370 for (int num7 = num2; num7 > 100; num7--)
80371 {
80372 if (!Collision.SolidTiles(num3 + num4 - 10, num3 + num4 + 10, num7 - 20, num7 + 15) && !PlayerLOS(num3 + num4 - 10, num7) && !PlayerLOS(num3 + num4 + 10, num7) && !PlayerLOS(num3 + num4 - 10, num7 - 20) && !PlayerLOS(num3 + num4 + 10, num7 - 20))
80373 {
80374 int num8 = NPC.NewNPC(new EntitySource_WorldEvent(), (num3 + num4) * 16, num7 * 16, array[j]);
80375 if (Main.netMode == 2 && num8 < 200)
80376 {
80377 NetMessage.SendData(23, -1, -1, null, num8);
80378 }
80379 flag = true;
80380 break;
80381 }
80382 }
80383 if (flag)
80384 {
80385 break;
80386 }
80387 }
80388 if (!flag)
80389 {
80390 NPC.NewNPC(new EntitySource_WorldEvent(), num3 * 16, (num2 - 40) * 16, array[j]);
80391 }
80392 }
80393 NPC.TowerActiveVortex = (NPC.TowerActiveNebula = (NPC.TowerActiveSolar = (NPC.TowerActiveStardust = true)));
80394 NPC.LunarApocalypseIsUp = true;
80395 NPC.ShieldStrengthTowerSolar = (NPC.ShieldStrengthTowerVortex = (NPC.ShieldStrengthTowerNebula = (NPC.ShieldStrengthTowerStardust = NPC.ShieldStrengthTowerMax)));
80396 NetMessage.SendData(101);
80398 }
Inconsistently used by vanilla when spawning more exotic things like the lunatic pillars,...
static void MessageLunarApocalypse()
static bool PlayerLOS(int x, int y)

References Terraria.Main.getGoodWorld, Terraria.Main.netMode, Terraria.NPC.NewNPC(), Terraria.Main.rand, Terraria.Main.remixWorld, Terraria.NetMessage.SendData(), Terraria.NPC.ShieldStrengthTowerMax, Terraria.Collision.SolidTiles(), and Terraria.Main.worldSurface.

Referenced by Terraria.NPC.DoDeathEvents().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: