mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* IoC source gen compatibility Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter. * Missed a spot
22 lines
723 B
C#
22 lines
723 B
C#
using Content.Server.Chat;
|
|
|
|
namespace Content.Server.Chat.Systems;
|
|
|
|
public sealed partial class AnnounceOnSpawnSystem : EntitySystem
|
|
{
|
|
[Dependency] private 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) : Loc.GetString("chat-manager-sender-announcement");
|
|
_chat.DispatchGlobalAnnouncement(message, sender, playSound: true, comp.Sound, comp.Color);
|
|
}
|
|
}
|