diff --git a/Content.Client/Administration/UI/Tabs/AdminTab/AdminShuttleCallEnableWindow.xaml b/Content.Client/Administration/UI/Tabs/AdminTab/AdminShuttleCallEnableWindow.xaml new file mode 100644 index 0000000000..68dde30436 --- /dev/null +++ b/Content.Client/Administration/UI/Tabs/AdminTab/AdminShuttleCallEnableWindow.xaml @@ -0,0 +1,9 @@ + + + + + + diff --git a/Content.Client/Administration/UI/Tabs/AdminTab/AdminShuttleCallEnableWindow.xaml.cs b/Content.Client/Administration/UI/Tabs/AdminTab/AdminShuttleCallEnableWindow.xaml.cs new file mode 100644 index 0000000000..130ed1377a --- /dev/null +++ b/Content.Client/Administration/UI/Tabs/AdminTab/AdminShuttleCallEnableWindow.xaml.cs @@ -0,0 +1,16 @@ +using Robust.Client.AutoGenerated; +using Robust.Client.UserInterface.CustomControls; +using Robust.Client.UserInterface.XAML; + +namespace Content.Client.Administration.UI.Tabs.AdminTab +{ + [GenerateTypedNameReferences] + public sealed partial class AdminShuttleCallEnableWindow : DefaultWindow + { + public AdminShuttleCallEnableWindow() + { + RobustXamlLoader.Load(this); + IoCManager.InjectDependencies(this); + } + } +} diff --git a/Content.Client/Administration/UI/Tabs/AdminTab/AdminTab.xaml b/Content.Client/Administration/UI/Tabs/AdminTab/AdminTab.xaml index a8a3cf6f20..32ef267ba8 100644 --- a/Content.Client/Administration/UI/Tabs/AdminTab/AdminTab.xaml +++ b/Content.Client/Administration/UI/Tabs/AdminTab/AdminTab.xaml @@ -17,6 +17,7 @@ + diff --git a/Content.Server/Communications/CommunicationsConsoleSystem.cs b/Content.Server/Communications/CommunicationsConsoleSystem.cs index f441578340..6ac6935a66 100644 --- a/Content.Server/Communications/CommunicationsConsoleSystem.cs +++ b/Content.Server/Communications/CommunicationsConsoleSystem.cs @@ -16,6 +16,7 @@ using Content.Shared.Communications; using Content.Shared.Database; using Content.Shared.Emag.Components; using Content.Shared.Popups; +using Content.Shared.White; using Robust.Server.GameObjects; using Robust.Shared.Configuration; @@ -188,6 +189,10 @@ namespace Content.Server.Communications if (_emergency.EmergencyShuttleArrived || !_roundEndSystem.CanCallOrRecall()) return false; + var shuttleCallEnabled = _cfg.GetCVar(WhiteCVars.EmergencyShuttleCallEnabled); + if (!shuttleCallEnabled) + return false; + // Calling shuttle checks if (_roundEndSystem.ExpectedCountdownEnd is null) return comp.CanShuttle; diff --git a/Content.Server/Shuttles/Commands/EnableShuttleCallCommand.cs b/Content.Server/Shuttles/Commands/EnableShuttleCallCommand.cs new file mode 100644 index 0000000000..97e6422226 --- /dev/null +++ b/Content.Server/Shuttles/Commands/EnableShuttleCallCommand.cs @@ -0,0 +1,40 @@ +using Content.Server.Administration; +using Content.Server.Chat.Managers; +using Content.Shared.Administration; +using Content.Shared.White; +using Robust.Shared.Configuration; +using Robust.Shared.Console; + +namespace Content.Server.Shuttles.Commands; + +[AdminCommand(AdminFlags.Fun)] +public sealed class EnableShuttleCallCommand : IConsoleCommand +{ + public string Command => "enableShuttleCall"; + public string Description => Loc.GetString("Toggles the shuttle call."); + public string Help => $"{Command} "; + + [Dependency] private readonly IConfigurationManager _cfg = default!; + public void Execute(IConsoleShell shell, string argStr, string[] args) + { + if (args.Length != 1 || !bool.TryParse(args[0], out bool value)) + { + shell.WriteError($"{args[0]} is not a valid boolean."); + return; + } + + var shuttleEnabled = _cfg.GetCVar(WhiteCVars.EmergencyShuttleCallEnabled); + if (value == shuttleEnabled) + { + shell.WriteError($"enableShuttleCall is already {args[0]}"); + return; + } + + _cfg.SetCVar(WhiteCVars.EmergencyShuttleCallEnabled, value); + + var announce = Loc.GetString("emergency_shuttle-announce-toggle", + ("admin", $"{shell.Player?.Name}"), + ("value", $"{value}")); + IoCManager.Resolve().SendAdminAnnouncement(announce); + } +} diff --git a/Content.Shared/White/WhiteCVars.cs b/Content.Shared/White/WhiteCVars.cs index e9e5be9885..ef98b9078b 100644 --- a/Content.Shared/White/WhiteCVars.cs +++ b/Content.Shared/White/WhiteCVars.cs @@ -115,4 +115,11 @@ public sealed class WhiteCVars public static readonly CVarDef NonPeacefulRoundEndEnabled = CVarDef.Create("white.non_peaceful_round_end_enabled", true, CVar.SERVERONLY | CVar.ARCHIVE); + + /* + * Disabling calling shuttle by admin button + */ + + public static readonly CVarDef EmergencyShuttleCallEnabled = + CVarDef.Create("shuttle.emergency_shuttle_call", true, CVar.SERVER | CVar.REPLICATED | CVar.ARCHIVE); }