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

◆ CheckLavaDeath()

void Terraria.Item.CheckLavaDeath ( int i)
inlineprivate

Definition at line 48637 of file Item.cs.

48638 {
48639 if (type == 267)
48640 {
48641 if (Main.netMode == 1)
48642 {
48643 return;
48644 }
48645 int num = stack;
48646 active = false;
48647 type = 0;
48648 stack = 0;
48649 bool flag = false;
48650 for (int j = 0; j < 200; j++)
48651 {
48652 if (Main.npc[j].active && Main.npc[j].type == 22)
48653 {
48654 int num2 = -Main.npc[j].direction;
48655 if (Main.npc[j].IsNPCValidForBestiaryKillCredit())
48656 {
48657 Main.BestiaryTracker.Kills.RegisterKill(Main.npc[j]);
48658 }
48659 Main.npc[j].StrikeNPCNoInteraction(9999, 10f, -num2);
48660 num--;
48661 flag = true;
48662 if (Main.netMode == 2)
48663 {
48664 NetMessage.SendData(28, -1, -1, null, j, 9999f, 10f, -num2);
48665 }
48666 NPC.SpawnWOF(position);
48667 }
48668 }
48669 if (flag)
48670 {
48671 List<int> list = new List<int>();
48672 for (int k = 0; k < 200; k++)
48673 {
48674 if (num <= 0)
48675 {
48676 break;
48677 }
48678 NPC nPC = Main.npc[k];
48679 if (nPC.active && nPC.isLikeATownNPC)
48680 {
48681 list.Add(k);
48682 }
48683 }
48684 while (num > 0 && list.Count > 0)
48685 {
48686 int index = Main.rand.Next(list.Count);
48687 int num3 = list[index];
48688 list.RemoveAt(index);
48689 int num4 = -Main.npc[num3].direction;
48690 if (Main.npc[num3].IsNPCValidForBestiaryKillCredit())
48691 {
48692 Main.BestiaryTracker.Kills.RegisterKill(Main.npc[num3]);
48693 }
48694 Main.npc[num3].StrikeNPCNoInteraction(9999, 10f, -num4);
48695 num--;
48696 if (Main.netMode == 2)
48697 {
48698 NetMessage.SendData(28, -1, -1, null, num3, 9999f, 10f, -num4);
48699 }
48700 }
48701 }
48702 NetMessage.SendData(21, -1, -1, null, i);
48703 }
48704 else if (playerIndexTheItemIsReservedFor == Main.myPlayer && rare == 0 && type >= 0 && type < ItemID.Count && !ItemID.Sets.IsLavaImmuneRegardlessOfRarity[type])
48705 {
48706 active = false;
48707 type = 0;
48708 stack = 0;
48709 if (Main.netMode != 0)
48710 {
48711 NetMessage.SendData(21, -1, -1, null, i);
48712 }
48713 }
48714 }
void Add(TKey key, TValue value)
Vector2 position
Definition Entity.cs:14
static bool[] IsLavaImmuneRegardlessOfRarity
Definition ItemID.cs:51
static readonly short Count
Definition ItemID.cs:12138
int stack
Definition Item.cs:149
int playerIndexTheItemIsReservedFor
Definition Item.cs:231

References Terraria.Entity.active, Terraria.Main.BestiaryTracker, Terraria.ID.ItemID.Count, System.index, Terraria.ID.ItemID.Sets.IsLavaImmuneRegardlessOfRarity, System.list, Terraria.Main.myPlayer, Terraria.Main.netMode, Terraria.Main.npc, Terraria.Item.playerIndexTheItemIsReservedFor, Terraria.Entity.position, Terraria.Main.rand, Terraria.Item.rare, Terraria.NetMessage.SendData(), Terraria.NPC.SpawnWOF(), Terraria.Item.stack, and Terraria.Item.type.

Referenced by Terraria.Item.UpdateItem().