]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fixed client console flooding with warnings on RGB color slider changes (#21333)
authorKISS <59531932+YuriyKiss@users.noreply.github.com>
Fri, 5 Jan 2024 05:04:11 +0000 (07:04 +0200)
committerGitHub <noreply@github.com>
Fri, 5 Jan 2024 05:04:11 +0000 (21:04 -0800)
added reparent bool for this kinds of unequips

Co-authored-by: Yurii Kis <yurii.kis@smartteksas.com>
Content.Client/Lobby/UI/LobbyCharacterPreviewPanel.cs
Content.Shared/Inventory/InventorySystem.Equip.cs

index 86989cd56141a3c3fcbd3fb107fdd4bd21a09cce..f9481caa3bbde0ed6d022fb1717d1177a80b327e 100644 (file)
@@ -148,7 +148,8 @@ namespace Content.Client.Lobby.UI
                 foreach (var slot in slots)
                 {
                     var itemType = gear.GetGear(slot.Name, profile);
-                    if (invSystem.TryUnequip(dummy, slot.Name, out var unequippedItem, true, true))
+
+                    if (invSystem.TryUnequip(dummy, slot.Name, out var unequippedItem, silent: true, force: true, reparent: false))
                     {
                         entMan.DeleteEntity(unequippedItem.Value);
                     }
index 848c8c35584d0beb2b4da42ee3ce8bc7d592eb28..5e740ec2eaeb924bda22ee068b4adf2ed61d12f3 100644 (file)
@@ -276,18 +276,58 @@ public abstract partial class InventorySystem
         return true;
     }
 
-    public bool TryUnequip(EntityUid uid, string slot, bool silent = false, bool force = false, bool predicted = false,
-        InventoryComponent? inventory = null, ClothingComponent? clothing = null) => TryUnequip(uid, uid, slot, silent, force, predicted, inventory, clothing);
+    public bool TryUnequip(
+        EntityUid uid,
+        string slot,
+        bool silent = false,
+        bool force = false,
+        bool predicted = false,
+        InventoryComponent? inventory = null,
+        ClothingComponent? clothing = null,
+        bool reparent = true)
+    {
+        return TryUnequip(uid, uid, slot, silent, force, predicted, inventory, clothing, reparent);
+    }
 
-    public bool TryUnequip(EntityUid actor, EntityUid target, string slot, bool silent = false,
-        bool force = false, bool predicted = false, InventoryComponent? inventory = null, ClothingComponent? clothing = null) =>
-        TryUnequip(actor, target, slot, out _, silent, force, predicted, inventory, clothing);
+    public bool TryUnequip(
+        EntityUid actor,
+        EntityUid target,
+        string slot,
+        bool silent = false,
+        bool force = false,
+        bool predicted = false,
+        InventoryComponent? inventory = null,
+        ClothingComponent? clothing = null,
+        bool reparent = true)
+    {
+        return TryUnequip(actor, target, slot, out _, silent, force, predicted, inventory, clothing, reparent);
+    }
 
-    public bool TryUnequip(EntityUid uid, string slot, [NotNullWhen(true)] out EntityUid? removedItem, bool silent = false, bool force = false, bool predicted = false,
-        InventoryComponent? inventory = null, ClothingComponent? clothing = null) => TryUnequip(uid, uid, slot, out removedItem, silent, force, predicted, inventory, clothing);
+    public bool TryUnequip(
+        EntityUid uid,
+        string slot,
+        [NotNullWhen(true)] out EntityUid? removedItem,
+        bool silent = false,
+        bool force = false,
+        bool predicted = false,
+        InventoryComponent? inventory = null,
+        ClothingComponent? clothing = null,
+        bool reparent = true)
+    {
+        return TryUnequip(uid, uid, slot, out removedItem, silent, force, predicted, inventory, clothing, reparent);
+    }
 
-    public bool TryUnequip(EntityUid actor, EntityUid target, string slot, [NotNullWhen(true)] out EntityUid? removedItem, bool silent = false,
-        bool force = false, bool predicted = false, InventoryComponent? inventory = null, ClothingComponent? clothing = null)
+    public bool TryUnequip(
+        EntityUid actor,
+        EntityUid target,
+        string slot,
+        [NotNullWhen(true)] out EntityUid? removedItem,
+        bool silent = false,
+        bool force = false,
+        bool predicted = false,
+        InventoryComponent? inventory = null,
+        ClothingComponent? clothing = null,
+        bool reparent = true)
     {
         removedItem = null;
 
@@ -329,11 +369,11 @@ public abstract partial class InventorySystem
             if (slotDef != slotDefinition && slotDef.DependsOn == slotDefinition.Name)
             {
                 //this recursive call might be risky
-                TryUnequip(actor, target, slotDef.Name, true, true, predicted, inventory);
+                TryUnequip(actor, target, slotDef.Name, true, true, predicted, inventory, reparent: reparent);
             }
         }
 
-        if (!_containerSystem.Remove(removedItem.Value, slotContainer, force: force))
+        if (!_containerSystem.Remove(removedItem.Value, slotContainer, force: force, reparent: reparent))
             return false;
 
         // TODO: Inventory needs a hot cleanup hoo boy