using Robust.Shared.Map;
using Robust.Shared.Network;
using Robust.Shared.Player;
+using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Replays;
using Robust.Shared.Utility;
[Dependency] private readonly INetManager _netMan = default!;
[Dependency] private readonly IReplayRecordingManager _replay = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
+ [Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ChatSystem _chat = default!;
_netMan.ServerSendMessage(args.ChatMsg, actor.PlayerSession.ConnectedClient);
}
+ /// <summary>
+ /// Send radio message to all active radio listeners
+ /// </summary>
+ public void SendRadioMessage(EntityUid messageSource, string message, ProtoId<RadioChannelPrototype> channel, EntityUid radioSource, bool escapeMarkup = true)
+ {
+ SendRadioMessage(messageSource, message, _prototype.Index(channel), radioSource, escapeMarkup: escapeMarkup);
+ }
+
/// <summary>
/// Send radio message to all active radio listeners
/// </summary>
/// <param name="messageSource">Entity that spoke the message</param>
/// <param name="radioSource">Entity that picked up the message and will send it, e.g. headset</param>
- public void SendRadioMessage(EntityUid messageSource, string message, RadioChannelPrototype channel, EntityUid radioSource)
+ public void SendRadioMessage(EntityUid messageSource, string message, RadioChannelPrototype channel, EntityUid radioSource, bool escapeMarkup = true)
{
// TODO if radios ever garble / modify messages, feedback-prevention needs to be handled better than this.
if (!_messages.Add(message))
name = FormattedMessage.EscapeText(name);
var speech = _chat.GetSpeechVerb(messageSource, message);
+ var content = escapeMarkup
+ ? FormattedMessage.EscapeText(message)
+ : message;
var wrappedMessage = Loc.GetString(speech.Bold ? "chat-radio-message-wrap-bold" : "chat-radio-message-wrap",
("color", channel.Color),
("verb", Loc.GetString(_random.Pick(speech.SpeechVerbStrings))),
("channel", $"\\[{channel.LocalizedName}\\]"),
("name", name),
- ("message", FormattedMessage.EscapeText(message)));
+ ("message", content));
// most radios are relayed to chat, so lets parse the chat message beforehand
var chat = new ChatMessage(
using Content.Server.UserInterface;
using Content.Shared.Access.Components;
using Content.Shared.Research.Components;
+using Content.Shared.Research.Prototypes;
namespace Content.Server.Research.Systems;
if (!this.IsPowered(uid, EntityManager))
return;
+ if (!PrototypeManager.TryIndex<TechnologyPrototype>(args.Id, out var technologyPrototype))
+ return;
+
if (TryComp<AccessReaderComponent>(uid, out var access) && !_accessReader.IsAllowed(ent, uid, access))
{
_popup.PopupEntity(Loc.GetString("research-console-no-access-popup"), ent);
if (!UnlockTechnology(uid, args.Id, ent))
return;
+ var message = Loc.GetString("research-console-unlock-technology-radio-broadcast",
+ ("technology", Loc.GetString(technologyPrototype.Name)),
+ ("amount", technologyPrototype.Cost));
+ _radio.SendRadioMessage(uid, message, component.AnnouncementChannel, uid, escapeMarkup: false);
SyncClientWithServer(uid);
UpdateConsoleInterface(uid, component);
}
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Content.Server.Administration.Logs;
+using Content.Server.Radio.EntitySystems;
using Content.Shared.Access.Systems;
using Content.Shared.Popups;
using Content.Shared.Research.Components;
[Dependency] private readonly AccessReaderSystem _accessReader = default!;
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
+ [Dependency] private readonly RadioSystem _radio = default!;
public override void Initialize()
{