Skip to content
Closed
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
4 changes: 2 additions & 2 deletions EXILED/Exiled.API/Enums/DoorLockType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public enum DoorLockType
NoPower = 128, // 0x0080

/// <summary>
/// Isloation.
/// Isolation.
/// </summary>
Isolation = 256, // 0x0100

Expand All @@ -74,4 +74,4 @@ public enum DoorLockType
/// </summary>
Lockdown2176 = 512,
}
}
}
2 changes: 1 addition & 1 deletion EXILED/Exiled.API/Enums/RoomType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public enum RoomType
EzGateB,

/// <summary>
/// Entrance Zone's Shelter rfoom.
/// Entrance Zone's Shelter room.
/// </summary>
EzShelter,

Expand Down
2 changes: 1 addition & 1 deletion EXILED/Exiled.API/Features/Broadcast.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public Broadcast()
/// <summary>
/// Initializes a new instance of the <see cref="Broadcast"/> class.
/// </summary>
/// <param name="content">The content of the broadcast>.</param>
/// <param name="content">The content of the broadcast.</param>
/// <param name="duration">The duration of the broadcast, in seconds.</param>
/// <param name="show">Whether the broadcast should be shown.</param>
/// <param name="type">The type of the broadcast.</param>
Expand Down
2 changes: 1 addition & 1 deletion EXILED/Exiled.API/Features/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3225,7 +3225,7 @@ public void EnableEffect(EffectType type, float duration = 0f, bool addDurationI
/// <param name="intensity">The intensity of the effect will be active for.</param>
/// <param name="duration">The amount of time the effect will be active for.</param>
/// <param name="addDurationIfActive">If the effect is already active, setting to <see langword="true"/> will add this duration onto the effect.</param>
/// <returns>return if the effect has been Enable.</returns>
/// <returns>A bool indicating whether the effect was valid and successfully enabled.</returns>
public bool EnableEffect(EffectType type, byte intensity, float duration = 0f, bool addDurationIfActive = false)
=> TryGetEffect(type, out StatusEffectBase statusEffect) && EnableEffect(statusEffect, intensity, duration, addDurationIfActive);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// -----------------------------------------------------------------------
// <copyright file="ExplodingMicroHIDEventArgs.cs" company="ExMod Team">
// Copyright (c) ExMod Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.Events.EventArgs.Player
{
using Exiled.API.Features.Items;
using Exiled.Events.EventArgs.Interfaces;

/// <summary>
/// Contains all information after deactivating.
/// </summary>
public class ExplodingMicroHidEventArgs : IPlayerEvent
{
/// <summary>
/// Initializes a new instance of the <see cref="ExplodingMicroHidEventArgs" /> class.
/// </summary>
/// <param name="item"><inheritdoc cref="Item"/></param>
public ExplodingMicroHidEventArgs(Item item)
{
Item = item;
MicroHid = item as MicroHid;
Player = item.Owner;
}

/// <summary>
/// Gets the item.
/// </summary>
public Item Item { get; }

/// <summary>
/// Gets the player in owner of the item.
/// </summary>
public Exiled.API.Features.Player Player { get; }

/// <summary>
/// Gets Scp1344 item.
/// </summary>
public MicroHid MicroHid { get; }

/// <summary>
/// Gets or sets a value indicating whether the player can explode the micro HID.
/// </summary>
public bool IsAllowed { get; set; } = true;
}
}
11 changes: 11 additions & 0 deletions EXILED/Exiled.Events/Handlers/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,11 @@ public class Player
/// </summary>
public static Event<ChangingDisruptorModeEventArgs> ChangingDisruptorMode { get; set; } = new();

/// <summary>
/// Invoked before micro HID explode while charging.
/// </summary>
public static Event<ExplodingMicroHidEventArgs> ExplodingMicroHid { get; set; } = new();

/// <summary>
/// Invoked before player interacts with coffee cup.
/// </summary>
Expand Down Expand Up @@ -1260,6 +1265,12 @@ public static void OnItemRemoved(ReferenceHub referenceHub, InventorySystem.Item
/// <param name="ev">The <see cref="ChangingDisruptorModeEventArgs"/> instance.</param>
public static void OnChangingDisruptorMode(ChangingDisruptorModeEventArgs ev) => ChangingDisruptorMode.InvokeSafely(ev);

/// <summary>
/// Called before exploding MicroHID.
/// </summary>
/// <param name="ev">The <see cref="ExplodingMicroHidEventArgs"/> instance.</param>
public static void OnExplodingMicroHID(ExplodingMicroHidEventArgs ev) => ExplodingMicroHid.InvokeSafely(ev);

/// <summary>
/// Called before player interacts with coffee cup.
/// </summary>
Expand Down
40 changes: 40 additions & 0 deletions EXILED/Exiled.Events/Patches/Events/Player/ExplodingMicroHID.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// -----------------------------------------------------------------------
// <copyright file="ExplodingMicroHID.cs" company="ExMod Team">
// Copyright (c) ExMod Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

#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;

/// <summary>
/// Patches <see cref="InventorySystem.Items.MicroHID.Modules.ChargeFireModeModule.ServerExplode"/>.
/// Adds the <see cref="ExplodingMicroHid" /> event.
/// </summary>
[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;
}
}
}