Skip to content

Commit

Permalink
Fix firelock lights for hot / pressurized rooms (#15892)
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-leys authored and Vordenburg committed May 8, 2023
1 parent 850e960 commit 101a03f
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 12 deletions.
27 changes: 27 additions & 0 deletions Content.Client/Doors/FirelockSystem.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}
1 change: 0 additions & 1 deletion Content.IntegrationTests/Tests/Doors/AirlockTest.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
1 change: 0 additions & 1 deletion Content.Server/Construction/Conditions/AirlockBolted.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
3 changes: 1 addition & 2 deletions Content.Server/Doors/Systems/FirelockSystem.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -161,13 +160,13 @@ private void OnUpdateState(EntityUid uid, FirelockComponent component, DoorState
{
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)
Expand Down
3 changes: 1 addition & 2 deletions Content.Server/Doors/WireActions/DoorSafetyWireAction.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Content.Server.Doors.Components;
using Content.Server.Wires;
using Content.Shared.Doors;
using Content.Shared.Doors.Components;
Expand All @@ -11,7 +10,7 @@ public sealed class DoorSafetyWireAction : ComponentWireAction<AirlockComponent>
{
public override Color Color { get; set; } = Color.Red;
public override string Name { get; set; } = "wire-name-door-safety";


[DataField("timeout")]
private int _timeout = 30;
Expand Down
3 changes: 1 addition & 2 deletions Content.Server/Doors/WireActions/DoorTimingWireAction.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Content.Server.Doors.Components;
using Content.Server.Wires;
using Content.Shared.Doors;
using Content.Shared.Doors.Components;
Expand All @@ -11,7 +10,7 @@ public sealed class DoorTimingWireAction : ComponentWireAction<AirlockComponent>
{
public override Color Color { get; set; } = Color.Orange;
public override string Name { get; set; } = "wire-name-door-timer";

[DataField("timeout")]
private int _timeout = 30;

Expand Down
1 change: 0 additions & 1 deletion Content.Server/Remotes/DoorRemoteSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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
{
/// <summary>
/// Companion component to <see cref="DoorComponent"/> that handles firelock-specific behavior, including
Expand Down

0 comments on commit 101a03f

Please sign in to comment.