Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions EXILED/Exiled.CustomItems/API/Features/CustomArmor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@
namespace Exiled.CustomItems.API.Features
{
using System;
using System.Collections.Generic;
using System.ComponentModel;

using Exiled.API.Extensions;
using Exiled.API.Features;
using Exiled.API.Features.Items;
using Exiled.API.Structs;
using Exiled.Events.EventArgs.Player;

using InventorySystem.Items.Armor;
using MEC;

/// <summary>
Expand Down Expand Up @@ -55,6 +58,16 @@ public override ItemType Type
[Description("The value must be above 0 and below 100")]
public virtual int VestEfficacy { get; set; } = 80;

/// <summary>
/// Gets or sets the Ammunition limit the player have.
/// </summary>
public virtual List<ArmorAmmoLimit> AmmoLimits { get; set; } = new();

/// <summary>
/// Gets or sets the Item Category limit the player have.
/// </summary>
public virtual List<BodyArmor.ArmorCategoryLimitModifier> CategoryLimits { get; set; } = new();

/// <inheritdoc />
public override void Give(Player player, bool displayMessage = true)
{
Expand All @@ -66,6 +79,12 @@ public override void Give(Player player, bool displayMessage = true)
armor.VestEfficacy = VestEfficacy;
armor.HelmetEfficacy = HelmetEfficacy;

if (AmmoLimits.Count != 0)
armor.AmmoLimits = AmmoLimits;

if (AmmoLimits.Count != 0)
armor.CategoryLimits = CategoryLimits;

player.AddItem(armor);

TrackedSerials.Add(armor.Serial);
Expand Down
4 changes: 2 additions & 2 deletions EXILED/Exiled.CustomItems/API/Features/CustomWeapon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public override ItemType Type
/// <summary>
/// Gets or sets the weapon damage.
/// </summary>
public abstract float Damage { get; set; }
public virtual float Damage { get; set; } = float.NaN;

/// <summary>
/// Gets or sets a value indicating how big of a clip the weapon will have.
Expand Down Expand Up @@ -205,7 +205,7 @@ protected virtual void OnShot(ShotEventArgs ev)
/// <param name="ev"><see cref="HurtingEventArgs"/>.</param>
protected virtual void OnHurting(HurtingEventArgs ev)
{
if (ev.IsAllowed && Damage > 0f)
if (ev.IsAllowed && Damage != float.NaN)
ev.Amount = Damage;
}

Expand Down
Loading