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

◆ PullItem_Common()

void Terraria.Player.PullItem_Common ( Item itemToPickUp,
float xPullSpeed )
inlineprivate

Definition at line 33694 of file Player.cs.

33695 {
33696 if ((double)position.X + (double)width * 0.5 > (double)itemToPickUp.position.X + (double)itemToPickUp.width * 0.5)
33697 {
33698 if (itemToPickUp.velocity.X < itemGrabSpeedMax + velocity.X)
33699 {
33700 itemToPickUp.velocity.X += itemGrabSpeed;
33701 }
33702 if (itemToPickUp.velocity.X < 0f)
33703 {
33704 itemToPickUp.velocity.X += itemGrabSpeed * xPullSpeed;
33705 }
33706 }
33707 else
33708 {
33709 if (itemToPickUp.velocity.X > 0f - itemGrabSpeedMax + velocity.X)
33710 {
33711 itemToPickUp.velocity.X -= itemGrabSpeed;
33712 }
33713 if (itemToPickUp.velocity.X > 0f)
33714 {
33715 itemToPickUp.velocity.X -= itemGrabSpeed * xPullSpeed;
33716 }
33717 }
33718 if ((double)position.Y + (double)height * 0.5 > (double)itemToPickUp.position.Y + (double)itemToPickUp.height * 0.5)
33719 {
33720 if (itemToPickUp.velocity.Y < itemGrabSpeedMax)
33721 {
33722 itemToPickUp.velocity.Y += itemGrabSpeed;
33723 }
33724 if (itemToPickUp.velocity.Y < 0f)
33725 {
33726 itemToPickUp.velocity.Y += itemGrabSpeed * xPullSpeed;
33727 }
33728 }
33729 else
33730 {
33731 if (itemToPickUp.velocity.Y > 0f - itemGrabSpeedMax)
33732 {
33733 itemToPickUp.velocity.Y -= itemGrabSpeed;
33734 }
33735 if (itemToPickUp.velocity.Y > 0f)
33736 {
33737 itemToPickUp.velocity.Y -= itemGrabSpeed * xPullSpeed;
33738 }
33739 }
33740 }
Vector2 velocity
The velocity of this Entity in world coordinates per tick.
Definition Entity.cs:33
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
static float itemGrabSpeedMax
Definition Player.cs:2705
static float itemGrabSpeed
Definition Player.cs:2703

References Terraria.Entity.height, Terraria.Player.itemGrabSpeed, Terraria.Player.itemGrabSpeedMax, Terraria.Entity.position, Terraria.Entity.velocity, and Terraria.Entity.width.

Referenced by Terraria.Player.GrabItems().

+ Here is the caller graph for this function: