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

◆ DropItems()

void Terraria.Player.DropItems ( )
inline

Definition at line 54936 of file Player.cs.

54937 {
54940 where !item.IsAir
54941 select item, mediumCoreDeath: true);
54943 foreach (Item item2 in startInventory)
54944 {
54945 if (!startCounts.ContainsKey(item2.netID))
54946 {
54947 startCounts[item2.netID] = 0;
54948 }
54949 startCounts[item2.netID] += item2.stack;
54950 }
54951 startCounts[ModContent.ItemType<StartBag>()] = 1;
54953 for (int i = 0; i < 59; i++)
54954 {
54955 if (inventory[i].stack > 0)
54956 {
54957 int type2 = inventory[i].type;
54958 Item itemToDrop = inventory[i];
54959 if (startCounts.TryGetValue(type2, out var startCount))
54960 {
54961 int j = Math.Min(itemToDrop.stack, startCount);
54962 itemToDrop.stack -= j;
54963 startCounts[type2] -= j;
54964 }
54965 if (itemToDrop.stack > 0)
54966 {
54968 }
54969 }
54970 inventory[i].TurnToAir();
54971 if (i < armor.Length)
54972 {
54974 }
54975 if (i < dye.Length)
54976 {
54978 }
54979 if (i < miscEquips.Length)
54980 {
54982 }
54983 if (i < miscDyes.Length)
54984 {
54986 }
54987 }
54988 EquipmentLoadout[] loadouts = Loadouts;
54989 for (int type = 0; type < loadouts.Length; type++)
54990 {
54991 loadouts[type].TryDroppingItems(this, itemSource_Death);
54992 }
54994 }
void TurnToAir(bool fullReset=false)
Definition Item.cs:51791
int type
The Item ID of this item. The Item ID is a unique number assigned to each Item loaded into the game....
Definition Item.cs:345
static ModAccessorySlotPlayer ModSlotPlayer(Player player)
This serves as a central place to store equipment slots and their corresponding textures....
Manages content added by mods. Liasons between mod content and Terraria's arrays and oversees the Loa...
Definition ModContent.cs:38
static List< Item > GetStartingItems(Player player, IEnumerable< Item > vanillaItems, bool mediumCoreDeath=false)
This is where all ModPlayer hooks are gathered and called.
IEnumerable< Item > DropItems_GetDefaults()
Definition Player.cs:54996
void TryDroppingSingleItem(IEntitySource source, Item theItem)
Definition Player.cs:55018
Item[] armor
The player's armor and accessories. Indexes 0-2 hold head, chest, and legs armor while 10-12 hold the...
Definition Player.cs:1651
IEntitySource GetItemSource_Death()
Definition Player.cs:7841
EquipmentLoadout[] Loadouts
Definition Player.cs:3281
Item[] miscEquips
The player's equipment items. From indexes 0-4: Pet, Light Pet, Minecart, Mount, and Hook.
Definition Player.cs:1658
Item[] miscDyes
Definition Player.cs:1660
void DropItems_End(IList< Item > startInventory)
Definition Player.cs:55012
Item[] inventory
The player's normal inventory. Indexes 0-9 hold the hotbar items, 10-49 the rest of the main inventor...
Definition Player.cs:1767
This object encapsulates context information about the source of a particular spawning event of an It...

References Terraria.Player.armor, Terraria.Player.DropItems_End(), Terraria.Player.DropItems_GetDefaults(), Terraria.Player.dye, Terraria.Player.GetItemSource_Death(), Terraria.ModLoader.PlayerLoader.GetStartingItems(), Terraria.Player.inventory, Terraria.Player.Loadouts, Terraria.Player.miscDyes, Terraria.Player.miscEquips, Terraria.ModLoader.AccessorySlotLoader.ModSlotPlayer(), Terraria.Player.TryDroppingSingleItem(), Terraria.Item.TurnToAir(), and Terraria.Item.type.

Referenced by Terraria.Player.KillMe().

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