Files
wwdpublic/Content.Server/HealthExaminable/HealthExaminableSystem.cs
Nemanja 1408d6c712 Replace IClickAlert with events (#30728)
* Replace IAlertClick with events

* whoop

* eek!
2025-07-19 11:12:44 +10:00

40 lines
1.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Content.Server.Chat.Managers;
using Content.Shared.Chat;
using Content.Shared.Damage;
using Content.Shared.HealthExaminable;
using Robust.Server.Player;
namespace Content.Server.HealthExaminable;
public sealed class HealthExaminableSystem : SharedHealthExaminableSystem
{
[Dependency] private readonly IChatManager _сhatManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<HealthExaminableComponent, CheckHealthAlertEvent>(OnCheckHealthAlert);
}
private void OnCheckHealthAlert(EntityUid uid, HealthExaminableComponent component, CheckHealthAlertEvent args)
{
if (!TryComp(uid, out DamageableComponent? damageable)
|| !_playerManager.TryGetSessionByEntity(uid, out var session))
return;
var markup = Loc.GetString("health-alert-start")
+ "\n"
+ GetMarkup(uid, (uid, component), damageable).ToMarkup();
_сhatManager.ChatMessageToOne(
ChatChannel.Emotes,
markup,
markup,
EntityUid.Invalid,
false,
session.Channel);
}
}