2023-12-07 01:24:33 +00:00
|
|
|
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);
|
2024-07-11 17:02:53 +03:00
|
|
|
var sender = comp.Sender != null ? Loc.GetString(comp.Sender) : Loc.GetString("chat-manager-sender-announcement");
|
2023-12-07 01:24:33 +00:00
|
|
|
_chat.DispatchGlobalAnnouncement(message, sender, playSound: true, comp.Sound, comp.Color);
|
|
|
|
|
}
|
|
|
|
|
}
|