Add examines for damage values (#11090)

* Add examines for damage values

Even immersive sims still give you values.

We should also do this for armour so people don't have to yml dive and so the general public actually know the balance of things.

* Slightly better

* Cleanup
This commit is contained in:
metalgearsloth
2022-09-09 09:08:14 +10:00
committed by GitHub
parent 7ae1d59ce2
commit 2f07270744
10 changed files with 238 additions and 6 deletions

View File

@@ -7,6 +7,7 @@ using Content.Shared.MobState.Components;
using Content.Shared.Radiation.Events;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
namespace Content.Shared.Damage
{
@@ -22,6 +23,31 @@ namespace Content.Shared.Damage
SubscribeLocalEvent<DamageableComponent, OnIrradiatedEvent>(OnIrradiated);
}
/// <summary>
/// Retrieves the damage examine values.
/// </summary>
public FormattedMessage GetDamageExamine(DamageSpecifier damageSpecifier, string? type = null)
{
var msg = new FormattedMessage();
if (string.IsNullOrEmpty(type))
{
msg.AddMarkup(Loc.GetString("damage-examine"));
}
else
{
msg.AddMarkup(Loc.GetString("damage-examine-type", ("type", type)));
}
foreach (var damage in damageSpecifier.DamageDict)
{
msg.PushNewline();
msg.AddMarkup(Loc.GetString("damage-value", ("type", damage.Key), ("amount", damage.Value)));
}
return msg;
}
/// <summary>
/// Initialize a damageable component
/// </summary>