]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Revert "Fix bug with pipe color" (#39135)
authorArtisticRoomba <145879011+ArtisticRoomba@users.noreply.github.com>
Mon, 4 Aug 2025 20:10:54 +0000 (13:10 -0700)
committerGitHub <noreply@github.com>
Mon, 4 Aug 2025 20:10:54 +0000 (13:10 -0700)
Content.Client/Atmos/EntitySystems/PipeColorVisualizerSystem.cs
Content.Client/UserInterface/Systems/Storage/Controls/ItemGridPiece.cs
Content.Server/Atmos/Piping/Components/AtmosPipeColorComponent.cs [moved from Content.Shared/Atmos/Components/AtmosPipeColorComponent.cs with 63% similarity]
Content.Server/Atmos/Piping/EntitySystems/AtmosPipeColorSystem.cs [new file with mode: 0644]
Content.Server/Sandbox/Commands/ColorNetworkCommand.cs
Content.Server/SprayPainter/SprayPainterSystem.cs
Content.Shared/Atmos/EntitySystems/AtmosPipeColorSystem.cs [deleted file]

index b23a44e403d0040e0f6c90e1357350e5643f0b3c..5595f441f76882c6a8c61a9475f19fc77200c4a1 100644 (file)
@@ -1,46 +1,11 @@
 using Content.Client.Atmos.Components;
 using Robust.Client.GameObjects;
-using Content.Client.UserInterface.Systems.Storage.Controls;
 using Content.Shared.Atmos.Piping;
-using Content.Shared.Hands;
-using Content.Shared.Atmos.Components;
-using Content.Shared.Item;
 
 namespace Content.Client.Atmos.EntitySystems;
 
 public sealed class PipeColorVisualizerSystem : VisualizerSystem<PipeColorVisualsComponent>
 {
-    [Dependency] private readonly SharedItemSystem _itemSystem = default!;
-
-    public override void Initialize()
-    {
-        base.Initialize();
-
-        SubscribeLocalEvent<PipeColorVisualsComponent, GetInhandVisualsEvent>(OnGetVisuals);
-        SubscribeLocalEvent<PipeColorVisualsComponent, BeforeRenderInGridEvent>(OnDrawInGrid);
-    }
-
-    /// <summary>
-    ///     This method is used to display the color changes of the pipe on the screen..
-    /// </summary>
-    private void OnGetVisuals(Entity<PipeColorVisualsComponent> item, ref GetInhandVisualsEvent args)
-    {
-        foreach (var (_, layerData) in args.Layers)
-        {
-            if (TryComp(item.Owner, out AtmosPipeColorComponent? pipeColor))
-                layerData.Color = pipeColor.Color;
-        }
-    }
-
-    /// <summary>
-    ///     This method is used to change the pipe's color in a container grid.
-    /// </summary>
-    private void OnDrawInGrid(Entity<PipeColorVisualsComponent> item, ref BeforeRenderInGridEvent args)
-    {
-        if (TryComp(item.Owner, out AtmosPipeColorComponent? pipeColor))
-            args.Color = pipeColor.Color;
-    }
-
     protected override void OnAppearanceChange(EntityUid uid, PipeColorVisualsComponent component, ref AppearanceChangeEvent args)
     {
         if (TryComp<SpriteComponent>(uid, out var sprite)
@@ -50,8 +15,6 @@ public sealed class PipeColorVisualizerSystem : VisualizerSystem<PipeColorVisual
             var layer = sprite[PipeVisualLayers.Pipe];
             layer.Color = color.WithAlpha(layer.Color.A);
         }
-
-        _itemSystem.VisualsChanged(uid);
     }
 }
 
index 60c74939f6f73d5609f261375f84fafc3f813950..d07db112c8abaa599c0504580f6b5ca386d1e01e 100644 (file)
@@ -185,12 +185,7 @@ public sealed class ItemGridPiece : Control, IEntityControl
 
             handle.SetTransform(pos, iconRotation);
             var box = new UIBox2(root, root + sprite.Size * scale);
-
-            var ev = new BeforeRenderInGridEvent(new Color(255, 255, 255));
-            _entityManager.EventBus.RaiseLocalEvent(Entity, ev);
-
-            handle.DrawTextureRect(sprite, box, ev.Color);
-
+            handle.DrawTextureRect(sprite, box);
             handle.SetTransform(GlobalPixelPosition, Angle.Zero);
         }
         else
