Improves examine for ranged weapons, magazines and ammo.

This commit is contained in:
Víctor Aguilera Puerto
2020-08-22 20:07:35 +02:00
parent fffff53762
commit 5de139d6fd
6 changed files with 69 additions and 22 deletions

View File

@@ -16,11 +16,12 @@ using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
{
[RegisterComponent]
public sealed class AmmoBoxComponent : Component, IInteractUsing, IUse, IInteractHand, IMapInit
public sealed class AmmoBoxComponent : Component, IInteractUsing, IUse, IInteractHand, IMapInit, IExamine
{
public override string Name => "AmmoBox";
@@ -197,6 +198,8 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
return TryUse(eventArgs.User);
}
// So if you have 200 rounds in a box and that suddenly creates 200 entities you're not having a fun time
[Verb]
private sealed class DumpVerb : Verb<AmmoBoxComponent>
@@ -218,5 +221,11 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
component.EjectContents(10);
}
}
public void Examine(FormattedMessage message, bool inDetailsRange)
{
message.AddMarkup(Loc.GetString("\nIt's a [color=white]{0}[/color] ammo box.", _caliber));
message.AddMarkup(Loc.GetString("\nIt has [color=white]{0}[/color] out of [color=white]{1}[/color] ammo left.", AmmoLeft, _capacity));
}
}
}