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

◆ CheckDrowning()

void Terraria.NPC.CheckDrowning ( )
inline

Definition at line 112169 of file NPC.cs.

112170 {
112171 //IL_0001: Unknown result type (might be due to invalid IL or missing references)
112172 //IL_017a: Unknown result type (might be due to invalid IL or missing references)
112173 //IL_0197: Unknown result type (might be due to invalid IL or missing references)
112174 //IL_019d: Unknown result type (might be due to invalid IL or missing references)
112175 bool flag = Collision.DrownCollision(position, width, height, 1f);
112176 if (Main.netMode != 1)
112177 {
112178 if (flag)
112179 {
112180 if (++breathCounter >= 7)
112181 {
112182 breathCounter = 0;
112183 breath--;
112184 if (breath <= 0)
112185 {
112186 friendlyRegen = 0;
112187 breath = 0;
112188 life -= 2;
112189 if (life % 24 < 2)
112190 {
112191 netUpdate = true;
112192 }
112193 if (life <= 0)
112194 {
112195 life = 1;
112196 StrikeNPCNoInteraction(2, 0f, 0);
112197 if (Main.netMode != 0)
112198 {
112199 NetMessage.SendData(28, -1, -1, null, whoAmI, 2f);
112200 }
112201 }
112202 }
112203 }
112204 }
112205 else
112206 {
112207 breath += 3;
112208 if (breath > 200)
112209 {
112210 breath = 200;
112211 }
112212 breathCounter = 0;
112213 }
112214 }
112215 if (flag && Main.rand.Next(20) == 0 && !lavaWet && !honeyWet && !shimmerWet)
112216 {
112217 int num = 0;
112218 int num2 = 0;
112219 if (type == 369)
112220 {
112221 num2 = 8;
112222 }
112223 Dust.NewDust(new Vector2(position.X + (float)((10 + num) * direction), position.Y + (float)num2 + 4f), width - 8, 8, 34, 0f, 0f, 0, default(Color), 1.2f);
112224 }
112225 }
bool honeyWet
Definition Entity.cs:61
bool shimmerWet
Definition Entity.cs:59
int whoAmI
The index of this Entity within its specific array. These arrays track the entities in the world....
Definition Entity.cs:16
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
int breath
Definition NPC.cs:1207
int friendlyRegen
Definition NPC.cs:1205
int breathCounter
Definition NPC.cs:1211
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 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
bool netUpdate
Definition NPC.cs:1130
int StrikeNPCNoInteraction(int Damage, float knockBack, int hitDirection)
Definition NPC.cs:91674

References Terraria.Collision.DrownCollision(), Terraria.Main.netMode, Terraria.Dust.NewDust(), Terraria.Main.rand, and Terraria.NetMessage.SendData().

+ Here is the call graph for this function: