]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix inventory transform bug (#21144)
authorLeon Friedrich <60421075+ElectroJr@users.noreply.github.com>
Sun, 22 Oct 2023 05:54:30 +0000 (16:54 +1100)
committerGitHub <noreply@github.com>
Sun, 22 Oct 2023 05:54:30 +0000 (16:54 +1100)
Content.Shared/Inventory/InventorySystem.Equip.cs

index f3181a87b161dd6ea5862239a4767caaa782af64..90c9f0e1e0fddfa06c89412caf979a6b972cf8a2 100644 (file)
@@ -27,6 +27,7 @@ public abstract partial class InventorySystem
     [Dependency] private readonly SharedHandsSystem _handsSystem = default!;
     [Dependency] private readonly IGameTiming _gameTiming = default!;
     [Dependency] private readonly INetManager _netMan = default!;
+    [Dependency] private readonly SharedTransformSystem _transform = default!;
 
     private void InitializeEquip()
     {
@@ -372,20 +373,10 @@ public abstract partial class InventorySystem
             }
         }
 
-        if (force)
-        {
-            slotContainer.ForceRemove(removedItem.Value);
-        }
-        else
-        {
-            if (!slotContainer.Remove(removedItem.Value))
-            {
-                //should never happen bc of the canremove lets just keep in just in case
-                return false;
-            }
-        }
+        if (!slotContainer.Remove(removedItem.Value, force: force))
+            return false;
 
-        Transform(removedItem.Value).Coordinates = Transform(target).Coordinates;
+        _transform.DropNextTo(removedItem.Value, target);
 
         if (!silent && Resolve(removedItem.Value, ref clothing, false) && clothing.UnequipSound != null && _gameTiming.IsFirstTimePredicted)
         {
@@ -405,8 +396,7 @@ public abstract partial class InventorySystem
             SoundSystem.Play(clothing.UnequipSound.GetSound(), filter, target, clothing.UnequipSound.Params.WithVolume(-2f));
         }
 
-        inventory.Dirty();
-
+        Dirty(target, inventory);
         _movementSpeed.RefreshMovementSpeedModifiers(target);
 
         return true;