Skip to content

Commit

Permalink
добавлена задержка в 10 секунд между кодом гамма и объявлении об прин…
Browse files Browse the repository at this point in the history
…ятии обр
  • Loading branch information
Schrodinger71 committed Dec 28, 2024
1 parent 5334e80 commit f3f4ed7
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions Content.Server/ADT/Administration/Commands/SendERTCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using System.Numerics;
using Content.Server.Chat.Managers;
using Robust.Shared.ContentPack;
using System.Threading.Tasks;

namespace Content.Server.ADT.Administration.Commands;

Expand All @@ -33,7 +34,8 @@ public sealed class SendERTCommand : IConsoleCommand
public string Command => "sendert";
public string Description => Loc.GetString("send-ert-description");
public string Help => Loc.GetString("send-ert-help");
public void Execute(IConsoleShell shell, string argStr, string[] args)

public async void Execute(IConsoleShell shell, string argStr, string[] args)
{
#region Setup vars
string audioPath = "";
Expand Down Expand Up @@ -158,12 +160,6 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)

if (isAnnounce) // Write announce & play audio
{
if (isSetAlertLevel)
{
if (stationUid == null) { shell.WriteLine(Loc.GetString("sent-ert-invalid-grid")); return; } //We are on station?
_system.GetEntitySystem<AlertLevelSystem>().SetLevel(stationUid.Value, alertLevelCode, false, true, true, true);
}

if (isPlayAudio)
{
Filter filter = Filter.Empty().AddAllPlayers(_playerManager);
Expand All @@ -175,6 +171,15 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)
}

_system.GetEntitySystem<ChatSystem>().DispatchGlobalAnnouncement(Loc.GetString($"ert-send-{args[0].ToLower()}-announcement"), Loc.GetString($"ert-send-{args[0].ToLower()}-announcer"), playSound: playAuidoFromAnnouncement, colorOverride: announceColor);

if (args[0].ToLower() != "denial") // Если отказ то задержка нам не нужна
await Task.Delay(10000); // Ставим задержку на 10 секунд

if (isSetAlertLevel)
{
if (stationUid == null) { shell.WriteLine(Loc.GetString("sent-ert-invalid-grid")); return; } //We are on station?
_system.GetEntitySystem<AlertLevelSystem>().SetLevel(stationUid.Value, alertLevelCode, false, true, true, true);
}
}
#endregion

Expand Down

0 comments on commit f3f4ed7

Please sign in to comment.