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:
MishaUnity
2023-07-26 21:49:38 +03:00
committed by GitHub
parent bf4d7ba782
commit 325d2a39ee
32 changed files with 2512 additions and 1653 deletions

View File

@@ -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;