Skip to content

Commit

Permalink
fix announcer not being set on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
DEATHB4DEFEAT committed Jul 12, 2024
1 parent 34a85e0 commit 781ca6b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions Content.Server/Announcements/Systems/AnnouncerSystem.Announcer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ namespace Content.Server.Announcements.Systems;
public sealed partial class AnnouncerSystem
{
private void OnRoundRestarting(RoundRestartCleanupEvent ev)
{
NewAnnouncer();
}


/// <summary>
/// Sets the announcer to a random one or the CVar
/// </summary>
private void NewAnnouncer()
{
var announcer = _config.GetCVar(CCVars.Announcer);
if (string.IsNullOrEmpty(announcer))
Expand All @@ -19,11 +28,9 @@ private void OnRoundRestarting(RoundRestartCleanupEvent ev)
SetAnnouncer(announcer);
}


/// <summary>
/// Picks a random announcer
/// Picks a random announcer prototype following blacklists
/// </summary>
/// <remarks>Probably not very useful for any other system</remarks>
public AnnouncerPrototype PickAnnouncer()
{
var list = _proto.Index<WeightedRandomPrototype>(_config.GetCVar(CCVars.AnnouncerList));
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Announcements/Systems/AnnouncerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override void Initialize()
{
base.Initialize();

PickAnnouncer();
NewAnnouncer();

_config.OnValueChanged(CCVars.Announcer, SetAnnouncer);

Expand Down

0 comments on commit 781ca6b

Please sign in to comment.