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
|
/// 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.
|
/// if the item action is not yet tied to an item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public EntityUid Item { get; private set; }
|
public EntityUid? Item { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the action in this slot should be shown as toggled on. Separate from Depressed.
|
/// 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),
|
ActionPrototype actionPrototype => new ActionAttempt(actionPrototype),
|
||||||
ItemActionPrototype itemActionPrototype =>
|
ItemActionPrototype itemActionPrototype =>
|
||||||
(Item != default && IoCManager.Resolve<IEntityManager>().TryGetComponent<ItemActionsComponent?>(Item, out var itemActions)) ?
|
(Item != null && IoCManager.Resolve<IEntityManager>().TryGetComponent<ItemActionsComponent?>(Item, out var itemActions)) ?
|
||||||
new ItemActionAttempt(itemActionPrototype, Item, itemActions) : null,
|
new ItemActionAttempt(itemActionPrototype, Item.Value, itemActions) : null,
|
||||||
_ => null
|
_ => null
|
||||||
};
|
};
|
||||||
return attempt;
|
return attempt;
|
||||||
@@ -245,8 +245,8 @@ namespace Content.Client.Actions.UI
|
|||||||
_beingHovered = true;
|
_beingHovered = true;
|
||||||
DrawModeChanged();
|
DrawModeChanged();
|
||||||
if (Action is not ItemActionPrototype) return;
|
if (Action is not ItemActionPrototype) return;
|
||||||
if (Item == default) return;
|
if (Item == null) return;
|
||||||
_actionsComponent.HighlightItemSlot(Item);
|
_actionsComponent.HighlightItemSlot(Item.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void MouseExited()
|
protected override void MouseExited()
|
||||||
|
|||||||
@@ -66,9 +66,9 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
|||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
await client.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 serverPlayerManager = server.ResolveDependency<IPlayerManager>();
|
||||||
var innateActions = new List<ActionType>();
|
var innateActions = new List<ActionType>();
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using System.Threading.Tasks;
|
|||||||
using Content.Server.Administration.Logs;
|
using Content.Server.Administration.Logs;
|
||||||
using Content.Server.CombatMode;
|
using Content.Server.CombatMode;
|
||||||
using Content.Server.Hands.Components;
|
using Content.Server.Hands.Components;
|
||||||
|
using Content.Server.Items;
|
||||||
using Content.Server.Pulling;
|
using Content.Server.Pulling;
|
||||||
using Content.Server.Storage.Components;
|
using Content.Server.Storage.Components;
|
||||||
using Content.Shared.ActionBlocker;
|
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.
|
// We pick up items if our hand is empty, even if we're in combat mode.
|
||||||
InteractHand(user, targetUid);
|
InteractHand(user, targetUid);
|
||||||
|
|||||||
@@ -62,12 +62,12 @@ namespace Content.Server.Mind
|
|||||||
public NetUserId OriginalOwnerUserId { get; }
|
public NetUserId OriginalOwnerUserId { get; }
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public bool IsVisitingEntity => VisitingEntity != default;
|
public bool IsVisitingEntity => VisitingEntity != null;
|
||||||
|
|
||||||
[ViewVariables]
|
[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)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
public string? CharacterName { get; set; }
|
public string? CharacterName { get; set; }
|
||||||
@@ -296,7 +296,7 @@ namespace Content.Server.Mind
|
|||||||
OwnedComponent = component;
|
OwnedComponent = component;
|
||||||
OwnedComponent?.InternalAssignMind(this);
|
OwnedComponent?.InternalAssignMind(this);
|
||||||
|
|
||||||
if (IsVisitingEntity
|
if (VisitingEntity != null
|
||||||
&& (ghostCheckOverride // to force mind transfer, for example from ControlMobVerb
|
&& (ghostCheckOverride // to force mind transfer, for example from ControlMobVerb
|
||||||
|| !entMan.TryGetComponent(VisitingEntity!, out GhostComponent? ghostComponent) // visiting entity is not a Ghost
|
|| !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
|
|| !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()
|
public void UnVisit()
|
||||||
{
|
{
|
||||||
if (!IsVisitingEntity)
|
if (VisitingEntity == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Session?.AttachToEntity(OwnedEntity);
|
Session?.AttachToEntity(OwnedEntity);
|
||||||
var oldVisitingEnt = VisitingEntity;
|
var oldVisitingEnt = VisitingEntity.Value;
|
||||||
// Null this before removing the component to avoid any infinite loops.
|
// Null this before removing the component to avoid any infinite loops.
|
||||||
VisitingEntity = default;
|
VisitingEntity = default;
|
||||||
|
|
||||||
DebugTools.AssertNotNull(oldVisitingEnt);
|
DebugTools.AssertNotNull(oldVisitingEnt);
|
||||||
|
|
||||||
var entities = IoCManager.Resolve<IEntityManager>();
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
if (entities.HasComponent<VisitingMindComponent>(oldVisitingEnt!))
|
if (entities.HasComponent<VisitingMindComponent>(oldVisitingEnt))
|
||||||
{
|
{
|
||||||
entities.RemoveComponent<VisitingMindComponent>(oldVisitingEnt);
|
entities.RemoveComponent<VisitingMindComponent>(oldVisitingEnt);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user