Files
wwdpublic/Content.Server/Chat/Systems/AnnounceOnSpawnSystem.cs

24 lines
780 B
C#

using Content.Server.Announcements.Systems;
using Robust.Shared.Player;
namespace Content.Server.Chat.Systems;
public sealed class AnnounceOnSpawnSystem : EntitySystem
{
[Dependency] private readonly AnnouncerSystem _announcer = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<AnnounceOnSpawnComponent, MapInitEvent>(OnInit);
}
private void OnInit(EntityUid uid, AnnounceOnSpawnComponent comp, MapInitEvent args)
{
var sender = comp.Sender != null ? Loc.GetString(comp.Sender) : Loc.GetString("chat-manager-sender-announcement");
_announcer.SendAnnouncement(_announcer.GetAnnouncementId("SpawnAnnounceCaptain"),
comp.Message, sender, colorOverride: comp.Color);
}
}