]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Remove server and shared sprite component (#15917)
authorLeon Friedrich <60421075+ElectroJr@users.noreply.github.com>
Sun, 30 Apr 2023 06:09:52 +0000 (18:09 +1200)
committerGitHub <noreply@github.com>
Sun, 30 Apr 2023 06:09:52 +0000 (16:09 +1000)
12 files changed:
Content.Client/AirlockPainter/AirlockPainterSystem.cs
Content.Client/Atmos/EntitySystems/AtmosPipeAppearanceSystem.cs
Content.Client/Clothing/ClientClothingSystem.cs
Content.Client/Doors/DoorSystem.cs
Content.Client/Items/Systems/ItemSystem.cs
Content.Client/Toggleable/ToggleableLightVisualsComponent.cs
Content.MapRenderer/Painters/GridPainter.cs
Content.Shared/Clothing/ClothingEvents.cs
Content.Shared/Clothing/Components/ClothingComponent.cs
Content.Shared/Hands/HandEvents.cs
Content.Shared/Item/ItemComponent.cs
Content.Shared/Item/SharedItemSystem.cs

index 6831b0e4e1fa05145fcd2cf244ad97b41633d91a..b0ee4a970da4b9fded65f2a9a19a86e6e962d26c 100644 (file)
@@ -3,7 +3,7 @@ using Robust.Client.Graphics;
 using Robust.Client.ResourceManagement;
 using Robust.Shared.Utility;
 using System.Linq;
-using static Robust.Shared.GameObjects.SharedSpriteComponent;
+using Robust.Shared.Serialization.TypeSerializers.Implementations;
 
 namespace Content.Client.AirlockPainter
 {
@@ -28,7 +28,7 @@ namespace Content.Client.AirlockPainter
                     continue;
                 }
 
-                RSIResource doorRsi = _resourceCache.GetResource<RSIResource>(TextureRoot / new ResPath(iconPath));
+                RSIResource doorRsi = _resourceCache.GetResource<RSIResource>(SpriteSpecifierSerializer.TextureRoot / new ResPath(iconPath));
                 if (!doorRsi.RSI.TryGetState("closed", out var icon))
                 {
                     Entries.Add(new AirlockPainterEntry(style, null));
index a9c5b53192abe9ff35df5ad71bd2981ae6413395..dcb904d5a5707a50b01e639e9c0fa67826dea574 100644 (file)
@@ -5,6 +5,7 @@ using Content.Shared.Atmos.Piping;
 using JetBrains.Annotations;
 using Robust.Client.GameObjects;
 using Robust.Client.ResourceManagement;
+using Robust.Shared.Serialization.TypeSerializers.Implementations;
 
 namespace Content.Client.Atmos.EntitySystems;
 
@@ -27,7 +28,7 @@ public sealed class AtmosPipeAppearanceSystem : EntitySystem
         if (!TryComp(uid, out SpriteComponent? sprite))
             return;
 
-        if (!_resCache.TryGetResource(SharedSpriteComponent.TextureRoot / component.RsiPath, out RSIResource? rsi))
+        if (!_resCache.TryGetResource(SpriteSpecifierSerializer.TextureRoot / component.RsiPath, out RSIResource? rsi))
         {
             Logger.Error($"{nameof(AtmosPipeAppearanceSystem)} could not load to load RSI {component.RsiPath}.");
             return;
index e289fb8b476f42d1e7032fc98cdc479fb258fe8a..22d639fc2fb86c5a9ee4503ed87bc20df02dbc5d 100644 (file)
@@ -11,8 +11,8 @@ using Content.Shared.Item;
 using Robust.Client.GameObjects;
 using Robust.Client.Graphics;
 using Robust.Client.ResourceManagement;
+using Robust.Shared.Serialization.TypeSerializers.Implementations;
 using static Robust.Client.GameObjects.SpriteComponent;
-using static Robust.Shared.GameObjects.SharedSpriteComponent;
 
 namespace Content.Client.Clothing;
 
@@ -131,7 +131,7 @@ public sealed class ClientClothingSystem : ClothingSystem
         RSI? rsi = null;
 
         if (clothing.RsiPath != null)
-            rsi = _cache.GetResource<RSIResource>(TextureRoot / clothing.RsiPath).RSI;
+            rsi = _cache.GetResource<RSIResource>(SpriteSpecifierSerializer.TextureRoot / clothing.RsiPath).RSI;
         else if (TryComp(uid, out SpriteComponent? sprite))
             rsi = sprite.BaseRSI;
 
index c77412ac65f5557d3f393ada106074e570c61e98..41680e4619713d662c2e953f4a78b13c5a23e605 100644 (file)
@@ -4,8 +4,8 @@ using Robust.Client.Animations;
 using Robust.Client.GameObjects;
 using Robust.Client.ResourceManagement;
 using Robust.Shared.Audio;
-using Robust.Shared.GameObjects;
 using Robust.Shared.Player;
+using Robust.Shared.Serialization.TypeSerializers.Implementations;
 using Robust.Shared.Timing;
 
 namespace Content.Client.Doors;
@@ -80,7 +80,7 @@ public sealed class DoorSystem : SharedDoorSystem
 
         if (AppearanceSystem.TryGetData<string>(uid, DoorVisuals.BaseRSI, out var baseRsi, args.Component))
         {
-            if (!_resourceCache.TryGetResource<RSIResource>(SharedSpriteComponent.TextureRoot / baseRsi, out var res))
+            if (!_resourceCache.TryGetResource<RSIResource>(SpriteSpecifierSerializer.TextureRoot / baseRsi, out var res))
             {
                 Logger.Error("Unable to load RSI '{0}'. Trace:\n{1}", baseRsi, Environment.StackTrace);
             }
@@ -89,7 +89,7 @@ public sealed class DoorSystem : SharedDoorSystem
                 layer.Rsi = res?.RSI;
             }
         }
-        
+
         TryComp<AnimationPlayerComponent>(uid, out var animPlayer);
         if (_animationSystem.HasRunningAnimation(uid, animPlayer, DoorComponent.AnimationKey))
             _animationSystem.Stop(uid, animPlayer, DoorComponent.AnimationKey); // Halt all running anomations.
index cfe7bd6fb96dfd087ecab5d2e115fdef95d07550..7ddc7d6c6d22a545ba1c06459ce5aebdda3e4c16 100644 (file)
@@ -1,12 +1,12 @@
 using System.Diagnostics.CodeAnalysis;
 using System.Linq;
 using Content.Shared.Hands;
+using Content.Shared.Inventory.Events;
 using Content.Shared.Item;
 using Robust.Client.GameObjects;
 using Robust.Client.Graphics;
 using Robust.Client.ResourceManagement;
-using Robust.Shared.Containers;
-using static Robust.Shared.GameObjects.SharedSpriteComponent;
+using Robust.Shared.Serialization.TypeSerializers.Implementations;
 
 namespace Content.Client.Items.Systems;
 
@@ -19,6 +19,20 @@ public sealed class ItemSystem : SharedItemSystem
         base.Initialize();
 
         SubscribeLocalEvent<ItemComponent, GetInhandVisualsEvent>(OnGetVisuals);
+
+        // TODO is this still needed? Shouldn't containers occlude them?
+        SubscribeLocalEvent<SpriteComponent, GotEquippedEvent>(OnEquipped);
+        SubscribeLocalEvent<SpriteComponent, GotUnequippedEvent>(OnUnequipped);
+    }
+
+    private void OnUnequipped(EntityUid uid, SpriteComponent component, GotUnequippedEvent args)
+    {
+        component.Visible = true;
+    }
+
+    private void OnEquipped(EntityUid uid, SpriteComponent component, GotEquippedEvent args)
+    {
+        component.Visible = false;
     }
 
     #region InhandVisuals
@@ -75,7 +89,7 @@ public sealed class ItemSystem : SharedItemSystem
         RSI? rsi = null;
 
         if (item.RsiPath != null)
-            rsi = _resCache.GetResource<RSIResource>(TextureRoot / item.RsiPath).RSI;
+            rsi = _resCache.GetResource<RSIResource>(SpriteSpecifierSerializer.TextureRoot / item.RsiPath).RSI;
         else if (TryComp(uid, out SpriteComponent? sprite))
             rsi = sprite.BaseRSI;
 
index 58ec08f2b8fc29f62e59fdb8c4a4a285c874692e..6c7c3c256ded88f2f34fa2b48c407b7a7bfe9189 100644 (file)
@@ -1,5 +1,4 @@
 using Content.Shared.Hands.Components;
-using static Robust.Shared.GameObjects.SharedSpriteComponent;
 
 namespace Content.Client.Toggleable;
 
index c6175a722d0fd64910b2a7a46a00e52e7082b80c..e46ff81b5ae9493218d3f32b5d9fd430d0208160 100644 (file)
@@ -73,7 +73,7 @@ namespace Content.MapRenderer.Painters
 
             foreach (var entity in _sEntityManager.GetEntities())
             {
-                if (!_sEntityManager.HasComponent<SharedSpriteComponent>(entity))
+                if (!_sEntityManager.HasComponent<SpriteComponent>(entity))
                 {
                     continue;
                 }
index 84603eb385ddda801e21935f8fe9ff7814e2f902..639212dd4d94f7f111780bd8811e2bcc47576cbe 100644 (file)
@@ -1,4 +1,3 @@
-using static Robust.Shared.GameObjects.SharedSpriteComponent;
 
 namespace Content.Shared.Clothing;
 
index e79bee3b5459b47b4f782059efbc3f13c98d5fb2..3f6925fd24c2aa15e50c93e5c55004dbed5fd67e 100644 (file)
@@ -16,7 +16,7 @@ public sealed class ClothingComponent : Component
 {
     [DataField("clothingVisuals")]
     [Access(typeof(ClothingSystem), typeof(InventorySystem), Other = AccessPermissions.ReadExecute)] // TODO remove execute permissions.
-    public Dictionary<string, List<SharedSpriteComponent.PrototypeLayerData>> ClothingVisuals = new();
+    public Dictionary<string, List<PrototypeLayerData>> ClothingVisuals = new();
 
     [ViewVariables(VVAccess.ReadWrite)]
     [DataField("quickEquip")]
index 29f4b2cad858c4973e25b1259076a3e579e79d6c..325601d9a0eb0cc63e08345706cb6c346896450b 100644 (file)
@@ -2,8 +2,6 @@ using Content.Shared.Hands.Components;
 using JetBrains.Annotations;
 using Robust.Shared.Map;
 using Robust.Shared.Serialization;
-using static Robust.Shared.GameObjects.SharedSpriteComponent;
-
 
 namespace Content.Shared.Hands
 {
index 7540901d88d043367b403e2db24c908e779462f2..58aae4f44648284911320b75efa7c53b3863556c 100644 (file)
@@ -20,7 +20,7 @@ public sealed class ItemComponent : Component
 
     [Access(typeof(SharedItemSystem))]
     [DataField("inhandVisuals")]
-    public Dictionary<HandLocation, List<SharedSpriteComponent.PrototypeLayerData>> InhandVisuals = new();
+    public Dictionary<HandLocation, List<PrototypeLayerData>> InhandVisuals = new();
 
     [Access(typeof(SharedItemSystem))]
     [ViewVariables(VVAccess.ReadWrite)]
index 229a25bffd57c65fb3ee701fdb64e275bdb7ec79..963cf95f732957b9a0b7ad4d2ce1016aa9942da9 100644 (file)
@@ -19,9 +19,6 @@ public abstract class SharedItemSystem : EntitySystem
     {
         base.Initialize();
         SubscribeLocalEvent<ItemComponent, GetVerbsEvent<InteractionVerb>>(AddPickupVerb);
-
-        SubscribeLocalEvent<SharedSpriteComponent, GotEquippedEvent>(OnEquipped);
-        SubscribeLocalEvent<SharedSpriteComponent, GotUnequippedEvent>(OnUnequipped);
         SubscribeLocalEvent<ItemComponent, InteractHandEvent>(OnHandInteract);
 
         SubscribeLocalEvent<ItemComponent, ComponentGetState>(OnGetState);
@@ -92,21 +89,6 @@ public abstract class SharedItemSystem : EntitySystem
         args.State = new ItemComponentState(component.Size, component.HeldPrefix);
     }
 
-    // Although netsync is being set to false for items client can still update these
-    // Realistically:
-    // Container should already hide these
-    // Client is the only thing that matters.
-
-    private void OnUnequipped(EntityUid uid, SharedSpriteComponent component, GotUnequippedEvent args)
-    {
-        component.Visible = true;
-    }
-
-    private void OnEquipped(EntityUid uid, SharedSpriteComponent component, GotEquippedEvent args)
-    {
-        component.Visible = false;
-    }
-
     private void AddPickupVerb(EntityUid uid, ItemComponent component, GetVerbsEvent<InteractionVerb> args)
     {
         if (args.Hands == null ||