diff --git a/Content.Client/CharacterInfo/CharacterInfoSystem.cs b/Content.Client/CharacterInfo/CharacterInfoSystem.cs index 617d816478..770a149a29 100644 --- a/Content.Client/CharacterInfo/CharacterInfoSystem.cs +++ b/Content.Client/CharacterInfo/CharacterInfoSystem.cs @@ -20,7 +20,7 @@ public sealed class CharacterInfoSystem : EntitySystem public void RequestCharacterInfo() { - var entity = _players.LocalPlayer?.ControlledEntity; + var entity = _players.LocalSession?.AttachedEntity; if (entity == null) { return; diff --git a/Content.Client/Eye/Blinding/BlindOverlay.cs b/Content.Client/Eye/Blinding/BlindOverlay.cs index 1949b170ab..1a4cb659a5 100644 --- a/Content.Client/Eye/Blinding/BlindOverlay.cs +++ b/Content.Client/Eye/Blinding/BlindOverlay.cs @@ -1,12 +1,8 @@ -using Content.Client.Movement.Systems; using Robust.Client.Graphics; using Robust.Client.Player; using Robust.Shared.Enums; using Robust.Shared.Prototypes; -using Content.Shared.Eye.Blinding; using Content.Shared.Eye.Blinding.Components; -using Content.Shared.Movement.Components; -using Content.Shared.Movement.Systems; namespace Content.Client.Eye.Blinding { @@ -18,7 +14,9 @@ namespace Content.Client.Eye.Blinding [Dependency] private readonly ILightManager _lightManager = default!; public override bool RequestScreenTexture => true; + public override OverlaySpace Space => OverlaySpace.WorldSpace; + private readonly ShaderInstance _greyscaleShader; private readonly ShaderInstance _circleMaskShader; @@ -30,6 +28,7 @@ namespace Content.Client.Eye.Blinding _greyscaleShader = _prototypeManager.Index("GreyscaleFullscreen").InstanceUnique(); _circleMaskShader = _prototypeManager.Index("CircleMask").InstanceUnique(); } + protected override bool BeforeDraw(in OverlayDrawArgs args) { if (!_entityManager.TryGetComponent(_playerManager.LocalSession?.AttachedEntity, out EyeComponent? eyeComp)) @@ -50,15 +49,13 @@ namespace Content.Client.Eye.Blinding var blind = _blindableComponent.IsBlind; - if (!blind && _blindableComponent.LightSetup) // Turn FOV back on if we can see again - { - _lightManager.Enabled = true; - _blindableComponent.LightSetup = false; - _blindableComponent.GraceFrame = true; - return true; - } + if (blind || !_blindableComponent.LightSetup) // Turn FOV back on if we can see again + return blind; - return blind; + _lightManager.Enabled = true; + _blindableComponent.LightSetup = false; + _blindableComponent.GraceFrame = true; + return true; } protected override void Draw(in OverlayDrawArgs args) @@ -75,7 +72,8 @@ namespace Content.Client.Eye.Blinding { _blindableComponent.LightSetup = true; // Ok we touched the lights _lightManager.Enabled = false; - } else + } + else { _blindableComponent.GraceFrame = false; } diff --git a/Content.Client/Eye/Blinding/BlindingSystem.cs b/Content.Client/Eye/Blinding/BlindingSystem.cs index 2bff5db4d6..e74687bedd 100644 --- a/Content.Client/Eye/Blinding/BlindingSystem.cs +++ b/Content.Client/Eye/Blinding/BlindingSystem.cs @@ -10,8 +10,7 @@ public sealed class BlindingSystem : EntitySystem { [Dependency] private readonly IPlayerManager _player = default!; [Dependency] private readonly IOverlayManager _overlayMan = default!; - [Dependency] ILightManager _lightManager = default!; - + [Dependency] private readonly ILightManager _lightManager = default!; private BlindOverlay _overlay = default!; @@ -27,7 +26,7 @@ public sealed class BlindingSystem : EntitySystem SubscribeNetworkEvent(RoundRestartCleanup); - _overlay = new(); + _overlay = new BlindOverlay(); } private void OnPlayerAttached(EntityUid uid, BlindableComponent component, LocalPlayerAttachedEvent args) @@ -43,13 +42,13 @@ public sealed class BlindingSystem : EntitySystem private void OnBlindInit(EntityUid uid, BlindableComponent component, ComponentInit args) { - if (_player.LocalPlayer?.ControlledEntity == uid) + if (_player.LocalSession?.AttachedEntity == uid) _overlayMan.AddOverlay(_overlay); } private void OnBlindShutdown(EntityUid uid, BlindableComponent component, ComponentShutdown args) { - if (_player.LocalPlayer?.ControlledEntity == uid) + if (_player.LocalSession?.AttachedEntity == uid) { _overlayMan.RemoveOverlay(_overlay); } diff --git a/Content.Client/Eye/Blinding/BlurryVisionSystem.cs b/Content.Client/Eye/Blinding/BlurryVisionSystem.cs index 91090fc460..c9f8acb57f 100644 --- a/Content.Client/Eye/Blinding/BlurryVisionSystem.cs +++ b/Content.Client/Eye/Blinding/BlurryVisionSystem.cs @@ -21,7 +21,7 @@ public sealed class BlurryVisionSystem : EntitySystem SubscribeLocalEvent(OnPlayerAttached); SubscribeLocalEvent(OnPlayerDetached); - _overlay = new(); + _overlay = new BlurryVisionOverlay(); } private void OnPlayerAttached(EntityUid uid, BlurryVisionComponent component, LocalPlayerAttachedEvent args) @@ -36,13 +36,13 @@ public sealed class BlurryVisionSystem : EntitySystem private void OnBlurryInit(EntityUid uid, BlurryVisionComponent component, ComponentInit args) { - if (_player.LocalPlayer?.ControlledEntity == uid) + if (_player.LocalSession?.AttachedEntity == uid) _overlayMan.AddOverlay(_overlay); } private void OnBlurryShutdown(EntityUid uid, BlurryVisionComponent component, ComponentShutdown args) { - if (_player.LocalPlayer?.ControlledEntity == uid) + if (_player.LocalSession?.AttachedEntity == uid) { _overlayMan.RemoveOverlay(_overlay); } diff --git a/Content.Client/UserInterface/Systems/Character/CharacterUIController.cs b/Content.Client/UserInterface/Systems/Character/CharacterUIController.cs index e56424f80c..d13f56c476 100644 --- a/Content.Client/UserInterface/Systems/Character/CharacterUIController.cs +++ b/Content.Client/UserInterface/Systems/Character/CharacterUIController.cs @@ -112,7 +112,6 @@ public sealed class CharacterUIController : UIController, IOnStateEntered - + - -