More miscellaneous compiler warning fixes (#18228)

This commit is contained in:
metalgearsloth
2023-07-23 16:03:57 +10:00
committed by GitHub
parent cfb827c99b
commit e755509fc7
12 changed files with 103 additions and 82 deletions

View File

@@ -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)
{