]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix inventory flickering and missing InventoryTemplateUpdated event (#39379)
authorslarticodefast <161409025+slarticodefast@users.noreply.github.com>
Wed, 6 Aug 2025 20:14:28 +0000 (22:14 +0200)
committerGitHub <noreply@github.com>
Wed, 6 Aug 2025 20:14:28 +0000 (22:14 +0200)
* fix flickering

* move InitClothing

* fix this

Content.Client/Inventory/ClientInventorySystem.cs
Content.Shared/Inventory/InventorySystem.Equip.cs
Content.Shared/Inventory/InventorySystem.Slots.cs

index 1f926b42a11619b7737a978376be80456e0b61e0..97da176ed25edc0f87e322ab4fca7e608ca2e0ab 100644 (file)
@@ -115,6 +115,13 @@ namespace Content.Client.Inventory
             OnLinkInventorySlots?.Invoke(uid, component);
         }
 
+        protected override void OnInit(Entity<InventoryComponent> ent, ref ComponentInit args)
+        {
+            base.OnInit(ent, ref args);
+
+            _clothingVisualsSystem.InitClothing(ent.Owner, ent.Comp);
+        }
+
         public override void Shutdown()
         {
             CommandBinds.Unregister<ClientInventorySystem>();
@@ -261,7 +268,6 @@ namespace Content.Client.Inventory
                     TryAddSlotData((ent.Owner, inventorySlots), (SlotData)slot);
             }
 
-            _clothingVisualsSystem.InitClothing(ent, ent.Comp);
             if (ent.Owner == _playerManager.LocalEntity)
                 ReloadInventory(inventorySlots);
         }
index 3ed068070a8c6205b830308c853d0f51a2675d1f..ae038b63f3e1da4ec086412a388955b086399b54 100644 (file)
@@ -194,8 +194,6 @@ public abstract partial class InventorySystem
         if (triggerHandContact && !((slotDefinition.SlotFlags & SlotFlags.GLOVES) == 0))
             TriggerHandContactInteraction(target);
 
-        Dirty(target, inventory);
-
         _movementSpeed.RefreshMovementSpeedModifiers(target);
 
         return true;
@@ -487,8 +485,6 @@ public abstract partial class InventorySystem
         if (triggerHandContact && !((slotDefinition.SlotFlags & SlotFlags.GLOVES) == 0))
             TriggerHandContactInteraction(target);
 
-        Dirty(target, inventory);
-
         _movementSpeed.RefreshMovementSpeedModifiers(target);
 
         return true;
index 09c3bbc45bd5192c605106aecadc56229fd6890a..3f0bdf10d45aa2aab73cc9334ce1f4c5e878b245 100644 (file)
@@ -74,7 +74,7 @@ public partial class InventorySystem : EntitySystem
         Dirty(target, targetComp);
     }
 
-    private void OnInit(Entity<InventoryComponent> ent, ref ComponentInit args)
+    protected virtual void OnInit(Entity<InventoryComponent> ent, ref ComponentInit args)
     {
         UpdateInventoryTemplate(ent);
     }
@@ -111,6 +111,9 @@ public partial class InventorySystem : EntitySystem
             container.OccludesLight = false;
             ent.Comp.Containers[i] = container;
         }
+
+        var ev = new InventoryTemplateUpdated();
+        RaiseLocalEvent(ent, ref ev);
     }
 
     private void OnOpenSlotStorage(OpenSlotStorageNetworkMessage ev, EntitySessionEventArgs args)