Fix firelock lights for hot / pressurized rooms (#15892)

This commit is contained in:
Tom Leys
2023-05-06 17:54:36 +12:00
committed by GitHub
parent eaa83ae113
commit 79eeefd813
9 changed files with 32 additions and 12 deletions

View File

@@ -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<FirelockComponent, AppearanceChangeEvent>(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<bool>(uid, DoorVisuals.ClosedLights, out var closedLights, args.Component) &&
closedLights);
args.Sprite.LayerSetVisible(DoorVisualLayers.BaseUnlit, unlitVisible);
}
}