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

◆ Transform()

void Terraria.NPC.Transform ( int newType)
inline

Definition at line 91590 of file NPC.cs.

91591 {
91592 //IL_008f: Unknown result type (might be due to invalid IL or missing references)
91593 //IL_0094: Unknown result type (might be due to invalid IL or missing references)
91594 //IL_00db: Unknown result type (might be due to invalid IL or missing references)
91595 //IL_00dd: Unknown result type (might be due to invalid IL or missing references)
91596 if (Main.netMode != 1)
91597 {
91598 int num = extraValue;
91599 bool flag = false;
91600 if (value == 0f)
91601 {
91602 flag = true;
91603 }
91604 int[] array = new int[maxBuffs];
91605 int[] array2 = new int[maxBuffs];
91606 for (int i = 0; i < maxBuffs; i++)
91607 {
91608 array[i] = buffType[i];
91609 array2[i] = buffTime[i];
91610 }
91611 float num2 = shimmerTransparency;
91612 _ = height;
91613 int oldType = type;
91614 int num3 = life;
91615 int num4 = lifeMax;
91616 Vector2 vector = velocity;
91617 position.Y += height;
91618 int num5 = spriteDirection;
91623 TargetClosest();
91624 velocity = vector;
91625 position.Y -= height;
91626 for (int j = 0; j < maxBuffs; j++)
91627 {
91628 buffType[j] = array[j];
91629 buffTime[j] = array2[j];
91630 }
91631 if (flag)
91632 {
91633 value = 0f;
91634 }
91635 if (lifeMax == num4)
91636 {
91637 life = num3;
91638 }
91640 switch (newType)
91641 {
91642 case 107:
91643 case 108:
91644 case 124:
91645 case 353:
91646 case 369:
91647 case 550:
91648 case 588:
91649 case 679:
91650 case 680:
91651 case 683:
91652 case 684:
91653 UpdateHomeTileState(homeless: true, (int)(position.X + (float)(width / 2)) / 16, (int)(position.Y + (float)height) / 16);
91654 break;
91655 }
91656 extraValue = num;
91657 if (Main.netMode == 2)
91658 {
91659 netUpdate = true;
91660 NetMessage.SendData(23, -1, -1, null, whoAmI);
91661 NetMessage.SendData(54, -1, -1, null, whoAmI);
91662 }
91665 if (townNPC)
91666 {
91667 homeless = true;
91668 WorldGen.CheckAchievement_RealEstateAndTownSlimes();
91669 }
91670 altTexture = 0;
91671 }
91672 }
int whoAmI
The index of this Entity within its specific array. These arrays track the entities in the world....
Definition Entity.cs:16
Vector2 velocity
The velocity of this Entity in world coordinates per tick.
Definition Entity.cs:33
Vector2 position
The position of this Entity in world coordinates.
Definition Entity.cs:28
int width
The width of this Entity's hitbox, in pixels.
Definition Entity.cs:46
int height
The height of this Entity's hitbox, in pixels.
Definition Entity.cs:51
static void GiveTownUniqueDataToNPCsThatNeedIt(int Type, int nextNPC)
Definition NPC.cs:91316
int spriteDirection
Definition NPC.cs:1143
static readonly int maxBuffs
Definition NPC.cs:647
int lifeMax
The maximum life of this NPC.
Definition NPC.cs:1077
void TargetClosest(bool faceTarget=true)
Definition NPC.cs:83247
void UpdateHomeTileState(bool homeless, int x, int y)
Definition NPC.cs:56221
int[] buffTime
Definition NPC.cs:651
bool SpawnedFromStatue
Definition NPC.cs:484
int extraValue
Definition NPC.cs:1158
float value
How many copper coins the NPC will drop when killed (100 copper coins = 1 silver coin etc....
Definition NPC.cs:1156
void SetDefaultsKeepPlayerInteraction(int Type)
Definition NPC.cs:3343
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 altTexture
Definition NPC.cs:498
void TransformVisuals(int oldType, int newType)
Definition NPC.cs:91412
float shimmerTransparency
Definition NPC.cs:643
bool homeless
Definition NPC.cs:1178
int life
The current life of the NPC. Automatically set to the value of F:Terraria.NPC.lifeMax at the end of S...
Definition NPC.cs:1072
int[] buffType
Definition NPC.cs:649
bool netUpdate
Definition NPC.cs:1130
bool townNPC
Definition NPC.cs:1174

References Terraria.WorldGen.CheckAchievement_RealEstateAndTownSlimes(), Terraria.Main.netMode, and Terraria.NetMessage.SendData().

Referenced by Terraria.NPC.AI_000_TransformBoundNPC(), Terraria.NPC.AI_003_Fighters(), Terraria.NPC.AI_007_TownEntities(), and Terraria.NPC.VanillaAI_Inner().

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