Allow changing alert level delay. (#17435)

This commit is contained in:
Pieter-Jan Briers
2023-06-24 14:01:14 +02:00
committed by GitHub
parent 489077868c
commit 3e03418238
3 changed files with 10 additions and 3 deletions

View File

@@ -29,8 +29,6 @@ public sealed class AlertLevelComponent : Component
/// </summary>
[ViewVariables(VVAccess.ReadWrite)] public bool IsLevelLocked = false;
[ViewVariables] public const float Delay = 30;
[ViewVariables] public float CurrentDelay = 0;
[ViewVariables] public bool ActiveDelay;

View File

@@ -1,8 +1,10 @@
using System.Linq;
using Content.Server.Chat.Systems;
using Content.Server.Station.Systems;
using Content.Shared.CCVar;
using Content.Shared.PDA;
using Robust.Shared.Audio;
using Robust.Shared.Configuration;
using Robust.Shared.Prototypes;
namespace Content.Server.AlertLevel;
@@ -12,6 +14,7 @@ public sealed class AlertLevelSystem : EntitySystem
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly ChatSystem _chatSystem = default!;
[Dependency] private readonly StationSystem _stationSystem = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
// Until stations are a prototype, this is how it's going to have to be.
public const string DefaultAlertLevelSet = "stationAlerts";
@@ -138,7 +141,7 @@ public sealed class AlertLevelSystem : EntitySystem
return;
}
component.CurrentDelay = AlertLevelComponent.Delay;
component.CurrentDelay = _cfg.GetCVar(CCVars.GameAlertLevelChangeDelay);
component.ActiveDelay = true;
}

View File

@@ -282,6 +282,12 @@ namespace Content.Shared.CCVar
CVarDef.Create("game.round_start_fail_shutdown_count", 5, CVar.SERVERONLY | CVar.SERVER);
#endif
/// <summary>
/// Delay between station alert level changes.
/// </summary>
public static readonly CVarDef<int> GameAlertLevelChangeDelay =
CVarDef.Create("game.alert_level_change_delay", 30, CVar.SERVERONLY);
/*
* Discord
*/