Skip to content

Commit

Permalink
Merge branch 'master' into whitelist-gaming
Browse files Browse the repository at this point in the history
  • Loading branch information
DebugOk authored Oct 17, 2023
2 parents 9623240 + 629baa6 commit 5d275d3
Show file tree
Hide file tree
Showing 685 changed files with 7,470 additions and 7,269 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/update-credits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Update Contrib and Patreons in credits

on:
workflow_dispatch:
schedule:
- cron: 0 0 * * 0

jobs:
get_credits:
runs-on: ubuntu-latest
# Hey there fork dev! If you like to include your own contributors in this then you can probably just change this to your own repo
# Do this in dump_github_contributors.ps1 too into your own repo
if: github.repository == 'DeltaV-Station/Delta-v-rebase'

steps:
- uses: actions/[email protected]
with:
ref: master

- name: Get this week's Contributors
shell: pwsh
run: Tools/dump_github_contributors.ps1 > Resources/Credits/GitHub.txt

# TODO
#- name: Get this week's Patreons
# run: Tools/script2dumppatreons > Resources/Credits/Patrons.yml

- name: Commit new credit files
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Update Credits
commit_author: DeltaV-Bot <[email protected]>
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ PublishScripts/
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
.nuget/

# Microsoft Azure Build Output
csx/
Expand Down
1 change: 0 additions & 1 deletion Content.Client/Actions/ActionsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public sealed class ActionsSystem : SharedActionsSystem

public event Action<EntityUid>? OnActionAdded;
public event Action<EntityUid>? OnActionRemoved;
public event OnActionReplaced? ActionReplaced;
public event Action? ActionsUpdated;
public event Action<ActionsComponent>? LinkActions;
public event Action? UnlinkActions;
Expand Down
8 changes: 8 additions & 0 deletions Content.Client/Administration/Managers/ClientAdminManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,13 @@ void IPostInjectInit.PostInject()

return null;
}

public AdminData? GetAdminData(bool includeDeAdmin = false)
{
if (_player.LocalPlayer is { Session: { } session })
return GetAdminData(session, includeDeAdmin);

return null;
}
}
}
24 changes: 22 additions & 2 deletions Content.Client/Administration/Managers/IClientAdminManager.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using Content.Shared.Administration;
using Content.Shared.Administration;

namespace Content.Client.Administration.Managers
{
Expand All @@ -13,6 +12,15 @@ public interface IClientAdminManager
/// </summary>
event Action AdminStatusUpdated;

/// <summary>
/// Gets the admin data for the client, if they are an admin.
/// </summary>
/// <param name="includeDeAdmin">
/// Whether to return admin data for admins that are current de-adminned.
/// </param>
/// <returns><see langword="null" /> if the player is not an admin.</returns>
AdminData? GetAdminData(bool includeDeAdmin = false);

/// <summary>
/// Checks whether the local player is an admin.
/// </summary>
Expand Down Expand Up @@ -52,5 +60,17 @@ public interface IClientAdminManager
bool CanAdminMenu();

void Initialize();

/// <summary>
/// Checks if the client is an admin.
/// </summary>
/// <param name="includeDeAdmin">
/// Whether to return admin data for admins that are current de-adminned.
/// </param>
/// <returns>true if the player is an admin, false otherwise.</returns>
bool IsAdmin(bool includeDeAdmin = false)
{
return GetAdminData(includeDeAdmin) != null;
}
}
}
4 changes: 3 additions & 1 deletion Content.Client/Administration/UI/AdminMenuWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
xmlns:atmosTab="clr-namespace:Content.Client.Administration.UI.Tabs.AtmosTab"
xmlns:tabs="clr-namespace:Content.Client.Administration.UI.Tabs"
xmlns:playerTab="clr-namespace:Content.Client.Administration.UI.Tabs.PlayerTab"
xmlns:objectsTab="clr-namespace:Content.Client.Administration.UI.Tabs.ObjectsTab">
xmlns:objectsTab="clr-namespace:Content.Client.Administration.UI.Tabs.ObjectsTab"
xmlns:panic="clr-namespace:Content.Client.Administration.UI.Tabs.PanicBunkerTab">
<TabContainer Name="MasterTabContainer">
<adminTab:AdminTab />
<adminbusTab:AdminbusTab />
<atmosTab:AtmosTab />
<tabs:RoundTab />
<tabs:ServerTab />
<panic:PanicBunkerTab Name="PanicBunkerControl" Access="Public" />
<playerTab:PlayerTab Name="PlayerTabControl" Access="Public" />
<objectsTab:ObjectsTab Name="ObjectsTabControl" Access="Public" />
</TabContainer>
Expand Down
7 changes: 4 additions & 3 deletions Content.Client/Administration/UI/AdminMenuWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ public sealed partial class AdminMenuWindow : DefaultWindow

