Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Helicaste committed Nov 15, 2023
2 parents 7f85721 + d9ed8a3 commit 43b91e4
Show file tree
Hide file tree
Showing 1,634 changed files with 138,391 additions and 20,110 deletions.
5 changes: 4 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -338,5 +338,8 @@ dotnet_naming_symbols.type_parameters_symbols.applicable_kinds = type_parameter
resharper_braces_for_ifelse = required_for_multiline
resharper_keep_existing_attribute_arrangement = true

[*.{csproj,xml,yml,dll.config,msbuildproj,targets}]
[*.{csproj,xml,yml,yaml,dll.config,msbuildproj,targets}]
indent_size = 2

[{*.yaml,*.yml}]
ij_yaml_indent_sequence_value = false
9 changes: 4 additions & 5 deletions Content.Client/Actions/ActionsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Linq;
using Content.Shared.Actions;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.Player;
using Robust.Shared.ContentPack;
using Robust.Shared.GameStates;
Expand Down Expand Up @@ -41,8 +40,8 @@ public sealed class ActionsSystem : SharedActionsSystem
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ActionsComponent, PlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<ActionsComponent, PlayerDetachedEvent>(OnPlayerDetached);
SubscribeLocalEvent<ActionsComponent, LocalPlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<ActionsComponent, LocalPlayerDetachedEvent>(OnPlayerDetached);
SubscribeLocalEvent<ActionsComponent, ComponentHandleState>(HandleComponentState);

SubscribeLocalEvent<InstantActionComponent, ComponentHandleState>(OnInstantHandleState);
Expand Down Expand Up @@ -196,12 +195,12 @@ protected override void ActionRemoved(EntityUid performer, EntityUid actionId, A
return GetActions(user);
}

private void OnPlayerAttached(EntityUid uid, ActionsComponent component, PlayerAttachedEvent args)
private void OnPlayerAttached(EntityUid uid, ActionsComponent component, LocalPlayerAttachedEvent args)
{
LinkAllActions(component);
}

private void OnPlayerDetached(EntityUid uid, ActionsComponent component, PlayerDetachedEvent? args = null)
private void OnPlayerDetached(EntityUid uid, ActionsComponent component, LocalPlayerDetachedEvent? args = null)
{
UnlinkAllActions();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Robust.Client.Player;
using Robust.Shared.ContentPack;
using Robust.Shared.Network;
using Robust.Shared.Players;
using Robust.Shared.Player;
using Robust.Shared.Utility;

namespace Content.Client.Administration.Managers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public sealed partial class PlayerListControl : BoxContainer
private List<PlayerInfo> _playerList = new();
private readonly List<PlayerInfo> _sortedPlayerList = new();

public event Action<PlayerInfo?>? OnSelectionChanged;
public event Action<PlayerInfo>? OnSelectionChanged;
public IReadOnlyList<PlayerInfo> PlayerInfo => _playerList;

public Func<PlayerInfo, string, string>? OverrideText;
Expand All @@ -46,9 +46,9 @@ public PlayerListControl()
BackgroundPanel.PanelOverride = new StyleBoxFlat {BackgroundColor = new Color(32, 38, 32)};
}

private void PlayerListItemPressed(BaseButton.ButtonEventArgs args, ListData data)
private void PlayerListItemPressed(BaseButton.ButtonEventArgs? args, ListData? data)
{
if (data is not PlayerListData {Info: var selectedPlayer})
if (args == null || data is not PlayerListData {Info: var selectedPlayer})
return;
if (args.Event.Function == EngineKeyFunctions.UIClick)
{
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
Expand Up @@ -5,7 +5,6 @@
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.IoC;
using Robust.Shared.Players;

namespace Content.Client.Administration.UI.Tabs.AdminTab
{
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
19 changes: 9 additions & 10 deletions Content.Client/Alerts/ClientAlertsSystem.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Linq;
using Content.Shared.Alert;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.Player;
using Robust.Shared.Prototypes;

Expand All @@ -22,8 +21,8 @@ public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<AlertsComponent, PlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<AlertsComponent, PlayerDetachedEvent>(OnPlayerDetached);
SubscribeLocalEvent<AlertsComponent, LocalPlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<AlertsComponent, LocalPlayerDetachedEvent>(OnPlayerDetached);

SubscribeLocalEvent<AlertsComponent, AfterAutoHandleStateEvent>(ClientAlertsHandleState);
}
Expand All @@ -47,20 +46,20 @@ public IReadOnlyDictionary<AlertKey, AlertState>? ActiveAlerts
}
}

