Files
wwdpublic/Content.Server/Chat/Systems/AnnounceOnSpawnSystem.cs
DEATHB4DEFEAT e3bc8d4c0e Random Announcer System (#415)
# Description

Replaces every instance of station announcements with an announcer
system meant to handle audio and messages for various announcers defined
in prototypes instead of each server replacing the scattered files
inconsistently with whatever singular thing they want to hear announce
messages.

# TODO

- [x] Systems
- [x] CVars
- [x] Sounds
- [x] Client volume slider
- [x] Collections
- [x] Prototypes
- [x] Events
- [x] Commands
- [x] PR media
- [x] Deglobalize
- [x] Passthrough localization parameters to overrides
- [x] Make every announcer follow the template
- [x] Move sounds into subdirectories
- [x] Make announcement IDs camelCased
- [x] Test announcement localizations
- [x] Weighted announcer lists

---

<details><summary><h1>Media</h1></summary>
<p>


https://github.com/Simple-Station/Parkstation-Friendly-Chainsaw/assets/77995199/caf5805d-acb0-4140-b344-875a8f79e5ee

</p>
</details>

---

# Changelog

🆑
- add: Added 4 new announcers that will randomly be selected every shift
2024-07-12 16:13:50 -04:00

26 lines
843 B
C#

using Content.Server.Chat;
using Content.Server.Announcements.Systems;
using Robust.Shared.Player;
namespace Content.Server.Chat.Systems;
public sealed class AnnounceOnSpawnSystem : EntitySystem
{
[Dependency] private readonly ChatSystem _chat = default!;
[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) : "Central Command";
_announcer.SendAnnouncement(_announcer.GetAnnouncementId("SpawnAnnounceCaptain"), Filter.Broadcast(),
comp.Message, sender, comp.Color);
}
}