Table of Contents

Class Projectile

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

A wrapper class for Projectile.

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

Properties

Base

Gets the InventorySystem.Items.ThrowableProjectiles.ThrownProjectile that this class is encapsulating.

public ThrownProjectile Base { get; }

Property Value

ThrownProjectile

ProjectileType

Gets the ProjectileType of the item.

public ProjectileType ProjectileType { get; }

Property Value

ProjectileType

Methods

Activate()

Activates the current Projectile.

public void Activate()

Create(ProjectileType)

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

Based on the projectiletype, the returned Projectile can be casted into a subclass to gain more control over the object.
The following have their own respective classes:
- FragGrenade can be casted to ExplosionGrenadeProjectile.
- Flashbang can be casted to FlashbangProjectile.
- Scp018 A and B variants can be casted to Scp018Projectile.
- Scp2176 can be casted to Scp2176Projectile.

Projectile that are not listed will cause an Exception.

public static Projectile Create(ProjectileType projectiletype)

Parameters

projectiletype ProjectileType

The ProjectileType of the projectile.

Returns

Projectile

The created Projectile.

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

Creates and spawns a Projectile.

public static Projectile CreateAndSpawn(ProjectileType type, Vector3 position, Quaternion? rotation = null, bool shouldBeActive = true, Player previousOwner = null)

Parameters

type ProjectileType

The ProjectileType of the projectile.

position Vector3

The position to spawn the Projectile at.

rotation Quaternion?

The rotation to spawn the Projectile.

shouldBeActive bool

Whether the Projectile should be in active state after spawn.

previousOwner Player

An optional previous owner of the item.

Returns

Projectile

The Projectile. See documentation of Create(ProjectileType) for more information on casting.

CreateAndSpawn<T>(ProjectileType, Vector3, Quaternion?, bool, Player)

Creates and spawns a Projectile.

public static Projectile CreateAndSpawn<T>(ProjectileType type, Vector3 position, Quaternion? rotation = null, bool shouldBeActive = true, Player previousOwner = null) where T : Projectile

Parameters

type ProjectileType

The ProjectileType of the projectile.

position Vector3

The position to spawn the Projectile at.

rotation Quaternion?

The rotation to spawn the Projectile.

shouldBeActive bool

Whether the Projectile should be in active state after spawn.

previousOwner Player

An optional previous owner of the item.

Returns

Projectile

The Projectile. See documentation of Create(ProjectileType) for more information on casting.

Type Parameters

T

The specified Projectile type.

Create<T>(ProjectileType)

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

Based on the projectiletype, the returned Projectile can be casted into a subclass to gain more control over the object.
The following have their own respective classes:
- FragGrenade can be casted to ExplosionGrenadeProjectile.
- Flashbang can be casted to FlashbangProjectile.
- Scp018 A and B variants can be casted to Scp018Projectile.
- Scp2176 can be casted to Scp2176Projectile.

Projectile that are not listed will cause an Exception.

public static Projectile Create<T>(ProjectileType projectiletype) where T : Projectile

Parameters

projectiletype ProjectileType

The ProjectileType of the projectile.

Returns

Projectile

The created Projectile.

Type Parameters

T

The specified Projectile type.

Spawn(Vector3, Quaternion?, bool, Player)

Spawns a Projectile.

public Projectile Spawn(Vector3 position, Quaternion? rotation = null, bool shouldBeActive = true, Player previousOwner = null)

Parameters

position Vector3

The position to spawn the Projectile at.

rotation Quaternion?

The rotation to spawn the Projectile.

shouldBeActive bool

Whether the Projectile should be in active state after spawn.

previousOwner Player

An optional previous owner of the item.

Returns

Projectile

The spawned Projectile.

ToString()

Returns the ProjectilePickup in a human readable format.

public override string ToString()

Returns

string

A string containing ProjectilePickup-related data.