protected override void AfterShowAlert(AlertsComponent alertsComponent)
protected override void AfterShowAlert(Entity<AlertsComponent> alerts)
{
if (_playerManager.LocalPlayer?.ControlledEntity != alertsComponent.Owner)
if (_playerManager.LocalPlayer?.ControlledEntity != alerts.Owner)
return;

SyncAlerts?.Invoke(this, alertsComponent.Alerts);
SyncAlerts?.Invoke(this, alerts.Comp.Alerts);
}

protected override void AfterClearAlert(AlertsComponent alertsComponent)
protected override void AfterClearAlert(Entity<AlertsComponent> alertsComponent)
{
if (_playerManager.LocalPlayer?.ControlledEntity != alertsComponent.Owner)
return;

SyncAlerts?.Invoke(this, alertsComponent.Alerts);
SyncAlerts?.Invoke(this, alertsComponent.Comp.Alerts);
}

private void ClientAlertsHandleState(EntityUid uid, AlertsComponent component, ref AfterAutoHandleStateEvent args)
Expand All @@ -69,7 +68,7 @@ private void ClientAlertsHandleState(EntityUid uid, AlertsComponent component, r
SyncAlerts?.Invoke(this, component.Alerts);
}

private void OnPlayerAttached(EntityUid uid, AlertsComponent component, PlayerAttachedEvent args)
private void OnPlayerAttached(EntityUid uid, AlertsComponent component, LocalPlayerAttachedEvent args)
{
if (_playerManager.LocalPlayer?.ControlledEntity != uid)
return;
Expand All @@ -87,7 +86,7 @@ protected override void HandleComponentShutdown(EntityUid uid, AlertsComponent c
ClearAlerts?.Invoke(this, EventArgs.Empty);
}

private void OnPlayerDetached(EntityUid uid, AlertsComponent component, PlayerDetachedEvent args)
private void OnPlayerDetached(EntityUid uid, AlertsComponent component, LocalPlayerDetachedEvent args)
{
ClearAlerts?.Invoke(this, EventArgs.Empty);
}
Expand Down
20 changes: 17 additions & 3 deletions Content.Client/Ame/UI/AmeWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<DefaultWindow xmlns="https://spacestation14.io"
<DefaultWindow xmlns="https://spacestation14.io"
Title="{Loc 'ame-window-title'}"
MinSize="250 250">
<BoxContainer Orientation="Vertical">
<GridContainer Columns="2">
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'ame-window-engine-status-label'}" />
<Label Text=" " />
Expand Down Expand Up @@ -42,5 +42,19 @@
<Label Text=" " />
<Label Name="CoreCount" Text="0" />
</BoxContainer>
</BoxContainer>
<BoxContainer></BoxContainer>
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'ame-window-power-currentsupply-label'}" />
<Label Text=" " />
<Label Name="CurrentPowerSupply" Text="0" />
<Label Text=" kW" />
</BoxContainer>
<BoxContainer></BoxContainer>
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'ame-window-power-targetsupply-label'}" />
<Label Text=" " />
<Label Name="TargetedPowerSupply" Text="0" />
<Label Text=" kW" />
</BoxContainer>
</GridContainer>
</DefaultWindow>
3 changes: 3 additions & 0 deletions Content.Client/Ame/UI/AmeWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ public void UpdateState(BoundUserInterfaceState state)

CoreCount.Text = $"{castState.CoreCount}";
InjectionAmount.Text = $"{castState.InjectionAmount}";
// format power statistics to pretty numbers
CurrentPowerSupply.Text = $"{castState.CurrentPowerSupply.ToString("N1")}";
TargetedPowerSupply.Text = $"{castState.TargetedPowerSupply.ToString("N1")}";
}
}
}
6 changes: 3 additions & 3 deletions Content.Client/Antag/AntagStatusIconSystem.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
using Content.Shared.Ghost;
using Content.Shared.StatusIcon;
using Content.Shared.StatusIcon.Components;
using Robust.Shared.Prototypes;
using Content.Shared.Ghost;
using Robust.Client.Player;
using Robust.Shared.Prototypes;

namespace Content.Client.Antag;

/// <summary>
/// Used for assigning specified icons for antags.
/// </summary>
public abstract class AntagStatusIconSystem<T> : SharedStatusIconSystem
where T : Component
where T : IComponent
{
[Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly IPlayerManager _player = default!;
Expand Down
Loading

0 comments on commit 43b91e4

Please sign in to comment.