fish-station/Content.Server/Chat/Systems/AnnounceOnSpawnSystem.cs
Vigers Ray 72affc5f7a
Очередь озвучки анонсов, фиксы багов и оптимизация генерации ттсов. (#35)
* Очередь на озвучку оповещений

* Фикс ошибок клиента и оптимизация ттса

* Укоротил сообщения о кодах

* чейнжлог
2024-06-07 11:04:08 +03:00

22 lines
728 B
C#

using Content.Server.Chat;
namespace Content.Server.Chat.Systems;
public sealed class AnnounceOnSpawnSystem : EntitySystem
{
[Dependency] private readonly ChatSystem _chat = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<AnnounceOnSpawnComponent, MapInitEvent>(OnInit);
}
private void OnInit(EntityUid uid, AnnounceOnSpawnComponent comp, MapInitEvent args)
{
var message = Loc.GetString(comp.Message);
var sender = comp.Sender != null ? Loc.GetString(comp.Sender) : "Central Command";
_chat.DispatchGlobalAnnouncement(message, sender, playDefault: true, announcementSound: comp.Sound, colorOverride: comp.Color);
}
}