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

◆ TryFloatingInFluid()

void Terraria.Player.TryFloatingInFluid ( )
inlineprivate

Definition at line 21678 of file Player.cs.

21679 {
21680 //IL_0031: Unknown result type (might be due to invalid IL or missing references)
21681 //IL_0036: Unknown result type (might be due to invalid IL or missing references)
21682 //IL_0048: Unknown result type (might be due to invalid IL or missing references)
21683 if (!ShouldFloatInWater)
21684 {
21685 return;
21686 }
21687 if (whoAmI == Main.myPlayer && sitting.isSitting)
21688 {
21689 sitting.SitUp(this);
21690 }
21691 if (Collision.GetWaterLine(base.Center.ToTileCoordinates(), out var waterLineHeight))
21692 {
21693 float num = base.Center.Y;
21694 if (mount.Active && mount.Type == 37)
21695 {
21696 num -= 6f;
21697 }
21698 float num2 = num + 8f;
21699 if (num2 + velocity.Y < waterLineHeight)
21700 {
21701 return;
21702 }
21703 if (num > waterLineHeight)
21704 {
21705 velocity.Y -= 0.4f;
21706 if (velocity.Y < -6f)
21707 {
21708 velocity.Y = -6f;
21709 }
21710 return;
21711 }
21712 velocity.Y = waterLineHeight - num2;
21713 if (velocity.Y < -3f)
21714 {
21715 velocity.Y = -3f;
21716 }
21717 if (velocity.Y == 0f)
21718 {
21719 velocity.Y = float.Epsilon;
21720 }
21721 }
21722 else
21723 {
21724 velocity.Y -= 0.4f;
21725 }
21726 }
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
bool Active
Definition Mount.cs:348
PlayerSittingHelper sitting
Definition Player.cs:3009
bool ShouldFloatInWater
Definition Player.cs:4211
Mount mount
This player's T:Terraria.Mount. Do not overwrite this value. Instead, call M:Terraria....
Definition Player.cs:2323
void SitUp(Player player, bool multiplayerBroadcast=true)

References Terraria.Mount.Active, Terraria.Collision.GetWaterLine(), Terraria.GameContent.PlayerSittingHelper.isSitting, Terraria.Player.mount, Terraria.Main.myPlayer, Terraria.Player.ShouldFloatInWater, Terraria.Player.sitting, Terraria.GameContent.PlayerSittingHelper.SitUp(), Terraria.Mount.Type, Terraria.Entity.velocity, and Terraria.Entity.whoAmI.

Referenced by Terraria.Player.HoneyCollision(), Terraria.Player.ShimmerCollision(), and Terraria.Player.WaterCollision().

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