Fixes some integration tests
This commit is contained in:
@@ -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 EntityUid 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,8 +231,8 @@ namespace Content.Client.Actions.UI
|
||||
{
|
||||
ActionPrototype actionPrototype => new ActionAttempt(actionPrototype),
|
||||
ItemActionPrototype itemActionPrototype =>
|
||||
(Item != default && IoCManager.Resolve<IEntityManager>().TryGetComponent<ItemActionsComponent?>(Item, out var itemActions)) ?
|
||||
new ItemActionAttempt(itemActionPrototype, Item, itemActions) : null,
|
||||
(Item != null && IoCManager.Resolve<IEntityManager>().TryGetComponent<ItemActionsComponent?>(Item, out var itemActions)) ?
|
||||
new ItemActionAttempt(itemActionPrototype, Item.Value, itemActions) : null,
|
||||
_ => null
|
||||
};
|
||||
return attempt;
|
||||
@@ -245,8 +245,8 @@ namespace Content.Client.Actions.UI
|
||||
_beingHovered = true;
|
||||
DrawModeChanged();
|
||||
if (Action is not ItemActionPrototype) return;
|
||||
if (Item == default) return;
|
||||
_actionsComponent.HighlightItemSlot(Item);
|
||||
if (Item == null) return;
|
||||
_actionsComponent.HighlightItemSlot(Item.Value);
|
||||
}
|
||||
|
||||
protected override void MouseExited()
|
||||
|
||||
@@ -66,9 +66,9 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
||||
await server.WaitIdleAsync();
|
||||
await client.WaitIdleAsync();
|
||||
|
||||
var cEntities = IoCManager.Resolve<IEntityManager>();
|
||||
var cEntities = client.ResolveDependency<IEntityManager>();
|
||||
|
||||
var sEntities = IoCManager.Resolve<IEntityManager>();
|
||||
var sEntities = server.ResolveDependency<IEntityManager>();
|
||||
var serverPlayerManager = server.ResolveDependency<IPlayerManager>();
|
||||
var innateActions = new List<ActionType>();
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Threading.Tasks;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.CombatMode;
|
||||
using Content.Server.Hands.Components;
|
||||
using Content.Server.Items;
|
||||
using Content.Server.Pulling;
|
||||
using Content.Server.Storage.Components;
|
||||
using Content.Shared.ActionBlocker;
|
||||
@@ -507,7 +508,7 @@ namespace Content.Server.Interaction
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!wideAttack && targetUid != default)
|
||||
else if (!wideAttack && targetUid != default && _entityManager.HasComponent<ItemComponent>(targetUid))
|
||||
{
|
||||
// We pick up items if our hand is empty, even if we're in combat mode.
|
||||
InteractHand(user, targetUid);
|
||||
|
||||
@@ -62,12 +62,12 @@ namespace Content.Server.Mind
|
||||
public NetUserId OriginalOwnerUserId { get; }
|
||||
|
||||
[ViewVariables]
|
||||
public bool IsVisitingEntity => VisitingEntity != default;
|
||||
public bool IsVisitingEntity => VisitingEntity != null;
|
||||
|
||||
[ViewVariables]
|
||||
public EntityUid VisitingEntity { get; private set; }
|
||||
public EntityUid? VisitingEntity { get; private set; }
|
||||
|
||||
[ViewVariables] public EntityUid? CurrentEntity => VisitingEntity.IsValid() ? VisitingEntity : OwnedEntity;
|
||||
[ViewVariables] public EntityUid? CurrentEntity => VisitingEntity ?? OwnedEntity;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public string? CharacterName { get; set; }
|
||||
@@ -296,7 +296,7 @@ namespace Content.Server.Mind
|
||||
OwnedComponent = component;
|
||||
OwnedComponent?.InternalAssignMind(this);
|
||||
|
||||
if (IsVisitingEntity
|
||||
if (VisitingEntity != null
|
||||
&& (ghostCheckOverride // to force mind transfer, for example from ControlMobVerb
|
||||
|| !entMan.TryGetComponent(VisitingEntity!, out GhostComponent? ghostComponent) // visiting entity is not a Ghost
|
||||
|| !ghostComponent.CanReturnToBody)) // it is a ghost, but cannot return to body anyway, so it's okay
|
||||
@@ -367,20 +367,20 @@ namespace Content.Server.Mind
|
||||
|
||||
public void UnVisit()
|
||||
{
|
||||
if (!IsVisitingEntity)
|
||||
if (VisitingEntity == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Session?.AttachToEntity(OwnedEntity);
|
||||
var oldVisitingEnt = VisitingEntity;
|
||||
var oldVisitingEnt = VisitingEntity.Value;
|
||||
// Null this before removing the component to avoid any infinite loops.
|
||||
VisitingEntity = default;
|
||||
|
||||
DebugTools.AssertNotNull(oldVisitingEnt);
|
||||
|
||||
var entities = IoCManager.Resolve<IEntityManager>();
|
||||
if (entities.HasComponent<VisitingMindComponent>(oldVisitingEnt!))
|
||||
if (entities.HasComponent<VisitingMindComponent>(oldVisitingEnt))
|
||||
{
|
||||
entities.RemoveComponent<VisitingMindComponent>(oldVisitingEnt);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user