add mass-media system (#18251)
* Add Console, PDA news tab, and ringstone popup * Add English localization * Add mass-media console board to Advanced Entertainment resrarch * Fix misprint * Deleting unused libraries * Fix round restart problem * Fixing restart problem * Just another fix * Сode optimization * Code optimization
This commit is contained in:
@@ -15,6 +15,8 @@ using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Containers;
|
||||
using Content.Shared.Light.Component;
|
||||
using Content.Server.MassMedia.Components;
|
||||
using Content.Server.MassMedia.Systems;
|
||||
|
||||
namespace Content.Server.PDA
|
||||
{
|
||||
@@ -25,6 +27,7 @@ namespace Content.Server.PDA
|
||||
[Dependency] private readonly RingerSystem _ringer = default!;
|
||||
[Dependency] private readonly StationSystem _station = default!;
|
||||
[Dependency] private readonly StoreSystem _store = default!;
|
||||
[Dependency] private readonly NewsSystem _news = default!;
|
||||
[Dependency] private readonly UserInterfaceSystem _ui = default!;
|
||||
[Dependency] private readonly UnpoweredFlashlightSystem _unpoweredFlashlight = default!;
|
||||
[Dependency] private readonly MindSystem _mindSystem = default!;
|
||||
@@ -42,6 +45,7 @@ namespace Content.Server.PDA
|
||||
SubscribeLocalEvent<PdaComponent, PdaShowMusicMessage>(OnUiMessage);
|
||||
SubscribeLocalEvent<PdaComponent, PdaShowUplinkMessage>(OnUiMessage);
|
||||
SubscribeLocalEvent<PdaComponent, PdaLockUplinkMessage>(OnUiMessage);
|
||||
SubscribeLocalEvent<PdaComponent, PdaOpenNewsMessage>(OnUiMessage);
|
||||
|
||||
SubscribeLocalEvent<StationRenamedEvent>(OnStationRenamed);
|
||||
SubscribeLocalEvent<AlertLevelChangedEvent>(OnAlertLevelChanged);
|
||||
@@ -112,6 +116,7 @@ namespace Content.Server.PDA
|
||||
var address = GetDeviceNetAddress(uid);
|
||||
var hasInstrument = HasComp<InstrumentComponent>(uid);
|
||||
var showUplink = HasComp<StoreComponent>(uid) && IsUnlocked(uid);
|
||||
var showNews = HasComp<NewsReadComponent>(uid);
|
||||
|
||||
UpdateStationName(uid, pda);
|
||||
UpdateAlertLevel(uid, pda);
|
||||
@@ -133,6 +138,7 @@ namespace Content.Server.PDA
|
||||
pda.StationName,
|
||||
showUplink,
|
||||
hasInstrument,
|
||||
showNews,
|
||||
address);
|
||||
|
||||
_cartridgeLoader?.UpdateUiState(uid, state);
|
||||
@@ -195,6 +201,18 @@ namespace Content.Server.PDA
|
||||
}
|
||||
}
|
||||
|
||||
private void OnUiMessage(EntityUid uid, PdaComponent pda, PdaOpenNewsMessage msg)
|
||||
{
|
||||
if (!PdaUiKey.Key.Equals(msg.UiKey))
|
||||
return;
|
||||
|
||||
if (TryComp<NewsReadComponent>(uid, out var news))
|
||||
{
|
||||
_news.ToggleUi(msg.Session.AttachedEntity!.Value, uid, news);
|
||||
UpdatePdaUi(uid, pda);
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsUnlocked(EntityUid uid)
|
||||
{
|
||||
return !TryComp<RingerUplinkComponent>(uid, out var uplink) || uplink.Unlocked;
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Content.Server.PDA.Ringer
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("range")]
|
||||
public float Range = 3f;
|
||||
public float Range = 0.5f;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("volume")]
|
||||
|
||||
@@ -2,6 +2,7 @@ using Content.Server.Store.Components;
|
||||
using Content.Server.Store.Systems;
|
||||
using Content.Shared.PDA;
|
||||
using Content.Shared.PDA.Ringer;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Store;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
@@ -19,6 +20,7 @@ namespace Content.Server.PDA.Ringer
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly UserInterfaceSystem _ui = default!;
|
||||
[Dependency] private readonly AudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -48,6 +50,18 @@ namespace Content.Server.PDA.Ringer
|
||||
private void RingerPlayRingtone(EntityUid uid, RingerComponent ringer, RingerPlayRingtoneMessage args)
|
||||
{
|
||||
EnsureComp<ActiveRingerComponent>(uid);
|
||||
|
||||
_popupSystem.PopupEntity(Loc.GetString("comp-ringer-vibration-popup"), uid, Filter.Pvs(uid, 0.05f), false, PopupType.Small);
|
||||
|
||||
UpdateRingerUserInterface(uid, ringer);
|
||||
}
|
||||
|
||||
public void RingerPlayRingtone(EntityUid uid, RingerComponent ringer)
|
||||
{
|
||||
EnsureComp<ActiveRingerComponent>(uid);
|
||||
|
||||
_popupSystem.PopupEntity(Loc.GetString("comp-ringer-vibration-popup"), uid, Filter.Pvs(uid, 0.05f), false, PopupType.Small);
|
||||
|
||||
UpdateRingerUserInterface(uid, ringer);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user