public AdminMenuWindow()
{
MinSize = new Vector2(500, 250);
MinSize = new Vector2(650, 250);
Title = Loc.GetString("admin-menu-title");
RobustXamlLoader.Load(this);
MasterTabContainer.SetTabTitle(0, Loc.GetString("admin-menu-admin-tab"));
MasterTabContainer.SetTabTitle(1, Loc.GetString("admin-menu-adminbus-tab"));
MasterTabContainer.SetTabTitle(2, Loc.GetString("admin-menu-atmos-tab"));
MasterTabContainer.SetTabTitle(3, Loc.GetString("admin-menu-round-tab"));
MasterTabContainer.SetTabTitle(4, Loc.GetString("admin-menu-server-tab"));
MasterTabContainer.SetTabTitle(5, Loc.GetString("admin-menu-players-tab"));
MasterTabContainer.SetTabTitle(6, Loc.GetString("admin-menu-objects-tab"));
MasterTabContainer.SetTabTitle(5, Loc.GetString("admin-menu-panic-bunker-tab"));
MasterTabContainer.SetTabTitle(6, Loc.GetString("admin-menu-players-tab"));
MasterTabContainer.SetTabTitle(7, Loc.GetString("admin-menu-objects-tab"));
}

protected override void Dispose(bool disposing)
Expand Down
3 changes: 2 additions & 1 deletion Content.Client/Administration/UI/BanPanel/BanPanel.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<LineEdit Name="HwidLine" MinWidth="100" HorizontalExpand="True" PlaceHolder="{Loc ban-panel-hwid}" ToolTip="{Loc ban-panel-ip-hwid-tooltip}" />
</BoxContainer>
<CheckBox Name="LastConnCheckbox" Margin="2" Text="{Loc ban-panel-last-conn}" Pressed="True" />
<CheckBox Name="EraseCheckbox" Margin="2" Text="{Loc ban-panel-erase}" Pressed="False" />
<BoxContainer Orientation="Horizontal" Margin="2">
<LineEdit Name="TimeLine" MaxWidth="150" MinWidth="70" PlaceHolder="0" />
<OptionButton Name="MultiplierOption" />
Expand All @@ -30,7 +31,7 @@
</BoxContainer>
<BoxContainer Orientation="Horizontal" Margin="4">
<OptionButton Name="TypeOption" />
<Control MinWidth="30"></Control>
<Control MinWidth="30" />
<Label Text="{Loc ban-panel-severity}" />
<OptionButton Name="SeverityOption" />
</BoxContainer>
Expand Down
8 changes: 3 additions & 5 deletions Content.Client/Administration/UI/BanPanel/BanPanel.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
using System.Globalization;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text.RegularExpressions;
using Content.Client.Administration.UI.CustomControls;
using Content.Client.Stylesheets;
using Content.Shared.Administration;
using Content.Shared.Database;
using Content.Shared.Roles;
Expand All @@ -23,7 +20,7 @@ namespace Content.Client.Administration.UI.BanPanel;
[GenerateTypedNameReferences]
public sealed partial class BanPanel : DefaultWindow
{
public event Action<string?, (IPAddress, int)?, bool, byte[]?, bool, uint, string, NoteSeverity, string[]?>? BanSubmitted;
public event Action<string?, (IPAddress, int)?, bool, byte[]?, bool, uint, string, NoteSeverity, string[]?, bool>? BanSubmitted;
public event Action<string>? PlayerChanged;
private string? PlayerUsername { get; set; }
private (IPAddress, int)? IpAddress { get; set; }
Expand Down Expand Up @@ -441,7 +438,8 @@ private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
var useLastIp = IpCheckbox.Pressed && LastConnCheckbox.Pressed && IpAddress is null;
var useLastHwid = HwidCheckbox.Pressed && LastConnCheckbox.Pressed && Hwid is null;
var severity = (NoteSeverity) SeverityOption.SelectedId;
BanSubmitted?.Invoke(player, IpAddress, useLastIp, Hwid, useLastHwid, (uint) (TimeEntered * Multiplier), reason, severity, roles);
var erase = EraseCheckbox.Pressed;
BanSubmitted?.Invoke(player, IpAddress, useLastIp, Hwid, useLastHwid, (uint) (TimeEntered * Multiplier), reason, severity, roles, erase);
}

