More miscellaneous compiler warning fixes (#18228)
This commit is contained in:
@@ -40,6 +40,7 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
|
||||
private void Reset()
|
||||
{
|
||||
var entManager = IoCManager.Resolve<IEntityManager>();
|
||||
var xformSystem = entManager.System<SharedTransformSystem>();
|
||||
var playerManager = IoCManager.Resolve<IPlayerManager>();
|
||||
var player = playerManager.LocalPlayer?.ControlledEntity;
|
||||
|
||||
@@ -50,16 +51,16 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
|
||||
if (entManager.TryGetComponent<TransformComponent>(player, out var xform))
|
||||
{
|
||||
currentMap = xform.MapID;
|
||||
position = xform.WorldPosition;
|
||||
position = xformSystem.GetWorldPosition(xform);
|
||||
|
||||
if (entManager.TryGetComponent<TransformComponent>(xform.GridUid, out var gridXform))
|
||||
{
|
||||
rotation = gridXform.WorldRotation;
|
||||
rotation = xformSystem.GetWorldRotation(gridXform);
|
||||
}
|
||||
else
|
||||
{
|
||||
// MapId moment
|
||||
rotation = xform.WorldRotation - xform.LocalRotation;
|
||||
rotation = xformSystem.GetWorldRotation(xform) - xform.LocalRotation;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Client.Atmos.EntitySystems;
|
||||
using Content.Shared.Atmos.Prototypes;
|
||||
@@ -8,9 +7,6 @@ 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.Shared.Map.Components;
|
||||
|
||||
namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
@@ -19,24 +15,31 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
[UsedImplicitly]
|
||||
public sealed partial class AddGasWindow : DefaultWindow
|
||||
{
|
||||
private IEnumerable<MapGridComponent>? _gridData;
|
||||
private List<EntityUid>? _gridData;
|
||||
private IEnumerable<GasPrototype>? _gasData;
|
||||
|
||||
protected override void EnteredTree()
|
||||
{
|
||||
// Fill out grids
|
||||
_gridData = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Owner != 0);
|
||||
foreach (var grid in _gridData)
|
||||
var entManager = IoCManager.Resolve<IEntityManager>();
|
||||
var playerManager = IoCManager.Resolve<IPlayerManager>();
|
||||
|
||||
var gridQuery = entManager.AllEntityQueryEnumerator<MapGridComponent>();
|
||||
_gridData ??= new List<EntityUid>();
|
||||
_gridData.Clear();
|
||||
|
||||
while (gridQuery.MoveNext(out var uid, out _))
|
||||
{
|
||||
var player = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
||||
var playerGrid = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<TransformComponent>(player)?.GridUid;
|
||||
GridOptions.AddItem($"{grid.Owner} {(playerGrid == grid.Owner ? " (Current)" : "")}");
|
||||
var player = playerManager.LocalPlayer?.ControlledEntity;
|
||||
var playerGrid = entManager.GetComponentOrNull<TransformComponent>(player)?.GridUid;
|
||||
GridOptions.AddItem($"{uid} {(playerGrid == uid ? " (Current)" : "")}");
|
||||
}
|
||||
|
||||
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
|
||||
|
||||
// Fill out gases
|
||||
_gasData = EntitySystem.Get<AtmosphereSystem>().Gases;
|
||||
_gasData = entManager.System<AtmosphereSystem>().Gases;
|
||||
|
||||
foreach (var gas in _gasData)
|
||||
{
|
||||
var gasName = Loc.GetString(gas.Name);
|
||||
@@ -53,8 +56,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
if (_gridData == null || _gasData == null)
|
||||
return;
|
||||
|
||||
var gridList = _gridData.ToList();
|
||||
var gridIndex = gridList[GridOptions.SelectedId].Owner;
|
||||
var gridIndex = _gridData[GridOptions.SelectedId];
|
||||
|
||||
var gasList = _gasData.ToList();
|
||||
var gasId = gasList[GasOptions.SelectedId].ID;
|
||||
|
||||
@@ -19,24 +19,32 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
[UsedImplicitly]
|
||||
public sealed partial class FillGasWindow : DefaultWindow
|
||||
{
|
||||
private IEnumerable<MapGridComponent>? _gridData;
|
||||
private List<EntityUid>? _gridData;
|
||||
private IEnumerable<GasPrototype>? _gasData;
|
||||
|
||||
protected override void EnteredTree()
|
||||
{
|
||||
// Fill out grids
|
||||
_gridData = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Owner != 0);
|
||||
foreach (var grid in _gridData)
|
||||
var entManager = IoCManager.Resolve<IEntityManager>();
|
||||
var playerManager = IoCManager.Resolve<IPlayerManager>();
|
||||
|
||||
var gridQuery = entManager.AllEntityQueryEnumerator<MapGridComponent>();
|
||||
_gridData ??= new List<EntityUid>();
|
||||
_gridData.Clear();
|
||||
|
||||
while (gridQuery.MoveNext(out var uid, out _))
|
||||
{
|
||||
var player = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
||||
var playerGrid = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<TransformComponent>(player)?.GridUid;
|
||||
GridOptions.AddItem($"{grid.Owner} {(playerGrid == grid.Owner ? " (Current)" : "")}");
|
||||
var player = playerManager.LocalPlayer?.ControlledEntity;
|
||||
var playerGrid = entManager.GetComponentOrNull<TransformComponent>(player)?.GridUid;
|
||||
GridOptions.AddItem($"{uid} {(playerGrid == uid ? " (Current)" : "")}");
|
||||
_gridData.Add(uid);
|
||||
}
|
||||
|
||||
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
|
||||
|
||||
// Fill out gases
|
||||
_gasData = EntitySystem.Get<AtmosphereSystem>().Gases;
|
||||
_gasData = entManager.System<AtmosphereSystem>().Gases;
|
||||
|
||||
foreach (var gas in _gasData)
|
||||
{
|
||||
var gasName = Loc.GetString(gas.Name);
|
||||
@@ -53,8 +61,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
if (_gridData == null || _gasData == null)
|
||||
return;
|
||||
|
||||
var gridList = _gridData.ToList();
|
||||
var gridIndex = gridList[GridOptions.SelectedId].Owner;
|
||||
var gridIndex = _gridData[GridOptions.SelectedId];
|
||||
|
||||
var gasList = _gasData.ToList();
|
||||
var gasId = gasList[GasOptions.SelectedId].ID;
|
||||
|
||||
@@ -17,16 +17,23 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
[UsedImplicitly]
|
||||
public sealed partial class SetTemperatureWindow : DefaultWindow
|
||||
{
|
||||
private IEnumerable<MapGridComponent>? _data;
|
||||
private List<EntityUid>? _data;
|
||||
|
||||
protected override void EnteredTree()
|
||||
{
|
||||
_data = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Owner != 0);
|
||||
foreach (var grid in _data)
|
||||
var entManager = IoCManager.Resolve<IEntityManager>();
|
||||
var playerManager = IoCManager.Resolve<IPlayerManager>();
|
||||
|
||||
var gridQuery = entManager.AllEntityQueryEnumerator<MapGridComponent>();
|
||||
_data ??= new List<EntityUid>();
|
||||
_data.Clear();
|
||||
|
||||
while (gridQuery.MoveNext(out var uid, out _))
|
||||
{
|
||||
var player = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
||||
var playerGrid = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<TransformComponent>(player)?.GridUid;
|
||||
GridOptions.AddItem($"{grid.Owner} {(playerGrid == grid.Owner ? " (Current)" : "")}");
|
||||
var player = playerManager.LocalPlayer?.ControlledEntity;
|
||||
var playerGrid = entManager.GetComponentOrNull<TransformComponent>(player)?.GridUid;
|
||||
GridOptions.AddItem($"{uid} {(playerGrid == uid ? " (Current)" : "")}");
|
||||
_data.Add(uid);
|
||||
}
|
||||
|
||||
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
|
||||
@@ -37,8 +44,8 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
{
|
||||
if (_data == null)
|
||||
return;
|
||||
var dataList = _data.ToList();
|
||||
var selectedGrid = dataList[GridOptions.SelectedId].Owner;
|
||||
|
||||
var selectedGrid = _data[GridOptions.SelectedId];
|
||||
IoCManager.Resolve<IClientConsoleHost>()
|
||||
.ExecuteCommand($"settemp {TileXSpin.Value} {TileYSpin.Value} {selectedGrid} {TemperatureSpin.Value}");
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@ namespace Content.Client.Audio;
|
||||
/// </summary>
|
||||
public sealed class AmbientSoundOverlay : Overlay
|
||||
{
|
||||
private IEntityManager _entManager;
|
||||
private AmbientSoundSystem _ambient;
|
||||
private EntityLookupSystem _lookup;
|
||||
private readonly IEntityManager _entManager;
|
||||
private readonly AmbientSoundSystem _ambient;
|
||||
private readonly EntityLookupSystem _lookup;
|
||||
|
||||
public override OverlaySpace Space => OverlaySpace.WorldSpace;
|
||||
|
||||
@@ -27,6 +27,7 @@ public sealed class AmbientSoundOverlay : Overlay
|
||||
var worldHandle = args.WorldHandle;
|
||||
var ambientQuery = _entManager.GetEntityQuery<AmbientSoundComponent>();
|
||||
var xformQuery = _entManager.GetEntityQuery<TransformComponent>();
|
||||
var xformSystem = _entManager.System<SharedTransformSystem>();
|
||||
|
||||
const float Size = 0.25f;
|
||||
const float Alpha = 0.25f;
|
||||
@@ -40,16 +41,16 @@ public sealed class AmbientSoundOverlay : Overlay
|
||||
{
|
||||
if (_ambient.IsActive(ambientSound))
|
||||
{
|
||||
worldHandle.DrawCircle(xform.WorldPosition, Size, Color.LightGreen.WithAlpha(Alpha * 2f));
|
||||
worldHandle.DrawCircle(xformSystem.GetWorldPosition(xform), Size, Color.LightGreen.WithAlpha(Alpha * 2f));
|
||||
}
|
||||
else
|
||||
{
|
||||
worldHandle.DrawCircle(xform.WorldPosition, Size, Color.Orange.WithAlpha(Alpha));
|
||||
worldHandle.DrawCircle(xformSystem.GetWorldPosition(xform), Size, Color.Orange.WithAlpha(Alpha));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
worldHandle.DrawCircle(xform.WorldPosition, Size, Color.Red.WithAlpha(Alpha));
|
||||
worldHandle.DrawCircle(xformSystem.GetWorldPosition(xform), Size, Color.Red.WithAlpha(Alpha));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Content.Client.Inventory
|
||||
public Action<SlotData>? EntitySlotUpdate = null;
|
||||
public Action<SlotData>? OnSlotAdded = null;
|
||||
public Action<SlotData>? OnSlotRemoved = null;
|
||||
public Action<InventorySlotsComponent>? OnLinkInventorySlots = null;
|
||||
public Action<EntityUid, InventorySlotsComponent>? OnLinkInventorySlots = null;
|
||||
public Action? OnUnlinkInventory = null;
|
||||
public Action<SlotSpriteUpdate>? OnSpriteUpdate = null;
|
||||
|
||||
@@ -138,7 +138,7 @@ namespace Content.Client.Inventory
|
||||
}
|
||||
}
|
||||
|
||||
OnLinkInventorySlots?.Invoke(component);
|
||||
OnLinkInventorySlots?.Invoke(uid, component);
|
||||
}
|
||||
|
||||
public override void Shutdown()
|
||||
@@ -173,7 +173,7 @@ namespace Content.Client.Inventory
|
||||
}
|
||||
|
||||
OnUnlinkInventory?.Invoke();
|
||||
OnLinkInventorySlots?.Invoke(component);
|
||||
OnLinkInventorySlots?.Invoke(player.Value, component);
|
||||
}
|
||||
|
||||
public void SetSlotHighlight(EntityUid owner, InventorySlotsComponent component, string slotName, bool state)
|
||||
|
||||
@@ -28,6 +28,7 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
|
||||
[UISystemDependency] private readonly ClientInventorySystem _inventorySystem = default!;
|
||||
[UISystemDependency] private readonly HandsSystem _handsSystem = default!;
|
||||
|
||||
private EntityUid? _playerUid;
|
||||
private InventorySlotsComponent? _playerInventory;
|
||||
private readonly Dictionary<string, ItemSlotButtonContainer> _slotGroups = new();
|
||||
|
||||
@@ -222,26 +223,26 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
|
||||
return;
|
||||
}
|
||||
|
||||
if (_playerInventory == null)
|
||||
if (_playerInventory == null || _playerUid == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Function == ContentKeyFunctions.ExamineEntity)
|
||||
{
|
||||
_inventorySystem.UIInventoryExamine(slot, _playerInventory.Owner);
|
||||
_inventorySystem.UIInventoryExamine(slot, _playerUid.Value);
|
||||
}
|
||||
else if (args.Function == EngineKeyFunctions.UseSecondary)
|
||||
{
|
||||
_inventorySystem.UIInventoryOpenContextMenu(slot, _playerInventory.Owner);
|
||||
_inventorySystem.UIInventoryOpenContextMenu(slot, _playerUid.Value);
|
||||
}
|
||||
else if (args.Function == ContentKeyFunctions.ActivateItemInWorld)
|
||||
{
|
||||
_inventorySystem.UIInventoryActivateItem(slot, _playerInventory.Owner);
|
||||
_inventorySystem.UIInventoryActivateItem(slot, _playerUid.Value);
|
||||
}
|
||||
else if (args.Function == ContentKeyFunctions.AltActivateItemInWorld)
|
||||
{
|
||||
_inventorySystem.UIInventoryAltActivateItem(slot, _playerInventory.Owner);
|
||||
_inventorySystem.UIInventoryAltActivateItem(slot, _playerUid.Value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,7 +259,7 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
|
||||
|
||||
public void UpdateHover(SlotControl control)
|
||||
{
|
||||
var player = _playerInventory?.Owner;
|
||||
var player = _playerUid;
|
||||
|
||||
if (!control.MouseIsHovering ||
|
||||
_playerInventory == null ||
|
||||
@@ -305,9 +306,10 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
|
||||
_inventorySystem.ReloadInventory();
|
||||
}
|
||||
|
||||
private void LoadSlots(InventorySlotsComponent clientInv)
|
||||
private void LoadSlots(EntityUid clientUid, InventorySlotsComponent clientInv)
|
||||
{
|
||||
UnloadSlots();
|
||||
_playerUid = clientUid;
|
||||
_playerInventory = clientInv;
|
||||
foreach (var slotData in clientInv.SlotData.Values)
|
||||
{
|
||||
@@ -319,6 +321,7 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
|
||||
|
||||
private void UnloadSlots()
|
||||
{
|
||||
_playerUid = null;
|
||||
_playerInventory = null;
|
||||
foreach (var slotGroup in _slotGroups.Values)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user