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

◆ TryFloatingInFluid()

void Terraria.Player.TryFloatingInFluid ( )
inlineprivate

Definition at line 22509 of file Player.cs.

22510 {
22511 if (!ShouldFloatInWater)
22512 {
22513 return;
22514 }
22515 if (whoAmI == Main.myPlayer && sitting.isSitting)
22516 {
22517 sitting.SitUp(this);
22518 }
22519 if (Collision.GetWaterLine(base.Center.ToTileCoordinates(), out var waterLineHeight))
22520 {
22521 float num = base.Center.Y;
22522 if (mount.Active && mount.Type == 37)
22523 {
22524 num -= 6f;
22525 }
22526 float num2 = num + 8f;
22528 {
22529 return;
22530 }
22531 if (num > waterLineHeight)
22532 {
22533 velocity.Y -= 0.4f;
22534 if (velocity.Y < -6f)
22535 {
22536 velocity.Y = -6f;
22537 }
22538 return;
22539 }
22540 velocity.Y = waterLineHeight - num2;
22541 if (velocity.Y < -3f)
22542 {
22543 velocity.Y = -3f;
22544 }
22545 if (velocity.Y == 0f)
22546 {
22547 velocity.Y = float.Epsilon;
22548 }
22549 }
22550 else
22551 {
22552 velocity.Y -= 0.4f;
22553 }
22554 }
Vector2 velocity
Definition Entity.cs:16
bool Active
Definition Mount.cs:345
PlayerSittingHelper sitting
Definition Player.cs:2463
bool ShouldFloatInWater
Definition Player.cs:3348
void SitUp(Player player, bool multiplayerBroadcast=true)

References Terraria.Collision.GetWaterLine(), and Terraria.Main.myPlayer.