protected override void FrameUpdate(FrameEventArgs args)
Expand Down
9 changes: 2 additions & 7 deletions Content.Client/Administration/UI/BanPanel/BanPanelEui.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Content.Client.Eui;
using Content.Shared.Administration;
using Content.Shared.Eui;
Expand All @@ -19,8 +14,8 @@ public BanPanelEui()
{
BanPanel = new BanPanel();
BanPanel.OnClose += () => SendMessage(new CloseEuiMessage());
BanPanel.BanSubmitted += (player, ip, useLastIp, hwid, useLastHwid, minutes, reason, severity, roles)
=> SendMessage(new BanPanelEuiStateMsg.CreateBanRequest(player, ip, useLastIp, hwid, useLastHwid, minutes, reason, severity, roles));
BanPanel.BanSubmitted += (player, ip, useLastIp, hwid, useLastHwid, minutes, reason, severity, roles, erase)
=> SendMessage(new BanPanelEuiStateMsg.CreateBanRequest(player, ip, useLastIp, hwid, useLastHwid, minutes, reason, severity, roles, erase));
BanPanel.PlayerChanged += player => SendMessage(new BanPanelEuiStateMsg.GetPlayerInfoRequest(player));
}

Expand Down
5 changes: 5 additions & 0 deletions Content.Client/Administration/UI/Bwoink/BwoinkWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public BwoinkWindow()
if (sel is not null)
{
Title = $"{sel.CharacterName} / {sel.Username}";

if (sel.OverallPlaytime != null)
{
Title += $" | {Loc.GetString("generic-playtime-title")}: {sel.PlaytimeString()}";
}
}
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<controls:PanicBunkerStatusWindow
xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.Administration.UI.Tabs.PanicBunkerTab"
Title="{Loc admin-ui-panic-bunker-window-title}">
<Label Name="MessageLabel" Access="Public" Text="{Loc admin-ui-panic-bunker-is-enabled}" />
</controls:PanicBunkerStatusWindow>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;

namespace Content.Client.Administration.UI.Tabs.PanicBunkerTab;

