<BoxContainer Orientation="Vertical">
<Label Text="{Loc 'observe-warning-1'}"/>
<Label Text="{Loc 'observe-warning-2'}"/>
- <BoxContainer Orientation="Horizontal" >
+ <BoxContainer Orientation="Horizontal">
<Button Name="NevermindButton" Text="{Loc 'observe-nevermind'}" SizeFlagsStretchRatio="1"/>
<Control HorizontalExpand="True" SizeFlagsStretchRatio="2" />
- <cc:CommandButton Command="observe" Name="ObserveButton" StyleClasses="Caution" Text="{Loc 'observe-confirm'}" SizeFlagsStretchRatio="1"/>
+ <cc:CommandButton Command="observe" Name="ObserveButton" StyleClasses="Caution" Text="{Loc 'observe-confirm'}" SizeFlagsStretchRatio="1"/>
+ <cc:CommandButton Command="observe admin" Name="ObserveAsAdminButton" Text="{Loc 'observe-as-admin'}" SizeFlagsStretchRatio="1" Visible="False"/>
</BoxContainer>
</BoxContainer>
</DefaultWindow>
+using Content.Shared.Administration.Managers;
using JetBrains.Annotations;
using Robust.Client.AutoGenerated;
+using Robust.Client.Player;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
[UsedImplicitly]
public sealed partial class ObserveWarningWindow : DefaultWindow
{
+ [Dependency] private readonly ISharedAdminManager _adminManager = default!;
+ [Dependency] private readonly IPlayerManager _playerManager = default!;
+
public ObserveWarningWindow()
{
Title = Loc.GetString("observe-warning-window-title");
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
+ var player = _playerManager.LocalSession;
+
+ if (player != null && _adminManager.IsAdmin(player))
+ {
+ ObserveButton.Text = Loc.GetString("observe-as-player");
+ ObserveAsAdminButton.Visible = true;
+ ObserveAsAdminButton.OnPressed += _ => { this.Close(); };
+ }
ObserveButton.OnPressed += _ => { this.Close(); };
NevermindButton.OnPressed += _ => { this.Close(); };
+using Content.Server.Administration.Managers;
using Content.Server.Station.Systems;
using Content.Shared.Administration;
+using Content.Shared.CCVar;
using Content.Shared.GameTicking;
using Content.Shared.Roles;
+using Robust.Shared.Configuration;
using Robust.Shared.Console;
using Robust.Shared.Prototypes;
{
[Dependency] private readonly IEntityManager _entManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
+ [Dependency] private readonly IAdminManager _adminManager = default!;
+ [Dependency] private readonly IConfigurationManager _cfg = default!;
public string Command => "joingame";
public string Description => "";
shell.WriteLine($"{jobPrototype.LocalizedName} has no available slots.");
return;
}
+
+ if (_adminManager.IsAdmin(player) && _cfg.GetCVar(CCVars.AdminDeadminOnJoin))
+ {
+ _adminManager.DeAdmin(player);
+ }
+
ticker.MakeJoinGame(player, station, id);
return;
}
+using Content.Server.Administration.Managers;
using Content.Shared.Administration;
using Content.Shared.GameTicking;
using Robust.Shared.Console;
sealed class ObserveCommand : IConsoleCommand
{
[Dependency] private readonly IEntityManager _e = default!;
+ [Dependency] private readonly IAdminManager _adminManager = default!;
public string Command => "observe";
public string Description => "";
return;
}
+ var isAdminCommand = args.Length > 0 && args[0].ToLower() == "admin";
+
+ if (!isAdminCommand && _adminManager.IsAdmin(player))
+ {
+ _adminManager.DeAdmin(player);
+ }
+
if (ticker.PlayerGameStatuses.TryGetValue(player.UserId, out var status) &&
status != PlayerGameStatus.JoinedGame)
{
observe-warning-1 = Are you sure you want to observe?
observe-warning-2 = You cannot play in the round if you do so.
observe-warning-window-title = Warning
+observe-as-admin = Admin Observe
+observe-as-player = Player Observe