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

◆ DropSelectedItem() [2/2]

void Terraria.Player.DropSelectedItem ( int slot,
ref Item theItemWeDrop )
inline

Definition at line 5573 of file Player.cs.

5574 {
5575 //IL_00da: Unknown result type (might be due to invalid IL or missing references)
5576 //IL_00ff: Unknown result type (might be due to invalid IL or missing references)
5577 //IL_0104: Unknown result type (might be due to invalid IL or missing references)
5578 //IL_00b5: Unknown result type (might be due to invalid IL or missing references)
5579 //IL_00c8: Unknown result type (might be due to invalid IL or missing references)
5580 bool flag = false;
5581 if (theItemWeDrop.favorited)
5582 {
5583 theItemWeDrop = GetItem(whoAmI, theItemWeDrop, GetItemSettings.GetItemInDropItemCheck);
5584 if (slot == 58)
5585 {
5586 Main.mouseItem = theItemWeDrop;
5587 }
5588 Recipe.FindRecipes();
5589 if (theItemWeDrop.type == 0)
5590 {
5591 flag = true;
5592 }
5593 }
5594 if (!flag)
5595 {
5596 Item item = new Item();
5597 if (((Main.mouseRight && !mouseInterface && Main.mouseRightRelease) || !Main.playerInventory) && Main.mouseItem.type > 0 && Main.mouseItem.stack > 0)
5598 {
5599 item = theItemWeDrop;
5600 theItemWeDrop = Main.mouseItem;
5601 delayUseItem = true;
5602 controlUseItem = false;
5603 }
5604 if (whoAmI == Main.myPlayer && theItemWeDrop.type == 5095)
5605 {
5606 LucyAxeMessage.Create(LucyAxeMessage.MessageSource.ThrownAway, base.Top, new Vector2((float)(direction * 7), -2f));
5607 }
5608 int num = Item.NewItem(GetItemSource_Misc(4), position, width, height, theItemWeDrop);
5609 theItemWeDrop.position = Main.item[num].position;
5610 Main.item[num] = theItemWeDrop;
5611 theItemWeDrop = new Item();
5612 if (slot == 58)
5613 {
5614 Main.mouseItem = new Item();
5615 }
5616 Item item2 = Main.item[num];
5617 if (Main.netMode == 0)
5618 {
5619 item2.noGrabDelay = 100;
5620 }
5621 item2.velocity.Y = -2f;
5622 item2.velocity.X = (float)(4 * direction) + velocity.X;
5623 item2.favorited = false;
5624 item2.newAndShiny = false;
5625 if (((Main.mouseRight && !mouseInterface) || !Main.playerInventory) && Main.mouseItem.type > 0)
5626 {
5627 theItemWeDrop = item;
5628 Main.mouseItem = new Item();
5629 }
5630 else
5631 {
5632 SetItemAnimation(10);
5633 JustDroppedAnItem = true;
5635 }
5636 Recipe.FindRecipes();
5637 if (Main.netMode == 1)
5638 {
5639 NetMessage.SendData(21, -1, -1, null, num);
5640 }
5641 }
5642 }
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
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 void Create(MessageSource source, Vector2 position, Vector2 velocity)
void SetItemAnimation(int frames)
Definition Player.cs:4923
Item GetItem(int plr, Item newItem, GetItemSettings settings)
Definition Player.cs:38131
bool mouseInterface
Definition Player.cs:1616
bool JustDroppedAnItem
Definition Player.cs:2603
void DropSelectedItem_InterruptActionsThatUseAnimations()
Definition Player.cs:5656
IEntitySource GetItemSource_Misc(int itemSourceId)
Definition Player.cs:7846
bool delayUseItem
Definition Player.cs:1996
bool controlUseItem
Definition Player.cs:1904

References Terraria.Player.controlUseItem, Terraria.GameContent.LucyAxeMessage.Create(), Terraria.Player.delayUseItem, Terraria.Entity.direction, Terraria.Player.DropSelectedItem_InterruptActionsThatUseAnimations(), Terraria.Recipe.FindRecipes(), Terraria.Player.GetItem(), Terraria.GetItemSettings.GetItemInDropItemCheck, Terraria.Player.GetItemSource_Misc(), Terraria.Entity.height, Terraria.Main.item, Terraria.Player.JustDroppedAnItem, Terraria.Player.mouseInterface, Terraria.Main.mouseItem, Terraria.Main.mouseRight, Terraria.Main.mouseRightRelease, Terraria.Main.myPlayer, Terraria.Main.netMode, Terraria.Item.NewItem(), Terraria.Main.playerInventory, Terraria.Entity.position, Terraria.NetMessage.SendData(), Terraria.Player.SetItemAnimation(), Terraria.Entity.velocity, Terraria.Entity.whoAmI, and Terraria.Entity.width.

+ Here is the call graph for this function: