From: Tom Leys Date: Sat, 6 May 2023 05:54:36 +0000 (+1200) Subject: Fix firelock lights for hot / pressurized rooms (#15892) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=79eeefd8131de26d2fcf250acdeffc407b856204;p=space-station-14.git Fix firelock lights for hot / pressurized rooms (#15892) --- diff --git a/Content.Client/Doors/FirelockSystem.cs b/Content.Client/Doors/FirelockSystem.cs new file mode 100644 index 0000000000..a06f3b8ff1 --- /dev/null +++ b/Content.Client/Doors/FirelockSystem.cs @@ -0,0 +1,27 @@ +using Content.Shared.Doors.Components; +using Robust.Client.GameObjects; + +namespace Content.Client.Doors; + +public sealed class FirelockSystem : EntitySystem +{ + [Dependency] protected readonly SharedAppearanceSystem AppearanceSystem = default!; + + public override void Initialize() + { + base.Initialize(); + SubscribeLocalEvent(OnAppearanceChange); + } + + private void OnAppearanceChange(EntityUid uid, FirelockComponent comp, ref AppearanceChangeEvent args) + { + if (args.Sprite == null) + return; + + // Apply the closed lights bool to the sprite + bool unlitVisible = + (AppearanceSystem.TryGetData(uid, DoorVisuals.ClosedLights, out var closedLights, args.Component) && + closedLights); + args.Sprite.LayerSetVisible(DoorVisualLayers.BaseUnlit, unlitVisible); + } +} diff --git a/Content.IntegrationTests/Tests/Doors/AirlockTest.cs b/Content.IntegrationTests/Tests/Doors/AirlockTest.cs index dd74105ca3..02c031af1f 100644 --- a/Content.IntegrationTests/Tests/Doors/AirlockTest.cs +++ b/Content.IntegrationTests/Tests/Doors/AirlockTest.cs @@ -1,6 +1,5 @@ using System; using System.Threading.Tasks; -using Content.Server.Doors.Components; using Content.Server.Doors.Systems; using Content.Shared.Doors.Components; using NUnit.Framework; diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs index ae614574f5..9877e7add9 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs @@ -1,6 +1,6 @@ using Content.Server.Atmos.Components; -using Content.Server.Doors.Components; using Content.Server.Doors.Systems; +using Content.Shared.Doors.Components; using Content.Shared.Atmos; using Content.Shared.Atmos.Components; using Content.Shared.Database; diff --git a/Content.Server/Construction/Conditions/AirlockBolted.cs b/Content.Server/Construction/Conditions/AirlockBolted.cs index 8ba908fef3..06a60118b9 100644 --- a/Content.Server/Construction/Conditions/AirlockBolted.cs +++ b/Content.Server/Construction/Conditions/AirlockBolted.cs @@ -1,6 +1,5 @@ using Content.Shared.Construction; using JetBrains.Annotations; -using Content.Server.Doors.Components; using Content.Shared.Doors.Components; using Content.Shared.Examine; diff --git a/Content.Server/Doors/Systems/FirelockSystem.cs b/Content.Server/Doors/Systems/FirelockSystem.cs index c23745423f..df89680b69 100644 --- a/Content.Server/Doors/Systems/FirelockSystem.cs +++ b/Content.Server/Doors/Systems/FirelockSystem.cs @@ -1,7 +1,6 @@ using Content.Server.Atmos.Components; using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.Monitor.Systems; -using Content.Server.Doors.Components; using Content.Server.Popups; using Content.Server.Power.Components; using Content.Server.Power.EntitySystems; @@ -161,13 +160,13 @@ namespace Content.Server.Doors.Systems { var ev = new BeforeDoorAutoCloseEvent(); RaiseLocalEvent(uid, ev); + UpdateVisuals(uid, component, args); if (ev.Cancelled) { return; } _doorSystem.SetNextStateChange(uid, component.AutocloseDelay); - UpdateVisuals(uid, component, args); } private void OnBeforeDoorAutoclose(EntityUid uid, FirelockComponent component, BeforeDoorAutoCloseEvent args) diff --git a/Content.Server/Doors/WireActions/DoorSafetyWireAction.cs b/Content.Server/Doors/WireActions/DoorSafetyWireAction.cs index 8d02d923fe..939d617de5 100644 --- a/Content.Server/Doors/WireActions/DoorSafetyWireAction.cs +++ b/Content.Server/Doors/WireActions/DoorSafetyWireAction.cs @@ -1,4 +1,3 @@ -using Content.Server.Doors.Components; using Content.Server.Wires; using Content.Shared.Doors; using Content.Shared.Doors.Components; @@ -11,7 +10,7 @@ public sealed class DoorSafetyWireAction : ComponentWireAction { public override Color Color { get; set; } = Color.Red; public override string Name { get; set; } = "wire-name-door-safety"; - + [DataField("timeout")] private int _timeout = 30; diff --git a/Content.Server/Doors/WireActions/DoorTimingWireAction.cs b/Content.Server/Doors/WireActions/DoorTimingWireAction.cs index 1539575590..1f576342f0 100644 --- a/Content.Server/Doors/WireActions/DoorTimingWireAction.cs +++ b/Content.Server/Doors/WireActions/DoorTimingWireAction.cs @@ -1,4 +1,3 @@ -using Content.Server.Doors.Components; using Content.Server.Wires; using Content.Shared.Doors; using Content.Shared.Doors.Components; @@ -11,7 +10,7 @@ public sealed class DoorTimingWireAction : ComponentWireAction { public override Color Color { get; set; } = Color.Orange; public override string Name { get; set; } = "wire-name-door-timer"; - + [DataField("timeout")] private int _timeout = 30; diff --git a/Content.Server/Remotes/DoorRemoteSystem.cs b/Content.Server/Remotes/DoorRemoteSystem.cs index 2f93ad08d2..bbc84eec6e 100644 --- a/Content.Server/Remotes/DoorRemoteSystem.cs +++ b/Content.Server/Remotes/DoorRemoteSystem.cs @@ -7,7 +7,6 @@ using Content.Shared.Doors.Systems; using Content.Shared.Physics; using Content.Shared.Access.Components; using Content.Server.Doors.Systems; -using Content.Server.Doors.Components; using Content.Server.Power.EntitySystems; using Content.Shared.Database; using Content.Shared.Interaction.Events; diff --git a/Content.Server/Doors/Components/FirelockComponent.cs b/Content.Shared/Doors/Components/FirelockComponent.cs similarity index 95% rename from Content.Server/Doors/Components/FirelockComponent.cs rename to Content.Shared/Doors/Components/FirelockComponent.cs index 249a413023..ceef5964a3 100644 --- a/Content.Server/Doors/Components/FirelockComponent.cs +++ b/Content.Shared/Doors/Components/FirelockComponent.cs @@ -1,7 +1,6 @@ -using Content.Server.Atmos.Monitor.Components; using Content.Shared.Doors.Components; -namespace Content.Server.Doors.Components +namespace Content.Shared.Doors.Components { /// /// Companion component to that handles firelock-specific behavior, including