Skip to content

Commit

Permalink
Merge branch 'arumoon-server' of git.arumoon.ru:Workbench-Team/space-…
Browse files Browse the repository at this point in the history
…station-14 into socks
  • Loading branch information
AruMoon committed Sep 16, 2023
2 parents 239a063 + 558ca9c commit 64563ca
Show file tree
Hide file tree
Showing 1,777 changed files with 163,231 additions and 36,317 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Robust.Client.GameObjects;
using Robust.Shared.Prototypes;
using static Content.Shared.Access.Components.IdCardConsoleComponent;

namespace Content.Client.Access.UI
{
public sealed class IdCardConsoleBoundUserInterface : BoundUserInterface
Expand Down
6 changes: 2 additions & 4 deletions Content.Client/Actions/ActionEvents.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using Content.Shared.Actions.ActionTypes;

namespace Content.Client.Actions;

/// <summary>
/// This event is raised when a user clicks on an empty action slot. Enables other systems to fill this slow.
/// This event is raised when a user clicks on an empty action slot. Enables other systems to fill this slot.
/// </summary>
public sealed class FillActionSlotEvent : EntityEventArgs
{
public ActionType? Action;
public EntityUid? Action;
}
289 changes: 170 additions & 119 deletions Content.Client/Actions/ActionsSystem.cs

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions Content.Client/Actions/UI/ActionAlertTooltip.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using System;
using Content.Client.Stylesheets;
using Content.Shared.Actions;
using Content.Shared.Actions.ActionTypes;
using Content.Client.Stylesheets;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.IoC;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using static Robust.Client.UserInterface.Controls.BoxContainer;
Expand Down
9 changes: 5 additions & 4 deletions Content.Client/Administration/AdminNameOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,21 @@ protected override void Draw(in OverlayDrawArgs args)

foreach (var playerInfo in _system.PlayerList)
{
var entity = _entityManager.GetEntity(playerInfo.NetEntity);

// Otherwise the entity can not exist yet
if (!_entityManager.EntityExists(playerInfo.EntityUid))
if (entity == null || !_entityManager.EntityExists(entity))
{
continue;
}
var entity = playerInfo.EntityUid.Value;

// if not on the same map, continue
if (_entityManager.GetComponent<TransformComponent>(entity).MapID != _eyeManager.CurrentMap)
if (_entityManager.GetComponent<TransformComponent>(entity.Value).MapID != _eyeManager.CurrentMap)
{
continue;
}

var aabb = _entityLookup.GetWorldAABB(entity);
var aabb = _entityLookup.GetWorldAABB(entity.Value);

// if not on screen, continue
if (!aabb.Intersects(in viewport))
Expand Down
14 changes: 8 additions & 6 deletions Content.Client/Administration/Systems/AdminVerbSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ private void AddAdminVerbs(GetVerbsEvent<Verb> args)
// View variables verbs
if (_clientConGroupController.CanViewVar())
{
Verb verb = new();
verb.Category = VerbCategory.Debug;
verb.Text = "View Variables";
verb.Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/vv.svg.192dpi.png"));
verb.Act = () => _clientConsoleHost.ExecuteCommand($"vv {args.Target}");
verb.ClientExclusive = true; // opening VV window is client-side. Don't ask server to run this verb.
Verb verb = new()
{
Category = VerbCategory.Debug,
Text = "View Variables",
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/vv.svg.192dpi.png")),
Act = () => _clientConsoleHost.ExecuteCommand($"vv {GetNetEntity(args.Target)}"),
ClientExclusive = true // opening VV window is client-side. Don't ask server to run this verb.
};
args.Verbs.Add(verb);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ namespace Content.Client.Administration.UI.CustomControls
public sealed partial class PlayerListControl : BoxContainer
{
private readonly AdminSystem _adminSystem;
private readonly VerbSystem _verbSystem;

private List<PlayerInfo> _playerList = new();
private readonly List<PlayerInfo> _sortedPlayerList = new();
Expand All @@ -29,11 +28,14 @@ public sealed partial class PlayerListControl : BoxContainer
public Func<PlayerInfo, string, string>? OverrideText;
public Comparison<PlayerInfo>? Comparison;

private IEntityManager _entManager;
private IUserInterfaceManager _uiManager;

public PlayerListControl()
{
_adminSystem = EntitySystem.Get<AdminSystem>();
_verbSystem = EntitySystem.Get<VerbSystem>();
IoCManager.InjectDependencies(this);
_entManager = IoCManager.Resolve<IEntityManager>();
_uiManager = IoCManager.Resolve<IUserInterfaceManager>();
_adminSystem = _entManager.System<AdminSystem>();
RobustXamlLoader.Load(this);
// Fill the Option data
PlayerListContainer.ItemPressed += PlayerListItemPressed;
Expand All @@ -56,9 +58,9 @@ private void PlayerListItemPressed(BaseButton.ButtonEventArgs args, ListData dat
if (OverrideText != null && args.Button.Children.FirstOrDefault()?.Children?.FirstOrDefault() is Label label)
label.Text = GetText(selectedPlayer);
}
else if (args.Event.Function == EngineKeyFunctions.UseSecondary && selectedPlayer.EntityUid != null)
else if (args.Event.Function == EngineKeyFunctions.UseSecondary && selectedPlayer.NetEntity != null)
{
IoCManager.Resolve<IUserInterfaceManager>().GetUIController<VerbMenuUIController>().OpenVerbMenu(selectedPlayer.EntityUid.Value);
_uiManager.GetUIController<VerbMenuUIController>().OpenVerbMenu(_entManager.GetEntity(selectedPlayer.NetEntity.Value));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ public sealed partial class AddReagentWindow : DefaultWindow
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;

private readonly EntityUid _targetEntity;
private readonly NetEntity _targetEntity;
private string _targetSolution;
private ReagentPrototype? _selectedReagent;

// FloatSpinBox does not (yet?) play nice with xaml
private FloatSpinBox _quantitySpin = new(1, 2) { Value = 10, HorizontalExpand = true};

public AddReagentWindow(EntityUid targetEntity, string targetSolution)
public AddReagentWindow(NetEntity targetEntity, string targetSolution)
{
IoCManager.InjectDependencies(this);
RobustXamlLoader.Load(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public sealed partial class EditSolutionsWindow : DefaultWindow
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;

private EntityUid _target = EntityUid.Invalid;
private NetEntity _target = NetEntity.Invalid;
private string? _selectedSolution;
private AddReagentWindow? _addReagentWindow;
private Dictionary<string, Solution>? _solutions;
Expand All @@ -38,12 +38,13 @@ public override void Close()
_addReagentWindow?.Dispose();
}

public void SetTargetEntity(EntityUid target)
public void SetTargetEntity(NetEntity target)
{
_target = target;
var uid = _entityManager.GetEntity(target);

var targetName = _entityManager.EntityExists(target)
? IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(target).EntityName
var targetName = _entityManager.EntityExists(uid)
? _entityManager.GetComponent<MetaDataComponent>(uid).EntityName
: string.Empty;

Title = Loc.GetString("admin-solutions-window-title", ("targetName", targetName));
Expand Down
5 changes: 4 additions & 1 deletion Content.Client/Administration/UI/SetOutfit/SetOutfitEui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ namespace Content.Client.Administration.UI.SetOutfit
public sealed class SetOutfitEui : BaseEui
{
private readonly SetOutfitMenu _window;
private IEntityManager _entManager;

public SetOutfitEui()
{
_entManager = IoCManager.Resolve<IEntityManager>();
_window = new SetOutfitMenu();
_window.OnClose += OnClosed;
}
Expand All @@ -34,7 +37,7 @@ public override void Closed()
public override void HandleState(EuiStateBase state)
{
var outfitState = (SetOutfitEuiState) state;
_window.TargetEntityId = outfitState.TargetEntityId;
_window.TargetEntityId = outfitState.TargetNetEntity;

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public sealed partial class SetOutfitMenu : DefaultWindow
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;

public EntityUid? TargetEntityId { get; set; }
public NetEntity? TargetEntityId { get; set; }
private StartingGearPrototype? _selectedOutfit;

public SetOutfitMenu()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace Content.Client.Administration.UI.SpawnExplosion;
[UsedImplicitly]
public sealed class SpawnExplosionEui : BaseEui
{
[Dependency] private readonly EntityManager _entManager = default!;
[Dependency] private readonly IOverlayManager _overlayManager = default!;

private readonly SpawnExplosionWindow _window;
Expand Down Expand Up @@ -69,7 +70,14 @@ public override void HandleMessage(EuiMessageBase msg)
_overlayManager.AddOverlay(_debugOverlay);
}

_debugOverlay.Tiles = data.Explosion.Tiles;
var tiles = new Dictionary<EntityUid, Dictionary<int, List<Vector2i>>>();
_debugOverlay.Tiles.Clear();

foreach (var (nent, det) in data.Explosion.Tiles)
{
tiles[_entManager.GetEntity(nent)] = det;
}

_debugOverlay.SpaceTiles = data.Explosion.SpaceTiles;
_debugOverlay.Intensity = data.Explosion.Intensity;
_debugOverlay.Slope = data.Slope;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,15 @@ private void OnOptionSelect(OptionButton.ItemSelectedEventArgs obj)
private void OnTeleportButtonPressed(BaseButton.ButtonEventArgs obj)
{
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
$"tp {XCoordinate.Value} {YCoordinate.Value} {MapOptions.SelectedId}");
$"tp {XCoordinate.Value} {YCoordinate.Value} {new MapId(MapOptions.SelectedId)}");
}

private void OnSubmitButtonPressed(BaseButton.ButtonEventArgs obj)
{
if (MapPath.Text.Length == 0) return;

IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
$"loadbp {MapOptions.SelectedId} \"{MapPath.Text}\" {XCoordinate.Value} {YCoordinate.Value} {RotationSpin.Value}");
$"loadbp {new MapId(MapOptions.SelectedId)} \"{MapPath.Text}\" {XCoordinate.Value} {YCoordinate.Value} {RotationSpin.Value}");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ 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 {selectedGrid}");
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"addatmos {entManager.GetNetEntity(selectedGrid)}");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
[UsedImplicitly]
public sealed partial class AddGasWindow : DefaultWindow
{
private List<EntityUid>? _gridData;
private List<NetEntity>? _gridData;
private IEnumerable<GasPrototype>? _gasData;

protected override void EnteredTree()
Expand All @@ -25,11 +25,12 @@ protected override void EnteredTree()
var playerManager = IoCManager.Resolve<IPlayerManager>();

var gridQuery = entManager.AllEntityQueryEnumerator<MapGridComponent>();
_gridData ??= new List<EntityUid>();
_gridData ??= new List<NetEntity>();
_gridData.Clear();

while (gridQuery.MoveNext(out var uid, out _))
{
_gridData.Add(entManager.GetNetEntity(uid));
var player = playerManager.LocalPlayer?.ControlledEntity;
var playerGrid = entManager.GetComponentOrNull<TransformComponent>(player)?.GridUid;
GridOptions.AddItem($"{uid} {(playerGrid == uid ? " (Current)" : "")}");
Expand Down Expand Up @@ -60,7 +61,6 @@ private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj)

var gasList = _gasData.ToList();
var gasId = gasList[GasOptions.SelectedId].ID;

IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
$"addgas {TileXSpin.Value} {TileYSpin.Value} {gridIndex} {gasId} {AmountSpin.Value}");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
[UsedImplicitly]
public sealed partial class FillGasWindow : DefaultWindow
{
private List<EntityUid>? _gridData;
private List<NetEntity>? _gridData;
private IEnumerable<GasPrototype>? _gasData;

protected override void EnteredTree()
Expand All @@ -29,15 +29,15 @@ protected override void EnteredTree()
var playerManager = IoCManager.Resolve<IPlayerManager>();

var gridQuery = entManager.AllEntityQueryEnumerator<MapGridComponent>();
_gridData ??= new List<EntityUid>();
_gridData ??= new List<NetEntity>();
_gridData.Clear();

while (gridQuery.MoveNext(out var uid, out _))
{
var player = playerManager.LocalPlayer?.ControlledEntity;
var playerGrid = entManager.GetComponentOrNull<TransformComponent>(player)?.GridUid;
GridOptions.AddItem($"{uid} {(playerGrid == uid ? " (Current)" : "")}");
_gridData.Add(uid);
_gridData.Add(entManager.GetNetEntity(uid));
}

GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
[UsedImplicitly]
public sealed partial class SetTemperatureWindow : DefaultWindow
{
private List<EntityUid>? _data;
private List<NetEntity>? _data;

protected override void EnteredTree()
{
var entManager = IoCManager.Resolve<IEntityManager>();
var playerManager = IoCManager.Resolve<IPlayerManager>();

var gridQuery = entManager.AllEntityQueryEnumerator<MapGridComponent>();
_data ??= new List<EntityUid>();
_data ??= new List<NetEntity>();
_data.Clear();

while (gridQuery.MoveNext(out var uid, out _))
{
var player = playerManager.LocalPlayer?.ControlledEntity;
var playerGrid = entManager.GetComponentOrNull<TransformComponent>(player)?.GridUid;
GridOptions.AddItem($"{uid} {(playerGrid == uid ? " (Current)" : "")}");
_data.Add(uid);
_data.Add(entManager.GetNetEntity(uid));
}

GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public sealed partial class PlayerTab : Control
private const string ArrowDown = "";
private readonly Color _altColor = Color.FromHex("#292B38");
private readonly Color _defaultColor = Color.FromHex("#2F2F3B");
private IEntityManager _entManager;
private readonly AdminSystem _adminSystem;
private IReadOnlyList<PlayerInfo> _players = new List<PlayerInfo>();

Expand All @@ -29,7 +30,8 @@ public sealed partial class PlayerTab : Control

public PlayerTab()
{
_adminSystem = EntitySystem.Get<AdminSystem>();
_entManager = IoCManager.Resolve<IEntityManager>();
_adminSystem = _entManager.System<AdminSystem>();
RobustXamlLoader.Load(this);
RefreshPlayerList(_adminSystem.PlayerList);

Expand Down Expand Up @@ -119,7 +121,7 @@ private void RefreshPlayerList(IReadOnlyList<PlayerInfo> players)
player.Antag ? "YES" : "NO",
new StyleBoxFlat(useAltColor ? _altColor : _defaultColor),
player.Connected);
entry.PlayerUid = player.EntityUid;
entry.PlayerEntity = player.NetEntity;
entry.OnPressed += args => OnEntryPressed?.Invoke(args);
PlayerList.AddChild(entry);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Content.Client.Administration.UI.Tabs.PlayerTab;
[GenerateTypedNameReferences]
public sealed partial class PlayerTabEntry : ContainerButton
{
public EntityUid? PlayerUid;
public NetEntity? PlayerEntity;

public PlayerTabEntry(string username, string character, string identity, string job, string antagonist, StyleBox styleBox, bool connected)
{
Expand Down
Loading

0 comments on commit 64563ca

Please sign in to comment.