Table of Contents

Class Pickup

Namespace
Exiled.API.Features.Pickups
Assembly
Exiled.API.dll

A wrapper class for InventorySystem.Items.Pickups.ItemPickupBase.

public class Pickup : TypeCastObject<Pickup>, IWrapper<ItemPickupBase>, IWorldSpace, IPosition, IRotation
Inheritance
Pickup
Implements
IWrapper<ItemPickupBase>
Derived
Inherited Members
Extension Methods

Properties

Base

Gets or sets the InventorySystem.Items.ItemBase of the item.

public ItemPickupBase Base { get; protected set; }

Property Value

ItemPickupBase

Category

Gets the ItemCategory of the item.

public ItemCategory Category { get; }

Property Value

ItemCategory

GameObject

Gets the UnityEngine.GameObject of the Pickup.

public GameObject GameObject { get; }

Property Value

GameObject

InUse

Gets or sets a value indicating whether the pickup is currently in use.

public bool InUse { get; set; }

Property Value

bool

Info

Gets or sets the pickup information.

public PickupSyncInfo Info { get; set; }

Property Value

PickupSyncInfo

IsLocked

Gets or sets a value indicating whether the pickup is locked (can't be picked up).

public bool IsLocked { get; set; }

Property Value

bool

IsSpawned

Gets a value indicating whether this pickup is spawned.

public bool IsSpawned { get; }

Property Value

bool

List

Gets a IEnumerable<T> of Pickup which contains all the Pickup instances.

public static IEnumerable<Pickup> List { get; }

Property Value

IEnumerable<Pickup>

PhysicsModule

Gets the pickup's PhysicsModule.

public PickupStandardPhysics PhysicsModule { get; }

Property Value

PickupStandardPhysics

PickupTime

Gets or sets the amount of time it takes to pick up this item, based on Weight.

public float PickupTime { get; set; }

Property Value

float

Remarks

Notes: Changing this value will change the item's Weight. This does not account for status effects such as Hypothermia; see PickupTimeForPlayer(Player) to account for status effects.

See Also

Position

Gets or sets the pickup position.

public Vector3 Position { get; set; }

Property Value

Vector3
See Also

PreviousOwner

Gets or sets the previous owner of this item.

public Player PreviousOwner { get; set; }

Property Value

Player
See Also

RelativePosition

Gets or sets the relative position of the pickup.

public RelativePosition RelativePosition { get; set; }

Property Value

RelativePosition

Rigidbody

Gets the UnityEngine.Rigidbody of the Pickup.

public Rigidbody Rigidbody { get; }

Property Value

Rigidbody

Room

Gets the current Room the Pickup is in.

public Room Room { get; }

Property Value

Room

Rotation

Gets or sets the pickup rotation.

public Quaternion Rotation { get; set; }

Property Value

Quaternion
See Also

Scale

Gets or sets the pickup's scale value.

public Vector3 Scale { get; set; }

Property Value

Vector3

Serial

Gets or sets the unique serial number for the item.

public ushort Serial { get; set; }

Property Value

ushort

Transform

Gets the UnityEngine.Transform of the Pickup.

public Transform Transform { get; }

Property Value

Transform

Type

Gets the ItemType of the item.

public ItemType Type { get; }

Property Value

ItemType

Weight

Gets or sets the weight of the item.

public float Weight { get; set; }

Property Value

float
See Also

Methods

Clone()

Clones the current pickup with a different serial.

public virtual Pickup Clone()

Returns

Pickup

Cloned pickup object.

Create(ItemType)

Creates and returns a new Pickup with the proper inherited subclass.

Based on the type, the returned Pickup can be cast into a subclass to gain more control over the object.
- All valid ammo should be cast to the AmmoPickup class.
- All valid firearms (not including the Micro HID) should be cast to the FirearmPickup class.
- All valid keycards should be cast to the KeycardPickup class.
- All valid armor should be cast to the BodyArmorPickup class.
- All grenades and throwables (not including SCP-018 and SCP-2176) should be cast to the GrenadePickup class.


The following have their own respective classes:
- Radios can be cast to RadioPickup.
- The Micro HID can be cast to MicroHIDPickup.
- SCP-244 A and B variants can be cast to Scp244Pickup.
- SCP-330 can be cast to Scp330Pickup.
- SCP-018 can be cast to Scp018Projectile.
- SCP-2176 can be cast to Scp2176Projectile.

Items that are not listed above do not have a subclass, and can only use the base Pickup class.

public static Pickup Create(ItemType type)

Parameters

type ItemType

The ItemType of the pickup.

Returns

Pickup

The created Pickup.

See Also

CreateAndSpawn(ItemType, Vector3, Quaternion?, Player)

Creates and spawns a Pickup.

public static Pickup CreateAndSpawn(ItemType type, Vector3 position, Quaternion? rotation = null, Player previousOwner = null)

Parameters

type ItemType

The ItemType of the pickup.

position Vector3

The position to spawn the Pickup at.

rotation Quaternion?

The rotation to spawn the Pickup.

previousOwner Player

An optional previous owner of the item.

Returns

Pickup

The Pickup. See documentation of Create(ItemType) for more information on casting.

See Also
CreateAndSpawn(ProjectileType, Vector3, Quaternion?, bool, Player)

CreateAndSpawn<T>(ItemType, Vector3, Quaternion?, Player)

Creates and spawns a Pickup.

public static Pickup CreateAndSpawn<T>(ItemType type, Vector3 position, Quaternion? rotation = null, Player previousOwner = null) where T : Pickup

Parameters

type ItemType

The ItemType of the pickup.

position Vector3

The position to spawn the Pickup at.

rotation Quaternion?

The rotation to spawn the Pickup.

previousOwner Player

An optional previous owner of the item.

Returns

Pickup

The Pickup. See documentation of Create(ItemType) for more information on casting.

Type Parameters

T

The specified Pickup type.

See Also
CreateAndSpawn(ProjectileType, Vector3, Quaternion?, bool, Player)

Create<T>(ItemType)

Creates and returns a new Pickup with the proper inherited subclass.

Based on the type, the returned Pickup can be cast into a subclass to gain more control over the object.
- All valid ammo should be cast to the AmmoPickup class.
- All valid firearms (not including the Micro HID) should be cast to the FirearmPickup class.
- All valid keycards should be cast to the KeycardPickup class.
- All valid armor should be cast to the BodyArmorPickup class.
- All grenades and throwables (not including SCP-018 and SCP-2176) should be cast to the GrenadePickup class.


The following have their own respective classes:
- Radios can be cast to RadioPickup.
- The Micro HID can be cast to MicroHIDPickup.
- SCP-244 A and B variants can be cast to Scp244Pickup.
- SCP-330 can be cast to Scp330Pickup.
- SCP-018 can be cast to Scp018Projectile.
- SCP-2176 can be cast to Scp2176Projectile.

Items that are not listed above do not have a subclass, and can only use the base Pickup class.

public static Pickup Create<T>(ItemType type) where T : Pickup

Parameters

type ItemType

The ItemType of the pickup.

Returns

Pickup

The created Pickup.

Type Parameters

T

The specified Pickup type.

See Also

Destroy()

Destroys the already spawned pickup.

public void Destroy()
See Also

Get(ItemPickupBase)

Gets an existing Pickup or creates a new instance of one.

public static Pickup Get(ItemPickupBase pickupBase)

Parameters

pickupBase ItemPickupBase

The InventorySystem.Items.Pickups.ItemPickupBase to convert into a Pickup.

Returns

Pickup

The Pickup wrapper for the given InventorySystem.Items.Pickups.ItemPickupBase.

Get(ItemType)

Gets an IEnumerable<T> of Pickup containing all existing InventorySystem.Items.Pickups.ItemPickupBase instances given an ItemType.

public static IEnumerable<Pickup> Get(ItemType type)

Parameters

type ItemType

The ItemType to look for.

Returns

IEnumerable<Pickup>

An IEnumerable<T> of Pickup containing all existing InventorySystem.Items.Pickups.ItemPickupBase instances.

See Also
GetRandomPickup(ItemType)

Get(IEnumerable<ItemPickupBase>)

Gets an IEnumerable<T> of Pickup containing all existing InventorySystem.Items.Pickups.ItemPickupBase instances given an IEnumerable<T> of InventorySystem.Items.Pickups.ItemPickupBase.

public static IEnumerable<Pickup> Get(IEnumerable<ItemPickupBase> pickups)

Parameters

pickups IEnumerable<ItemPickupBase>

An IEnumerable<T> of InventorySystem.Items.Pickups.ItemPickupBase to convert into an IEnumerable<T> of Pickup.

Returns

IEnumerable<Pickup>

An IEnumerable<T> of Pickup containing all existing InventorySystem.Items.Pickups.ItemPickupBase instances.

Get(IEnumerable<GameObject>)

Gets an IEnumerable<T> of Pickup containing all existing InventorySystem.Items.Pickups.ItemPickupBase instances given an IEnumerable<T> of UnityEngine.GameObject.

public static IEnumerable<Pickup> Get(IEnumerable<GameObject> gameObjects)

Parameters

gameObjects IEnumerable<GameObject>

The UnityEngine.GameObject's to check.

Returns

IEnumerable<Pickup>

An IEnumerable<T> of Pickup containing all existing InventorySystem.Items.Pickups.ItemPickupBase instances.

Get(ushort)

Gets the Pickup given a Serial.

public static Pickup Get(ushort serial)

Parameters

serial ushort

The serial to look for.

Returns

Pickup

The Pickup given the specified serial.

Get(GameObject)

Gets the Pickup given a UnityEngine.GameObject.

public static Pickup Get(GameObject gameObject)

Parameters

gameObject GameObject

The UnityEngine.GameObject to check.

Returns

Pickup

The Pickup given the specified UnityEngine.GameObject.

Get<T>(ItemPickupBase)

Gets an existing Pickup or creates a new instance of one.

public static T Get<T>(ItemPickupBase pickupBase) where T : Pickup

Parameters

pickupBase ItemPickupBase

The InventorySystem.Items.Pickups.ItemPickupBase to convert into an pickup.

Returns

T

The pickup wrapper for the given InventorySystem.Items.Pickups.ItemPickupBase.

Type Parameters

T

The specified Pickup type.

Get<T>(ItemType)

Gets an IEnumerable<T> containing all existing InventorySystem.Items.Pickups.ItemPickupBase instances given an ItemType.

public static IEnumerable<T> Get<T>(ItemType type) where T : Pickup

Parameters

type ItemType

The ItemType to look for.

Returns

IEnumerable<T>

A IEnumerable<T> of Pickup.

Type Parameters

T

The type T to cast the pickups to.

See Also
GetRandomPickup(ItemType)

Get<T>(IEnumerable<ItemPickupBase>)

Gets an IEnumerable<T> of Pickup containing all existing InventorySystem.Items.Pickups.ItemPickupBase instances given a IEnumerable<T> of InventorySystem.Items.Pickups.ItemPickupBase.

public static IEnumerable<T> Get<T>(IEnumerable<ItemPickupBase> pickups) where T : Pickup

Parameters

pickups IEnumerable<ItemPickupBase>

An IEnumerable<T> of InventorySystem.Items.Pickups.ItemPickupBase to convert into an IEnumerable<T> of Pickup.

Returns

IEnumerable<T>

An IEnumerable<T> of Pickup containing all existing InventorySystem.Items.Pickups.ItemPickupBase instances.

Type Parameters

T

The type T to cast the pickups to.

Get<T>(IEnumerable<GameObject>)

Gets an IEnumerable<T> containing all existing InventorySystem.Items.Pickups.ItemPickupBase instances given a IEnumerable<T> of UnityEngine.GameObject.

public static IEnumerable<T> Get<T>(IEnumerable<GameObject> gameObjects) where T : Pickup

Parameters

gameObjects IEnumerable<GameObject>

The UnityEngine.GameObject's to check.

Returns

IEnumerable<T>

The Pickup given the specified UnityEngine.GameObject.

Type Parameters

T

The type T to cast the pickups to.

InitializeProperties(ItemBase)

initialize item properties.

protected virtual void InitializeProperties(ItemBase itemBase)

Parameters

itemBase ItemBase

target item.

PickupTimeForPlayer(Player)

Returns the amount of time it will take for the provided player to pick up this item, based on Weight and active status effects.

public float PickupTimeForPlayer(Player player)

Parameters

player Player

The player to check search time.

Returns

float

The amount of time it will take for the provided player to pick up this item.

Exceptions

ArgumentNullException

player cannot be null.

See Also

Spawn()

Spawns pickup on a server.

public virtual void Spawn()
See Also

Spawn(Vector3, Quaternion?, Player)

Spawns pickup on a server.

public Pickup Spawn(Vector3 position, Quaternion? rotation = null, Player previousOwner = null)

Parameters

position Vector3

The position to spawn the Pickup at.

rotation Quaternion?

The rotation to spawn the Pickup.

previousOwner Player

An optional previous owner of the item.

Returns

Pickup

The spawned Pickup.

See Also
Spawn(Vector3, Quaternion?, bool, Player)

ToString()

Returns the Pickup in a human readable format.

public override string ToString()

Returns

string

A string containing Pickup-related data.

UnSpawn()

Unspawns pickup on server.

public void UnSpawn()
See Also