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:
@@ -1,4 +1,5 @@
|
|||||||
using Content.Server.Administration.Logs;
|
using Content.Server.Administration.Logs;
|
||||||
|
using Content.Server.Chat.Managers;
|
||||||
using Content.Server.GameTicking.Presets;
|
using Content.Server.GameTicking.Presets;
|
||||||
using Content.Server.GameTicking.Rules.Components;
|
using Content.Server.GameTicking.Rules.Components;
|
||||||
using Content.Shared.Random;
|
using Content.Shared.Random;
|
||||||
@@ -17,6 +18,7 @@ public sealed class SecretRuleSystem : GameRuleSystem<SecretRuleComponent>
|
|||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
|
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
|
||||||
[Dependency] private readonly IAdminLogManager _adminLogger = 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)
|
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);
|
var preset = _prototypeManager.Index<WeightedRandomPrototype>(presetString).Pick(_random);
|
||||||
Log.Info($"Selected {preset} for secret.");
|
Log.Info($"Selected {preset} for secret.");
|
||||||
_adminLogger.Add(LogType.EventStarted, $"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;
|
var rules = _prototypeManager.Index<GamePresetPrototype>(preset).Rules;
|
||||||
foreach (var rule in rules)
|
foreach (var rule in rules)
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# Sent to admin chat
|
||||||
|
rule-secret-selected-preset = Selected {$preset} for secret.
|
||||||
Reference in New Issue
Block a user