Fix bug with pipe color (#30645)

Co-authored-by: ArtisticRoomba <145879011+ArtisticRoomba@users.noreply.github.com>
This commit is contained in:
IgorAnt028
2025-07-20 01:10:38 +03:00
committed by GitHub
parent f21803bfd8
commit 41a175636b
7 changed files with 105 additions and 59 deletions

View File

@@ -0,0 +1,36 @@
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);
}
}