@@ -303,19 +298,6 @@ public sealed class ItemGridPiece : Control, IEntityControl
     public EntityUid? UiEntity => Entity;
 }
 
-/// <summary>
-///     This event gets raised before a sprite gets drawn in a grid and lets to change the sprite color for several gameobjects that have special sprites to render in containers.
-/// </summary>
-public sealed class BeforeRenderInGridEvent : EntityEventArgs
-{
-    public Color Color { get; set; }
-
-    public BeforeRenderInGridEvent(Color color)
-    {
-        Color = color;
-    }
-}
-
 public enum ItemGridPieceMarks
 {
     First,
similarity index 63%
rename from Content.Shared/Atmos/Components/AtmosPipeColorComponent.cs
rename to Content.Server/Atmos/Piping/Components/AtmosPipeColorComponent.cs
index ee8e55491f3794b001ef908b7c29888b851ab1c2..a8edb07d31880abc84c9c0fbf81ae86c65773ccb 100644 (file)
@@ -1,22 +1,19 @@
-using Content.Shared.Atmos.EntitySystems;
-using Robust.Shared.GameStates;
+using Content.Server.Atmos.Piping.EntitySystems;
 using JetBrains.Annotations;
 
-namespace Content.Shared.Atmos.Components;
+namespace Content.Server.Atmos.Piping.Components;
 
-[RegisterComponent, NetworkedComponent]
-[AutoGenerateComponentState]
+[RegisterComponent]
 public sealed partial class AtmosPipeColorComponent : Component
 {
     [DataField]
-    [AutoNetworkedField]
     public Color Color { get; set; } = Color.White;
 
     [ViewVariables(VVAccess.ReadWrite), UsedImplicitly]
     public Color ColorVV
     {
         get => Color;
-        set => IoCManager.Resolve<IEntityManager>().System<AtmosPipeColorSystem>().SetColor((Owner, this), value);
+        set => IoCManager.Resolve<IEntityManager>().System<AtmosPipeColorSystem>().SetColor(Owner, this, value);
     }
 }
 
diff --git a/Content.Server/Atmos/Piping/EntitySystems/AtmosPipeColorSystem.cs b/Content.Server/Atmos/Piping/EntitySystems/AtmosPipeColorSystem.cs
new file mode 100644 (file)
index 0000000..91f7046
--- /dev/null
@@ -0,0 +1,48 @@
+using Content.Server.Atmos.Piping.Components;
+using Content.Shared.Atmos.Piping;
+using Robust.Server.GameObjects;
+
+namespace Content.Server.Atmos.Piping.EntitySystems
+{
+    public sealed class AtmosPipeColorSystem : EntitySystem
+    {
+        [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
+
+        public override void Initialize()
+        {
+            base.Initialize();
+
+            SubscribeLocalEvent<AtmosPipeColorComponent, ComponentStartup>(OnStartup);
+            SubscribeLocalEvent<AtmosPipeColorComponent, ComponentShutdown>(OnShutdown);
+        }
+
+        private void OnStartup(EntityUid uid, AtmosPipeColorComponent component, ComponentStartup args)
+        {
+            if (!TryComp(uid, out AppearanceComponent? appearance))
+                return;
+
+            _appearance.SetData(uid, PipeColorVisuals.Color, component.Color, appearance);
+        }
+
+        private void OnShutdown(EntityUid uid, AtmosPipeColorComponent component, ComponentShutdown args)
+        {
+            if (!TryComp(uid, out AppearanceComponent? appearance))
+                return;
+
+            _appearance.SetData(uid, PipeColorVisuals.Color, Color.White, appearance);
+        }
+
+        public void SetColor(EntityUid uid, AtmosPipeColorComponent component, Color color)
+        {
+            component.Color = color;
+
+            if (!TryComp(uid, out AppearanceComponent? appearance))
+                return;
+
+            _appearance.SetData(uid, PipeColorVisuals.Color, color, appearance);
+
+            var ev = new AtmosPipeColorChangedEvent(color);
+            RaiseLocalEvent(uid, ref ev);
+        }
+    }
+}
index 89c1182eaef7f9a89f4da5cab91530e7132f19b3..8237ccb2eb74845a2024ea6d5842eb77f41a2e78 100644 (file)
@@ -1,6 +1,6 @@
 using Content.Server.Administration.Managers;
-using Content.Shared.Atmos.Components;
-using Content.Shared.Atmos.EntitySystems;
+using Content.Server.Atmos.Piping.Components;
+using Content.Server.Atmos.Piping.EntitySystems;
 using Content.Shared.Administration;
 using Content.Shared.NodeContainer;
 using Content.Shared.NodeContainer.NodeGroups;
@@ -78,7 +78,7 @@ namespace Content.Server.Sandbox.Commands
                 if (!EntityManager.TryGetComponent(x.Owner, out AtmosPipeColorComponent? atmosPipeColorComponent))
                     continue;
 
-                _pipeColorSystem.SetColor((x.Owner, atmosPipeColorComponent), color);
+                _pipeColorSystem.SetColor(x.Owner, atmosPipeColorComponent, color);
             }
         }
     }
