Fix ghost radios and colours (#9064)

This commit is contained in:
metalgearsloth
2022-06-23 20:48:26 +10:00
committed by GitHub
parent 876e4fbdb5
commit c6d534a1be
2 changed files with 27 additions and 9 deletions

View File

@@ -7,15 +7,30 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
namespace Content.Server.Ghost.Components namespace Content.Server.Ghost.Components
{ {
/// <summary>
/// Add to a particular entity to let it receive messages from the specified channels.
/// </summary>
[RegisterComponent] [RegisterComponent]
[ComponentReference(typeof(IRadio))] [ComponentReference(typeof(IRadio))]
public sealed class GhostRadioComponent : Component, IRadio public sealed class GhostRadioComponent : Component, IRadio
{ {
// TODO: This class is yuck
[Dependency] private readonly IServerNetManager _netManager = default!; [Dependency] private readonly IServerNetManager _netManager = default!;
[Dependency] private readonly IEntityManager _entMan = default!; [Dependency] private readonly IEntityManager _entMan = default!;
[DataField("channels", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<RadioChannelPrototype>))] [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) public void Receive(string message, RadioChannelPrototype channel, EntityUid speaker)
{ {
@@ -29,7 +44,7 @@ namespace Content.Server.Ghost.Components
Channel = ChatChannel.Radio, Channel = ChatChannel.Radio,
Message = message, Message = message,
//Square brackets are added here to avoid issues with escaping //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); _netManager.ServerSendMessage(msg, playerChannel);

View File

@@ -3,64 +3,67 @@
name: "Common" name: "Common"
keycode: ";" keycode: ";"
frequency: 1459 frequency: 1459
color: "#1ecc43"
- type: radioChannel - type: radioChannel
id: CentCom id: CentCom
name: "CentCom" name: "CentCom"
keycode: 'y' keycode: 'y'
frequency: 1337 frequency: 1337
color: "#2681a5"
- type: radioChannel - type: radioChannel
id: Command id: Command
name: "Command" name: "Command"
keycode: 'c' keycode: 'c'
frequency: 1353 frequency: 1353
color: "#334e6d" color: "#fcdf03"
- type: radioChannel - type: radioChannel
id: Engineering id: Engineering
name: "Engineering" name: "Engineering"
keycode: 'e' keycode: 'e'
frequency: 1357 frequency: 1357
color: "#efb341" color: "#f37746"
- type: radioChannel - type: radioChannel
id: Medical id: Medical
name: "Medical" name: "Medical"
keycode: 'm' keycode: 'm'
frequency: 1355 frequency: 1355
color: "#52b4e9" color: "#57b8f0"
- type: radioChannel - type: radioChannel
id: Science id: Science
name: "Science" name: "Science"
keycode: 'n' keycode: 'n'
frequency: 1351 frequency: 1351
color: "#d381c9" color: "#c68cfa"
- type: radioChannel - type: radioChannel
id: Security id: Security
name: "Security" name: "Security"
keycode: 's' keycode: 's'
frequency: 1359 frequency: 1359
color: "#de3a3a" color: "#dd3535"
- type: radioChannel - type: radioChannel
id: Service id: Service
name: "Service" name: "Service"
keycode: 'v' keycode: 'v'
frequency: 1349 frequency: 1349
color: "#9fed58" color: "#6ca729"
- type: radioChannel - type: radioChannel
id: Supply id: Supply
name: "Supply" name: "Supply"
keycode: 'u' keycode: 'u'
frequency: 1347 frequency: 1347
color: "#a46106" color: "#b88646"
- type: radioChannel - type: radioChannel
id: Syndicate id: Syndicate
name: "Syndicate" name: "Syndicate"
keycode: 't' keycode: 't'
frequency: 1213 frequency: 1213
color: "#8f4a4b"