Fix ghost radios and colours (#9064)
This commit is contained in:
@@ -7,15 +7,30 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
|
||||
|
||||
namespace Content.Server.Ghost.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// Add to a particular entity to let it receive messages from the specified channels.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(IRadio))]
|
||||
public sealed class GhostRadioComponent : Component, IRadio
|
||||
{
|
||||
// TODO: This class is yuck
|
||||
[Dependency] private readonly IServerNetManager _netManager = default!;
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
[DataField("channels", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<RadioChannelPrototype>))]
|
||||
private HashSet<string> _channels = new();
|
||||
private HashSet<string> _channels = new()
|
||||
{
|
||||
"Common",
|
||||
"Command",
|
||||
"CentCom",
|
||||
"Engineering",
|
||||
"Medical",
|
||||
"Science",
|
||||
"Security",
|
||||
"Service",
|
||||
"Supply",
|
||||
};
|
||||
|
||||
public void Receive(string message, RadioChannelPrototype channel, EntityUid speaker)
|
||||
{
|
||||
@@ -29,7 +44,7 @@ namespace Content.Server.Ghost.Components
|
||||
Channel = ChatChannel.Radio,
|
||||
Message = message,
|
||||
//Square brackets are added here to avoid issues with escaping
|
||||
MessageWrap = Loc.GetString("chat-radio-message-wrap", ("channel", $"\\[{channel.Name}\\]"), ("name", _entMan.GetComponent<MetaDataComponent>(speaker).EntityName))
|
||||
MessageWrap = Loc.GetString("chat-radio-message-wrap", ("color", channel.Color), ("channel", $"\\[{channel.Name}\\]"), ("name", _entMan.GetComponent<MetaDataComponent>(speaker).EntityName))
|
||||
};
|
||||
|
||||
_netManager.ServerSendMessage(msg, playerChannel);
|
||||
|
||||
Reference in New Issue
Block a user