-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: DroppingAmmo, DroppedAmmo and InteractingDoor #371
Conversation
Added ItemType property to DroppingAmmoEventArgs and DroppedAmmoEventArgs Added ColliderId propperty to InteractingDoorEventArgs
Forgot to mention. The |
@@ -36,14 +39,21 @@ public class DroppingAmmoEventArgs : IPlayerEvent, IDeniableEvent | |||
/// <param name="isAllowed"> | |||
/// <inheritdoc cref="IsAllowed" /> | |||
/// </param> | |||
public DroppingAmmoEventArgs(Player player, AmmoType ammoType, ushort amount, bool isAllowed = true) | |||
public DroppingAmmoEventArgs(Player player, byte itemType, AmmoType ammoType, ushort amount, bool isAllowed = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public DroppingAmmoEventArgs(Player player, byte itemType, AmmoType ammoType, ushort amount, bool isAllowed = true) | |
public DroppingAmmoEventArgs(Player player, ItemTypeitemType, ushort amount, bool isAllowed = true) |
(require to sligly change Transpiller to remove GetAmmoType)
@@ -60,7 +63,7 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi | |||
// true | |||
new(OpCodes.Ldc_I4_1), | |||
|
|||
// DroppingAmmoEventArgs ev = new(Player, AmmoType, ushort, bool) | |||
// DroppingAmmoEventArgs ev = new(Player, ItemType, AmmoType, ushort, bool) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// DroppingAmmoEventArgs ev = new(Player, ItemType, AmmoType, ushort, bool) | |
// DroppingAmmoEventArgs ev = new(Player, ItemType, ushort, bool) |
// itemType | ||
new(OpCodes.Ldarg_1), | ||
|
||
// ammoType | ||
new(OpCodes.Ldarg_1), | ||
new(OpCodes.Call, Method(typeof(API.Extensions.ItemExtensions), nameof(API.Extensions.ItemExtensions.GetAmmoType))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// itemType | |
new(OpCodes.Ldarg_1), | |
// ammoType | |
new(OpCodes.Ldarg_1), | |
new(OpCodes.Call, Method(typeof(API.Extensions.ItemExtensions), nameof(API.Extensions.ItemExtensions.GetAmmoType))), | |
// itemType | |
new(OpCodes.Ldarg_1), |
// ev.AmmoType | ||
new(OpCodes.Ldloc_S, ev.LocalIndex), | ||
new(OpCodes.Callvirt, PropertyGetter(typeof(DroppingAmmoEventArgs), nameof(DroppingAmmoEventArgs.AmmoType))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// ev.AmmoType | |
new(OpCodes.Ldloc_S, ev.LocalIndex), | |
new(OpCodes.Callvirt, PropertyGetter(typeof(DroppingAmmoEventArgs), nameof(DroppingAmmoEventArgs.AmmoType))), |
@@ -36,14 +39,20 @@ public class DroppedAmmoEventArgs : IPlayerEvent | |||
/// <param name="ammoPickups"> | |||
/// <inheritdoc cref="AmmoPickups" /> | |||
/// </param> | |||
public DroppedAmmoEventArgs(Player player, AmmoType ammoType, ushort amount, List<InventorySystem.Items.Firearms.Ammo.AmmoPickup> ammoPickups) | |||
public DroppedAmmoEventArgs(Player player, ItemType itemType, AmmoType ammoType, ushort amount, List<InventorySystem.Items.Firearms.Ammo.AmmoPickup> ammoPickups) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public DroppedAmmoEventArgs(Player player, ItemType itemType, AmmoType ammoType, ushort amount, List<InventorySystem.Items.Firearms.Ammo.AmmoPickup> ammoPickups) | |
public DroppedAmmoEventArgs(Player player, ItemType itemType, ushort amount, List<InventorySystem.Items.Firearms.Ammo.AmmoPickup> ammoPickups) |
/// <param name="ammoType"> | ||
/// <inheritdoc cref="AmmoType" /> | ||
/// </param> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// <param name="ammoType"> | |
/// <inheritdoc cref="AmmoType" /> | |
/// </param> |
/// <param name="ammoType"> | ||
/// <inheritdoc cref="AmmoType" /> | ||
/// </param> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// <param name="ammoType"> | |
/// <inheritdoc cref="AmmoType" /> | |
/// </param> |
because CustomItem put IsAllowed to false (it's should be added a call to the event inside CustomItem overide) |
@louis1706 |
I didn't said to remove it just use ItemType.GetAmmoType() |
Okay. I'll tweak it tonight and finalize the changes with |
Added support for DroppingAmmo in Exiled.CustomItems Shorten some of *AmmoEventArgs constructors
Description for pull request is updated I don't know exactly if I did what you meant by changes for |
public DroppingAmmoEventArgs(Player player, AmmoType ammoType, ushort amount, bool isAllowed = true) | ||
public DroppingAmmoEventArgs(Player player, byte itemType, ushort amount, bool isAllowed = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not use byte for itemtype
Fixed summary for ItemType in DroppedAmmoEventArgs. CustomItem.OnDroppingAmmo now triggers when CustomItem.Type equals dropped ItemType.
Checked my own changes, works fine on version 14.0.1 |
Description for pull request is updated |
{ | ||
if (!Check(ev.Item)) | ||
return; | ||
|
||
OnDroppingItem(ev); | ||
|
||
// Don't forget to remove this with next update |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a Todo and supress error
(put your IDE as build as Release not Debug)
* feat: ``Lift::Get(ElevatorGroup)`` (#372) Lift::Get(ElevatorGroup) * fix: PlacingBulletHoleEventArgs::Position (#377) Fix * fix: DryFiring fired constantly (#378) Fix DryFiring fired constantly * feat: Unbanned event addition (#185) * Option A * Style cop happy * Sigh stylecop * For Yamato * Done, not tested * Stylecop --------- Co-authored-by: Yamato <[email protected]> * feat: Adding CustomKeycard for CustomItems (#98) * uwu * itemtype check * bruh bruh brrr ☠ * fix * fix * fix no.2 * some events * ExMod Team copyright --------- Co-authored-by: Yamato <[email protected]> Co-authored-by: Yamato <[email protected]> * feat: ShadowType (#382) More features for the Light wrapper * fix: remove var & fix FF for explosions * feat: DroppingAmmo, DroppedAmmo and InteractingDoor (#371) * fix: DoorType and RoomType for Checkpoint (#379) Fix DoorType and RoomType for Checkpoint * feat: CustomStats (#363) * CustomStats * replace Mathf.Clamp01 by Mathf.Clamp * Remove CustomStaminaStat.cs --------- Co-authored-by: Yamato <[email protected]> * fix: NPC Spawn using wrong SpawnType (#375) Update Npc.cs * fix: Fix FF for explosions (#383) * fix: nre fix * fix: respawningteam event fix * fix: fix explosion ff * feat: LockerType extension (#384) * feat: LockerType extension * fix: fix of fix * fix: init fix for play gun sound * Revert "fix: init fix for play gun sound" This reverts commit f4d5541. * feat: Fix OnInternalSpawning & Added ChargingJailbird setter (by BlackSerperior6) (#368) BlackSerperior6 Co-authored-by: BlackSerperior6 <[email protected]> * feat: `ExplodingGrenadeEventArgs::ExplosionType` (#385) * ExplosionType * ExplodingGrenadeEventArgs::ExplosionType --------- Co-authored-by: Yamato <[email protected]> Co-authored-by: scp252arc <[email protected]> Co-authored-by: X <[email protected]> Co-authored-by: Yamato <[email protected]> Co-authored-by: Trevlouw <[email protected]> Co-authored-by: Misfiy <[email protected]> Co-authored-by: Cosmos Zvezdochkin <[email protected]> Co-authored-by: Rysik5318 <[email protected]> Co-authored-by: BlackSerperior6 <[email protected]>
Description
Describe the changes
Added
OnDroppingAmmo
override inCustomItem
Triggers if player requests to drop item which
ItemType
equals to theItemType
specified byCustomItem
OnDropping
toOnDroppingItem
override inCustomItem
(the only breaking change)Added
ItemType
property toDroppingAmmoEventArgs
andDroppedAmmoEventArg
Will allow normal interaction with custom items (see in the screenshots below)
Example of custom item
New behavior with custom items
New behavior with ammo
Added
ColliderId
andCollider
property toInteractingDoorEventArgs
Allows you to identify the
Collider
byColliderId
of the door/gate the player is interacting with.For example: Door button, left part of door and etc.
New behavior example 1
New behavior example 2
Bugged SCP-106 door colliders
What is the current behavior? (You can also link to an open issue here)
:)
What is the new behavior? (if this is a feature change)
Described in Description
Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
No
Other information:
No
Types of changes
Submission checklist
Patches (if there are any changes related to Harmony patches)
Other