diff --git a/EXILED/Exiled.API/Features/Items/Armor.cs b/EXILED/Exiled.API/Features/Items/Armor.cs index 8d795ec33..048e1717d 100644 --- a/EXILED/Exiled.API/Features/Items/Armor.cs +++ b/EXILED/Exiled.API/Features/Items/Armor.cs @@ -74,12 +74,12 @@ internal Armor(ItemType type) } /// - /// Gets or sets a value indicating whether excess ammo should be removed when the armor is dropped. + /// Gets a value indicating whether excess ammo should be removed when the armor is dropped. /// public bool RemoveExcessOnDrop { get => !Base.DontRemoveExcessOnDrop; - set => Base.DontRemoveExcessOnDrop = !value; + internal set => Base.DontRemoveExcessOnDrop = !value; } /// @@ -150,7 +150,6 @@ public IEnumerable CategoryLimits { Weight = Weight, StaminaUseMultiplier = StaminaUseMultiplier, - RemoveExcessOnDrop = RemoveExcessOnDrop, CategoryLimits = CategoryLimits, StaminaRegenMultiplier = StaminaRegenMultiplier, AmmoLimits = AmmoLimits, @@ -166,7 +165,6 @@ internal override void ReadPickupInfoBefore(Pickup pickup) { HelmetEfficacy = armorPickup.HelmetEfficacy; VestEfficacy = armorPickup.VestEfficacy; - RemoveExcessOnDrop = armorPickup.RemoveExcessOnDrop; StaminaUseMultiplier = armorPickup.StaminaUseMultiplier; StaminaRegenMultiplier = armorPickup.StaminaRegenMultiplier; AmmoLimits = armorPickup.AmmoLimits; diff --git a/EXILED/Exiled.API/Features/Pickups/BodyArmorPickup.cs b/EXILED/Exiled.API/Features/Pickups/BodyArmorPickup.cs index 47cfb108c..1b6376353 100644 --- a/EXILED/Exiled.API/Features/Pickups/BodyArmorPickup.cs +++ b/EXILED/Exiled.API/Features/Pickups/BodyArmorPickup.cs @@ -73,6 +73,7 @@ internal BodyArmorPickup(ItemType type) /// /// Gets or sets a value indicating whether excess ammo should be removed when the armor is dropped. /// + [Obsolete("Propetry is internal, and controls armor remove logic for clearing inventory")] public bool RemoveExcessOnDrop { get; set; } /// @@ -132,7 +133,6 @@ internal override void ReadItemInfo(Item item) { helmetEfficacy = armoritem.HelmetEfficacy; vestEfficacy = armoritem.VestEfficacy; - RemoveExcessOnDrop = armoritem.RemoveExcessOnDrop; StaminaUseMultiplier = armoritem.StaminaUseMultiplier; StaminaRegenMultiplier = armoritem.StaminaRegenMultiplier; AmmoLimits = armoritem.AmmoLimits; @@ -148,7 +148,6 @@ protected override void InitializeProperties(ItemBase itemBase) { helmetEfficacy = armoritem.HelmetEfficacy; vestEfficacy = armoritem.VestEfficacy; - RemoveExcessOnDrop = !armoritem.DontRemoveExcessOnDrop; StaminaUseMultiplier = armoritem._staminaUseMultiplier; StaminaRegenMultiplier = armoritem.StaminaRegenMultiplier; AmmoLimits = armoritem.AmmoLimits.Select(limit => (ArmorAmmoLimit)limit); diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ChangingRoleAndSpawned.cs b/EXILED/Exiled.Events/Patches/Events/Player/ChangingRoleAndSpawned.cs index 47f1ede44..d31306a20 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ChangingRoleAndSpawned.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ChangingRoleAndSpawned.cs @@ -220,16 +220,13 @@ private static void ChangeInventory(ChangingRoleEventArgs ev) inventory.SendAmmoNextFrame = true; } - if (!StartingInventories.DefinedInventories.TryGetValue(ev.NewRole, out InventoryRoleInfo value)) - return; - - foreach (KeyValuePair item in value.Ammo) - inventory.ServerAddAmmo(item.Key, item.Value); + foreach (KeyValuePair ammo in ev.Ammo) + inventory.ServerAddAmmo(ammo.Key, ammo.Value); - for (int i = 0; i < value.Items.Length; i++) + foreach (ItemType item in ev.Items) { - ItemBase arg = inventory.ServerAddItem(value.Items[i], ItemAddReason.StartingItem, 0); - InventoryItemProvider.OnItemProvided?.Invoke(ev.Player.ReferenceHub, arg); + ItemBase itemBase = inventory.ServerAddItem(item, ItemAddReason.StartingItem); + InventoryItemProvider.OnItemProvided?.Invoke(ev.Player.ReferenceHub, itemBase); } InventoryItemProvider.InventoriesToReplenish.Enqueue(ev.Player.ReferenceHub);