Improve stripping UI (#9768)
This commit is contained in:
@@ -2,6 +2,7 @@ using Content.Shared.Hands;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using JetBrains.Annotations;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Content.Server.Hands.Systems
|
||||
{
|
||||
@@ -10,16 +11,21 @@ namespace Content.Server.Hands.Systems
|
||||
{
|
||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||
|
||||
public bool TrySpawnVirtualItemInHand(EntityUid blockingEnt, EntityUid user)
|
||||
public bool TrySpawnVirtualItemInHand(EntityUid blockingEnt, EntityUid user) => TrySpawnVirtualItemInHand(blockingEnt, user, out _);
|
||||
|
||||
public bool TrySpawnVirtualItemInHand(EntityUid blockingEnt, EntityUid user, [NotNullWhen(true)] out EntityUid? virtualItem)
|
||||
{
|
||||
if (!_handsSystem.TryGetEmptyHand(user, out var hand))
|
||||
{
|
||||
virtualItem = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
var pos = EntityManager.GetComponent<TransformComponent>(user).Coordinates;
|
||||
var virtualItem = EntityManager.SpawnEntity("HandVirtualItem", pos);
|
||||
var virtualItemComp = EntityManager.GetComponent<HandVirtualItemComponent>(virtualItem);
|
||||
virtualItem = EntityManager.SpawnEntity("HandVirtualItem", pos);
|
||||
var virtualItemComp = EntityManager.GetComponent<HandVirtualItemComponent>(virtualItem.Value);
|
||||
virtualItemComp.BlockingEntity = blockingEnt;
|
||||
_handsSystem.DoPickup(user, hand, virtualItem);
|
||||
_handsSystem.DoPickup(user, hand, virtualItem.Value);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -106,23 +106,6 @@ namespace Content.Server.Hands.Systems
|
||||
}
|
||||
|
||||
#region EntityInsertRemove
|
||||
public override void DoDrop(EntityUid uid, Hand hand, bool doDropInteraction = true, SharedHandsComponent? hands = null)
|
||||
{
|
||||
base.DoDrop(uid, hand,doDropInteraction, hands);
|
||||
|
||||
// update gui of anyone stripping this entity.
|
||||
_strippableSystem.SendUpdate(uid);
|
||||
}
|
||||
|
||||
public override void DoPickup(EntityUid uid, Hand hand, EntityUid entity, SharedHandsComponent? hands = null)
|
||||
{
|
||||
base.DoPickup(uid, hand, entity, hands);
|
||||
|
||||
// update gui of anyone stripping this entity.
|
||||
_strippableSystem.SendUpdate(uid);
|
||||
}
|
||||
|
||||
|
||||
public override void PickupAnimation(EntityUid item, EntityCoordinates initialPosition, Vector2 finalPosition,
|
||||
EntityUid? exclude)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user