OOC sent by an admin will have a different color (#3117)

* Admin OOC is sent with a different color than regular OOC

- Also adds the OOC color to the database

* Command to set the color

* Ooc -> OOC

* Change default color to Red (`#ff0000`)

* Outdated namespace
This commit is contained in:
Leo
2021-02-14 11:59:56 -03:00
committed by GitHub
parent 54f48aa6a9
commit a3d0e3f6a7
17 changed files with 1324 additions and 30 deletions

View File

@@ -1,5 +1,7 @@
using JetBrains.Annotations;
using Lidgren.Network;
using Robust.Shared.GameObjects;
using Robust.Shared.Maths;
using Robust.Shared.Network;
namespace Content.Shared.Chat
@@ -7,6 +9,7 @@ namespace Content.Shared.Chat
/// <summary>
/// Sent from server to client to notify the client about a new chat message.
/// </summary>
[UsedImplicitly]
public sealed class MsgChatMessage : NetMessage
{
#region REQUIRED
@@ -38,6 +41,12 @@ namespace Content.Shared.Chat
/// </summary>
public EntityUid SenderEntity { get; set; }
/// <summary>
/// The override color of the message
/// </summary>
public Color MessageColorOverride { get; set; } = Color.Transparent;
public override void ReadFromBuffer(NetIncomingMessage buffer)
{
Channel = (ChatChannel) buffer.ReadInt16();
@@ -53,6 +62,7 @@ namespace Content.Shared.Chat
SenderEntity = buffer.ReadEntityUid();
break;
}
MessageColorOverride = buffer.ReadColor();
}
public override void WriteToBuffer(NetOutgoingMessage buffer)
@@ -70,6 +80,7 @@ namespace Content.Shared.Chat
buffer.Write(SenderEntity);
break;
}
buffer.Write(MessageColorOverride);
}
}
}

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
@@ -15,10 +16,11 @@ namespace Content.Shared.Preferences
{
private Dictionary<int, ICharacterProfile> _characters;
public PlayerPreferences(IEnumerable<KeyValuePair<int, ICharacterProfile>> characters, int selectedCharacterIndex)
public PlayerPreferences(IEnumerable<KeyValuePair<int, ICharacterProfile>> characters, int selectedCharacterIndex, Color adminOOCColor)
{
_characters = new Dictionary<int, ICharacterProfile>(characters);
SelectedCharacterIndex = selectedCharacterIndex;
AdminOOCColor = adminOOCColor;
}
/// <summary>
@@ -41,6 +43,8 @@ namespace Content.Shared.Preferences
/// </summary>
public ICharacterProfile SelectedCharacter => Characters[SelectedCharacterIndex];
public Color AdminOOCColor { get; set; }
public int FirstEmptySlot()
{
var firstEmpty = IndexOfCharacter(null);