Fix 3000 errors
This commit is contained in:
@@ -84,7 +84,7 @@ namespace Content.Client.Actions
|
||||
return new((in PointerInputCmdHandler.PointerInputCmdArgs args) =>
|
||||
{
|
||||
var playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
||||
if (playerEntity == null ||
|
||||
if (playerEntity == default ||
|
||||
!EntityManager.TryGetComponent<ClientActionsComponent?>(playerEntity.Value, out var actionsComponent)) return false;
|
||||
|
||||
actionsComponent.HandleHotbarKeybind(slot, args);
|
||||
@@ -98,7 +98,7 @@ namespace Content.Client.Actions
|
||||
return new((in PointerInputCmdHandler.PointerInputCmdArgs args) =>
|
||||
{
|
||||
var playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
||||
if (playerEntity == null ||
|
||||
if (playerEntity == default ||
|
||||
!EntityManager.TryGetComponent<ClientActionsComponent?>(playerEntity.Value, out var actionsComponent)) return false;
|
||||
|
||||
actionsComponent.HandleChangeHotbarKeybind(hotbar, args);
|
||||
@@ -110,7 +110,7 @@ namespace Content.Client.Actions
|
||||
private bool TargetingOnUse(in PointerInputCmdHandler.PointerInputCmdArgs args)
|
||||
{
|
||||
var playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
||||
if (playerEntity == null ||
|
||||
if (playerEntity == default ||
|
||||
!EntityManager.TryGetComponent<ClientActionsComponent?>(playerEntity.Value, out var actionsComponent)) return false;
|
||||
|
||||
return actionsComponent.TargetingOnUse(args);
|
||||
@@ -119,7 +119,7 @@ namespace Content.Client.Actions
|
||||
private void ToggleActionsMenu()
|
||||
{
|
||||
var playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
||||
if (playerEntity == null ||
|
||||
if (playerEntity == default ||
|
||||
!EntityManager.TryGetComponent<ClientActionsComponent?>(playerEntity.Value, out var actionsComponent)) return;
|
||||
|
||||
actionsComponent.ToggleActionsMenu();
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using Content.Client.Actions.Assignments;
|
||||
using Content.Client.Actions.UI;
|
||||
using Content.Client.Hands;
|
||||
using Content.Client.Inventory;
|
||||
using Content.Client.Items.Managers;
|
||||
using Content.Shared.Actions.Components;
|
||||
using Content.Shared.Actions.Prototypes;
|
||||
@@ -226,7 +224,7 @@ namespace Content.Client.Actions
|
||||
/// Highlights the item slot (inventory or hand) that contains this item
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
public void HighlightItemSlot(IEntity item)
|
||||
public void HighlightItemSlot(EntityUid item)
|
||||
{
|
||||
StopHighlightingItemSlots();
|
||||
|
||||
@@ -236,7 +234,7 @@ namespace Content.Client.Actions
|
||||
|
||||
/// <summary>
|
||||
/// Stops highlighting any item slots we are currently highlighting.
|
||||
/// </summary>
|
||||
/// </summary>H
|
||||
public void StopHighlightingItemSlots()
|
||||
{
|
||||
if (_highlightedEntity == default)
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Content.Client.Actions.UI
|
||||
/// Item the action is provided by, only valid if Action is an ItemActionPrototype. May be null
|
||||
/// if the item action is not yet tied to an item.
|
||||
/// </summary>
|
||||
public IEntity? Item { get; private set; }
|
||||
public EntityUid Item { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the action in this slot should be shown as toggled on. Separate from Depressed.
|
||||
@@ -231,7 +231,7 @@ namespace Content.Client.Actions.UI
|
||||
{
|
||||
ActionPrototype actionPrototype => new ActionAttempt(actionPrototype),
|
||||
ItemActionPrototype itemActionPrototype =>
|
||||
(Item != null && IoCManager.Resolve<IEntityManager>().TryGetComponent<ItemActionsComponent?>(Item, out var itemActions)) ?
|
||||
(Item != default && IoCManager.Resolve<IEntityManager>().TryGetComponent<ItemActionsComponent?>(Item, out var itemActions)) ?
|
||||
new ItemActionAttempt(itemActionPrototype, Item, itemActions) : null,
|
||||
_ => null
|
||||
};
|
||||
@@ -245,7 +245,7 @@ namespace Content.Client.Actions.UI
|
||||
_beingHovered = true;
|
||||
DrawModeChanged();
|
||||
if (Action is not ItemActionPrototype) return;
|
||||
if (Item == null) return;
|
||||
if (Item == default) return;
|
||||
_actionsComponent.HighlightItemSlot(Item);
|
||||
}
|
||||
|
||||
@@ -376,7 +376,7 @@ namespace Content.Client.Actions.UI
|
||||
if (Action != null && Action == action) return;
|
||||
|
||||
Action = action;
|
||||
Item = null;
|
||||
Item = default;
|
||||
_depressed = false;
|
||||
ToggledOn = false;
|
||||
ActionEnabled = actionEnabled;
|
||||
@@ -395,10 +395,10 @@ namespace Content.Client.Actions.UI
|
||||
public void Assign(ItemActionPrototype action)
|
||||
{
|
||||
// already assigned
|
||||
if (Action != null && Action == action && Item == null) return;
|
||||
if (Action != null && Action == action && Item == default) return;
|
||||
|
||||
Action = action;
|
||||
Item = null;
|
||||
Item = default;
|
||||
_depressed = false;
|
||||
ToggledOn = false;
|
||||
ActionEnabled = false;
|
||||
@@ -415,7 +415,7 @@ namespace Content.Client.Actions.UI
|
||||
/// <param name="action">action to assign</param>
|
||||
/// <param name="item">item the action is provided by</param>
|
||||
/// <param name="actionEnabled">whether action should initially appear enable or disabled</param>
|
||||
public void Assign(ItemActionPrototype action, IEntity item, bool actionEnabled)
|
||||
public void Assign(ItemActionPrototype action, EntityUid item, bool actionEnabled)
|
||||
{
|
||||
// already assigned
|
||||
if (Action != null && Action == action && Item == item) return;
|
||||
@@ -439,7 +439,7 @@ namespace Content.Client.Actions.UI
|
||||
{
|
||||
if (!HasAssignment) return;
|
||||
Action = null;
|
||||
Item = null;
|
||||
Item = default;
|
||||
ToggledOn = false;
|
||||
_depressed = false;
|
||||
Cooldown = null;
|
||||
@@ -502,7 +502,7 @@ namespace Content.Client.Actions.UI
|
||||
SetActionIcon(Action.Icon.Frame0());
|
||||
}
|
||||
|
||||
if (Item != null)
|
||||
if (Item != default)
|
||||
{
|
||||
SetItemIcon(IoCManager.Resolve<IEntityManager>().TryGetComponent<ISpriteComponent?>(Item, out var spriteComponent) ? spriteComponent : null);
|
||||
}
|
||||
|
||||
@@ -378,10 +378,10 @@ namespace Content.Client.Actions.UI
|
||||
private void UpdateActionSlot(EntityUid item, ItemActionType itemActionType, ActionSlot actionSlot,
|
||||
ActionAssignment? assignedActionType)
|
||||
{
|
||||
if (!_entityManager.TryGetEntity(item, out var itemEntity)) return;
|
||||
if (!_entityManager.EntityExists(item)) return;
|
||||
if (_actionManager.TryGet(itemActionType, out var action))
|
||||
{
|
||||
actionSlot.Assign(action, itemEntity, true);
|
||||
actionSlot.Assign(action, item, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -420,7 +420,7 @@ namespace Content.Client.Actions.UI
|
||||
|
||||
// if we are targeting with an action now on cooldown, stop targeting if we should
|
||||
if (SelectingTargetFor?.Action != null && SelectingTargetFor.Action == action &&
|
||||
SelectingTargetFor.Item == itemEntity &&
|
||||
SelectingTargetFor.Item == item &&
|
||||
actionState.IsOnCooldown(_gameTiming) && action.DeselectOnCooldown)
|
||||
{
|
||||
StopTargeting();
|
||||
|
||||
Reference in New Issue
Block a user