Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Colin-Tel committed Oct 24, 2023
2 parents 158e16e + a2bbda4 commit 3bd00af
Show file tree
Hide file tree
Showing 1,238 changed files with 128,486 additions and 118,055 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 == 'space-wizards/space-station-14'

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: PJBot <[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
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
@@ -1,10 +1,12 @@
using System.Linq;
using System.Numerics;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Shared.Enums;
using Robust.Shared.Map;
using System.Linq;
using System.Numerics;
using Robust.Shared.Map.Components;

namespace Content.Client.Administration.UI.SpawnExplosion;

Expand All @@ -13,7 +15,6 @@ public sealed class ExplosionDebugOverlay : Overlay
{
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly IMapManager _mapManager = default!;

public Dictionary<int, List<Vector2i>>? SpaceTiles;
public Dictionary<EntityUid, Dictionary<int, List<Vector2i>>> Tiles = new();
Expand Down Expand Up @@ -61,14 +62,15 @@ private void DrawScreen(OverlayDrawArgs args)
var handle = args.ScreenHandle;
Box2 gridBounds;
var xformQuery = _entityManager.GetEntityQuery<TransformComponent>();
var xformSystem = _entityManager.System<TransformSystem>();

foreach (var (gridId, tileSets) in Tiles)
{
if (!_mapManager.TryGetGrid(gridId, out var grid))
if (!_entityManager.TryGetComponent(gridId, out MapGridComponent? grid))
continue;

var gridXform = xformQuery.GetComponent(grid.Owner);
var (_, _, matrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(xformQuery);
var gridXform = xformQuery.GetComponent(gridId);
var (_, _, matrix, invMatrix) = xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform, xformQuery);
gridBounds = invMatrix.TransformBox(args.WorldBounds).Enlarged(grid.TileSize * 2);
DrawText(handle, gridBounds, matrix, tileSets, grid.TileSize);
}
Expand Down Expand Up @@ -114,9 +116,9 @@ private void DrawText(
}
}

if (tileSets.ContainsKey(0))
if (tileSets.TryGetValue(0, out var set))
{
var epicenter = tileSets[0].First();
var epicenter = set.First();
var worldCenter = transform.Transform((epicenter + Vector2Helpers.Half) * tileSize);
var screenCenter = _eyeManager.WorldToScreen(worldCenter) + new Vector2(-24, -24);
var text = $"{Intensity[0]:F2}\nΣ={TotalIntensity:F1}\nΔ={Slope:F1}";
Expand All @@ -129,14 +131,15 @@ private void DrawWorld(in OverlayDrawArgs args)
var handle = args.WorldHandle;
Box2 gridBounds;
var xformQuery = _entityManager.GetEntityQuery<TransformComponent>();
var xformSystem = _entityManager.System<TransformSystem>();

foreach (var (gridId, tileSets) in Tiles)
{
if (!_mapManager.TryGetGrid(gridId, out var grid))
if (!_entityManager.TryGetComponent(gridId, out MapGridComponent? grid))
continue;

var gridXform = xformQuery.GetComponent(grid.Owner);
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(xformQuery);
var gridXform = xformQuery.GetComponent(gridId);
var (_, _, worldMatrix, invWorldMatrix) = xformSystem.GetWorldPositionRotationMatrixWithInv(gridXform, xformQuery);
gridBounds = invWorldMatrix.TransformBox(args.WorldBounds).Enlarged(grid.TileSize * 2);
handle.SetTransform(worldMatrix);
DrawTiles(handle, gridBounds, tileSets, SpaceTileSize);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using Robust.Client.AutoGenerated;
using Robust.Client.Console;
using Robust.Client.Player;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Map.Components;

namespace Content.Client.Administration.UI.Tabs.AtmosTab
Expand All @@ -17,16 +13,29 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
[UsedImplicitly]
public sealed partial class AddAtmosWindow : DefaultWindow
{
private IEnumerable<MapGridComponent>? _data;
[Dependency] private readonly IPlayerManager _players = default!;
[Dependency] private readonly IEntityManager _entities = default!;

private readonly List<Entity<MapGridComponent>> _data = new();

public AddAtmosWindow()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
}

protected override void EnteredTree()
{
_data = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Owner != 0);
foreach (var grid in _data)
_data.Clear();

var player = _players.LocalPlayer?.ControlledEntity;
var playerGrid = _entities.GetComponentOrNull<TransformComponent>(player)?.GridUid;
var query = IoCManager.Resolve<IEntityManager>().AllEntityQueryEnumerator<MapGridComponent>();

while (query.MoveNext(out var uid, out var grid))
{
var player = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
var playerGrid = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<TransformComponent>(player)?.GridUid;
GridOptions.AddItem($"{grid.Owner} {(playerGrid == grid.Owner ? " (Current)" : "")}");
_data.Add((uid, grid));
GridOptions.AddItem($"{uid} {(playerGrid == uid ? " (Current)" : "")}");
}

GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
Expand All @@ -35,12 +44,8 @@ protected override void EnteredTree()

private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
{
if (_data == null)
return;
var dataList = _data.ToList();
var entManager = IoCManager.Resolve<IEntityManager>();
var selectedGrid = dataList[GridOptions.SelectedId].Owner;
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"addatmos {entManager.GetNetEntity(selectedGrid)}");
var selectedGrid = _data[GridOptions.SelectedId].Owner;
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"addatmos {_entities.GetNetEntity(selectedGrid)}");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Linq;
using Content.Client.Station;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
Expand Down Expand Up @@ -40,13 +39,34 @@ public ObjectsTab()

private void RefreshObjectList(ObjectsTabSelection selection)
{
var entities = selection switch
var entities = new List<EntityUid>();
switch (selection)
{
ObjectsTabSelection.Stations => _entityManager.EntitySysManager.GetEntitySystem<StationSystem>().Stations.ToList(),
ObjectsTabSelection.Grids => _entityManager.EntityQuery<MapGridComponent>(true).Select(x => x.Owner).ToList(),
ObjectsTabSelection.Maps => _entityManager.EntityQuery<MapComponent>(true).Select(x => x.Owner).ToList(),
_ => throw new ArgumentOutOfRangeException(nameof(selection), selection, null),
};
case ObjectsTabSelection.Stations:
entities.AddRange(_entityManager.EntitySysManager.GetEntitySystem<StationSystem>().Stations);
break;
case ObjectsTabSelection.Grids:
{
var query = _entityManager.AllEntityQueryEnumerator<MapGridComponent>();
while (query.MoveNext(out var uid, out _))
{
entities.Add(uid);
}

break;
}
case ObjectsTabSelection.Maps:
{
var query = _entityManager.AllEntityQueryEnumerator<MapComponent>();
while (query.MoveNext(out var uid, out _))
{
entities.Add(uid);
}
break;
}
default:
throw new ArgumentOutOfRangeException(nameof(selection), selection, null);
}

foreach (var control in _objects)
{
Expand Down
Loading

0 comments on commit 3bd00af

Please sign in to comment.