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

◆ SpawnWOF()

static void Terraria.NPC.SpawnWOF ( Vector2 pos)
inlinestatic

Definition at line 90565 of file NPC.cs.

90566 {
90567 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
90568 //IL_0034: Unknown result type (might be due to invalid IL or missing references)
90569 //IL_0041: Unknown result type (might be due to invalid IL or missing references)
90570 //IL_005b: Unknown result type (might be due to invalid IL or missing references)
90571 //IL_02b0: Unknown result type (might be due to invalid IL or missing references)
90572 //IL_00f1: Unknown result type (might be due to invalid IL or missing references)
90573 if (pos.Y / 16f < (float)(Main.maxTilesY - 205) || Main.wofNPCIndex >= 0 || Main.netMode == 1 || AnyNPCs(113))
90574 {
90575 return;
90576 }
90577 Player.FindClosest(pos, 16, 16);
90578 int num = 1;
90579 if (pos.X / 16f > (float)(Main.maxTilesX / 2))
90580 {
90581 num = -1;
90582 }
90583 bool flag = false;
90584 int num3 = (int)pos.X;
90585 int targetPlayerIndex = 0;
90586 while (!flag)
90587 {
90588 flag = true;
90589 for (int i = 0; i < 255; i++)
90590 {
90591 if (Main.player[i].active && Main.player[i].position.X > (float)(num3 - 1200) && Main.player[i].position.X < (float)(num3 + 1200))
90592 {
90593 num3 -= num * 16;
90594 flag = false;
90596 }
90597 }
90598 if (num3 / 16 < 20 || num3 / 16 > Main.maxTilesX - 20)
90599 {
90600 flag = true;
90601 }
90602 }
90603 int num4 = (int)pos.Y;
90604 int num5 = num3 / 16;
90605 int num6 = num4 / 16;
90606 int num7 = 0;
90607 int num8 = 1000;
90608 if (!WorldGen.InWorld(num5, num6, 2) || WorldGen.SolidTile(num5, num6) || Main.tile[num5, num6 - num7].liquid >= 100)
90609 {
90610 while (true)
90611 {
90612 num8--;
90613 if (num8 <= 0)
90614 {
90615 break;
90616 }
90617 try
90618 {
90619 if (WorldGen.InWorld(num5, num6 - num7, 2) && !WorldGen.SolidTile(num5, num6 - num7) && Main.tile[num5, num6 - num7].liquid < 100)
90620 {
90621 num6 -= num7;
90622 break;
90623 }
90624 if (WorldGen.InWorld(num5, num6 + num7, 2) && !WorldGen.SolidTile(num5, num6 + num7) && Main.tile[num5, num6 + num7].liquid < 100)
90625 {
90626 num6 += num7;
90627 break;
90628 }
90629 num7++;
90630 }
90631 catch
90632 {
90633 break;
90634 }
90635 }
90636 }
90637 int num9 = Main.UnderworldLayer + 10;
90638 int num10 = num9 + 70;
90639 if (num6 < num9)
90640 {
90641 num6 = num9;
90642 }
90643 if (num6 > num10)
90644 {
90645 num6 = num10;
90646 }
90647 num4 = num6 * 16;
90649 if (Main.netMode == 0)
90650 {
90651 Main.NewText(Language.GetTextValue("Announcement.HasAwoken", Main.npc[num2].TypeName), 175, 75);
90652 }
90653 else if (Main.netMode == 2)
90654 {
90655 ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", Main.npc[num2].GetTypeNetName()), new Color(175, 75, 255));
90656 }
90657 }
static void BroadcastChatMessage(NetworkText text, Color color, int excludedPlayer=-1)
Definition ChatHelper.cs:51
static string GetTextValue(string key)
Retrieves the text value for a specified localization key. The text returned will be for the currentl...
Definition Language.cs:35
Contains methods to access or retrieve localization values. The Localization Guideteaches more about ...
Definition Language.cs:12
static NetworkText FromKey(string key, params object[] substitutions)
Creates a NetworkText object from a localization key and optional substitutions. The receiving client...
Represents text that will be sent over the network in multiplayer and displayed to the receiving user...
static bool AnyNPCs(int Type)
Returns true if there are any active NPC in the world of the given NPC type (F:Terraria....
Definition NPC.cs:106615
static int NewNPC(IEntitySource source, int X, int Y, int Type, int Start=0, float ai0=0f, float ai1=0f, float ai2=0f, float ai3=0f, int Target=255)
Spawns an NPC into the game world with the given type. This method should not be called on multipla...
Definition NPC.cs:91239
static IEntitySource GetBossSpawnSource(int targetPlayerIndex)
Definition NPC.cs:91144

References Terraria.Chat.ChatHelper.BroadcastChatMessage(), Terraria.Player.FindClosest(), Terraria.Localization.NetworkText.FromKey(), Terraria.Localization.Language.GetTextValue(), Terraria.WorldGen.InWorld(), Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.Main.netMode, Terraria.Main.NewText(), Terraria.Main.npc, Terraria.Main.player, Terraria.WorldGen.SolidTile(), Terraria.Main.tile, and Terraria.Main.wofNPCIndex.

Referenced by Terraria.Item.CheckLavaDeath(), and Terraria.NPC.DoDeathEvents().

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