Send what seleted for secret to admin chat (#26500)

* Send what seleted for secret to admin chat

* add line

* Add localization support
This commit is contained in:
lzk
2024-03-29 06:03:34 +01:00
committed by GitHub
parent 653d53db13
commit 69a15ada7f
2 changed files with 5 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
using Content.Server.Administration.Logs;
using Content.Server.Chat.Managers;
using Content.Server.GameTicking.Presets;
using Content.Server.GameTicking.Rules.Components;
using Content.Shared.Random;
@@ -17,6 +18,7 @@ public sealed class SecretRuleSystem : GameRuleSystem<SecretRuleComponent>
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly IChatManager _chatManager = default!;
protected override void Added(EntityUid uid, SecretRuleComponent component, GameRuleComponent gameRule, GameRuleAddedEvent args)
{
@@ -42,6 +44,7 @@ public sealed class SecretRuleSystem : GameRuleSystem<SecretRuleComponent>
var preset = _prototypeManager.Index<WeightedRandomPrototype>(presetString).Pick(_random);
Log.Info($"Selected {preset} for secret.");
_adminLogger.Add(LogType.EventStarted, $"Selected {preset} for secret.");
_chatManager.SendAdminAnnouncement(Loc.GetString("rule-secret-selected-preset", ("preset", preset)));
var rules = _prototypeManager.Index<GamePresetPrototype>(preset).Rules;
foreach (var rule in rules)