From 815dee7193e1d6ae270a02d53894eee219011d61 Mon Sep 17 00:00:00 2001 From: SimpleStation14 Date: Fri, 3 May 2024 11:57:26 -0400 Subject: [PATCH] Cherry-picked commit 451890b85b49e17a0019d107db4a31a48cdd3518 from space-wizards/space-station-14/master --- .../Systems/AdminVerbSystem.Tools.cs | 16 ++++++++++++++-- .../Ranged/Systems/SharedGunSystem.Ballistic.cs | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Content.Server/Administration/Systems/AdminVerbSystem.Tools.cs b/Content.Server/Administration/Systems/AdminVerbSystem.Tools.cs index c68336deab8..9d66338c8bf 100644 --- a/Content.Server/Administration/Systems/AdminVerbSystem.Tools.cs +++ b/Content.Server/Administration/Systems/AdminVerbSystem.Tools.cs @@ -718,9 +718,21 @@ private void AddTricksVerbs(GetVerbsEvent args) Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Fun/caps.rsi"), "mag-6"), Act = () => { - _quickDialog.OpenDialog(player, "Set Bullet Amount", $"Amount (max {ballisticAmmo.Capacity}):", (int amount) => + _quickDialog.OpenDialog(player, "Set Bullet Amount", $"Amount (standard {ballisticAmmo.Capacity}):", (string amount) => { - ballisticAmmo.UnspawnedCount = amount; + if (!int.TryParse(amount, out var result)) + return; + + if (result > 0) + { + ballisticAmmo.UnspawnedCount = result; + } + else + { + ballisticAmmo.UnspawnedCount = 0; + } + + _gun.UpdateBallisticAppearance(args.Target, ballisticAmmo); }); }, Impact = LogImpact.Medium, diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Ballistic.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Ballistic.cs index a8f7ee23956..91aad895821 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Ballistic.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Ballistic.cs @@ -261,7 +261,7 @@ private void OnBallisticAmmoCount(EntityUid uid, BallisticAmmoProviderComponent args.Capacity = component.Capacity; } - private void UpdateBallisticAppearance(EntityUid uid, BallisticAmmoProviderComponent component) + public void UpdateBallisticAppearance(EntityUid uid, BallisticAmmoProviderComponent component) { if (!Timing.IsFirstTimePredicted || !TryComp(uid, out var appearance)) return;