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

◆ PlayerInteraction()

void Terraria.NPC.PlayerInteraction ( int player)
inline

Definition at line 85611 of file NPC.cs.

85612 {
85613 if ((realLife < 0) ? (lastInteraction == player) : (Main.npc[realLife].lastInteraction == player))
85614 {
85615 return;
85616 }
85617 if (type == 13 || type == 14 || type == 15)
85618 {
85619 for (int i = 0; i < 200; i++)
85620 {
85621 if (i != whoAmI && Main.npc[i].active && (Main.npc[i].type == 13 || Main.npc[i].type == 14 || Main.npc[i].type == 15))
85622 {
85623 Main.npc[i].ApplyInteraction(player);
85624 }
85625 }
85626 }
85627 if (type == 134 || type == 135 || type == 136)
85628 {
85629 for (int j = 0; j < 200; j++)
85630 {
85631 if (j != whoAmI && Main.npc[j].active && (Main.npc[j].type == 134 || Main.npc[j].type == 135 || Main.npc[j].type == 136))
85632 {
85633 Main.npc[j].ApplyInteraction(player);
85634 }
85635 }
85636 }
85637 if (type == 35 || type == 36)
85638 {
85639 for (int k = 0; k < 200; k++)
85640 {
85641 if (k != whoAmI && Main.npc[k].active && (Main.npc[k].type == 35 || Main.npc[k].type == 36))
85642 {
85643 Main.npc[k].ApplyInteraction(player);
85644 }
85645 }
85646 }
85647 if (type == 113 || type == 114)
85648 {
85649 for (int l = 0; l < 200; l++)
85650 {
85651 if (l != whoAmI && Main.npc[l].active && (Main.npc[l].type == 113 || Main.npc[l].type == 114))
85652 {
85653 Main.npc[l].ApplyInteraction(player);
85654 }
85655 }
85656 }
85657 if (type >= 127 && type <= 131)
85658 {
85659 for (int m = 0; m < 200; m++)
85660 {
85661 if (m != whoAmI && Main.npc[m].active && Main.npc[m].type >= 127 && Main.npc[m].type <= 131)
85662 {
85663 Main.npc[m].ApplyInteraction(player);
85664 }
85665 }
85666 }
85667 if (type >= 245 && type <= 249)
85668 {
85669 for (int n = 0; n < 200; n++)
85670 {
85671 if (n != whoAmI && Main.npc[n].active && Main.npc[n].type >= 245 && Main.npc[n].type <= 249)
85672 {
85673 Main.npc[n].ApplyInteraction(player);
85674 }
85675 }
85676 }
85677 if ((type == 396 || type == 397) && Main.npc[(int)ai[3]].active && Main.npc[(int)ai[3]].type == 398)
85678 {
85679 Main.npc[(int)ai[3]].ApplyInteraction(player);
85680 }
85681 if ((type == 393 || type == 394) && Main.npc[(int)ai[0]].active && Main.npc[(int)ai[0]].type == 395)
85682 {
85683 Main.npc[(int)ai[0]].ApplyInteraction(player);
85684 }
85685 if (type == 492 && Main.npc[(int)ai[0]].active && Main.npc[(int)ai[0]].type == 491)
85686 {
85687 Main.npc[(int)ai[0]].ApplyInteraction(player);
85688 }
85689 if (type == 125 || type == 126)
85690 {
85691 for (int num = 0; num < 200; num++)
85692 {
85693 if (num != whoAmI && Main.npc[num].active && (Main.npc[num].type == 125 || Main.npc[num].type == 126))
85694 {
85695 Main.npc[num].ApplyInteraction(player);
85696 }
85697 }
85698 }
85699 ApplyInteraction(player);
85700 }
int whoAmI
The index of this Entity within its specific array. These arrays track the entities in the world....
Definition Entity.cs:16
bool active
If true, the Entity actually exists within the game world. Within the specific entity array,...
Definition Entity.cs:21
float[] ai
An array with 4 slots used for any sort of data storage, which is occasionally synced from the server...
Definition NPC.cs:997
void ApplyInteraction(int player)
Definition NPC.cs:85702
int type
The NPC ID of this NPC. The NPC ID is a unique number assigned to each NPC loaded into the game....
Definition NPC.cs:990
int lastInteraction
The F:Terraria.Entity.whoAmI of the T:Terraria.Player that last damaged this NPC. Used to award Banne...
Definition NPC.cs:536
int realLife
Stores the index (the F:Terraria.Entity.whoAmI) of a single NPC. This NPC will then share a health po...
Definition NPC.cs:604

References Terraria.Main.npc.