diff --git a/Content.Client/GameObjects/Components/Doors/AirlockVisualizer2D.cs b/Content.Client/GameObjects/Components/Doors/AirlockVisualizer2D.cs index a565f07207..144ef90367 100644 --- a/Content.Client/GameObjects/Components/Doors/AirlockVisualizer2D.cs +++ b/Content.Client/GameObjects/Components/Doors/AirlockVisualizer2D.cs @@ -90,22 +90,20 @@ namespace Content.Client.GameObjects.Components.Doors state = DoorVisualState.Closed; } + var unlitVisible = true; switch (state) { case DoorVisualState.Closed: sprite.LayerSetState(DoorVisualLayers.Base, "closed"); sprite.LayerSetState(DoorVisualLayers.BaseUnlit, "closed_unlit"); - sprite.LayerSetVisible(DoorVisualLayers.BaseUnlit, true); break; case DoorVisualState.Closing: - sprite.LayerSetVisible(DoorVisualLayers.BaseUnlit, true); if (!animPlayer.HasRunningAnimation(AnimationKey)) { animPlayer.Play(CloseAnimation, AnimationKey); } break; case DoorVisualState.Opening: - sprite.LayerSetVisible(DoorVisualLayers.BaseUnlit, true); if (!animPlayer.HasRunningAnimation(AnimationKey)) { animPlayer.Play(OpenAnimation, AnimationKey); @@ -114,10 +112,10 @@ namespace Content.Client.GameObjects.Components.Doors break; case DoorVisualState.Open: sprite.LayerSetState(DoorVisualLayers.Base, "open"); - sprite.LayerSetVisible(DoorVisualLayers.BaseUnlit, false); + unlitVisible = false; break; case DoorVisualState.Deny: - sprite.LayerSetVisible(DoorVisualLayers.BaseUnlit, false); + unlitVisible = false; if (!animPlayer.HasRunningAnimation(AnimationKey)) { animPlayer.Play(DenyAnimation, AnimationKey); @@ -126,6 +124,13 @@ namespace Content.Client.GameObjects.Components.Doors default: throw new ArgumentOutOfRangeException(); } + + if (component.TryGetData(DoorVisuals.Powered, out bool powered) && !powered) + { + unlitVisible = false; + } + + sprite.LayerSetVisible(DoorVisualLayers.BaseUnlit, unlitVisible); } } diff --git a/Content.Server/GameObjects/Components/Doors/AirlockComponent.cs b/Content.Server/GameObjects/Components/Doors/AirlockComponent.cs index 7e7839c630..400ac3f4a9 100644 --- a/Content.Server/GameObjects/Components/Doors/AirlockComponent.cs +++ b/Content.Server/GameObjects/Components/Doors/AirlockComponent.cs @@ -4,6 +4,8 @@ using Content.Server.GameObjects.Components.Interactable.Tools; using Content.Server.GameObjects.Components.Power; using Content.Server.GameObjects.Components.VendingMachines; using Content.Server.GameObjects.EntitySystems; +using Content.Shared.GameObjects.Components.Doors; +using Robust.Server.GameObjects; using Robust.Server.Interfaces.GameObjects; using Robust.Shared.GameObjects; using Robust.Shared.IoC; @@ -77,6 +79,16 @@ namespace Content.Server.GameObjects.Components.Doors base.Initialize(); _powerDevice = Owner.GetComponent(); _wires = Owner.GetComponent(); + + _powerDevice.OnPowerStateChanged += PowerDeviceOnOnPowerStateChanged; + } + + private void PowerDeviceOnOnPowerStateChanged(object sender, PowerStateEventArgs e) + { + if (Owner.TryGetComponent(out AppearanceComponent appearance)) + { + appearance.SetData(DoorVisuals.Powered, e.Powered); + } } protected override void ActivateImpl(ActivateEventArgs args) diff --git a/Content.Shared/GameObjects/Components/Doors/SharedDoorComponent.cs b/Content.Shared/GameObjects/Components/Doors/SharedDoorComponent.cs index 0a50523380..12c95c1a7d 100644 --- a/Content.Shared/GameObjects/Components/Doors/SharedDoorComponent.cs +++ b/Content.Shared/GameObjects/Components/Doors/SharedDoorComponent.cs @@ -8,6 +8,7 @@ namespace Content.Shared.GameObjects.Components.Doors public enum DoorVisuals { VisualState, + Powered } [NetSerializable]