]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Convert ReinforcedWallVisualizer to ECS (#15735)
authorBixkitts <72874643+Bixkitts@users.noreply.github.com>
Mon, 1 May 2023 19:39:11 +0000 (20:39 +0100)
committerGitHub <noreply@github.com>
Mon, 1 May 2023 19:39:11 +0000 (15:39 -0400)
Content.Client/Wall/ReinforcedWallVisualizer.cs [deleted file]
Content.Client/Wall/ReinforcedWallVisuals.cs [new file with mode: 0644]
Resources/Prototypes/Entities/Structures/Walls/walls.yml

diff --git a/Content.Client/Wall/ReinforcedWallVisualizer.cs b/Content.Client/Wall/ReinforcedWallVisualizer.cs
deleted file mode 100644 (file)
index 37c4419..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-using Content.Shared.Wall;
-using JetBrains.Annotations;
-using Robust.Client.GameObjects;
-using Robust.Shared.GameObjects;
-using Robust.Shared.IoC;
-
-namespace Content.Client.Wall
-{
-    [UsedImplicitly]
-    public sealed class ReinforcedWallVisualizer : AppearanceVisualizer
-    {
-        [Obsolete("Subscribe to AppearanceChangeEvent instead.")]
-        public override void OnChangeData(AppearanceComponent component)
-        {
-            base.OnChangeData(component);
-
-            if (component.TryGetData(ReinforcedWallVisuals.DeconstructionStage, out int stage))
-            {
-                SetDeconstructionStage(component, stage);
-            }
-        }
-
-        public void SetDeconstructionStage(AppearanceComponent component, int stage)
-        {
-            var entity = component.Owner;
-
-            var entities = IoCManager.Resolve<IEntityManager>();
-            if (!entities.TryGetComponent(entity, out SpriteComponent? sprite)) return;
-
-            var index = sprite.LayerMapReserveBlank(ReinforcedWallVisualLayers.Deconstruction);
-
-            if (stage < 0)
-            {
-                sprite.LayerSetVisible(index, false);
-                return;
-            }
-
-            sprite.LayerSetVisible(index, true);
-            sprite.LayerSetState(index, $"reinf_construct-{stage}");
-        }
-    }
-
-    public enum ReinforcedWallVisualLayers : byte
-    {
-        Deconstruction,
-    }
-}
diff --git a/Content.Client/Wall/ReinforcedWallVisuals.cs b/Content.Client/Wall/ReinforcedWallVisuals.cs
new file mode 100644 (file)
index 0000000..355ecc8
--- /dev/null
@@ -0,0 +1,6 @@
+namespace Content.Client.Wall;
+
+public enum ReinforcedWallVisualLayers : byte
+{
+    Deconstruction,
+}
index 7270c80e5bb0d49245565dac09637fc418a3a762..61c3a70ff22af20b7d802a8d79f8b8b4497ee2cd 100644 (file)
     key: walls
     base: reinf_over
   - type: Appearance
+  - type: GenericVisualizer
     visuals:
-      - type: ReinforcedWallVisualizer
+      enum.ReinforcedWallVisuals.DeconstructionStage:
+        ReinforcedWallVisualLayers.Deconstruction:
+          -1: { visible: false }
+          0: { state: reinf_construct-0, visible: true}
+          1: { state: reinf_construct-1, visible: true}
+          2: { state: reinf_construct-2, visible: true}
+          3: { state: reinf_construct-3, visible: true}
+          4: { state: reinf_construct-4, visible: true}
+          5: { state: reinf_construct-5, visible: true}
   - type: StaticPrice
     price: 150
   - type: RadiationBlocker