Revolver fixes for caseless ammo and wielding (#30117)
* handled check * splits Handled and TryResetDelay checks
This commit is contained in:
@@ -9,6 +9,8 @@ using Robust.Shared.Utility;
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Shared.Interaction.Events;
|
using Content.Shared.Interaction.Events;
|
||||||
|
using Content.Shared.Wieldable;
|
||||||
|
using Content.Shared.Wieldable.Components;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
|
|
||||||
namespace Content.Shared.Weapons.Ranged.Systems;
|
namespace Content.Shared.Weapons.Ranged.Systems;
|
||||||
@@ -31,9 +33,14 @@ public partial class SharedGunSystem
|
|||||||
|
|
||||||
private void OnRevolverUse(EntityUid uid, RevolverAmmoProviderComponent component, UseInHandEvent args)
|
private void OnRevolverUse(EntityUid uid, RevolverAmmoProviderComponent component, UseInHandEvent args)
|
||||||
{
|
{
|
||||||
|
if (args.Handled)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!_useDelay.TryResetDelay(uid))
|
if (!_useDelay.TryResetDelay(uid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
args.Handled = true;
|
||||||
|
|
||||||
Cycle(component);
|
Cycle(component);
|
||||||
UpdateAmmoCount(uid, prediction: false);
|
UpdateAmmoCount(uid, prediction: false);
|
||||||
Dirty(uid, component);
|
Dirty(uid, component);
|
||||||
@@ -393,10 +400,14 @@ public partial class SharedGunSystem
|
|||||||
args.Ammo.Add((spawned, EnsureComp<AmmoComponent>(spawned)));
|
args.Ammo.Add((spawned, EnsureComp<AmmoComponent>(spawned)));
|
||||||
|
|
||||||
if (cartridge.DeleteOnSpawn)
|
if (cartridge.DeleteOnSpawn)
|
||||||
|
{
|
||||||
|
component.AmmoSlots[index] = null;
|
||||||
component.Chambers[index] = null;
|
component.Chambers[index] = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
component.AmmoSlots[index] = null;
|
||||||
component.Chambers[index] = null;
|
component.Chambers[index] = null;
|
||||||
args.Ammo.Add((ent.Value, EnsureComp<AmmoComponent>(ent.Value)));
|
args.Ammo.Add((ent.Value, EnsureComp<AmmoComponent>(ent.Value)));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user