42 lines
1.5 KiB
C#
42 lines
1.5 KiB
C#
using Content.Shared.Examine;
|
|
using Content.Shared.Verbs;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Content.Server.DetailExaminable
|
|
{
|
|
public sealed class DetailExaminableSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly ExamineSystemShared _examineSystem = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<DetailExaminableComponent, GetVerbsEvent<ExamineVerb>>(OnGetExamineVerbs);
|
|
}
|
|
|
|
private void OnGetExamineVerbs(EntityUid uid, DetailExaminableComponent component, GetVerbsEvent<ExamineVerb> args)
|
|
{
|
|
// TODO: Hide if identity isn't visible (when identity is merged)
|
|
var detailsRange = _examineSystem.IsInDetailsRange(args.User, uid);
|
|
|
|
var verb = new ExamineVerb()
|
|
{
|
|
Act = () =>
|
|
{
|
|
var markup = new FormattedMessage();
|
|
markup.AddMarkup(component.Content);
|
|
_examineSystem.SendExamineTooltip(args.User, uid, markup, false, false);
|
|
},
|
|
Text = Loc.GetString("detail-examinable-verb-text"),
|
|
Category = VerbCategory.Examine,
|
|
Disabled = !detailsRange,
|
|
Message = Loc.GetString("detail-examinable-verb-disabled"),
|
|
IconTexture = "/Textures/Interface/VerbIcons/examine.svg.192dpi.png"
|
|
};
|
|
|
|
args.Verbs.Add(verb);
|
|
}
|
|
}
|
|
}
|