Skip to content
This repository was archived by the owner on Feb 17, 2023. It is now read-only.

Commit 8a41002

Browse files
committed
yes
1 parent 46ad896 commit 8a41002

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

API/Modifiers/FirearmModifier.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using MEC;
55

66
using InventorySystem.Items.Firearms.Attachments;
7+
using InventorySystem.Items.Firearms.Attachments.Components;
78

89
using Exiled.API.Features;
910
using Exiled.API.Features.Items;
@@ -15,7 +16,6 @@
1516
using FirearmBase = InventorySystem.Items.Firearms.Firearm;
1617
using PlayerHandler = Exiled.Events.Handlers.Player;
1718
using ItemHandler = Exiled.Events.Handlers.Item;
18-
using InventorySystem.Items.Firearms.Attachments.Components;
1919

2020
namespace ItemUtils.API.Modifiers
2121
{
@@ -28,17 +28,20 @@ public class FirearmModifier : WeaponModifier
2828
public override void RegisterEvents()
2929
{
3030
PlayerHandler.Handcuffing += OnHandcuffing;
31-
ItemHandler.ChangingDurability += OnUsingAmmo;
32-
ItemHandler.ChangingAttachments += OnChangingAttachments;
3331
CustomHandler.ObtainingItem += OnObtainingItem;
32+
ItemHandler.ChangingAttachments += OnChangingAttachments;
33+
ItemHandler.ChangingDurability += OnUsingAmmo;
34+
35+
//CustomHandler.ProcessingParamValue += OnProcessingParamValue;
3436
base.RegisterEvents();
3537
}
3638
public override void UnregisterEvents()
3739
{
3840
PlayerHandler.Handcuffing -= OnHandcuffing;
39-
ItemHandler.ChangingDurability -= OnUsingAmmo;
40-
ItemHandler.ChangingAttachments -= OnChangingAttachments;
4141
CustomHandler.ObtainingItem -= OnObtainingItem;
42+
ItemHandler.ChangingAttachments -= OnChangingAttachments;
43+
ItemHandler.ChangingDurability -= OnUsingAmmo;
44+
//CustomHandler.ProcessingParamValue -= OnProcessingParamValue;
4245
base.UnregisterEvents();
4346
}
4447

@@ -101,10 +104,10 @@ private void ModifyAttachments(FirearmBase gun)
101104

102105
private void ModifyParameters(FirearmBase gun, Attachment att, Dictionary<AttachmentParam, float> newParams)
103106
{
107+
Log.Debug("Changing params for " + att.Name);
104108
foreach (KeyValuePair<AttachmentParam, float> pair in newParams)
105109
{
106-
if (att.TryGetValue(pair.Key, out _))
107-
att.SetParameterValue(pair.Key, gun.ProcessValue(pair.Value, pair.Key));
110+
att.SetParameterValue(pair.Key, gun.ProcessValue(pair.Value, pair.Key));
108111
}
109112
}
110113
}

Events/CustomHandler.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
using ItemUtils.Events.EventArgs;
44

5-
65
namespace ItemUtils.Events
76
{
87
public static class CustomHandler

ItemUtils.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<DefineConstants>DEBUG;TRACE</DefineConstants>
2222
<ErrorReport>prompt</ErrorReport>
2323
<WarningLevel>4</WarningLevel>
24+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
2425
</PropertyGroup>
2526
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2627
<DebugType>pdbonly</DebugType>

0 commit comments

Comments
 (0)