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

◆ BigMimicSummonCheck()

static bool Terraria.NPC.BigMimicSummonCheck ( int x,
int y,
Player user )
inlinestatic

Definition at line 82979 of file NPC.cs.

82980 {
82981 if (Main.netMode == 1 || !Main.hardMode)
82982 {
82983 return false;
82984 }
82985 int num = Chest.FindChest(x, y);
82986 if (num < 0)
82987 {
82988 return false;
82989 }
82990 int num2 = 0;
82991 int num3 = 0;
82992 int num4 = 0;
82993 for (int i = 0; i < 40; i++)
82994 {
82995 ushort num5 = Main.tile[Main.chest[num].x, Main.chest[num].y].type;
82996 int num6 = Main.tile[Main.chest[num].x, Main.chest[num].y].frameX / 36;
82997 if (TileID.Sets.BasicChest[num5] && (num5 != 21 || num6 < 5 || num6 > 6) && Main.chest[num].item[i] != null && Main.chest[num].item[i].type > 0)
82998 {
82999 if (Main.chest[num].item[i].type == 3092)
83000 {
83001 num2 += Main.chest[num].item[i].stack;
83002 }
83003 else if (Main.chest[num].item[i].type == 3091)
83004 {
83005 num3 += Main.chest[num].item[i].stack;
83006 }
83007 else
83008 {
83009 num4++;
83010 }
83011 }
83012 }
83013 if (num4 == 0 && num2 + num3 == 1)
83014 {
83015 _ = 1;
83016 if (TileID.Sets.BasicChest[Main.tile[x, y].type])
83017 {
83018 if (Main.tile[x, y].frameX % 36 != 0)
83019 {
83020 x--;
83021 }
83022 if (Main.tile[x, y].frameY % 36 != 0)
83023 {
83024 y--;
83025 }
83026 int number = Chest.FindChest(x, y);
83027 for (int j = 0; j < 40; j++)
83028 {
83029 Main.chest[num].item[j] = new Item();
83030 }
83031 Chest.DestroyChest(x, y);
83032 for (int k = x; k <= x + 1; k++)
83033 {
83034 for (int l = y; l <= y + 1; l++)
83035 {
83036 if (TileID.Sets.BasicChest[Main.tile[k, l].type])
83037 {
83038 Main.tile[k, l].ClearTile();
83039 }
83040 }
83041 }
83042 int number2 = 1;
83043 if (Main.tile[x, y].type == 467)
83044 {
83045 number2 = 5;
83046 }
83047 if (Main.tile[x, y].type >= TileID.Count)
83048 {
83049 number2 = 101;
83050 }
83051 NetMessage.SendData(34, -1, -1, null, number2, x, y, 0f, number, Main.tile[x, y].type);
83052 NetMessage.SendTileSquare(-1, x, y, 3);
83053 }
83054 int num7 = 475;
83055 if (num3 == 1)
83056 {
83057 num7 = ((!WorldGen.crimson) ? 473 : 474);
83058 }
83059 int num8 = NewNPC(user.GetNPCSource_TileInteraction(x, y), x * 16 + 16, y * 16 + 32, num7);
83060 Main.npc[num8].whoAmI = num8;
83061 NetMessage.SendData(23, -1, -1, null, num8);
83062 Main.npc[num8].BigMimicSpawnSmoke();
83063 }
83064 return false;
83065 }
static bool[] BasicChest
Definition TileID.cs:290
static readonly ushort Count
Definition TileID.cs:1928
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

References Terraria.ID.TileID.Sets.BasicChest, Terraria.Main.chest, Terraria.ID.TileID.Count, Terraria.WorldGen.crimson, Terraria.Chest.DestroyChest(), Terraria.Chest.FindChest(), Terraria.Main.hardMode, Terraria.Main.netMode, Terraria.NPC.NewNPC(), Terraria.Main.npc, Terraria.NetMessage.SendData(), Terraria.NetMessage.SendTileSquare(), and Terraria.Main.tile.

Referenced by Terraria.Player.Update().

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