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
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
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
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
playerPlayerThe Player who will receive the item.
displayMessageboolIndicates 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
OnHurting(HurtingEventArgs)
Handles hurting for custom weapons.
protected virtual void OnHurting(HurtingEventArgs ev)
Parameters
OnReloaded(ReloadedWeaponEventArgs)
Handles reloaded for custom weapons.
protected virtual void OnReloaded(ReloadedWeaponEventArgs ev)
Parameters
OnReloading(ReloadingWeaponEventArgs)
Handles reloading for custom weapons.
protected virtual void OnReloading(ReloadingWeaponEventArgs ev)
Parameters
OnShooting(ShootingEventArgs)
Handles shooting for custom weapons.
protected virtual void OnShooting(ShootingEventArgs ev)
Parameters
OnShot(ShotEventArgs)
Handles shot for custom weapons.
protected virtual void OnShot(ShotEventArgs ev)
Parameters
Spawn(Vector3, Item, Player?)
Spawns the CustomItem in a specific position.
public override Pickup? Spawn(Vector3 position, Item item, Player? previousOwner = null)
Parameters
positionVector3The UnityEngine.Vector3 where the CustomItem will be spawned.
itemItemThe Item to be spawned as a CustomItem.
previousOwnerPlayerThe 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
positionVector3The UnityEngine.Vector3 where the CustomItem will be spawned.
previousOwnerPlayerThe 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()