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

◆ DryCollision()

void Terraria.Player.DryCollision ( bool fallThrough,
bool ignorePlats )
inline

Definition at line 22556 of file Player.cs.

22557 {
22558 int num = ((!onTrack) ? height : (height - 10));
22559 if (velocity.Length() > 16f)
22560 {
22561 Vector2 vector = Collision.TileCollision(position, velocity, width, num, fallThrough, ignorePlats, (int)gravDir);
22562 float num2 = velocity.Length();
22564 if (vector.Y == 0f)
22565 {
22566 vector2.Y = 0f;
22567 }
22569 bool flag = mount.Type == 7 || mount.Type == 8 || mount.Type == 12 || mount.Type == 44 || mount.Type == 49;
22570 _ = Vector2.Zero;
22571 while (num2 > 0f)
22572 {
22573 float num3 = num2;
22574 if (num3 > 16f)
22575 {
22576 num3 = 16f;
22577 }
22578 num2 -= num3;
22580 velocity = vector3;
22582 vector3 = velocity;
22583 if (velocity.Y == gravity && (!mount.Active || (!mount.Cart && mount.Type != 48 && !flag)))
22584 {
22585 Collision.StepDown(ref position, ref vector3, width, height, ref stepSpeed, ref gfxOffY, (int)gravDir, waterWalk || waterWalk2);
22586 }
22587 if (gravDir == -1f)
22588 {
22589 if ((carpetFrame != -1 || velocity.Y <= gravity) && !controlUp)
22590 {
22591 Collision.StepUp(ref position, ref vector3, width, height, ref stepSpeed, ref gfxOffY, (int)gravDir, controlUp);
22592 }
22593 }
22594 else if (flag || ((carpetFrame != -1 || velocity.Y >= gravity) && !controlDown && !mount.Cart))
22595 {
22596 Collision.StepUp(ref position, ref vector3, width, height, ref stepSpeed, ref gfxOffY, (int)gravDir, controlUp);
22597 }
22598 Vector2 vector4 = Collision.TileCollision(position, vector3, width, num, fallThrough, ignorePlats, (int)gravDir);
22599 if (Collision.up && gravDir == 1f)
22600 {
22601 jump = 0;
22602 }
22603 if (waterWalk || waterWalk2)
22604 {
22606 vector4 = Collision.WaterCollision(position, vector4, width, height, fallThrough, fall2: false, waterWalk);
22607 if (vector5 != velocity)
22608 {
22609 fallStart = (int)(position.Y / 16f);
22610 }
22611 }
22612 position += vector4;
22613 bool falling = false;
22614 if (vector4.Y > gravity)
22615 {
22616 falling = true;
22617 }
22618 if (vector4.Y < 0f - gravity)
22619 {
22620 falling = true;
22621 }
22622 velocity = vector4;
22624 TryBouncingBlocks(falling);
22627 Collision.StepConveyorBelt(this, gravDir);
22628 vector4 = velocity;
22629 zero += vector4;
22630 }
22631 velocity = zero;
22632 return;
22633 }
22634 velocity = Collision.TileCollision(position, velocity, width, num, fallThrough, ignorePlats, (int)gravDir);
22635 if (Collision.up && gravDir == 1f)
22636 {
22637 jump = 0;
22638 }
22639 if (waterWalk || waterWalk2)
22640 {
22642 velocity = Collision.WaterCollision(position, velocity, width, height, fallThrough, fall2: false, waterWalk);
22643 if (vector6 != velocity)
22644 {
22645 fallStart = (int)(position.Y / 16f);
22646 }
22647 }
22648 position += velocity;
22649 }
Vector2 velocity
Definition Entity.cs:16
Vector2 position
Definition Entity.cs:14
bool Active
Definition Mount.cs:345
float stepSpeed
Definition Player.cs:1303
void SlopingCollision(bool fallThrough, bool ignorePlats)
Definition Player.cs:22725
void UpdateTouchingTiles()
Definition Player.cs:53670
void SlopeDownMovement()
Definition Player.cs:22431
void TryBouncingBlocks(bool Falling)
Definition Player.cs:33032
void TryLandingOnDetonator()
Definition Player.cs:33018

References Microsoft.Xna.Framework.Vector2.Normalize(), Terraria.Collision.StepConveyorBelt(), Terraria.Collision.StepDown(), Terraria.Collision.StepUp(), Terraria.Collision.TileCollision(), Terraria.Collision.up, Terraria.Collision.WaterCollision(), and Microsoft.Xna.Framework.Vector2.Zero.