Fix admin verb to set unspawned ballisic ammo count (#26411)
Don't crash if an invalid value is given.
This commit is contained in:
@@ -718,9 +718,21 @@ public sealed partial class AdminVerbSystem
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user