Table of Contents

Class CustomWeapon

Namespace
Exiled.CustomItems.API.Features
Assembly
Exiled.CustomItems.dll

The Custom Weapon base class.

public abstract class CustomWeapon : CustomItem
Inheritance
CustomWeapon
Inherited Members
Extension Methods

Properties

Attachments

Gets or sets value indicating what InventorySystem.Items.Firearms.Attachments.Components.Attachments the weapon will have.

public virtual AttachmentName[] Attachments { get; set; }

Property Value

AttachmentName[]

ClipSize

Gets or sets a value indicating how big of a clip the weapon will have.

public virtual byte ClipSize { get; set; }

Property Value

byte

Remarks

Warning for ItemType.GunShotgun and ItemType.GunRevolver. They are not fully compatible with this features.

Damage

Gets or sets the weapon damage.

public virtual float Damage { get; set; }

Property Value

float

FriendlyFire

Gets or sets a value indicating whether to allow friendly fire with this weapon on FF-enabled servers.

public virtual bool FriendlyFire { get; set; }

Property Value

bool

Type

Gets or sets the ItemType to use for this item.

public override ItemType Type { get; set; }

Property Value

ItemType

Methods

Give(Player, bool)

Gives the CustomItem to a player.

public override void Give(Player player, bool displayMessage = true)

Parameters

player Player

The Player who will receive the item.

displayMessage bool

Indicates whether ShowPickedUpMessage(Player) will be called when the player receives the item.

OnChangingAttachment(ChangingAttachmentsEventArgs)

Handles attachment changing for custom weapons.

protected virtual void OnChangingAttachment(ChangingAttachmentsEventArgs ev)

Parameters

ev ChangingAttachmentsEventArgs

ChangingAttachmentsEventArgs.

OnHurting(HurtingEventArgs)

Handles hurting for custom weapons.

protected virtual void OnHurting(HurtingEventArgs ev)

Parameters

ev HurtingEventArgs

HurtingEventArgs.

OnReloaded(ReloadedWeaponEventArgs)

Handles reloaded for custom weapons.

protected virtual void OnReloaded(ReloadedWeaponEventArgs ev)

Parameters

ev ReloadedWeaponEventArgs

ReloadedWeaponEventArgs.

OnReloading(ReloadingWeaponEventArgs)

Handles reloading for custom weapons.

protected virtual void OnReloading(ReloadingWeaponEventArgs ev)

Parameters

ev ReloadingWeaponEventArgs

ReloadingWeaponEventArgs.

OnShooting(ShootingEventArgs)

Handles shooting for custom weapons.

protected virtual void OnShooting(ShootingEventArgs ev)

Parameters

ev ShootingEventArgs

ShootingEventArgs.

OnShot(ShotEventArgs)

Handles shot for custom weapons.

protected virtual void OnShot(ShotEventArgs ev)

Parameters

ev ShotEventArgs

ShotEventArgs.

Spawn(Vector3, Item, Player?)

Spawns the CustomItem in a specific position.

public override Pickup? Spawn(Vector3 position, Item item, Player? previousOwner = null)

Parameters

position Vector3

The UnityEngine.Vector3 where the CustomItem will be spawned.

item Item

The Item to be spawned as a CustomItem.

previousOwner Player

The PreviousOwner of the item. Can be null.

Returns

Pickup

The Pickup of the spawned CustomItem.

Spawn(Vector3, Player?)

Spawns the CustomItem in a specific position.

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

Parameters

position Vector3

The UnityEngine.Vector3 where the CustomItem will be spawned.

previousOwner Player

The PreviousOwner of the item. Can be null.

Returns

Pickup

The Pickup of the spawned CustomItem.

SubscribeEvents()

Called after the manager is initialized, to allow loading of special event handlers.

protected override void SubscribeEvents()

UnsubscribeEvents()

Called when the manager is being destroyed, to allow unloading of special event handlers.

protected override void UnsubscribeEvents()