research console radio messages on unlock (#22166)
This commit is contained in:
@@ -1,8 +1,15 @@
|
||||
using Content.Shared.Radio;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Research.Components;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed partial class ResearchConsoleComponent : Component
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The radio channel that the unlock announcements are broadcast to.
|
||||
/// </summary>
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public ProtoId<RadioChannelPrototype> AnnouncementChannel = "Science";
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
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;
|
||||
@@ -19,6 +20,7 @@ namespace Content.Server.Research.Systems
|
||||
[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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user