diff --git a/EXILED/Exiled.API/Enums/DoorLockType.cs b/EXILED/Exiled.API/Enums/DoorLockType.cs index a71aac7024..b876c24c11 100644 --- a/EXILED/Exiled.API/Enums/DoorLockType.cs +++ b/EXILED/Exiled.API/Enums/DoorLockType.cs @@ -65,7 +65,7 @@ public enum DoorLockType NoPower = 128, // 0x0080 /// - /// Isloation. + /// Isolation. /// Isolation = 256, // 0x0100 @@ -74,4 +74,4 @@ public enum DoorLockType /// Lockdown2176 = 512, } -} \ No newline at end of file +} diff --git a/EXILED/Exiled.API/Enums/RoomType.cs b/EXILED/Exiled.API/Enums/RoomType.cs index 054029601a..3cb78e53f2 100644 --- a/EXILED/Exiled.API/Enums/RoomType.cs +++ b/EXILED/Exiled.API/Enums/RoomType.cs @@ -235,7 +235,7 @@ public enum RoomType EzGateB, /// - /// Entrance Zone's Shelter rfoom. + /// Entrance Zone's Shelter room. /// EzShelter, diff --git a/EXILED/Exiled.API/Features/Broadcast.cs b/EXILED/Exiled.API/Features/Broadcast.cs index 6c82e747d6..34fbe4c3e4 100644 --- a/EXILED/Exiled.API/Features/Broadcast.cs +++ b/EXILED/Exiled.API/Features/Broadcast.cs @@ -25,7 +25,7 @@ public Broadcast() /// /// Initializes a new instance of the class. /// - /// The content of the broadcast>. + /// The content of the broadcast. /// The duration of the broadcast, in seconds. /// Whether the broadcast should be shown. /// The type of the broadcast. diff --git a/EXILED/Exiled.API/Features/Player.cs b/EXILED/Exiled.API/Features/Player.cs index 498f7c0c1f..6af35c8ca4 100644 --- a/EXILED/Exiled.API/Features/Player.cs +++ b/EXILED/Exiled.API/Features/Player.cs @@ -3225,7 +3225,7 @@ public void EnableEffect(EffectType type, float duration = 0f, bool addDurationI /// The intensity of the effect will be active for. /// The amount of time the effect will be active for. /// If the effect is already active, setting to will add this duration onto the effect. - /// return if the effect has been Enable. + /// A bool indicating whether the effect was valid and successfully enabled. public bool EnableEffect(EffectType type, byte intensity, float duration = 0f, bool addDurationIfActive = false) => TryGetEffect(type, out StatusEffectBase statusEffect) && EnableEffect(statusEffect, intensity, duration, addDurationIfActive); diff --git a/EXILED/Exiled.Events/EventArgs/Player/ExplodingMicroHIDEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ExplodingMicroHIDEventArgs.cs new file mode 100644 index 0000000000..b4510875d6 --- /dev/null +++ b/EXILED/Exiled.Events/EventArgs/Player/ExplodingMicroHIDEventArgs.cs @@ -0,0 +1,49 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.EventArgs.Player +{ + using Exiled.API.Features.Items; + using Exiled.Events.EventArgs.Interfaces; + + /// + /// Contains all information after deactivating. + /// + public class ExplodingMicroHidEventArgs : IPlayerEvent + { + /// + /// Initializes a new instance of the class. + /// + /// + public ExplodingMicroHidEventArgs(Item item) + { + Item = item; + MicroHid = item as MicroHid; + Player = item.Owner; + } + + /// + /// Gets the item. + /// + public Item Item { get; } + + /// + /// Gets the player in owner of the item. + /// + public Exiled.API.Features.Player Player { get; } + + /// + /// Gets Scp1344 item. + /// + public MicroHid MicroHid { get; } + + /// + /// Gets or sets a value indicating whether the player can explode the micro HID. + /// + public bool IsAllowed { get; set; } = true; + } +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Handlers/Player.cs b/EXILED/Exiled.Events/Handlers/Player.cs index ac58bb3085..f7e39a7bad 100644 --- a/EXILED/Exiled.Events/Handlers/Player.cs +++ b/EXILED/Exiled.Events/Handlers/Player.cs @@ -583,6 +583,11 @@ public class Player /// public static Event ChangingDisruptorMode { get; set; } = new(); + /// + /// Invoked before micro HID explode while charging. + /// + public static Event ExplodingMicroHid { get; set; } = new(); + /// /// Invoked before player interacts with coffee cup. /// @@ -1260,6 +1265,12 @@ public static void OnItemRemoved(ReferenceHub referenceHub, InventorySystem.Item /// The instance. public static void OnChangingDisruptorMode(ChangingDisruptorModeEventArgs ev) => ChangingDisruptorMode.InvokeSafely(ev); + /// + /// Called before exploding MicroHID. + /// + /// The instance. + public static void OnExplodingMicroHID(ExplodingMicroHidEventArgs ev) => ExplodingMicroHid.InvokeSafely(ev); + /// /// Called before player interacts with coffee cup. /// diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ExplodingMicroHID.cs b/EXILED/Exiled.Events/Patches/Events/Player/ExplodingMicroHID.cs new file mode 100644 index 0000000000..7ce99caf8a --- /dev/null +++ b/EXILED/Exiled.Events/Patches/Events/Player/ExplodingMicroHID.cs @@ -0,0 +1,40 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +#pragma warning disable SA1313 // Parameter names should begin with lower-case letter + +namespace Exiled.Events.Patches.Events.Player +{ + using Exiled.API.Features; + using Exiled.API.Features.Items; + using Exiled.Events.Attributes; + using Exiled.Events.EventArgs.Player; + using HarmonyLib; + using InventorySystem.Items.MicroHID; + + /// + /// Patches . + /// Adds the event. + /// + [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.ExplodingMicroHid))] + [HarmonyPatch(typeof(InventorySystem.Items.MicroHID.Modules.ChargeFireModeModule), nameof(InventorySystem.Items.MicroHID.Modules.ChargeFireModeModule.ServerExplode))] + internal static class ExplodingMicroHid + { + private static bool Prefix(ref MicroHIDItem __instance) + { + ExplodingMicroHidEventArgs ev = new(Item.Get(__instance)); + Exiled.Events.Handlers.Player.OnExplodingMicroHID(ev); + + if (!ev.IsAllowed) + { + return false; + } + + return true; + } + } +} \ No newline at end of file