research console radio messages on unlock (#22166)

This commit is contained in:
Nemanja
2023-12-06 02:00:51 -05:00
committed by GitHub
parent 5ecd4aa855
commit 89295d97b6
6 changed files with 37 additions and 3 deletions

View File

@@ -3,6 +3,7 @@ using Content.Server.Research.Components;
using Content.Server.UserInterface;
using Content.Shared.Access.Components;
using Content.Shared.Research.Components;
using Content.Shared.Research.Prototypes;
namespace Content.Server.Research.Systems;
@@ -25,6 +26,9 @@ public sealed partial class ResearchSystem
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);
@@ -34,6 +38,10 @@ public sealed partial class ResearchSystem
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);
}