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

◆ CanSnapToPosition()

bool Terraria.Player.CanSnapToPosition ( Vector2 offset)
inline

Definition at line 31571 of file Player.cs.

31572 {
31573 //IL_0001: Unknown result type (might be due to invalid IL or missing references)
31574 //IL_0006: Unknown result type (might be due to invalid IL or missing references)
31575 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
31576 //IL_0022: Unknown result type (might be due to invalid IL or missing references)
31577 //IL_0034: Unknown result type (might be due to invalid IL or missing references)
31578 //IL_0039: Unknown result type (might be due to invalid IL or missing references)
31579 //IL_003a: Unknown result type (might be due to invalid IL or missing references)
31580 //IL_005b: Unknown result type (might be due to invalid IL or missing references)
31581 //IL_0061: Unknown result type (might be due to invalid IL or missing references)
31582 //IL_0066: Unknown result type (might be due to invalid IL or missing references)
31583 //IL_0067: Unknown result type (might be due to invalid IL or missing references)
31584 //IL_0074: Unknown result type (might be due to invalid IL or missing references)
31585 //IL_0099: Unknown result type (might be due to invalid IL or missing references)
31586 //IL_009e: Unknown result type (might be due to invalid IL or missing references)
31587 //IL_00b4: Unknown result type (might be due to invalid IL or missing references)
31588 //IL_00b9: Unknown result type (might be due to invalid IL or missing references)
31589 //IL_00c5: Unknown result type (might be due to invalid IL or missing references)
31590 //IL_00ca: Unknown result type (might be due to invalid IL or missing references)
31591 //IL_00cb: Unknown result type (might be due to invalid IL or missing references)
31592 //IL_00d1: Unknown result type (might be due to invalid IL or missing references)
31593 //IL_00d6: Unknown result type (might be due to invalid IL or missing references)
31594 //IL_00d7: Unknown result type (might be due to invalid IL or missing references)
31595 if (Collision.SolidCollision(position + offset, width, height))
31596 {
31597 return false;
31598 }
31599 bool canSnapToPosition = Collision.CanHit(position, width, height, position + offset, width, height);
31600 if (!canSnapToPosition)
31601 {
31603 if (!canSnapToPosition)
31604 {
31605 int num = Math.Sign(offset.X);
31606 if (num != 0)
31607 {
31608 Vector2 vector = default(Vector2);
31609 ((Vector2)(ref vector))._002Ector((float)(num * width), 0f);
31610 if (Collision.TileCollision(position, vector, width, height, fallThrough: true, fall2: true, (int)gravDir) == vector)
31611 {
31613 }
31614 }
31615 }
31616 }
31617 return canSnapToPosition;
31618 }
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
void TryAllowingSnappingToPosition(ref bool canSnapToPosition, Vector2 pos1, Vector2 pos2)
Definition Player.cs:31620

References Terraria.Collision.CanHit(), Terraria.Player.gravDir, Terraria.Entity.height, Terraria.Entity.position, Terraria.Collision.SolidCollision(), Terraria.Collision.TileCollision(), Terraria.Player.TryAllowingSnappingToPosition(), and Terraria.Entity.width.

Referenced by Terraria.Player.PetAnimal(), Terraria.GameContent.PlayerSittingHelper.SitDown(), and Terraria.GameContent.PlayerSleepingHelper.StartSleeping().

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