Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADD traitor codewords highlight #1582

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Content.Client/UserInterface/Systems/Chat/Widgets/ChatBox.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using Content.Client.UserInterface.Systems.Chat.Controls;
using Content.Shared.Chat;
using Content.Shared.Input;
using Content.Shared.SS220.ShowCodewords;
using Robust.Client.Audio;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.Player;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
Expand Down Expand Up @@ -65,6 +67,20 @@ private void OnMessageAdded(ChatMessage msg)

var color = msg.MessageColorOverride ?? msg.Channel.TextColor();

//ss220 codewords highlight add start
var playerManager = IoCManager.Resolve<IPlayerManager>();
var entManager = IoCManager.Resolve<IEntityManager>();

if (playerManager.LocalEntity != null &&
entManager.TryGetComponent<ShowCodewordsComponent>(playerManager.LocalEntity, out var showCodewordsComponent))
{
foreach (var codeword in showCodewordsComponent.CodeWords)
{
msg.WrappedMessage = msg.WrappedMessage.Replace(codeword, $"[color=pink]{codeword}[/color]");
}
}
//ss220 codewords highlight add end

AddLine(msg.WrappedMessage, color);
}

Expand Down
8 changes: 8 additions & 0 deletions Content.Server/GameTicking/Rules/TraitorRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using System.Text;
using Content.Shared.GameTicking.Components;
using Content.Server.SS220.MindSlave;
using Content.Shared.SS220.ShowCodewords;

namespace Content.Server.GameTicking.Rules;

Expand Down Expand Up @@ -106,6 +107,13 @@ public bool MakeTraitor(EntityUid traitor, TraitorRuleComponent component, bool

component.TraitorMinds.Add(mindId);

//ss220 codewords highlight add start

var showCodewordsComp = EnsureComp<ShowCodewordsComponent>(traitor);
showCodewordsComp.CodeWords = component.Codewords;

//ss220 codewords highlight add end

// Assign briefing
_roleSystem.MindAddRole(mindId, new RoleBriefingComponent
{
Expand Down
11 changes: 11 additions & 0 deletions Content.Shared/SS220/ShowCodewords/ShowCodewordsComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Robust.Shared.GameStates;

namespace Content.Shared.SS220.ShowCodewords;

[RegisterComponent, NetworkedComponent]
[AutoGenerateComponentState]
public sealed partial class ShowCodewordsComponent : Component
{
[DataField("codewords"), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public string[] CodeWords;
}
Loading