Literally Murder IExamine (#7352)
This commit is contained in:
@@ -1,25 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.GameTicking.Rules;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Roles;
|
||||
using Content.Server.Suspicion.Roles;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.Suspicion;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.Suspicion
|
||||
{
|
||||
[RegisterComponent]
|
||||
#pragma warning disable 618
|
||||
public sealed class SuspicionRoleComponent : SharedSuspicionRoleComponent, IExamine
|
||||
#pragma warning restore 618
|
||||
public sealed class SuspicionRoleComponent : SharedSuspicionRoleComponent
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
@@ -123,27 +113,6 @@ namespace Content.Server.Suspicion
|
||||
|
||||
Dirty();
|
||||
}
|
||||
|
||||
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
|
||||
{
|
||||
if (!IsDead())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var traitor = IsTraitor();
|
||||
var color = traitor ? "red" : "green";
|
||||
var role = traitor ? "suspicion-role-component-role-traitor" : "suspicion-role-component-role-innocent";
|
||||
var article = traitor ? "generic-article-a" : "generic-article-an";
|
||||
|
||||
var tooltip = Loc.GetString("suspicion-role-component-on-examine-tooltip",
|
||||
("article", Loc.GetString(article)),
|
||||
("colorName", color),
|
||||
("role",Loc.GetString(role)));
|
||||
|
||||
message.AddMarkup(tooltip);
|
||||
}
|
||||
|
||||
public override ComponentState GetComponentState()
|
||||
{
|
||||
if (Role == null)
|
||||
|
||||
32
Content.Server/Suspicion/SuspicionRoleSystem.cs
Normal file
32
Content.Server/Suspicion/SuspicionRoleSystem.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Content.Shared.Examine;
|
||||
|
||||
namespace Content.Server.Suspicion
|
||||
{
|
||||
public sealed class SuspicionRoleSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<SuspicionRoleComponent, ExaminedEvent>(OnExamined);
|
||||
}
|
||||
private void OnExamined(EntityUid uid, SuspicionRoleComponent component, ExaminedEvent args)
|
||||
{
|
||||
if (!component.IsDead())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var traitor = component.IsTraitor();
|
||||
var color = traitor ? "red" : "green";
|
||||
var role = traitor ? "suspicion-role-component-role-traitor" : "suspicion-role-component-role-innocent";
|
||||
var article = traitor ? "generic-article-a" : "generic-article-an";
|
||||
|
||||
var tooltip = Loc.GetString("suspicion-role-component-on-examine-tooltip",
|
||||
("article", Loc.GetString(article)),
|
||||
("colorName", color),
|
||||
("role",Loc.GetString(role)));
|
||||
|
||||
args.PushMarkup(tooltip);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user