Skip to content

Commit

Permalink
misaka tinybrain moment
Browse files Browse the repository at this point in the history
  • Loading branch information
joker-119 committed May 10, 2023
1 parent 1544575 commit b711c12
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
11 changes: 2 additions & 9 deletions Exiled.Events/EventArgs/Player/ThrowingRequestEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,19 @@ namespace Exiled.Events.EventArgs.Player
/// <summary>
/// Contains all information before receving a throwing request.
/// </summary>
public class ThrowingRequestEventArgs : IPlayerEvent, IDeniableEvent
public class ThrowingRequestEventArgs : IPlayerEvent
{
/// <summary>
/// Initializes a new instance of the <see cref="ThrowingRequestEventArgs"/> class.
/// </summary>
/// <param name="player"><inheritdoc cref="Player"/></param>
/// <param name="item"><inheritdoc cref="Throwable"/></param>
/// <param name="request"><inheritdoc cref="RequestType"/></param>
/// <param name="isAllowed"><inheritdoc cref="IsAllowed"/></param>
public ThrowingRequestEventArgs(Player player, ThrowableItem item, ThrowableNetworkHandler.RequestType request, bool isAllowed = true)
public ThrowingRequestEventArgs(Player player, ThrowableItem item, ThrowableNetworkHandler.RequestType request)
{
Player = player;
Throwable = (Throwable)Item.Get(item);
RequestType = (ThrowRequest)request;
IsAllowed = isAllowed;
}

/// <summary>
Expand All @@ -48,10 +46,5 @@ public ThrowingRequestEventArgs(Player player, ThrowableItem item, ThrowableNetw
/// Gets or sets the type of throw being requested.
/// </summary>
public ThrowRequest RequestType { get; set; }

/// <summary>
/// Gets or sets a value indicating whether or not the grenade can be thrown.
/// </summary>
public bool IsAllowed { get; set; } = true;
}
}
8 changes: 0 additions & 8 deletions Exiled.Events/Patches/Events/Player/ThrowingRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,14 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
new(OpCodes.Ldarg_1),
new(OpCodes.Ldfld, Field(typeof(ThrowableNetworkHandler.ThrowableItemRequestMessage), nameof(ThrowableNetworkHandler.ThrowableItemRequestMessage.Request))),

// true
new(OpCodes.Ldc_I4_1),

// ThrowingRequestEventArgs ev = new(Player.Get(referenceHub), ThrowableItem,Networkconnection.Request, true);
new(OpCodes.Newobj, GetDeclaredConstructors(typeof(ThrowingRequestEventArgs))[0]),
new(OpCodes.Dup),
new(OpCodes.Dup),
new(OpCodes.Stloc_S, ev.LocalIndex),

// Handlers.Player.OnThrowingRequest(ev);
new(OpCodes.Call, Method(typeof(Handlers.Player), nameof(Handlers.Player.OnThrowingRequest))),

// if (ev.IsAllowed) return;
new(OpCodes.Callvirt, PropertyGetter(typeof(ThrowingRequestEventArgs), nameof(ThrowingRequestEventArgs.IsAllowed))),
new(OpCodes.Brfalse_S, returnLabel),

// Networkconnection.Serial
new(OpCodes.Ldarg_1),
new(OpCodes.Ldfld, Field(typeof(ThrowableNetworkHandler.ThrowableItemRequestMessage), nameof(ThrowableNetworkHandler.ThrowableItemRequestMessage.Serial))),
Expand Down

0 comments on commit b711c12

Please sign in to comment.