]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Don't delete virtual hand items on client (#14954)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Wed, 29 Mar 2023 11:04:21 +0000 (22:04 +1100)
committerGitHub <noreply@github.com>
Wed, 29 Mar 2023 11:04:21 +0000 (22:04 +1100)
Content.Shared/Cuffs/SharedCuffableSystem.cs
Content.Shared/Hands/SharedHandVirtualItemSystem.cs

index 2cf87ea96c63d21d19fe93466e3f8b1fceef7a74..f513bb4aa345d962dd4e12d1b789ffe6122bfc29 100644 (file)
@@ -134,11 +134,11 @@ namespace Content.Shared.Cuffs
 
         private void OnCuffsRemovedFromContainer(EntityUid uid, CuffableComponent component, EntRemovedFromContainerMessage args)
         {
-            if (args.Container.ID == component.Container.ID)
-            {
-                _handVirtualItem.DeleteInHandsMatching(uid, args.Entity);
-                UpdateCuffState(uid, component);
-            }
+            if (args.Container.ID != component.Container.ID)
+                return;
+
+            _handVirtualItem.DeleteInHandsMatching(uid, args.Entity);
+            UpdateCuffState(uid, component);
         }
 
         private void OnCuffsInsertedIntoContainer(EntityUid uid, CuffableComponent component, ContainerModifiedMessage args)
index e33ffdf051898fa20b8c823bd845167c92bd9b23..037b36d4a87b376b7a483cf4cb13dc7221f93c41 100644 (file)
@@ -48,6 +48,11 @@ public abstract class SharedHandVirtualItemSystem : EntitySystem
     /// </summary>
     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))
         {
             if (TryComp(hand.HeldEntity, out HandVirtualItemComponent? virt) && virt.BlockingEntity == matching)