Files
crystall-punk-14/Content.Server/Traitor/TraitorRole.cs
ShadowCommander bfc4da9377 Mind ecs (#14412)
2023-03-26 14:31:13 -04:00

36 lines
1.2 KiB
C#

using Content.Server.Chat.Managers;
using Content.Server.Mind;
using Content.Server.Roles;
using Content.Shared.Roles;
namespace Content.Server.Traitor
{
public sealed class TraitorRole : Role
{
public AntagPrototype Prototype { get; }
public TraitorRole(Mind.Mind mind, AntagPrototype antagPrototype) : base(mind)
{
Prototype = antagPrototype;
Name = Loc.GetString(antagPrototype.Name);
Antagonist = antagPrototype.Antagonist;
}
public override string Name { get; }
public override bool Antagonist { get; }
public void GreetTraitor(string[] codewords)
{
var entityManager = IoCManager.Resolve<IEntityManager>();
var mindSystem = entityManager.System<MindSystem>();
if (mindSystem.TryGetSession(Mind, out var session))
{
var chatMgr = IoCManager.Resolve<IChatManager>();
chatMgr.DispatchServerMessage(session, Loc.GetString("traitor-role-greeting"));
chatMgr.DispatchServerMessage(session, Loc.GetString("traitor-role-codewords", ("codewords", string.Join(", ",codewords))));
}
}
}
}