Don't delete virtual hand items on client (#14954)
This commit is contained in:
@@ -134,12 +134,12 @@ namespace Content.Shared.Cuffs
|
|||||||
|
|
||||||
private void OnCuffsRemovedFromContainer(EntityUid uid, CuffableComponent component, EntRemovedFromContainerMessage args)
|
private void OnCuffsRemovedFromContainer(EntityUid uid, CuffableComponent component, EntRemovedFromContainerMessage args)
|
||||||
{
|
{
|
||||||
if (args.Container.ID == component.Container.ID)
|
if (args.Container.ID != component.Container.ID)
|
||||||
{
|
return;
|
||||||
|
|
||||||
_handVirtualItem.DeleteInHandsMatching(uid, args.Entity);
|
_handVirtualItem.DeleteInHandsMatching(uid, args.Entity);
|
||||||
UpdateCuffState(uid, component);
|
UpdateCuffState(uid, component);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void OnCuffsInsertedIntoContainer(EntityUid uid, CuffableComponent component, ContainerModifiedMessage args)
|
private void OnCuffsInsertedIntoContainer(EntityUid uid, CuffableComponent component, ContainerModifiedMessage args)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,6 +48,11 @@ public abstract class SharedHandVirtualItemSystem : EntitySystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void DeleteInHandsMatching(EntityUid user, EntityUid matching)
|
public void DeleteInHandsMatching(EntityUid user, EntityUid matching)
|
||||||
{
|
{
|
||||||
|
// Client can't currently predict deleting network entities atm and this might happen due to the
|
||||||
|
// hands leaving PVS for example, in which case we wish to ignore it.
|
||||||
|
if (_net.IsClient)
|
||||||
|
return;
|
||||||
|
|
||||||
foreach (var hand in _hands.EnumerateHands(user))
|
foreach (var hand in _hands.EnumerateHands(user))
|
||||||
{
|
{
|
||||||
if (TryComp(hand.HeldEntity, out HandVirtualItemComponent? virt) && virt.BlockingEntity == matching)
|
if (TryComp(hand.HeldEntity, out HandVirtualItemComponent? virt) && virt.BlockingEntity == matching)
|
||||||
|
|||||||
Reference in New Issue
Block a user