From 117c4cbed1d612df302124d91605f6f780537d89 Mon Sep 17 00:00:00 2001 From: Remuchi Date: Sat, 27 Jan 2024 19:09:42 +0700 Subject: [PATCH] =?UTF-8?q?fix:=20=D1=84=D0=B8=D0=BA=D1=81=20=D1=81=D0=B2?= =?UTF-8?q?=D0=B5=D1=82=D0=B0=20=D0=B4=D0=B2=D0=B5=D1=80=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Content.Client/Doors/AirlockSystem.cs | 56 +++++++++++-------- .../Doors/Components/AirlockComponent.cs | 4 +- .../Doors/Airlocks/base_structureairlocks.yml | 1 + 3 files changed, 35 insertions(+), 26 deletions(-) diff --git a/Content.Client/Doors/AirlockSystem.cs b/Content.Client/Doors/AirlockSystem.cs index 82d76ed766..a707cb71ff 100644 --- a/Content.Client/Doors/AirlockSystem.cs +++ b/Content.Client/Doors/AirlockSystem.cs @@ -28,35 +28,37 @@ public sealed class AirlockSystem : SharedAirlockSystem private void OnComponentStartup(EntityUid uid, AirlockComponent comp, ComponentStartup args) { // Has to be on component startup because we don't know what order components initialize in and running this before DoorComponent inits _will_ crash. - if(!TryComp(uid, out var door)) + if (!TryComp(uid, out var door)) return; if (comp.OpenUnlitVisible) // Otherwise there are flashes of the fallback sprite between clicking on the door and the door closing animation starting. { door.OpenSpriteStates.Add((DoorVisualLayers.BaseUnlit, comp.OpenSpriteState)); + door.OpenSpriteStates.Add((DoorVisualLayers.BaseBolted, "bolted_open_unlit")); door.ClosedSpriteStates.Add((DoorVisualLayers.BaseUnlit, comp.ClosedSpriteState)); + door.ClosedSpriteStates.Add((DoorVisualLayers.BaseBolted, "bolted_unlit")); } - ((Animation)door.OpeningAnimation).AnimationTracks.Add(new AnimationTrackSpriteFlick() + ((Animation) door.OpeningAnimation).AnimationTracks.Add(new AnimationTrackSpriteFlick { LayerKey = DoorVisualLayers.BaseUnlit, KeyFrames = { new AnimationTrackSpriteFlick.KeyFrame(comp.OpeningSpriteState, 0f) }, } ); - ((Animation)door.ClosingAnimation).AnimationTracks.Add(new AnimationTrackSpriteFlick() + ((Animation) door.ClosingAnimation).AnimationTracks.Add(new AnimationTrackSpriteFlick { LayerKey = DoorVisualLayers.BaseUnlit, KeyFrames = { new AnimationTrackSpriteFlick.KeyFrame(comp.ClosingSpriteState, 0f) }, } ); - door.DenyingAnimation = new Animation() + door.DenyingAnimation = new Animation { Length = TimeSpan.FromSeconds(comp.DenyAnimationTime), AnimationTracks = { - new AnimationTrackSpriteFlick() + new AnimationTrackSpriteFlick { LayerKey = DoorVisualLayers.BaseUnlit, KeyFrames = { new AnimationTrackSpriteFlick.KeyFrame(comp.DenySpriteState, 0f) }, @@ -64,19 +66,19 @@ public sealed class AirlockSystem : SharedAirlockSystem } }; - if(!comp.AnimatePanel) + if (!comp.AnimatePanel) return; - ((Animation)door.OpeningAnimation).AnimationTracks.Add(new AnimationTrackSpriteFlick() + ((Animation) door.OpeningAnimation).AnimationTracks.Add(new AnimationTrackSpriteFlick { LayerKey = WiresVisualLayers.MaintenancePanel, - KeyFrames = {new AnimationTrackSpriteFlick.KeyFrame(comp.OpeningPanelSpriteState, 0f)}, + KeyFrames = { new AnimationTrackSpriteFlick.KeyFrame(comp.OpeningPanelSpriteState, 0f) }, }); - ((Animation)door.ClosingAnimation).AnimationTracks.Add(new AnimationTrackSpriteFlick + ((Animation) door.ClosingAnimation).AnimationTracks.Add(new AnimationTrackSpriteFlick { LayerKey = WiresVisualLayers.MaintenancePanel, - KeyFrames = {new AnimationTrackSpriteFlick.KeyFrame(comp.ClosingPanelSpriteState, 0f)}, + KeyFrames = { new AnimationTrackSpriteFlick.KeyFrame(comp.ClosingPanelSpriteState, 0f) }, }); } @@ -94,18 +96,24 @@ public sealed class AirlockSystem : SharedAirlockSystem if (_appearanceSystem.TryGetData(uid, DoorVisuals.Powered, out var powered, args.Component) && powered) { - boltedVisible = _appearanceSystem.TryGetData(uid, DoorVisuals.BoltLights, out var lights, args.Component) - && lights && (state == DoorState.Closed || state == DoorState.Welded); + boltedVisible = + _appearanceSystem.TryGetData(uid, DoorVisuals.BoltLights, out var lights, args.Component) + && lights && state is DoorState.Closed or DoorState.Welded; + + emergencyLightsVisible = + _appearanceSystem.TryGetData(uid, DoorVisuals.EmergencyLights, out var eaLights, + args.Component) && eaLights; - emergencyLightsVisible = _appearanceSystem.TryGetData(uid, DoorVisuals.EmergencyLights, out var eaLights, args.Component) && eaLights; unlitVisible = - (state == DoorState.Closing - || state == DoorState.Opening - || state == DoorState.Denying - || state == DoorState.Welded - || (state == DoorState.Open && comp.OpenUnlitVisible) - || (_appearanceSystem.TryGetData(uid, DoorVisuals.ClosedLights, out var closedLights, args.Component) && closedLights)) - && !boltedVisible && !emergencyLightsVisible; ; + (state == DoorState.Closing + || state == DoorState.Opening + || state == DoorState.Denying + || state == DoorState.Welded + || state == DoorState.Open && comp.OpenUnlitVisible + || state == DoorState.Closed && comp.OpenUnlitVisible + || _appearanceSystem.TryGetData(uid, DoorVisuals.ClosedLights, out var closedLights, + args.Component) && closedLights) + && !boltedVisible && !emergencyLightsVisible; } args.Sprite.LayerSetVisible(DoorVisualLayers.BaseUnlit, unlitVisible); @@ -114,10 +122,10 @@ public sealed class AirlockSystem : SharedAirlockSystem { args.Sprite.LayerSetVisible( DoorVisualLayers.BaseEmergencyAccess, - emergencyLightsVisible - && state != DoorState.Open - && state != DoorState.Opening - && state != DoorState.Closing + emergencyLightsVisible + && state != DoorState.Open + && state != DoorState.Opening + && state != DoorState.Closing && !boltedVisible ); } diff --git a/Content.Shared/Doors/Components/AirlockComponent.cs b/Content.Shared/Doors/Components/AirlockComponent.cs index 332df2ac77..beae0dd493 100644 --- a/Content.Shared/Doors/Components/AirlockComponent.cs +++ b/Content.Shared/Doors/Components/AirlockComponent.cs @@ -72,8 +72,8 @@ public sealed partial class AirlockComponent : Component /// /// Whether the door lights should be visible. /// - [DataField] - public bool OpenUnlitVisible = false; + [DataField("openUnlitVisible")] + public bool OpenUnlitVisible = true; /// /// Whether the door should display emergency access lights. diff --git a/Resources/Prototypes/Entities/Structures/Doors/Airlocks/base_structureairlocks.yml b/Resources/Prototypes/Entities/Structures/Doors/Airlocks/base_structureairlocks.yml index 19900f496b..7069b8e58d 100644 --- a/Resources/Prototypes/Entities/Structures/Doors/Airlocks/base_structureairlocks.yml +++ b/Resources/Prototypes/Entities/Structures/Doors/Airlocks/base_structureairlocks.yml @@ -64,6 +64,7 @@ - type: Weldable time: 3 - type: Airlock + openUnlitVisible: true - type: NavMapDoor - type: DoorBolt - type: Appearance