forked from Exiled-Official/EXILED
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Fix Reload & Unload & ClipSize & Added Reloaded & UnLoaded (#398)
* Fix Unloading and Reloading not working when denied * Fix Crash * better doc * Added UnloadedWeapon & ReloadedWeapon * Fix CustomWeapon * Wrong event moment * missing negative * Update CustomWeapon.cs * HitscanHitregModuleBase (require testing) * Fixing for AutomaticWeapon * Warning * Fix Unloading event getting call with reloading * Update ReloadingWeaponEventArgs.cs * Make than ClipSize 0 or Negative do not affect the CustomWeapon
- Loading branch information
Showing
8 changed files
with
329 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
EXILED/Exiled.Events/EventArgs/Player/ReloadedWeaponEventArgs.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="ReloadedWeaponEventArgs.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 API.Features; | ||
using API.Features.Items; | ||
|
||
using Interfaces; | ||
|
||
/// <summary> | ||
/// Contains all information after a player's weapon is reloaded. | ||
/// </summary> | ||
public class ReloadedWeaponEventArgs : IPlayerEvent, IFirearmEvent | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ReloadedWeaponEventArgs" /> class. | ||
/// </summary> | ||
/// <param name="firearm"> | ||
/// <inheritdoc cref="Firearm" /> | ||
/// </param> | ||
public ReloadedWeaponEventArgs(InventorySystem.Items.Firearms.Firearm firearm) | ||
{ | ||
Firearm = Item.Get<Firearm>(firearm); | ||
Player = Firearm.Owner; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the <see cref="API.Features.Items.Firearm" /> being reloaded. | ||
/// </summary> | ||
public Firearm Firearm { get; } | ||
|
||
/// <inheritdoc/> | ||
public Item Item => Firearm; | ||
|
||
/// <summary> | ||
/// Gets the player who's reloading the weapon. | ||
/// </summary> | ||
public Player Player { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
EXILED/Exiled.Events/EventArgs/Player/UnloadedWeaponEventArgs.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="UnloadedWeaponEventArgs.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 API.Features; | ||
using API.Features.Items; | ||
|
||
using Interfaces; | ||
|
||
/// <summary> | ||
/// Contains all information after a player's weapon is unloaded. | ||
/// </summary> | ||
public class UnloadedWeaponEventArgs : IPlayerEvent, IFirearmEvent | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="UnloadedWeaponEventArgs" /> class. | ||
/// </summary> | ||
/// <param name="firearm"> | ||
/// <inheritdoc cref="Firearm" /> | ||
/// </param> | ||
public UnloadedWeaponEventArgs(InventorySystem.Items.Firearms.Firearm firearm) | ||
{ | ||
Firearm = Item.Get<Firearm>(firearm); | ||
Player = Firearm.Owner; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the <see cref="API.Features.Items.Firearm" /> being unloaded. | ||
/// </summary> | ||
public Firearm Firearm { get; } | ||
|
||
/// <inheritdoc/> | ||
public Item Item => Firearm; | ||
|
||
/// <summary> | ||
/// Gets the player who's unloading the weapon. | ||
/// </summary> | ||
public Player Player { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
magic number?