Fix foldable-pickup interactions. (#6057)
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Interaction;
|
||||
@@ -11,7 +10,6 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
@@ -101,28 +99,11 @@ namespace Content.Shared.Item
|
||||
[DataField("sprite")]
|
||||
private string? _rsiPath;
|
||||
|
||||
/// <summary>
|
||||
/// If a player can pick up this item.
|
||||
/// </summary>
|
||||
public bool CanPickup(EntityUid user, bool popup = true)
|
||||
{
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanPickup(user))
|
||||
return false;
|
||||
|
||||
if (_entMan.GetComponent<TransformComponent>(user).MapID != _entMan.GetComponent<TransformComponent>(Owner).MapID)
|
||||
return false;
|
||||
|
||||
if (!_entMan.TryGetComponent(Owner, out IPhysBody? physics) || physics.BodyType == BodyType.Static)
|
||||
return false;
|
||||
|
||||
return user.InRangeUnobstructed(Owner, ignoreInsideBlocker: true, popup: popup);
|
||||
}
|
||||
|
||||
bool IInteractHand.InteractHand(InteractHandEventArgs eventArgs)
|
||||
{
|
||||
var user = eventArgs.User;
|
||||
|
||||
if (!CanPickup(user))
|
||||
if (!user.InRangeUnobstructed(Owner, ignoreInsideBlocker: true))
|
||||
return false;
|
||||
|
||||
if (!_entMan.TryGetComponent(user, out SharedHandsComponent hands))
|
||||
@@ -133,8 +114,8 @@ namespace Content.Shared.Item
|
||||
if (activeHand == null)
|
||||
return false;
|
||||
|
||||
hands.TryPickupEntityToActiveHand(Owner, animateUser: true);
|
||||
return true;
|
||||
// hands checks action blockers
|
||||
return hands.TryPickupEntityToActiveHand(Owner, animateUser: true);
|
||||
}
|
||||
|
||||
private void OnEquippedPrefixChange()
|
||||
|
||||
Reference in New Issue
Block a user