[GenerateTypedNameReferences]
public sealed partial class PanicBunkerStatusWindow : DefaultWindow
{
public PanicBunkerStatusWindow()
{
RobustXamlLoader.Load(this);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<controls:PanicBunkerTab
xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.Administration.UI.Tabs.PanicBunkerTab"
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls"
Margin="4">
<BoxContainer Orientation="Vertical">
<cc:CommandButton Name="EnabledButton" Command="panicbunker" ToggleMode="True"
Text="{Loc admin-ui-panic-bunker-disabled}"
ToolTip="{Loc admin-ui-panic-bunker-tooltip}" />
<BoxContainer Orientation="Horizontal">
<cc:CommandButton Name="DisableAutomaticallyButton" HorizontalExpand="True"
Command="panicbunker_disable_with_admins"
ToggleMode="True"
Text="{Loc admin-ui-panic-bunker-disable-automatically}"
ToolTip="{Loc admin-ui-panic-bunker-disable-automatically-tooltip}" />
<cc:CommandButton Name="EnableAutomaticallyButton" HorizontalExpand="True"
Command="panicbunker_enable_without_admins"
ToggleMode="True"
Text="{Loc admin-ui-panic-bunker-enable-automatically}"
ToolTip="{Loc admin-ui-panic-bunker-enable-automatically-tooltip}" />
<cc:CommandButton Name="CountDeadminnedButton" HorizontalExpand="True"
Command="panicbunker_count_deadminned_admins"
ToggleMode="True"
Text="{Loc admin-ui-panic-bunker-count-deadminned-admins}"
ToolTip="{Loc admin-ui-panic-bunker-count-deadminned-admins-tooltip}" />
</BoxContainer>
<cc:CommandButton Name="ShowReasonButton" Command="panicbunker_show_reason"
ToggleMode="True" Text="{Loc admin-ui-panic-bunker-show-reason}"
ToolTip="{Loc admin-ui-panic-bunker-show-reason-tooltip}" />
<BoxContainer Orientation="Vertical" Margin="0 10 0 0">
<BoxContainer Orientation="Horizontal" Margin="2">
<Label Text="{Loc admin-ui-panic-bunker-min-account-age}" MinWidth="175" />
<LineEdit Name="MinAccountAge" MinWidth="50" Margin="0 0 5 0" />
<Label Text="{Loc generic-hours}" />
</BoxContainer>
<BoxContainer Orientation="Horizontal" Margin="2">
<Label Text="{Loc admin-ui-panic-bunker-min-overall-hours}" MinWidth="175" />
<LineEdit Name="MinOverallHours" MinWidth="50" Margin="0 0 5 0" />
<Label Text="{Loc generic-hours}" />
</BoxContainer>
</BoxContainer>
</BoxContainer>
</controls:PanicBunkerTab>
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
using Content.Shared.Administration.Events;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Console;

namespace Content.Client.Administration.UI.Tabs.PanicBunkerTab;

[GenerateTypedNameReferences]
public sealed partial class PanicBunkerTab : Control
{
[Dependency] private readonly IConsoleHost _console = default!;

private string _minAccountAge;
private string _minOverallHours;

public PanicBunkerTab()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);

DisableAutomaticallyButton.ToolTip = Loc.GetString("admin-ui-panic-bunker-disable-automatically-tooltip");

MinAccountAge.OnTextEntered += args => SendMinAccountAge(args.Text);
MinAccountAge.OnFocusExit += args => SendMinAccountAge(args.Text);
_minAccountAge = MinAccountAge.Text;

MinOverallHours.OnTextEntered += args => SendMinOverallHours(args.Text);
MinOverallHours.OnFocusExit += args => SendMinOverallHours(args.Text);
_minOverallHours = MinOverallHours.Text;
}

private void SendMinAccountAge(string text)
{
if (string.IsNullOrWhiteSpace(text) ||
text == _minAccountAge ||
!int.TryParse(text, out var minutes))
{
return;
}

_console.ExecuteCommand($"panicbunker_min_account_age {minutes}");
}

private void SendMinOverallHours(string text)
{
if (string.IsNullOrWhiteSpace(text) ||
text == _minOverallHours ||
!int.TryParse(text, out var hours))
{
return;
}

_console.ExecuteCommand($"panicbunker_min_overall_hours {hours}");
}

public void UpdateStatus(PanicBunkerStatus status)
{
EnabledButton.Pressed = status.Enabled;
EnabledButton.Text = Loc.GetString(status.Enabled
? "admin-ui-panic-bunker-enabled"
: "admin-ui-panic-bunker-disabled"
);
EnabledButton.ModulateSelfOverride = status.Enabled ? Color.Red : null;

DisableAutomaticallyButton.Pressed = status.DisableWithAdmins;
EnableAutomaticallyButton.Pressed = status.EnableWithoutAdmins;
CountDeadminnedButton.Pressed = status.CountDeadminnedAdmins;
ShowReasonButton.Pressed = status.ShowReason;

MinAccountAge.Text = status.MinAccountAgeHours.ToString();
_minAccountAge = MinAccountAge.Text;

MinOverallHours.Text = status.MinOverallHours.ToString();
_minOverallHours = MinOverallHours.Text;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,11 @@ private void RefreshPlayerList(IReadOnlyList<PlayerInfo> players)
player.StartingJob,
player.Antag ? "YES" : "NO",
new StyleBoxFlat(useAltColor ? _altColor : _defaultColor),
player.Connected);
player.Connected,
player.PlaytimeString());
entry.PlayerEntity = player.NetEntity;
entry.OnPressed += args => OnEntryPressed?.Invoke(args);
entry.ToolTip = Loc.GetString("player-tab-entry-tooltip");
PlayerList.AddChild(entry);

useAltColor ^= true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,9 @@
SizeFlagsStretchRatio="2"
HorizontalExpand="True"
ClipText="True"/>
<Label Name="OverallPlaytimeLabel"
SizeFlagsStretchRatio="2"
HorizontalExpand="True"
ClipText="True"/>
</BoxContainer>
</ContainerButton>
Loading

0 comments on commit 5d275d3

Please sign in to comment.