Fix gun cycling ammo count update (#25635)
Doesn't update correctly when cycling.
This commit is contained in:
@@ -112,7 +112,10 @@ public abstract partial class SharedGunSystem
|
||||
}
|
||||
}
|
||||
|
||||
CycleCartridge(uid, component, user);
|
||||
if (!CycleCartridge(uid, component, user))
|
||||
{
|
||||
UpdateAmmoCount(uid);
|
||||
}
|
||||
|
||||
if (component.BoltClosed != false)
|
||||
{
|
||||
@@ -202,11 +205,12 @@ public abstract partial class SharedGunSystem
|
||||
/// <summary>
|
||||
/// Tries to take ammo from the magazine and insert into the chamber.
|
||||
/// </summary>
|
||||
private void CycleCartridge(EntityUid uid, ChamberMagazineAmmoProviderComponent component, EntityUid? user = null, AppearanceComponent? appearance = null)
|
||||
private bool CycleCartridge(EntityUid uid, ChamberMagazineAmmoProviderComponent component, EntityUid? user = null, AppearanceComponent? appearance = null)
|
||||
{
|
||||
// Try to put a new round in if possible.
|
||||
var magEnt = GetMagazineEntity(uid);
|
||||
var chambered = GetChamberEntity(uid);
|
||||
var result = false;
|
||||
|
||||
// Similar to what takeammo does though that uses an optimised version where
|
||||
// multiple bullets may be fired in a single tick.
|
||||
@@ -243,7 +247,11 @@ public abstract partial class SharedGunSystem
|
||||
{
|
||||
UpdateAmmoCount(uid);
|
||||
}
|
||||
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user