index a5e08a91a6fdbe2b43e05fac5a2dde05770c69a0..24ab5e0ea2903497afc145f1ff587cbc6836c168 100644 (file)
@@ -1,5 +1,5 @@
-using Content.Shared.Atmos.Components;
-using Content.Shared.Atmos.EntitySystems;
+using Content.Server.Atmos.Piping.Components;
+using Content.Server.Atmos.Piping.EntitySystems;
 using Content.Server.Charges;
 using Content.Server.Decals;
 using Content.Server.Destructible;
@@ -147,7 +147,7 @@ public sealed class SprayPainterSystem : SharedSprayPainterSystem
             return;
 
         Audio.PlayPvs(ent.Comp.SpraySound, ent);
-        _pipeColor.SetColor((target, color), args.Color);
+        _pipeColor.SetColor(target, color, args.Color);
 
         args.Handled = true;
     }
diff --git a/Content.Shared/Atmos/EntitySystems/AtmosPipeColorSystem.cs b/Content.Shared/Atmos/EntitySystems/AtmosPipeColorSystem.cs
deleted file mode 100644 (file)
index 548136f..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-using Content.Shared.Atmos.Components;
-using Content.Shared.Atmos.Piping;
-
-namespace Content.Shared.Atmos.EntitySystems;
-
-public sealed class AtmosPipeColorSystem : EntitySystem
-{
-
-    [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
-
-    public override void Initialize()
-    {
-        base.Initialize();
-
-        SubscribeLocalEvent<AtmosPipeColorComponent, ComponentStartup>(OnStartup);
-        SubscribeLocalEvent<AtmosPipeColorComponent, ComponentShutdown>(OnShutdown);
-    }
-
-    private void OnStartup(Entity<AtmosPipeColorComponent> item, ref ComponentStartup args)
-    {
-        _appearance.SetData(item.Owner, PipeColorVisuals.Color, item.Comp.Color);
-    }
-
-    private void OnShutdown(Entity<AtmosPipeColorComponent> item, ref ComponentShutdown args)
-    {
-        _appearance.SetData(item.Owner, PipeColorVisuals.Color, Color.White);
-    }
-
-    public void SetColor(Entity<AtmosPipeColorComponent> item, Color color)
-    {
-        item.Comp.Color = color;
-        _appearance.SetData(item.Owner, PipeColorVisuals.Color, color);
-        Dirty(item);
-    }
-}
-