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

◆ GetItemGrabRange()

int Terraria.Player.GetItemGrabRange ( Item item)
inline

Fetches the range at which the given item begins to gravitate towards the player.
This range, referred to as item grab range, is measured in pixels.

Parameters
itemThe item whose grab range is being evaluated.
Returns
The item grab range of the player, in pixels.

Definition at line 33847 of file Player.cs.

33848 {
33850 if (goldRing && item.IsACoin)
33851 {
33852 num += Item.coinGrabRange;
33853 }
33854 if (manaMagnet && (item.type == 184 || item.type == 1735 || item.type == 1868))
33855 {
33856 num += Item.manaGrabRange;
33857 }
33858 if (item.type == 4143)
33859 {
33860 num += Item.manaGrabRange;
33861 }
33862 if (lifeMagnet && (item.type == 58 || item.type == 1734 || item.type == 1867))
33863 {
33864 num += Item.lifeGrabRange;
33865 }
33866 if (treasureMagnet)
33867 {
33868 num += Item.treasureGrabRange;
33869 }
33870 if (item.type == 3822)
33871 {
33872 num += 50;
33873 }
33874 if (ItemID.Sets.NebulaPickup[item.type])
33875 {
33876 num += 100;
33877 }
33879 {
33880 num += 240;
33881 }
33882 ItemLoader.GrabRange(item, this, ref num);
33883 return num;
33884 }
int whoAmI
The index of this Entity within its specific array. These arrays track the entities in the world....
Definition Entity.cs:16
static bool[] NebulaPickup
Do not add items to this set. If true for a given item type (F:Terraria.Item.type),...
Definition ItemID.cs:1380
static void GrabRange(Item item, Player player, ref int grabRange)
Calls ModItem.GrabRange, then all GlobalItem.GrabRange hooks.
This serves as the central class from which item-related functions are carried out....
Definition ItemLoader.cs:26
static int defaultItemGrabRange
Definition Player.cs:2701
bool treasureMagnet
Definition Player.cs:1127

References Terraria.Item.coinGrabRange, Terraria.Player.defaultItemGrabRange, Terraria.Player.difficulty, Terraria.Player.goldRing, Terraria.ModLoader.ItemLoader.GrabRange(), Terraria.GameContent.Creative.CreativePowerManager.Instance, Terraria.Item.IsACoin, Terraria.GameContent.Creative.CreativePowers.APerPlayerTogglePower.IsEnabledForPlayer(), Terraria.Item.lifeGrabRange, Terraria.Player.lifeMagnet, Terraria.Item.manaGrabRange, Terraria.Player.manaMagnet, Terraria.ID.ItemID.Sets.NebulaPickup, Terraria.Item.treasureGrabRange, Terraria.Player.treasureMagnet, Terraria.Item.type, and Terraria.Entity.whoAmI.

Referenced by Terraria.Item.FindOwner(), and Terraria.Player.GrabItems().

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