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

◆ CheckDrowning()

void Terraria.Player.CheckDrowning ( )
inline

Definition at line 21284 of file Player.cs.

21285 {
21286 //IL_0001: Unknown result type (might be due to invalid IL or missing references)
21287 //IL_03c2: Unknown result type (might be due to invalid IL or missing references)
21288 //IL_03df: Unknown result type (might be due to invalid IL or missing references)
21289 //IL_03e5: Unknown result type (might be due to invalid IL or missing references)
21290 //IL_035f: Unknown result type (might be due to invalid IL or missing references)
21291 //IL_037c: Unknown result type (might be due to invalid IL or missing references)
21292 //IL_0382: Unknown result type (might be due to invalid IL or missing references)
21293 bool flag = Collision.DrownCollision(position, width, height, gravDir);
21294 if (armor[0].type == 250 || armor[0].type == 4275)
21295 {
21296 flag = true;
21297 }
21298 if (inventory[selectedItem].type == 186 && itemAnimation == 0)
21299 {
21300 try
21301 {
21302 int num = (int)((position.X + (float)(width / 2) + (float)(6 * direction)) / 16f);
21303 int num2 = 0;
21304 if (gravDir == -1f)
21305 {
21306 num2 = height;
21307 }
21308 int num3 = (int)((position.Y + (float)num2 - 44f * gravDir) / 16f);
21309 if (Main.tile[num, num3] != null && Main.tile[num, num3].liquid < 128)
21310 {
21311 if (Main.tile[num, num3] == null)
21312 {
21313 Main.tile[num, num3] = default(Tile);
21314 }
21315 if (!Main.tile[num, num3].active() || !Main.tileSolid[Main.tile[num, num3].type] || Main.tileSolidTop[Main.tile[num, num3].type])
21316 {
21317 flag = false;
21318 }
21319 }
21320 }
21321 catch
21322 {
21323 }
21324 }
21325 if (gills)
21326 {
21327 flag = Main.getGoodWorld && !flag;
21328 }
21329 if (shimmering)
21330 {
21331 flag = false;
21332 }
21333 if (mount.Active && mount.Type == 4)
21334 {
21335 flag = false;
21336 }
21337 if (Main.myPlayer == whoAmI)
21338 {
21339 if (accMerman)
21340 {
21341 if (flag)
21342 {
21343 merman = true;
21344 }
21345 flag = false;
21346 }
21347 if (flag)
21348 {
21349 breathCD++;
21350 if (breathCD >= breathCDMax)
21351 {
21352 breathCD = 0;
21353 breath--;
21354 if (breath == 0)
21355 {
21357 }
21358 if (breath <= 0)
21359 {
21360 lifeRegenTime = 0f;
21361 breath = 0;
21362 statLife -= 2;
21363 if (statLife <= 0)
21364 {
21365 statLife = 0;
21366 KillMe(PlayerDeathReason.ByOther(1), 10.0, 0);
21367 }
21368 }
21369 }
21370 }
21371 else
21372 {
21373 breath += 3;
21374 if (breath > breathMax)
21375 {
21376 breath = breathMax;
21377 }
21378 breathCD = 0;
21379 }
21380 }
21381 if (flag && Main.rand.Next(20) == 0 && !lavaWet && !honeyWet)
21382 {
21383 int num4 = 0;
21384 if (gravDir == -1f)
21385 {
21386 num4 += height - 12;
21387 }
21388 if (inventory[selectedItem].type == 186)
21389 {
21390 Dust.NewDust(new Vector2(position.X + (float)(10 * direction) + 4f, position.Y + (float)num4 - 54f * gravDir), width - 8, 8, 34, 0f, 0f, 0, default(Color), 1.2f);
21391 }
21392 else
21393 {
21394 Dust.NewDust(new Vector2(position.X + (float)(12 * direction), position.Y + (float)num4 + 4f * gravDir), width - 8, 8, 34, 0f, 0f, 0, default(Color), 1.2f);
21395 }
21396 }
21397 }
static SlotId PlaySound(in SoundStyle? style, Vector2? position=null, SoundUpdateCallback? updateCallback=null)
Attempts to play a sound style with the provided sound style (if it's not null), and returns a valid ...
static PlayerDeathReason ByOther(int type, int playerIndex=-1)
bool honeyWet
Definition Entity.cs:61
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
bool Active
Definition Mount.cs:348
float lifeRegenTime
How effective this player's natural life regeneration should be. Resets whenever the player is hurt,...
Definition Player.cs:2146
Item[] armor
The player's armor and accessories. Indexes 0-2 hold head, chest, and legs armor while 10-12 hold the...
Definition Player.cs:1651
int statLife
The current health of this player. Capped at F:Terraria.Player.statLifeMax2. If you increase this v...
Definition Player.cs:2102
void KillMe(PlayerDeathReason damageSource, double dmg, int hitDirection, bool pvp=false)
Definition Player.cs:37626
Mount mount
This player's T:Terraria.Mount. Do not overwrite this value. Instead, call M:Terraria....
Definition Player.cs:2323
Item[] inventory
The player's normal inventory. Indexes 0-9 hold the hotbar items, 10-49 the rest of the main inventor...
Definition Player.cs:1767

References Terraria.Player.accMerman, Terraria.Mount.Active, Terraria.Player.armor, Terraria.Player.breath, Terraria.Player.breathCD, Terraria.Player.breathCDMax, Terraria.Player.breathMax, Terraria.DataStructures.PlayerDeathReason.ByOther(), Terraria.Entity.direction, Terraria.Collision.DrownCollision(), Terraria.Player.gills, Terraria.Player.gravDir, Terraria.Entity.height, Terraria.Entity.honeyWet, Terraria.Player.inventory, Terraria.Player.itemAnimation, Terraria.Player.KillMe(), Terraria.Entity.lavaWet, Terraria.Player.lifeRegenTime, Terraria.Player.merman, Terraria.Player.mount, Terraria.Main.myPlayer, Terraria.Dust.NewDust(), Terraria.Audio.SoundEngine.PlaySound(), Terraria.Entity.position, Terraria.Main.rand, Terraria.Player.selectedItem, Terraria.Player.shimmering, Terraria.Player.statLife, Terraria.Main.tile, Terraria.Main.tileSolid, Terraria.Main.tileSolidTop, Terraria.Mount.Type, Terraria.Entity.whoAmI, and Terraria.Entity.width.

Referenced by Terraria.Player.Update().

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