Fixes some integration tests
This commit is contained in:
@@ -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